{"kind": "tool", "major": "18", "item": {"slug": "psql", "name": "psql", "name_zh": "", "category": "\u5ba2\u6237\u7aef\u7a0b\u5e8f", "summary": "psql \u2014 PostgreSQL \u7684\u4ea4\u4e92\u5f0f\u7ec8\u7aef", "aliases": ["psql"], "content_hash": "a9d74910d62e06242c930cc9392f1b41242738770257902ec678b3efe768898c", "versions": {"10": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "psql"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "10.23"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "34"}], "tables": [{"key": "options", "rows": [{"summary": "\u5728\u8bfb\u5165\u65f6\u5c06\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u884c\u8bfb\u53d6\uff09\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a all \u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-a --echo-all"}}, {"summary": "\u5207\u6362\u5230\u975e\u5bf9\u9f50\u8f93\u51fa\u6a21\u5f0f\uff08\u9ed8\u8ba4\u8f93\u51fa\u6a21\u5f0f\u662f\u5bf9\u9f50\u7684\uff09\u3002\u8fd9\u7b49\u6548\u4e8e \\pset format unaligned \u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-A --no-align"}}, {"summary": "\u628a\u5931\u8d25\u7684 SQL \u547d\u4ee4\u6253\u5370\u5230\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a errors \u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-b --echo-errors"}}, {"summary": "\u6307\u5b9a psql \u6267\u884c\u4e00\u4e2a\u7ed9\u5b9a\u7684\u547d\u4ee4\u5b57\u7b26\u4e32 command \u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u591a\u6b21\u5e76\u4e14\u4ee5\u4efb\u4f55\u987a\u5e8f\u4e0e -f \u9009\u9879\u7ec4\u5408\u5728\u4e00\u8d77\u3002\u5f53 -c \u6216\u8005 -f \u88ab\u6307\u5b9a\u65f6\uff0c psql \u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709 -c \u548c -f \u9009\u9879\u540e\u7ec8\u6b62\u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-c command --command= command"}}, {"summary": "\u6307\u5b9a\u8981\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002\u8fd9\u7b49\u6548\u4e8e\u6307\u5b9a dbname \u4e3a\u547d\u4ee4\u884c\u4e0a\u7684\u7b2c\u4e00\u4e2a\u975e\u9009\u9879\u53c2\u6570\u3002 dbname \u53ef\u4ee5\u662f \u8fde\u63a5\u5b57\u7b26\u4e32 \u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u5c06\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-d dbname --dbname= dbname"}}, {"summary": "\u4e5f\u628a\u53d1\u9001\u5230\u670d\u52a1\u5668\u7684\u6240\u6709 SQL \u547d\u4ee4\u590d\u5236\u5230\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a queries \u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-e --echo-queries"}}, {"summary": "\u56de\u663e \\d \u4ee5\u53ca\u5176\u4ed6\u53cd\u659c\u7ebf\u547d\u4ee4\u751f\u6210\u7684\u5b9e\u9645\u67e5\u8be2\u3002\u53ef\u4ee5\u7528\u5b83\u6765\u5b66\u4e60 psql \u7684\u5185\u90e8\u64cd\u4f5c\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO_HIDDEN \u8bbe\u7f6e\u4e3a on \u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-E --echo-hidden"}}, {"summary": "\u4ece\u6587\u4ef6 filename \u800c\u4e0d\u662f\u6807\u51c6\u8f93\u5165\u4e2d\u8bfb\u53d6\u547d\u4ee4\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u6307\u5b9a\uff0c\u4e5f\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u4e0e -c \u9009\u9879\u7ec4\u5408\u4f7f\u7528\u3002\u5f53\u6307\u5b9a\u4e86 -c \u6216 -f \u65f6\uff0c psql \u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709 -c \u548c -f \u9009\u9879\u540e\u7ec8\u6b62\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u7b49\u4ef7\u4e8e\u5143\u547d\u4ee4 \\i \u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-f filename --file= filename"}}, {"summary": "\u4f7f\u7528 separator \u4f5c\u4e3a\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e \\pset fieldsep \u6216\u8005 \\f \u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-F separator --field-separator= separator"}}, {"summary": "\u6307\u5b9a\u8fd0\u884c\u670d\u52a1\u5668\u7684\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u6240\u5728\u7684\u76ee\u5f55\u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-h hostname --host= hostname"}}, {"summary": "\u5207\u6362\u5230 HTML \u8868\u683c\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e \\pset format html \u6216\u8005 \\H \u547d\u4ee4\u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-H --html"}}, {"summary": "\u5217\u51fa\u6240\u6709\u53ef\u7528\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u9000\u51fa\u3002\u5176\u4ed6\u975e\u8fde\u63a5\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002\u8fd9\u4e0e\u5143\u547d\u4ee4 \\list \u7c7b\u4f3c\u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-l --list"}}, {"summary": "\u9664\u4e86\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u5199\u5230\u666e\u901a\u8f93\u51fa\u76ee\u6807\u4e4b\u5916\uff0c\u8fd8\u5199\u5230\u6587\u4ef6 filename \u4e2d\u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-L filename --log-file= filename"}}, {"summary": "\u4e0d\u8981\u4f7f\u7528 Readline \u8fdb\u884c\u884c\u7f16\u8f91\uff0c\u4e5f\u4e0d\u8981\u4f7f\u7528\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\u3002\u8fd9\u6709\u52a9\u4e8e\u5728\u526a\u5207\u548c\u7c98\u8d34\u65f6\u5173\u95edTAB \u8865\u5168\u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-n --no-readline"}}, {"summary": "\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u653e\u5230\u6587\u4ef6 filename \u4e2d\u3002\u8fd9\u7b49\u6548\u4e8e\u547d\u4ee4 \\o \u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-o filename --output= filename"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u7684\u6587\u4ef6\u540d\u540e\u7f00\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u7684\u503c\uff1b\u672a\u8bbe\u7f6e\u65f6\uff0c\u4f7f\u7528\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u7aef\u53e3\uff0c\u901a\u5e38\u4e3a 5432\u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-p port --port= port"}}, {"summary": "\u4ee5 \\pset \u7684\u5f62\u5f0f\u6307\u5b9a\u6253\u5370\u9009\u9879\u3002\u6ce8\u610f\uff0c\u8fd9\u91cc\u4f60\u5fc5\u987b\u7528\u4e00\u4e2a\u7b49\u53f7\u800c\u4e0d\u662f\u7a7a\u683c\u6765\u5206\u9694\u540d\u79f0\u548c\u503c\u3002\u4f8b\u5982\uff0c\u8981\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a LaTeX \uff0c\u5e94\u8be5\u5199\u6210 -P format=latex \u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-P assignment --pset= assignment"}}, {"summary": "\u6307\u5b9a psql \u5e94\u8be5\u5b89\u9759\u5730\u5de5\u4f5c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4f1a\u6253\u5370\u51fa\u6b22\u8fce\u6d88\u606f\u548c\u5404\u79cd\u63d0\u793a\u4fe1\u606f\u3002\u5982\u679c\u4f7f\u7528\u4e86\u8fd9\u4e2a\u9009\u9879\uff0c\u4ee5\u4e0a\u90a3\u4e9b\u5c31\u90fd\u4e0d\u4f1a\u8f93\u51fa\u3002\u5728\u4f7f\u7528 -c \u9009\u9879\u65f6\uff0c\u914d\u5408\u8fd9\u4e2a\u9009\u9879\u5f88\u6709\u7528\u3002\u8fd9\u7b49\u6548\u4e8e\u8bbe\u7f6e\u53d8\u91cf QUIET \u4e3a on \u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-q --quiet"}}, {"summary": "\u628a separator \u7528\u4f5c\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e \\pset recordsep \u547d\u4ee4\u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-R separator --record-separator= separator"}}, {"summary": "\u8fd0\u884c\u5728\u5355\u6b65\u6a21\u5f0f\u4e2d\u3002\u8fd9\u610f\u5473\u7740\u5728\u6bcf\u4e2a\u547d\u4ee4\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u4e4b\u524d\u90fd\u4f1a\u63d0\u793a\u7528\u6237\uff0c\u5e76\u5141\u8bb8\u53d6\u6d88\u6267\u884c\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u8c03\u8bd5\u811a\u672c\u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-s --single-step"}}, {"summary": "\u8fd0\u884c\u5728\u5355\u884c\u6a21\u5f0f\u4e2d\uff0c\u5176\u4e2d\u6362\u884c\u7b26\u4f1a\u7ec8\u6b62\u4e00\u4e2a SQL \u547d\u4ee4\uff0c\u5c31\u50cf\u5206\u53f7\u7684\u4f5c\u7528\u4e00\u6837\u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-S --single-line"}}, {"summary": "\u5173\u95ed\u6253\u5370\u5217\u540d\u548c\u7ed3\u679c\u884c\u8ba1\u6570\u9875\u811a\u7b49\u3002\u8fd9\u7b49\u6548\u4e8e \\t \u6216\u8005 \\pset tuples_only \u547d\u4ee4\u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-t --tuples-only"}}, {"summary": "\u6307\u5b9a\u8981\u653e\u5728 HTML table \u6807\u7b7e\u5185\u7684\u9009\u9879\u3002\u8be6\u89c1 \\pset tableattr \u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-T table_options --table-attr= table_options"}}, {"summary": "\u4f5c\u4e3a\u7528\u6237 username \u800c\u4e0d\u662f\u9ed8\u8ba4\u7528\u6237\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff08\u5f53\u7136\uff0c\u4f60\u5fc5\u987b\u5177\u6709\u8fd9\u6837\u505a\u7684\u6743\u9650\uff09\u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-U username --username= username"}}, {"summary": "\u6267\u884c\u4e00\u6b21\u53d8\u91cf\u8d4b\u503c\uff0c\u548c \\set \u5143\u547d\u4ee4\u76f8\u4f3c\u3002\u6ce8\u610f\u4f60\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u7528\u7b49\u53f7\u5206\u9694\u540d\u5b57\u548c\u503c\uff08\u5982\u679c\u6709\uff09\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u7684\u8bbe\u7f6e\uff0c\u53bb\u6389\u7b49\u53f7\u5c31\u884c\u3002\u8981\u628a\u4e00\u4e2a\u53d8\u91cf\u8bbe\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u4f7f\u7528\u7b49\u53f7\u4f46\u662f\u53bb\u6389\u503c\u3002\u8fd9\u4e9b\u8d4b\u503c\u5728\u547d\u4ee4\u884c\u5904\u7406\u671f\u95f4\u88ab\u5b8c\u6210\uff0c\u56e0\u6b64\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u7684\u53d8\u91cf\u5c06\u5728\u7a0d\u540e\u88ab\u8986\u76d6\u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-v assignment --set= assignment --variable= assignment"}}, {"summary": "\u6253\u5370 psql \u7248\u672c\u5e76\u4e14\u9000\u51fa\u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-V --version"}}, {"summary": "\u6c38\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982 .pgpass \u6587\u4ef6\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u8fd9\u4e2a\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4efb\u52a1\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u65f6\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 psql \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\uff0c\u5373\u4f7f\u8be5\u5bc6\u7801\u5b9e\u9645\u4e0a\u4e0d\u4f1a\u88ab\u4f7f\u7528\u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-W --password"}}, {"summary": "\u6253\u5f00\u6269\u5c55\u8868\u683c\u5f0f\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e \\x \u6216\u8005 \\pset expanded \u547d\u4ee4\u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-x --expanded"}}, {"summary": "\u4e0d\u8bfb\u53d6\u542f\u52a8\u6587\u4ef6\uff08\u65e2\u4e0d\u8bfb\u53d6\u7cfb\u7edf\u8303\u56f4\u7684 psqlrc \u6587\u4ef6\uff0c\u4e5f\u4e0d\u8bfb\u53d6\u7528\u6237\u7684 ~/.psqlrc \u6587\u4ef6\uff09\u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-X, --no-psqlrc"}}, {"summary": "\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u8fd9\u7b49\u6548\u4e8e \\pset fieldsep_zero \u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-z --field-separator-zero"}}, {"summary": "\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u4f8b\u5982\uff0c\u8fd9\u6709\u52a9\u4e8e\u4e0e xargs -0 \u914d\u5408\u4f7f\u7528\u3002\u8fd9\u7b49\u6548\u4e8e \\pset recordsep_zero \u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-0 --record-separator-zero"}}, {"summary": "\u8fd9\u4e2a\u9009\u9879\u53ea\u80fd\u4e0e\u4e00\u4e2a\u6216\u591a\u4e2a -c \u548c/\u6216 -f \u9009\u9879\u7ed3\u5408\u4f7f\u7528\u3002\u5b83\u4f1a\u5bfc\u81f4 psql \u5728\u7b2c\u4e00\u4e2a\u8fd9\u6837\u7684\u9009\u9879\u4e4b\u524d\u53d1\u51fa\u4e00\u4e2a BEGIN \u547d\u4ee4\uff0c\u5e76\u5728\u6700\u540e\u4e00\u4e2a\u9009\u9879\u4e4b\u540e\u53d1\u51fa\u4e00\u4e2a COMMIT \u547d\u4ee4\uff0c\u4ece\u800c\u5c06\u6240\u6709\u547d\u4ee4\u5305\u88c5\u6210\u4e00\u4e2a\u5355\u72ec\u7684\u4e8b\u52a1\u3002\u8fd9\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-1 --single-transaction"}}, {"summary": "\u663e\u793a\u6709\u5173 psql \u7684\u5e2e\u52a9\u5e76\u4e14\u9000\u51fa\u3002\u53ef\u9009\u7684 topic \u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a options \uff09\u9009\u62e9\u8981\u89e3\u91ca psql \u7684\u54ea\u4e00\u90e8\u5206\uff1a commands \u63cf\u8ff0 psql \u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b options \u63cf\u8ff0\u53ef\u4ee5\u88ab\u4f20\u9012\u7ed9 psql \u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c variables \u5219\u663e\u793a\u6709\u5173 psql \u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002", "signature": {"url": "/docs/10/app-psql.html", "text": "-? --help[= topic ]"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "COLUMNS", "description": "\u5982\u679c \\pset columns \u4e3a\u96f6\uff0c\u8fd9\u4e2a\u73af\u5883\u53d8\u91cf\u63a7\u5236\u7528\u4e8e wrapped \u683c\u5f0f\u7684\u5bbd\u5ea6\u4ee5\u53ca\u7528\u6765\u786e\u5b9a\u662f\u5426\u8f93\u51fa\u9700\u8981\u7528\u5230\u5206\u9875\u5668\u6216\u8005\u5207\u6362\u5230\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e2d\u7684\u5782\u76f4\u683c\u5f0f\u7684\u5bbd\u5ea6\u3002"}, {"name": "PAGER", "description": "\u5982\u679c\u67e5\u8be2\u7ed3\u679c\u65e0\u6cd5\u5728\u5c4f\u5e55\u4e0a\u5b8c\u6574\u663e\u793a\uff0c\u5219\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u9012\u7ed9\u8fd9\u4e2a\u547d\u4ee4\u3002\u5178\u578b\u503c\u4e3a more \u6216 less \u3002\u9ed8\u8ba4\u503c\u53d6\u51b3\u4e8e\u5e73\u53f0\u3002\u53ef\u4ee5\u5c06 PAGER \u8bbe\u7f6e\u4e3a\u7a7a\uff0c\u6216\u4f7f\u7528 \\pset \u547d\u4ee4\u4e2d\u4e0e\u5206\u9875\u5668\u6709\u5173\u7684\u9009\u9879\u6765\u7981\u7528\u5206\u9875\u5668\u3002"}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\uff08\u89c1 \u7b2c 33.14 \u8282 \uff09\u3002"}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "\\e \u3001 \\ef \u548c \\ev \u547d\u4ee4\u4f7f\u7528\u7684\u7f16\u8f91\u5668\u3002\u6309\u5217\u51fa\u7684\u987a\u5e8f\u68c0\u67e5\u8fd9\u4e9b\u53d8\u91cf\uff0c\u4f7f\u7528\u7b2c\u4e00\u4e2a\u5df2\u8bbe\u7f6e\u7684\u53d8\u91cf\u3002 \u5185\u7f6e\u7684\u9ed8\u8ba4\u7f16\u8f91\u5668\u5728 Unix \u7cfb\u7edf\u4e0a\u4e3a vi \uff0c\u5728 Windows \u7cfb\u7edf\u4e0a\u4e3a notepad.exe \u3002"}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "\u5f53 \\e \u3001 \\ef \u6216 \\ev \u5e26\u6709\u884c\u53f7\u53c2\u6570\u4f7f\u7528\u65f6\uff0c\u6b64\u53d8\u91cf\u6307\u5b9a\u5c06\u8d77\u59cb\u884c\u53f7\u4f20\u7ed9\u7528\u6237\u7f16\u8f91\u5668\u65f6\u6240\u7528\u7684\u547d\u4ee4\u884c\u53c2\u6570\u3002\u5bf9\u4e8e Emacs \u6216 vi \u4e4b\u7c7b\u7684\u7f16\u8f91\u5668\uff0c\u8fd9\u4e2a\u53c2\u6570\u662f\u4e00\u4e2a\u52a0\u53f7\u3002\u5982\u679c\u9009\u9879\u540d\u548c\u884c\u53f7\u4e4b\u95f4\u9700\u8981\u7a7a\u683c\uff0c\u8bf7\u5728\u53d8\u91cf\u503c\u4e2d\u5305\u542b\u672b\u5c3e\u7a7a\u683c\u3002\u4f8b\u5982\uff1a PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' \u5728 Unix \u7cfb\u7edf\u4e0a\u9ed8\u8ba4\u662f + \uff08\u5bf9\u5e94\u4e8e\u9ed8\u8ba4\u7f16\u8f91\u5668 vi \uff0c\u4e14\u5bf9\u5f88\u591a\u5176\u4ed6\u5e38\u89c1\u7f16\u8f91\u5668\u53ef\u7528\uff09\u3002\u5728 Windows \u7cfb\u7edf\u4e0a\u6ca1\u6709\u9ed8\u8ba4\u503c\u3002"}, {"name": "PSQL_HISTORY", "description": "\u547d\u4ee4\u5386\u53f2\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08 ~ \uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002"}, {"name": "PSQLRC", "description": "\u7528\u6237\u7684 .psqlrc \u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08 ~ \uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002"}, {"name": "SHELL", "description": "\u88ab \\! \u547d\u4ee4\u6267\u884c\u7684\u547d\u4ee4\u3002"}, {"name": "TMPDIR", "description": "\u5b58\u50a8\u4e34\u65f6\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u662f /tmp \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-a", "--echo-all"], "summary": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all .", "signature": "-a --echo-all", "source_url": "/docs/10/app-psql.html", "description": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all ."}, {"names": ["-A", "--no-align"], "summary": "Switches to unaligned output mode. (The default output mode is otherwise aligned.) This is equivalent to \\pset format unaligned .", "signature": "-A --no-align", "source_url": "/docs/10/app-psql.html", "description": "Switches to unaligned output mode. (The default output mode is otherwise aligned.) This is equivalent to \\pset format unaligned ."}, {"names": ["-b", "--echo-errors"], "summary": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors .", "signature": "-b --echo-errors", "source_url": "/docs/10/app-psql.html", "description": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors ."}, {"names": ["-c command", "--command= command"], "summary": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence.", "signature": "-c command --command= command", "source_url": "/docs/10/app-psql.html", "description": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. command must be either a command string that is completely parsable by the server (i.e., it contains no psql -specific features), or a single backslash command. Thus you cannot mix SQL and psql meta-commands within a -c option. To achieve that, you could use repeated -c options or pipe the string into psql , for example: psql -c '\\x' -c 'SELECT * FROM foo;' or echo '\\x \\\\ SELECT * FROM foo;' | psql ( \\\\ is the separator meta-command.) Each SQL command string passed to -c is sent to the server as a single query. Because of this, the server executes it as a single transaction even if the string contains multiple SQL commands, unless there are explicit BEGIN / COMMIT commands included in the string to divide it into multiple transactions. Also, psql only prints the result of the last SQL command in the string. This is different from the behavior when the same string is read from a file or fed to psql 's standard input, because then psql sends each SQL command separately. Because of this behavior, putting more than one command in a single -c string often has unexpected results. It's better to use repeated -c commands or feed multiple commands to psql 's standard input, either using echo as illustrated above, or via a shell here-document, for example: psql <<EOF \\x SELECT * FROM foo; EOF"}, {"names": ["-d dbname", "--dbname= dbname"], "summary": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "signature": "-d dbname --dbname= dbname", "source_url": "/docs/10/app-psql.html", "description": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--echo-queries"], "summary": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries .", "signature": "-e --echo-queries", "source_url": "/docs/10/app-psql.html", "description": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries ."}, {"names": ["-E", "--echo-hidden"], "summary": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on .", "signature": "-E --echo-hidden", "source_url": "/docs/10/app-psql.html", "description": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on ."}, {"names": ["-f filename", "--file= filename"], "summary": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i .", "signature": "-f filename --file= filename", "source_url": "/docs/10/app-psql.html", "description": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i . If filename is - (hyphen), then standard input is read until an EOF indication or \\q meta-command. This can be used to intersperse interactive input with input from files. Note however that Readline is not used in this case (much as if -n had been specified). Using this option is subtly different from writing psql < filename . In general, both will do what you expect, but using -f enables some nice features such as error messages with line numbers. There is also a slight chance that using this option will reduce the start-up overhead. On the other hand, the variant using the shell's input redirection is (in theory) guaranteed to yield exactly the same output you would have received had you entered everything by hand."}, {"names": ["-F separator", "--field-separator= separator"], "summary": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f .", "signature": "-F separator --field-separator= separator", "source_url": "/docs/10/app-psql.html", "description": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f ."}, {"names": ["-h hostname", "--host= hostname"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket.", "signature": "-h hostname --host= hostname", "source_url": "/docs/10/app-psql.html", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket."}, {"names": ["-H", "--html"], "summary": "Turn on HTML tabular output. This is equivalent to \\pset format html or the \\H command.", "signature": "-H --html", "source_url": "/docs/10/app-psql.html", "description": "Turn on HTML tabular output. This is equivalent to \\pset format html or the \\H command."}, {"names": ["-l", "--list"], "summary": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list .", "signature": "-l --list", "source_url": "/docs/10/app-psql.html", "description": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list . When this option is used, psql will connect to the database postgres , unless a different database is named on the command line (option -d or non-option argument, possibly via a service entry, but not via an environment variable)."}, {"names": ["-L filename", "--log-file= filename"], "summary": "Write all query output into file filename , in addition to the normal output destination.", "signature": "-L filename --log-file= filename", "source_url": "/docs/10/app-psql.html", "description": "Write all query output into file filename , in addition to the normal output destination."}, {"names": ["-n", "--no-readline"], "summary": "Do not use Readline for line editing and do not use the command history. This can be useful to turn off tab expansion when cutting and pasting.", "signature": "-n --no-readline", "source_url": "/docs/10/app-psql.html", "description": "Do not use Readline for line editing and do not use the command history. This can be useful to turn off tab expansion when cutting and pasting."}, {"names": ["-o filename", "--output= filename"], "summary": "Put all query output into file filename . This is equivalent to the command \\o .", "signature": "-o filename --output= filename", "source_url": "/docs/10/app-psql.html", "description": "Put all query output into file filename . This is equivalent to the command \\o ."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432.", "signature": "-p port --port= port", "source_url": "/docs/10/app-psql.html", "description": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432."}, {"names": ["-P assignment", "--pset= assignment"], "summary": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex .", "signature": "-P assignment --pset= assignment", "source_url": "/docs/10/app-psql.html", "description": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex ."}, {"names": ["-q", "--quiet"], "summary": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on .", "signature": "-q --quiet", "source_url": "/docs/10/app-psql.html", "description": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on ."}, {"names": ["-R separator", "--record-separator= separator"], "summary": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep .", "signature": "-R separator --record-separator= separator", "source_url": "/docs/10/app-psql.html", "description": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep ."}, {"names": ["-s", "--single-step"], "summary": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts.", "signature": "-s --single-step", "source_url": "/docs/10/app-psql.html", "description": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts."}, {"names": ["-S", "--single-line"], "summary": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does.", "signature": "-S --single-line", "source_url": "/docs/10/app-psql.html", "description": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does. Note This mode is provided for those who insist on it, but you are not necessarily encouraged to use it. In particular, if you mix SQL and meta-commands on a line the order of execution might not always be clear to the inexperienced user."}, {"names": ["-t", "--tuples-only"], "summary": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only .", "signature": "-t --tuples-only", "source_url": "/docs/10/app-psql.html", "description": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only ."}, {"names": ["-T table_options", "--table-attr= table_options"], "summary": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details.", "signature": "-T table_options --table-attr= table_options", "source_url": "/docs/10/app-psql.html", "description": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details."}, {"names": ["-U username", "--username= username"], "summary": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)", "signature": "-U username --username= username", "source_url": "/docs/10/app-psql.html", "description": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)"}, {"names": ["-v assignment", "--set= assignment", "--variable= assignment"], "summary": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later.", "signature": "-v assignment --set= assignment --variable= assignment", "source_url": "/docs/10/app-psql.html", "description": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later."}, {"names": ["-V", "--version"], "summary": "Print the psql version and exit.", "signature": "-V --version", "source_url": "/docs/10/app-psql.html", "description": "Print the psql version and exit."}, {"names": ["-w", "--no-password"], "summary": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/10/app-psql.html", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-W", "--password"], "summary": "Force psql to prompt for a password before connecting to a database, even if the password will not be used.", "signature": "-W --password", "source_url": "/docs/10/app-psql.html", "description": "Force psql to prompt for a password before connecting to a database, even if the password will not be used. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, psql will prompt for a password in any case. However, psql will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-x", "--expanded"], "summary": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded .", "signature": "-x --expanded", "source_url": "/docs/10/app-psql.html", "description": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded ."}, {"names": ["-X,", "--no-psqlrc"], "summary": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file).", "signature": "-X, --no-psqlrc", "source_url": "/docs/10/app-psql.html", "description": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file)."}, {"names": ["-z", "--field-separator-zero"], "summary": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero .", "signature": "-z --field-separator-zero", "source_url": "/docs/10/app-psql.html", "description": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero ."}, {"names": ["-0", "--record-separator-zero"], "summary": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero .", "signature": "-0 --record-separator-zero", "source_url": "/docs/10/app-psql.html", "description": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero ."}, {"names": ["-1", "--single-transaction"], "summary": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. This ensures that either all the commands complete successfully, or no changes are applied.", "signature": "-1 --single-transaction", "source_url": "/docs/10/app-psql.html", "description": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. This ensures that either all the commands complete successfully, or no changes are applied. If the commands themselves contain BEGIN , COMMIT , or ROLLBACK , this option will not have the desired effects. Also, if an individual command cannot be executed inside a transaction block, specifying this option will cause the whole transaction to fail."}, {"names": ["-?", "--help[= topic ]"], "summary": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables.", "signature": "-? --help[= topic ]", "source_url": "/docs/10/app-psql.html", "description": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables."}], "related": [{"url": "/wiki/psql/?v=10", "label": "psql \u5143\u547d\u4ee4"}, {"url": "/wiki/conn/?v=10", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v10.23/postgresql-10.23.tar.bz2", "label": "10.23", "major": "10", "channel": "historical", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/10/postgresql-10-A4.pdf", "bytes": 12631706, "pages": 2591, "sha256": "34497ab9efb45c5bdf1bd11b9016b5451354feb462fa029cf74557a5fa5fbbc1", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/10/postgresql-10-US.pdf", "bytes": 12531684, "pages": 2724, "sha256": "429cc7133ddf4f97c560aa466dc9caea4b718721a8321e293357037cf0af4733", "built_at": "2026-09-26"}}, "tree": "10", "index": "index.html", "major": "10", "pages": 1085, "release": "10.23", "source_url": "https://ftp.postgresql.org/pub/source/v10.23/postgresql-10.23.tar.bz2", "svg_assets": 0, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "94a4b2528372458e5662c18d406629266667c437198160a18cdfd2c4a4d6eee9"}, "revision": "f9301feba91e2e2566038a36b8cee0e4402db68989538f88670fddd20b1f78ea", "evidence_kind": "English manual and source declarations", "source_sha256": "94a4b2528372458e5662c18d406629266667c437198160a18cdfd2c4a4d6eee9"}, "sources": [{"url": "https://pg.center/docs/10/app-psql.html", "file": "app-psql.html", "label": "10.23 English manual \u00b7 app-psql.html", "anchor": "", "sha256": "9e11fe3148cb8c085808f632ed972aa4514332a67758a083a080169101eeb7a4", "language": "en", "original_url": "/docs/10/app-psql.html"}, {"url": "https://pg.center/docs/10/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "e4330732b6acd6c025a1fbdce45574b23d964de847a1b849ea88b98ab628d2e2", "language": "en", "original_url": "/docs/10/reference-client.html"}], "sections": [], "synopsis": ["psql [ option ...] [ dbname [ username ]]"], "signature": "psql [ option ...] [ dbname [ username ]]", "description": ["psql \u2014 PostgreSQL \u7684\u4ea4\u4e92\u5f0f\u7ec8\u7aef"], "environment": [{"name": "COLUMNS", "description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode."}, {"name": "PAGER", "description": "If the query results do not fit on the screen, they are piped through this command. Typical values are more or less . The default is platform-dependent. Use of the pager can be disabled by setting PAGER to empty, or by using pager-related options of the \\pset command."}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters (see Section 33.14 )."}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. The built-in default editors are vi on Unix systems and notepad.exe on Windows systems."}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems."}, {"name": "PSQL_HISTORY", "description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed."}, {"name": "PSQLRC", "description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed."}, {"name": "SHELL", "description": "Command executed by the \\! command."}, {"name": "TMPDIR", "description": "Directory for storing temporary files. The default is /tmp ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PSQL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></h2>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u2014 <span class=\"productname\">PostgreSQL</span>\u7684\u4ea4\u4e92\u5f0f\u7ec8\u7aef</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.18.4.1\"><code class=\"command\">psql</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em> [<em class=\"replaceable\"><code>username</code></em>]]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.18.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u662f<span class=\"productname\">PostgreSQL</span>\u7684\u4e00\u4e2a\u57fa\u4e8e\u7ec8\u7aef\u7684\u524d\u7aef\u3002\u5b83\u4f7f\u4f60\u80fd\u591f\u4ea4\u4e92\u5f0f\u5730\u8f93\u5165\u67e5\u8be2\uff0c\u5c06\u5176\u53d1\u9001\u7ed9<span class=\"productname\">PostgreSQL</span>\uff0c\u5e76\u67e5\u770b\u67e5\u8be2\u7ed3\u679c\u3002\u4e5f\u53ef\u4ee5\u4ece\u6587\u4ef6\u6216\u547d\u4ee4\u884c\u53c2\u6570\u63d0\u4f9b\u8f93\u5165\u3002\u6b64\u5916\uff0c<span class=\"application\">psql</span>\u8fd8\u63d0\u4f9b\u4e86\u82e5\u5e72\u5143\u547d\u4ee4\u548c\u591a\u79cd\u7c7b\u4f3c shell \u7684\u7279\u6027\uff0c\u4ee5\u4fbf\u4e8e\u7f16\u5199\u811a\u672c\u548c\u81ea\u52a8\u5316\u6267\u884c\u5404\u79cd\u4efb\u52a1\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-PSQL-3\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-a</code><br/></span><span class=\"term\"><code class=\"option\">--echo-all</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8bfb\u5165\u65f6\u5c06\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u884c\u8bfb\u53d6\uff09\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a <code class=\"literal\">all</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-A</code><br/></span><span class=\"term\"><code class=\"option\">--no-align</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230\u975e\u5bf9\u9f50\u8f93\u51fa\u6a21\u5f0f\uff08\u9ed8\u8ba4\u8f93\u51fa\u6a21\u5f0f\u662f\u5bf9\u9f50\u7684\uff09\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset format unaligned</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-b</code><br/></span><span class=\"term\"><code class=\"option\">--echo-errors</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u5931\u8d25\u7684 SQL \u547d\u4ee4\u6253\u5370\u5230\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">errors</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>command</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--command=<em class=\"replaceable\"><code>command</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a<span class=\"application\">psql</span>\u6267\u884c\u4e00\u4e2a\u7ed9\u5b9a\u7684\u547d\u4ee4\u5b57\u7b26\u4e32<em class=\"replaceable\"><code>command</code></em>\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u591a\u6b21\u5e76\u4e14\u4ee5\u4efb\u4f55\u987a\u5e8f\u4e0e<code class=\"option\">-f</code>\u9009\u9879\u7ec4\u5408\u5728\u4e00\u8d77\u3002\u5f53<code class=\"option\">-c</code>\u6216\u8005<code class=\"option\">-f</code>\u88ab\u6307\u5b9a\u65f6\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709<code class=\"option\">-c</code>\u548c<code class=\"option\">-f</code>\u9009\u9879\u540e\u7ec8\u6b62\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>command</code></em>\u5fc5\u987b\u662f\u4e00\u4e2a\u670d\u52a1\u5668\u5b8c\u5168\u53ef\u89e3\u6790\u7684\u547d\u4ee4\u5b57\u7b26\u4e32\uff08\u5373\u4e0d\u5305\u542b<span class=\"application\">psql</span>\u4e13\u6709\u7684\u7279\u6027\uff09\u6216\u8005\u5355\u4e2a\u53cd\u659c\u7ebf\u547d\u4ee4\u3002\u56e0\u6b64\u4e0d\u80fd\u5728\u4e00\u4e2a<code class=\"option\">-c</code>\u9009\u9879\u4e2d\u6df7\u5408<acronym class=\"acronym\">SQL</acronym>\u548c<span class=\"application\">psql</span>\u5143\u547d\u4ee4\u3002\u8981\u90a3\u6837\u505a\uff0c\u53ef\u4ee5\u4f7f\u7528\u591a\u4e2a<code class=\"option\">-c</code>\u9009\u9879\u6216\u8005\u628a\u5b57\u7b26\u4e32\u7528\u7ba1\u9053\u8f93\u9001\u5230<span class=\"application\">psql</span>\u4e2d\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">psql -c '\\x' -c 'SELECT * FROM foo;'\n</pre>\n<p lang=\"zh\">\u6216\u8005</p>\n<pre class=\"programlisting\">echo '\\x \\\\ SELECT * FROM foo;' | psql\n</pre>\n<p lang=\"zh\">\uff08<code class=\"literal\">\\\\</code>\u662f\u5206\u9694\u7b26\u5143\u547d\u4ee4\uff09\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u5b57\u7b26\u4e32\u4f20\u9012\u7ed9<code class=\"option\">-c</code>\u90fd\u4f5c\u4e3a\u4e00\u4e2a\u5355\u72ec\u7684\u67e5\u8be2\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u56e0\u6b64\uff0c\u5373\u4f7f\u5b57\u7b26\u4e32\u5305\u542b\u591a\u4e2a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\uff0c\u670d\u52a1\u5668\u4e5f\u4f1a\u5c06\u5176\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff0c\u9664\u975e\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u663e\u5f0f\u7684<code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code>\u547d\u4ee4\u5c06\u5176\u5206\u6210\u591a\u4e2a\u4e8b\u52a1\u3002\u6b64\u5916\uff0c<span class=\"application\">psql</span>\u53ea\u6253\u5370\u5b57\u7b26\u4e32\u4e2d\u6700\u540e\u4e00\u6761<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u7684\u7ed3\u679c\u3002\u8fd9\u4e0e\u4ece\u6587\u4ef6\u8bfb\u53d6\u540c\u4e00\u5b57\u7b26\u4e32\u6216\u5c06\u5176\u9001\u5165<span class=\"application\">psql</span>\u6807\u51c6\u8f93\u5165\u65f6\u7684\u884c\u4e3a\u4e0d\u540c\uff0c\u56e0\u4e3a\u5728\u8fd9\u4e9b\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">psql</span>\u4f1a\u5206\u522b\u53d1\u9001\u6bcf\u6761<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u7531\u4e8e\u8fd9\u79cd\u884c\u4e3a\uff0c\u5728\u5355\u4e2a <code class=\"option\">-c</code> \u5b57\u7b26\u4e32\u4e2d\u653e\u5165\u591a\u6761 SQL \u547d\u4ee4\u5e38\u5e38\u4f1a\u4ea7\u751f\u610f\u5916\u7ed3\u679c\u3002\u6700\u597d\u91cd\u590d\u4f7f\u7528 <code class=\"option\">-c</code> \u547d\u4ee4\uff0c\u6216\u5c06\u591a\u6761\u547d\u4ee4\u9001\u5165 <span class=\"application\">psql</span> \u7684\u6807\u51c6\u8f93\u5165\uff0c\u53ef\u4ee5\u50cf\u4e0a\u9762\u6240\u793a\u4f7f\u7528 <span class=\"application\">echo</span>\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528 shell \u7684 here-document\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">psql &lt;&lt;EOF\n\\x\nSELECT * FROM foo;\nEOF\n</pre></dd>\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>dbname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>dbname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002\u8fd9\u7b49\u6548\u4e8e\u6307\u5b9a<em class=\"replaceable\"><code>dbname</code></em>\u4e3a\u547d\u4ee4\u884c\u4e0a\u7684\u7b2c\u4e00\u4e2a\u975e\u9009\u9879\u53c2\u6570\u3002<em class=\"replaceable\"><code>dbname</code></em> \u53ef\u4ee5\u662f<a class=\"link\" href=\"/docs/10/libpq.html#LIBPQ-CONNSTRING\" title=\"33.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u5c06\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-e</code><br/></span><span class=\"term\"><code class=\"option\">--echo-queries</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e5f\u628a\u53d1\u9001\u5230\u670d\u52a1\u5668\u7684\u6240\u6709 SQL \u547d\u4ee4\u590d\u5236\u5230\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">queries</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-E</code><br/></span><span class=\"term\"><code class=\"option\">--echo-hidden</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u56de\u663e<code class=\"command\">\\d</code>\u4ee5\u53ca\u5176\u4ed6\u53cd\u659c\u7ebf\u547d\u4ee4\u751f\u6210\u7684\u5b9e\u9645\u67e5\u8be2\u3002\u53ef\u4ee5\u7528\u5b83\u6765\u5b66\u4e60<span class=\"application\">psql</span>\u7684\u5185\u90e8\u64cd\u4f5c\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO_HIDDEN</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u800c\u4e0d\u662f\u6807\u51c6\u8f93\u5165\u4e2d\u8bfb\u53d6\u547d\u4ee4\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u6307\u5b9a\uff0c\u4e5f\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u4e0e<code class=\"option\">-c</code>\u9009\u9879\u7ec4\u5408\u4f7f\u7528\u3002\u5f53\u6307\u5b9a\u4e86<code class=\"option\">-c</code>\u6216<code class=\"option\">-f</code>\u65f6\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709<code class=\"option\">-c</code>\u548c<code class=\"option\">-f</code>\u9009\u9879\u540e\u7ec8\u6b62\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u7b49\u4ef7\u4e8e\u5143\u547d\u4ee4<code class=\"command\">\\i</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c<em class=\"replaceable\"><code>filename</code></em>\u662f<code class=\"literal\">-</code>\uff08\u8fde\u5b57\u7b26\uff09\uff0c\u5219\u4f1a\u8bfb\u53d6\u6807\u51c6\u8f93\u5165\uff0c\u76f4\u5230\u9047\u5230 <acronym class=\"acronym\">EOF</acronym> \u6307\u793a\u6216<code class=\"command\">\\q</code>\u5143\u547d\u4ee4\u3002\u8fd9\u53ef\u7528\u4e8e\u5c06\u4ea4\u4e92\u5f0f\u8f93\u5165\u4e0e\u6587\u4ef6\u8f93\u5165\u4ea4\u9519\u4f7f\u7528\u3002\u4e0d\u8fc7\u8bf7\u6ce8\u610f\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\u4e0d\u4f1a\u4f7f\u7528 <span class=\"application\">Readline</span>\uff08\u5f88\u50cf\u6307\u5b9a\u4e86<code class=\"option\">-n</code>\u65f6\u7684\u60c5\u51b5\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u4e0e\u5199\u6210<code class=\"literal\">psql &lt; <em class=\"replaceable\"><code>filename</code></em></code>\u6709\u7ec6\u5fae\u5dee\u522b\u3002\u901a\u5e38\u4e24\u79cd\u5f62\u5f0f\u90fd\u4f1a\u5f97\u5230\u4f60\u671f\u671b\u7684\u7ed3\u679c\uff0c\u4f46\u4f7f\u7528<code class=\"literal\">-f</code>\u53ef\u4ee5\u542f\u7528\u4e00\u4e9b\u6709\u7528\u7684\u7279\u6027\uff0c\u4f8b\u5982\u5e26\u884c\u53f7\u7684\u9519\u8bef\u6d88\u606f\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u4e5f\u8fd8\u6709\u4e00\u70b9\u673a\u4f1a\u964d\u4f4e\u542f\u52a8\u5f00\u9500\u3002\u53e6\u4e00\u65b9\u9762\uff0c\u4f7f\u7528 shell \u8f93\u5165\u91cd\u5b9a\u5411\u7684\u5f62\u5f0f\u5728\u7406\u8bba\u4e0a\u80fd\u4fdd\u8bc1\u5f97\u5230\u4e0e\u4f60\u624b\u5de5\u9010\u884c\u8f93\u5165\u65f6\u5b8c\u5168\u76f8\u540c\u7684\u8f93\u51fa\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>separator</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--field-separator=<em class=\"replaceable\"><code>separator</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f7f\u7528<em class=\"replaceable\"><code>separator</code></em>\u4f5c\u4e3a\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset fieldsep</code>\u6216\u8005<code class=\"command\">\\f</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>hostname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>hostname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8fd0\u884c\u670d\u52a1\u5668\u7684\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u6240\u5728\u7684\u76ee\u5f55\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-H</code><br/></span><span class=\"term\"><code class=\"option\">--html</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230<acronym class=\"acronym\">HTML</acronym>\u8868\u683c\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"literal\">\\pset format html</code>\u6216\u8005<code class=\"command\">\\H</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--list</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u6240\u6709\u53ef\u7528\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u9000\u51fa\u3002\u5176\u4ed6\u975e\u8fde\u63a5\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002\u8fd9\u4e0e\u5143\u547d\u4ee4<code class=\"command\">\\list</code>\u7c7b\u4f3c\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8be5\u9009\u9879\u65f6\uff0c<span class=\"application\">psql</span>\u5c06\u8fde\u63a5\u5230\u6570\u636e\u5e93<code class=\"literal\">postgres</code>\uff0c\u9664\u975e\u547d\u4ee4\u884c\u4e0a\u6307\u5b9a\u4e86\u5176\u4ed6\u6570\u636e\u5e93\uff08\u901a\u8fc7<code class=\"option\">-d</code>\u9009\u9879\u6216\u975e\u9009\u9879\u53c2\u6570\uff0c\u4e5f\u53ef\u80fd\u901a\u8fc7\u670d\u52a1\u9879\uff0c\u4f46\u4e0d\u80fd\u901a\u8fc7\u73af\u5883\u53d8\u91cf\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--log-file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9664\u4e86\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u5199\u5230\u666e\u901a\u8f93\u51fa\u76ee\u6807\u4e4b\u5916\uff0c\u8fd8\u5199\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-readline</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8981\u4f7f\u7528<span class=\"application\">Readline</span>\u8fdb\u884c\u884c\u7f16\u8f91\uff0c\u4e5f\u4e0d\u8981\u4f7f\u7528\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\u3002\u8fd9\u6709\u52a9\u4e8e\u5728\u526a\u5207\u548c\u7c98\u8d34\u65f6\u5173\u95edTAB \u8865\u5168\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-o <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--output=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u653e\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u3002\u8fd9\u7b49\u6548\u4e8e\u547d\u4ee4<code class=\"command\">\\o</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u7684\u6587\u4ef6\u540d\u540e\u7f00\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u7684\u503c\uff1b\u672a\u8bbe\u7f6e\u65f6\uff0c\u4f7f\u7528\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u7aef\u53e3\uff0c\u901a\u5e38\u4e3a 5432\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P <em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--pset=<em class=\"replaceable\"><code>assignment</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ee5<code class=\"command\">\\pset</code>\u7684\u5f62\u5f0f\u6307\u5b9a\u6253\u5370\u9009\u9879\u3002\u6ce8\u610f\uff0c\u8fd9\u91cc\u4f60\u5fc5\u987b\u7528\u4e00\u4e2a\u7b49\u53f7\u800c\u4e0d\u662f\u7a7a\u683c\u6765\u5206\u9694\u540d\u79f0\u548c\u503c\u3002\u4f8b\u5982\uff0c\u8981\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a<span class=\"application\">LaTeX</span>\uff0c\u5e94\u8be5\u5199\u6210<code class=\"literal\">-P format=latex</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-q</code><br/></span><span class=\"term\"><code class=\"option\">--quiet</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a<span class=\"application\">psql</span>\u5e94\u8be5\u5b89\u9759\u5730\u5de5\u4f5c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4f1a\u6253\u5370\u51fa\u6b22\u8fce\u6d88\u606f\u548c\u5404\u79cd\u63d0\u793a\u4fe1\u606f\u3002\u5982\u679c\u4f7f\u7528\u4e86\u8fd9\u4e2a\u9009\u9879\uff0c\u4ee5\u4e0a\u90a3\u4e9b\u5c31\u90fd\u4e0d\u4f1a\u8f93\u51fa\u3002\u5728\u4f7f\u7528<code class=\"option\">-c</code>\u9009\u9879\u65f6\uff0c\u914d\u5408\u8fd9\u4e2a\u9009\u9879\u5f88\u6709\u7528\u3002\u8fd9\u7b49\u6548\u4e8e\u8bbe\u7f6e\u53d8\u91cf<code class=\"varname\">QUIET</code>\u4e3a<code class=\"literal\">on</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R <em class=\"replaceable\"><code>separator</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--record-separator=<em class=\"replaceable\"><code>separator</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a<em class=\"replaceable\"><code>separator</code></em>\u7528\u4f5c\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset recordsep</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code><br/></span><span class=\"term\"><code class=\"option\">--single-step</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5728\u5355\u6b65\u6a21\u5f0f\u4e2d\u3002\u8fd9\u610f\u5473\u7740\u5728\u6bcf\u4e2a\u547d\u4ee4\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u4e4b\u524d\u90fd\u4f1a\u63d0\u793a\u7528\u6237\uff0c\u5e76\u5141\u8bb8\u53d6\u6d88\u6267\u884c\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u8c03\u8bd5\u811a\u672c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S</code><br/></span><span class=\"term\"><code class=\"option\">--single-line</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd0\u884c\u5728\u5355\u884c\u6a21\u5f0f\u4e2d\uff0c\u5176\u4e2d\u6362\u884c\u7b26\u4f1a\u7ec8\u6b62\u4e00\u4e2a SQL \u547d\u4ee4\uff0c\u5c31\u50cf\u5206\u53f7\u7684\u4f5c\u7528\u4e00\u6837\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u79cd\u6a21\u5f0f\u662f\u4e3a\u575a\u6301\u4f7f\u7528\u5b83\u7684\u7528\u6237\u63d0\u4f9b\u7684\uff0c\u4f46\u5e76\u4e0d\u4e00\u5b9a\u503c\u5f97\u63a8\u8350\u3002\u7279\u522b\u662f\uff0c\u5982\u679c\u5728\u4e00\u884c\u4e2d\u6df7\u5408\u4e86<acronym class=\"acronym\">SQL</acronym>\u548c\u5143\u547d\u4ee4\uff0c\u5bf9\u4e8e\u6ca1\u6709\u7ecf\u9a8c\u7684\u7528\u6237\u6765\u8bf4\uff0c\u5b83\u4eec\u7684\u6267\u884c\u987a\u5e8f\u672a\u5fc5\u603b\u662f\u6e05\u695a\u7684\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t</code><br/></span><span class=\"term\"><code class=\"option\">--tuples-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5173\u95ed\u6253\u5370\u5217\u540d\u548c\u7ed3\u679c\u884c\u8ba1\u6570\u9875\u811a\u7b49\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\t</code>\u6216\u8005<code class=\"command\">\\pset tuples_only</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>table_options</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--table-attr=<em class=\"replaceable\"><code>table_options</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u653e\u5728<acronym class=\"acronym\">HTML</acronym> <code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u9009\u9879\u3002\u8be6\u89c1<code class=\"command\">\\pset tableattr</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f5c\u4e3a\u7528\u6237<em class=\"replaceable\"><code>username</code></em>\u800c\u4e0d\u662f\u9ed8\u8ba4\u7528\u6237\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff08\u5f53\u7136\uff0c\u4f60\u5fc5\u987b\u5177\u6709\u8fd9\u6837\u505a\u7684\u6743\u9650\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v <em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--set=<em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--variable=<em class=\"replaceable\"><code>assignment</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6267\u884c\u4e00\u6b21\u53d8\u91cf\u8d4b\u503c\uff0c\u548c<code class=\"command\">\\set</code>\u5143\u547d\u4ee4\u76f8\u4f3c\u3002\u6ce8\u610f\u4f60\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u7528\u7b49\u53f7\u5206\u9694\u540d\u5b57\u548c\u503c\uff08\u5982\u679c\u6709\uff09\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u7684\u8bbe\u7f6e\uff0c\u53bb\u6389\u7b49\u53f7\u5c31\u884c\u3002\u8981\u628a\u4e00\u4e2a\u53d8\u91cf\u8bbe\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u4f7f\u7528\u7b49\u53f7\u4f46\u662f\u53bb\u6389\u503c\u3002\u8fd9\u4e9b\u8d4b\u503c\u5728\u547d\u4ee4\u884c\u5904\u7406\u671f\u95f4\u88ab\u5b8c\u6210\uff0c\u56e0\u6b64\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u7684\u53d8\u91cf\u5c06\u5728\u7a0d\u540e\u88ab\u8986\u76d6\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">psql</span>\u7248\u672c\u5e76\u4e14\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6c38\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u8fd9\u4e2a\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4efb\u52a1\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u65f6\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u6574\u4e2a\u4f1a\u8bdd\u671f\u95f4\u90fd\u4f1a\u4fdd\u6301\u751f\u6548\uff0c\u56e0\u6b64\u5b83\u4e0d\u4ec5\u5f71\u54cd\u521d\u59cb\u8fde\u63a5\u5c1d\u8bd5\uff0c\u4e5f\u4f1a\u5f71\u54cd\u5143\u547d\u4ee4<code class=\"command\">\\connect</code>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236<span class=\"application\">psql</span>\u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\uff0c\u5373\u4f7f\u8be5\u5bc6\u7801\u5b9e\u9645\u4e0a\u4e0d\u4f1a\u88ab\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff0c\u5219<span class=\"application\">psql</span>\u65e0\u8bba\u5982\u4f55\u90fd\u4f1a\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">psql</span>\u9700\u8981\u5148\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\uff0c\u624d\u80fd\u77e5\u9053\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u663e\u5f0f\u6307\u5b9a<code class=\"option\">-W</code>\u503c\u5f97\u7528\u6765\u907f\u514d\u8fd9\u6b21\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u6574\u4e2a\u4f1a\u8bdd\u671f\u95f4\u90fd\u4f1a\u4fdd\u6301\u751f\u6548\uff0c\u56e0\u6b64\u5b83\u4e0d\u4ec5\u5f71\u54cd\u521d\u59cb\u8fde\u63a5\u5c1d\u8bd5\uff0c\u4e5f\u4f1a\u5f71\u54cd\u5143\u547d\u4ee4<code class=\"command\">\\connect</code>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x</code><br/></span><span class=\"term\"><code class=\"option\">--expanded</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5f00\u6269\u5c55\u8868\u683c\u5f0f\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\x</code>\u6216\u8005<code class=\"command\">\\pset expanded</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-X,</code><br/></span><span class=\"term\"><code class=\"option\">--no-psqlrc</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8bfb\u53d6\u542f\u52a8\u6587\u4ef6\uff08\u65e2\u4e0d\u8bfb\u53d6\u7cfb\u7edf\u8303\u56f4\u7684<code class=\"filename\">psqlrc</code>\u6587\u4ef6\uff0c\u4e5f\u4e0d\u8bfb\u53d6\u7528\u6237\u7684<code class=\"filename\">~/.psqlrc</code>\u6587\u4ef6\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-z</code><br/></span><span class=\"term\"><code class=\"option\">--field-separator-zero</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset fieldsep_zero</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-0</code><br/></span><span class=\"term\"><code class=\"option\">--record-separator-zero</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u4f8b\u5982\uff0c\u8fd9\u6709\u52a9\u4e8e\u4e0e<code class=\"literal\">xargs -0</code>\u914d\u5408\u4f7f\u7528\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset recordsep_zero</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-1</code><br/></span><span class=\"term\"><code class=\"option\">--single-transaction</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u9009\u9879\u53ea\u80fd\u4e0e\u4e00\u4e2a\u6216\u591a\u4e2a<code class=\"option\">-c</code>\u548c/\u6216<code class=\"option\">-f</code>\u9009\u9879\u7ed3\u5408\u4f7f\u7528\u3002\u5b83\u4f1a\u5bfc\u81f4<span class=\"application\">psql</span>\u5728\u7b2c\u4e00\u4e2a\u8fd9\u6837\u7684\u9009\u9879\u4e4b\u524d\u53d1\u51fa\u4e00\u4e2a<code class=\"command\">BEGIN</code>\u547d\u4ee4\uff0c\u5e76\u5728\u6700\u540e\u4e00\u4e2a\u9009\u9879\u4e4b\u540e\u53d1\u51fa\u4e00\u4e2a<code class=\"command\">COMMIT</code>\u547d\u4ee4\uff0c\u4ece\u800c\u5c06\u6240\u6709\u547d\u4ee4\u5305\u88c5\u6210\u4e00\u4e2a\u5355\u72ec\u7684\u4e8b\u52a1\u3002\u8fd9\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u547d\u4ee4\u672c\u8eab\u5305\u542b<code class=\"command\">BEGIN</code>\u3001<code class=\"command\">COMMIT</code>\u6216<code class=\"command\">ROLLBACK</code>\uff0c\u8fd9\u4e2a\u9009\u9879\u5c31\u4e0d\u4f1a\u4ea7\u751f\u671f\u671b\u7684\u6548\u679c\u3002\u53e6\u5916\uff0c\u5982\u679c\u67d0\u4e2a\u5355\u72ec\u547d\u4ee4\u4e0d\u80fd\u5728\u4e8b\u52a1\u5757\u4e2d\u6267\u884c\uff0c\u6307\u5b9a\u8fd9\u4e2a\u9009\u9879\u5c06\u5bfc\u81f4\u6574\u4e2a\u4e8b\u52a1\u5931\u8d25\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help[=<em class=\"replaceable\"><code>topic</code></em>]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u6709\u5173<span class=\"application\">psql</span>\u7684\u5e2e\u52a9\u5e76\u4e14\u9000\u51fa\u3002\u53ef\u9009\u7684<em class=\"replaceable\"><code>topic</code></em>\u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a<code class=\"literal\">options</code>\uff09\u9009\u62e9\u8981\u89e3\u91ca<span class=\"application\">psql</span>\u7684\u54ea\u4e00\u90e8\u5206\uff1a<code class=\"literal\">commands</code>\u63cf\u8ff0<span class=\"application\">psql</span>\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b<code class=\"literal\">options</code>\u63cf\u8ff0\u53ef\u4ee5\u88ab\u4f20\u9012\u7ed9<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c<code class=\"literal\">variables</code>\u5219\u663e\u793a\u6709\u5173<span class=\"application\">psql</span>\u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.18.7\">\n<h2 lang=\"zh\">\u9000\u51fa\u72b6\u6001</h2>\n<p lang=\"zh\">\u5982\u679c<span class=\"application\">psql</span>\u6b63\u5e38\u7ed3\u675f\uff0c\u5b83\u4f1a\u5411 shell \u8fd4\u56de 0\uff1b\u5982\u679c\u5b83\u81ea\u8eab\u53d1\u751f\u81f4\u547d\u9519\u8bef\uff08\u4f8b\u5982\u5185\u5b58\u8017\u5c3d\u3001\u627e\u4e0d\u5230\u6587\u4ef6\uff09\uff0c\u5219\u8fd4\u56de 1\uff1b\u5982\u679c\u5230\u670d\u52a1\u5668\u7684\u8fde\u63a5\u53d1\u751f\u6545\u969c\u4e14\u8be5\u4f1a\u8bdd\u4e0d\u662f\u4ea4\u4e92\u5f0f\u7684\uff0c\u5219\u8fd4\u56de 2\uff1b\u5982\u679c\u811a\u672c\u4e2d\u53d1\u751f\u9519\u8bef\u4e14\u53d8\u91cf<code class=\"varname\">ON_ERROR_STOP</code>\u5df2\u8bbe\u7f6e\uff0c\u5219\u8fd4\u56de 3\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.18.8\">\n<h2 lang=\"zh\">\u7528\u6cd5</h2>\n<div class=\"refsect2\" id=\"R2-APP-PSQL-CONNECTING\">\n<h3 lang=\"zh\">\u8fde\u63a5\u5230\u6570\u636e\u5e93</h3>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u662f\u5e38\u89c4\u7684 <span class=\"productname\">PostgreSQL</span> \u5ba2\u6237\u7aef\u5e94\u7528\u7a0b\u5e8f\u3002\u8981\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff0c\u4f60\u9700\u8981\u77e5\u9053\u76ee\u6807\u6570\u636e\u5e93\u540d\u79f0\u3001\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u548c\u7aef\u53e3\u53f7\uff0c\u4ee5\u53ca\u8981\u4ee5\u54ea\u4e2a\u6570\u636e\u5e93\u7528\u6237\u540d\u8fde\u63a5\u3002<span class=\"application\">psql</span> \u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u9009\u9879 <code class=\"option\">-d</code>\u3001<code class=\"option\">-h</code>\u3001<code class=\"option\">-p</code> \u548c <code class=\"option\">-U</code> \u5206\u522b\u6307\u5b9a\u8fd9\u4e9b\u53c2\u6570\u3002\u5982\u679c\u9047\u5230\u4e00\u4e2a\u4e0d\u5c5e\u4e8e\u4efb\u4f55\u9009\u9879\u7684\u53c2\u6570\uff0c\u5b83\u5c06\u88ab\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u540d\uff08\u5982\u679c\u6570\u636e\u5e93\u540d\u5df2\u7ecf\u7ed9\u51fa\uff0c\u5219\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u7528\u6237\u540d\uff09\u3002\u5e76\u975e\u6240\u6709\u8fd9\u4e9b\u9009\u9879\u90fd\u662f\u5fc5\u9700\u7684\uff1b\u5b83\u4eec\u90fd\u6709\u6709\u7528\u7684\u9ed8\u8ba4\u503c\u3002\u5982\u679c\u7701\u7565\u4e3b\u673a\u540d\uff0c<span class=\"application\">psql</span> \u5c06\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u5230\u672c\u5730\u4e3b\u673a\u4e0a\u7684\u670d\u52a1\u5668\uff0c\u800c\u5728\u6ca1\u6709 Unix \u57df\u5957\u63a5\u5b57\u7684\u673a\u5668\u4e0a\u5219\u901a\u8fc7 TCP/IP \u8fde\u63a5\u5230 <code class=\"literal\">localhost</code>\u3002\u9ed8\u8ba4\u7aef\u53e3\u53f7\u5728\u7f16\u8bd1\u65f6\u786e\u5b9a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u670d\u52a1\u5668\u4f7f\u7528\u76f8\u540c\u7684\u9ed8\u8ba4\u503c\uff0c\u56e0\u6b64\u5728\u5927\u591a\u6570\u60c5\u51b5\u4e0b\u4e0d\u5fc5\u6307\u5b9a\u7aef\u53e3\u3002\u9ed8\u8ba4\u7528\u6237\u540d\u662f\u4f60\u7684\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\uff0c\u9ed8\u8ba4\u6570\u636e\u5e93\u540d\u4e5f\u662f\u5982\u6b64\u3002\u8bf7\u6ce8\u610f\uff0c\u4f60\u4e0d\u80fd\u968f\u610f\u4ee5\u4efb\u610f\u6570\u636e\u5e93\u7528\u6237\u540d\u8fde\u63a5\u5230\u4efb\u610f\u6570\u636e\u5e93\u3002\u6570\u636e\u5e93\u7ba1\u7406\u5458\u5e94\u5f53\u5df2\u7ecf\u544a\u77e5\u4f60\u62e5\u6709\u7684\u8bbf\u95ee\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5f53\u9ed8\u8ba4\u503c\u4e0d\u5b8c\u5168\u5408\u9002\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7\u628a\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGDATABASE</code>\u3001<code class=\"envar\">PGHOST</code>\u3001<code class=\"envar\">PGPORT</code>\u548c<code class=\"envar\">PGUSER</code>\u8bbe\u7f6e\u4e3a\u9002\u5f53\u7684\u503c\u6765\u5c11\u6572\u4e00\u4e9b\u952e\u76d8\uff08\u989d\u5916\u7684\u73af\u5883\u53d8\u91cf\u89c1<a class=\"xref\" href=\"/docs/10/libpq-envars.html\" title=\"33.14.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a033.14\u00a0\u8282</a>\uff09\u3002\u53e6\u5916\uff0c\u51c6\u5907\u4e00\u4e2a<code class=\"filename\">~/.pgpass</code>\u6587\u4ef6\u4e5f\u5f88\u65b9\u4fbf\uff0c\u8fd9\u6837\u5c31\u4e0d\u5fc5\u7ecf\u5e38\u624b\u5de5\u8f93\u5165\u5bc6\u7801\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/10/libpq-pgpass.html\" title=\"33.15.\u00a0\u5bc6\u7801\u6587\u4ef6\">\u7b2c\u00a033.15\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u53e6\u4e00\u79cd\u6307\u5b9a\u8fde\u63a5\u53c2\u6570\u7684\u65b9\u6cd5\u662f\u4f7f\u7528 conninfo \u5b57\u7b26\u4e32\u6216 URI \u6765\u4ee3\u66ff\u6570\u636e\u5e93\u540d\u3002\u6b64\u673a\u5236\u5141\u8bb8\u5bf9\u8fde\u63a5\u8fdb\u884c\u975e\u5e38\u5e7f\u6cdb\u7684\u63a7\u5236\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">$ <strong class=\"userinput\"><code>psql \"service=myservice sslmode=require\"</code></strong>\n$ <strong class=\"userinput\"><code>psql postgresql://dbmaster:5433/mydb?sslmode=require</code></strong>\n</pre>\n<p lang=\"zh\">\u7528\u8fd9\u79cd\u65b9\u5f0f\uff0c\u4f60\u4e5f\u53ef\u4ee5\u628a<acronym class=\"acronym\">LDAP</acronym>\u7528\u4e8e<a class=\"xref\" href=\"/docs/10/libpq-ldap.html\" title=\"33.17.\u00a0\u8fde\u63a5\u53c2\u6570\u7684 LDAP \u67e5\u627e\">\u7b2c\u00a033.17\u00a0\u8282</a>\u4e2d\u63cf\u8ff0\u7684\u8fde\u63a5\u53c2\u6570\u67e5\u627e\u3002\u53ef\u7528\u8fde\u63a5\u9009\u9879\u7684\u66f4\u591a\u4fe1\u606f\u8bf7\u89c1<a class=\"xref\" href=\"/docs/10/libpq.html#LIBPQ-PARAMKEYWORDS\" title=\"33.1.2.\u00a0\u53c2\u6570\u5173\u952e\u8bcd\">\u7b2c\u00a033.1.2\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7531\u4e8e\u4efb\u4f55\u539f\u56e0\uff08\u4f8b\u5982\u6743\u9650\u4e0d\u8db3\u3001\u670d\u52a1\u5668\u6ca1\u6709\u5728\u76ee\u6807\u4e3b\u673a\u4e0a\u8fd0\u884c\u7b49\uff09\u5bfc\u81f4\u8fde\u63a5\u65e0\u6cd5\u5efa\u7acb\uff0c<span class=\"application\">psql</span>\u5c06\u8fd4\u56de\u4e00\u4e2a\u9519\u8bef\u5e76\u4e14\u7ec8\u6b62\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6807\u51c6\u8f93\u5165\u548c\u6807\u51c6\u8f93\u51fa\u90fd\u662f\u7ec8\u7aef\uff0c\u90a3\u4e48<span class=\"application\">psql</span>\u4f1a\u628a\u5ba2\u6237\u7aef\u7f16\u7801\u8bbe\u7f6e\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">auto</span>\u201d</span>\uff0c\u4ece\u533a\u57df\u8bbe\u7f6e\u4e2d\u68c0\u6d4b\u5408\u9002\u7684\u5ba2\u6237\u7aef\u7f16\u7801\uff08\u5728 Unix \u7cfb\u7edf\u4e0a\u662f<code class=\"envar\">LC_CTYPE</code>\u73af\u5883\u53d8\u91cf\uff09\u3002\u5982\u679c\u7ed3\u679c\u4e0d\u7b26\u5408\u9884\u671f\uff0c\u53ef\u4ee5\u4f7f\u7528\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGCLIENTENCODING</code>\u8986\u76d6\u5ba2\u6237\u7aef\u7f16\u7801\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"R2-APP-PSQL-4\">\n<h3 lang=\"zh\">\u8f93\u5165 SQL \u547d\u4ee4</h3>\n<p lang=\"zh\">\u5728\u6b63\u5e38\u64cd\u4f5c\u65f6\uff0c<span class=\"application\">psql</span>\u4f1a\u63d0\u4f9b\u4e00\u4e2a\u63d0\u793a\u7b26\uff0c\u8be5\u63d0\u793a\u7b26\u662f<span class=\"application\">psql</span>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u540d\u79f0\u540e\u9762\u8ddf\u4e0a\u5b57\u7b26\u4e32<code class=\"literal\">=&gt;</code>\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">$ <strong class=\"userinput\"><code>psql testdb</code></strong>\npsql (10.23)\nType \"help\" for help.\n\ntestdb=&gt;\n</pre>\n<p lang=\"zh\">\u5728\u63d0\u793a\u7b26\u4e0b\uff0c\u7528\u6237\u53ef\u4ee5\u8f93\u5165<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u3002\u901a\u5e38\uff0c\u5f53\u9047\u5230\u8868\u793a\u547d\u4ee4\u7ed3\u675f\u7684\u5206\u53f7\u65f6\uff0c\u8f93\u5165\u7684\u5185\u5bb9\u5c31\u4f1a\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u3002\u884c\u7ed3\u675f\u5e76\u4e0d\u4f1a\u7ec8\u6b62\u4e00\u6761\u547d\u4ee4\uff0c\u56e0\u6b64\u4e3a\u4e86\u63d0\u9ad8\u6e05\u6670\u5ea6\uff0c\u547d\u4ee4\u53ef\u4ee5\u5206\u5e03\u5728\u591a\u884c\u4e0a\u3002\u5982\u679c\u547d\u4ee4\u88ab\u53d1\u9001\u5e76\u6210\u529f\u6267\u884c\uff0c\u5176\u7ed3\u679c\u5c31\u4f1a\u663e\u793a\u5728\u5c4f\u5e55\u4e0a\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u53d7\u4fe1\u4efb\u7684\u7528\u6237\u80fd\u591f\u8bbf\u95ee\u5c1a\u672a\u91c7\u7528<a class=\"link\" href=\"/docs/10/ddl-schemas.html#DDL-SCHEMAS-PATTERNS\" title=\"5.8.6.\u00a0\u4f7f\u7528\u65b9\u5f0f\">\u6a21\u5f0f\u7684\u5b89\u5168\u4f7f\u7528\u65b9\u5f0f</a>\u7684\u6570\u636e\u5e93\uff0c\u8bf7\u5728\u4f1a\u8bdd\u5f00\u59cb\u65f6\u4ece<code class=\"varname\">search_path</code>\u4e2d\u79fb\u9664\u6240\u6709\u516c\u4f17\u53ef\u5199\u7684\u6a21\u5f0f\u3002\u53ef\u4ee5\u5728\u8fde\u63a5\u5b57\u7b26\u4e32\u4e2d\u52a0\u5165<code class=\"literal\">options=-csearch_path=</code>\uff0c\u6216\u8005\u5728\u6267\u884c\u5176\u4ed6 SQL \u547d\u4ee4\u4e4b\u524d\u53d1\u51fa<code class=\"literal\">SELECT pg_catalog.set_config('search_path', '', false)</code>\u3002\u8fd9\u79cd\u8003\u8651\u5e76\u975e<span class=\"application\">psql</span>\u7279\u6709\uff1b\u5b83\u9002\u7528\u4e8e\u4efb\u4f55\u6267\u884c\u4efb\u610f SQL \u547d\u4ee4\u7684\u63a5\u53e3\u3002</p>\n<p lang=\"zh\">\u6bcf\u5f53\u6267\u884c\u547d\u4ee4\u65f6\uff0c<span class=\"application\">psql</span>\u4e5f\u4f1a\u8f6e\u8be2\u7531<a class=\"xref\" href=\"/docs/10/sql-listen.html\" title=\"LISTEN\"><span class=\"refentrytitle\">LISTEN</span></a>\u548c<a class=\"xref\" href=\"/docs/10/sql-notify.html\" title=\"NOTIFY\"><span class=\"refentrytitle\">NOTIFY</span></a>\u751f\u6210\u7684\u5f02\u6b65\u901a\u77e5\u4e8b\u4ef6\u3002</p>\n<p lang=\"zh\">\u867d\u7136 C \u98ce\u683c\u7684\u5757\u6ce8\u91ca\u4f1a\u88ab\u4f20\u7ed9\u670d\u52a1\u5668\u5904\u7406\u5e76\u79fb\u9664\uff0c\u4f46 SQL \u6807\u51c6\u6ce8\u91ca\u4f1a\u7531<span class=\"application\">psql</span>\u81ea\u884c\u79fb\u9664\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"APP-PSQL-META-COMMANDS\">\n<h3 lang=\"zh\">\u5143\u547d\u4ee4</h3>\n<p lang=\"zh\">\u4f60\u8f93\u5165\u5230<span class=\"application\">psql</span>\u4e2d\u7684\u4efb\u4f55\u4ee5\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u5f00\u59cb\u7684\u4e1c\u897f\u90fd\u662f\u4e00\u4e2a<span class=\"application\">psql</span>\u5143\u547d\u4ee4\uff0c\u5b83\u4eec\u7531<span class=\"application\">psql</span>\u81ea\u884c\u5904\u7406\u3002\u8fd9\u4e9b\u547d\u4ee4\u8ba9<span class=\"application\">psql</span>\u5bf9\u7ba1\u7406\u548c\u7f16\u5199\u811a\u672c\u66f4\u6709\u7528\u3002\u5143\u547d\u4ee4\u5e38\u5e38\u88ab\u79f0\u4f5c\u659c\u7ebf\u6216\u8005\u53cd\u659c\u7ebf\u547d\u4ee4\u3002</p>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u547d\u4ee4\u7684\u683c\u5f0f\u662f\u7528\u53cd\u659c\u7ebf\u540e\u9762\u76f4\u63a5\u8ddf\u4e0a\u4e00\u4e2a\u547d\u4ee4\u52a8\u8bcd\uff0c\u7136\u540e\u662f\u4e00\u4e9b\u53c2\u6570\u3002\u53c2\u6570\u4e0e\u547d\u4ee4\u52a8\u8bcd\u548c\u5176\u4ed6\u53c2\u6570\u4e4b\u95f4\u7528\u4efb\u610f\u591a\u4e2a\u7a7a\u767d\u5b57\u7b26\u5206\u9694\u5f00\u3002</p>\n<p lang=\"zh\">\u8981\u5728\u53c2\u6570\u4e2d\u5305\u542b\u7a7a\u767d\uff0c\u53ef\u4ee5\u7528\u5355\u5f15\u53f7\u5c06\u5b83\u62ec\u8d77\u6765\u3002\u8981\u5728\u53c2\u6570\u4e2d\u5305\u542b\u4e00\u4e2a\u5355\u5f15\u53f7\uff0c\u53ef\u4ee5\u5728\u5355\u5f15\u53f7\u6587\u672c\u5185\u5199\u4e24\u4e2a\u5355\u5f15\u53f7\u3002\u5355\u5f15\u53f7\u4e2d\u7684\u5185\u5bb9\u8fd8\u4f1a\u63a5\u53d7\u7c7b\u4f3c C \u8bed\u8a00\u7684\u66ff\u6362\uff1a<code class=\"literal\">\\n</code>\uff08\u6362\u884c\uff09\u3001<code class=\"literal\">\\t</code>\uff08\u5236\u8868\u7b26\uff09\u3001<code class=\"literal\">\\b</code>\uff08\u9000\u683c\uff09\u3001<code class=\"literal\">\\r</code>\uff08\u56de\u8f66\uff09\u3001<code class=\"literal\">\\f</code>\uff08\u6362\u9875\uff09\u3001<code class=\"literal\">\\</code><em class=\"replaceable\"><code>digits</code></em>\uff08\u516b\u8fdb\u5236\uff09\u4ee5\u53ca<code class=\"literal\">\\x</code><em class=\"replaceable\"><code>digits</code></em>\uff08\u5341\u516d\u8fdb\u5236\uff09\u3002\u5728\u5355\u5f15\u53f7\u6587\u672c\u5185\uff0c\u53cd\u659c\u7ebf\u51fa\u73b0\u5728\u4efb\u4f55\u5176\u4ed6\u5b57\u7b26\u524d\u9762\u65f6\uff0c\u53ea\u662f\u5bf9\u8be5\u5355\u4e2a\u5b57\u7b26\u8fdb\u884c\u8f6c\u4e49\uff0c\u4e0d\u8bba\u5b83\u662f\u4ec0\u4e48\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u53c2\u6570\u4e2d\u51fa\u73b0\u4e00\u4e2a\u672a\u52a0\u5f15\u53f7\u7684\u5192\u53f7\uff08<code class=\"literal\">:</code>\uff09\uff0c\u540e\u9762\u7d27\u8ddf\u4e00\u4e2a<span class=\"application\">psql</span>\u53d8\u91cf\u540d\uff0c\u5b83\u5c31\u4f1a\u88ab\u8be5\u53d8\u91cf\u7684\u503c\u66ff\u6362\uff0c\u5982\u4e0b\u9762<a class=\"xref\" href=\"/docs/10/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL \u63d2\u503c\"><acronym class=\"acronym\">SQL</acronym> \u63d2\u503c</a>\u6240\u8ff0\u3002\u5176\u4e2d\u4ecb\u7ecd\u7684<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u548c<code class=\"literal\">:\"<em class=\"replaceable\"><code>variable_name</code></em>\"</code>\u5f62\u5f0f\u4e5f\u540c\u6837\u9002\u7528\u3002</p>\n<p lang=\"zh\">\u5728\u53c2\u6570\u4e2d\uff0c\u7528\u53cd\u5f15\u53f7\uff08<code class=\"literal\">`</code>\uff09\u5305\u56f4\u7684\u6587\u672c\u4f1a\u88ab\u89c6\u4e3a\u4f20\u7ed9 shell \u7684\u547d\u4ee4\u884c\u3002\u8be5\u547d\u4ee4\u7684\u8f93\u51fa\uff08\u53bb\u6389\u672b\u5c3e\u7684\u6362\u884c\u7b26\uff09\u4f1a\u66ff\u6362\u53cd\u5f15\u53f7\u4e2d\u7684\u6587\u672c\u3002\u5728\u53cd\u5f15\u53f7\u5305\u56f4\u7684\u6587\u672c\u5185\u90e8\uff0c\u4e0d\u4f1a\u8fdb\u884c\u7279\u6b8a\u7684\u5f15\u53f7\u5904\u7406\u6216\u5176\u4ed6\u5904\u7406\uff0c\u4f46\u51fa\u73b0<code class=\"literal\">:<em class=\"replaceable\"><code>variable_name</code></em></code>\u65f6\uff0c\u5982\u679c<em class=\"replaceable\"><code>variable_name</code></em>\u662f<span class=\"application\">psql</span>\u53d8\u91cf\u540d\uff0c\u5c31\u4f1a\u88ab\u66ff\u6362\u4e3a\u8be5\u53d8\u91cf\u7684\u503c\u3002\u6b64\u5916\uff0c<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u4e5f\u4f1a\u88ab\u66ff\u6362\u4e3a\u8be5\u53d8\u91cf\u7684\u503c\uff0c\u5e76\u4f1a\u9002\u5f53\u5730\u52a0\u4e0a\u5f15\u53f7\uff0c\u4f7f\u5176\u6210\u4e3a\u5355\u4e2a shell \u547d\u4ee4\u53c2\u6570\u3002\uff08\u540e\u4e00\u79cd\u5f62\u5f0f\u51e0\u4e4e\u603b\u662f\u66f4\u53ef\u53d6\uff0c\u9664\u975e\u4f60\u975e\u5e38\u786e\u5b9a\u53d8\u91cf\u4e2d\u5305\u542b\u4ec0\u4e48\u3002\uff09\u7531\u4e8e\u65e0\u6cd5\u4fdd\u8bc1\u5728\u6240\u6709\u5e73\u53f0\u4e0a\u90fd\u80fd\u5bf9\u56de\u8f66\u548c\u6362\u884c\u5b57\u7b26\u5b89\u5168\u5730\u52a0\u5f15\u53f7\uff0c\u5f53\u53d8\u91cf\u503c\u4e2d\u51fa\u73b0\u8fd9\u7c7b\u5b57\u7b26\u65f6\uff0c<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u5f62\u5f0f\u4f1a\u6253\u5370\u9519\u8bef\u6d88\u606f\uff0c\u5e76\u4e14\u4e0d\u4f1a\u66ff\u6362\u53d8\u91cf\u503c\u3002</p>\n<p lang=\"zh\">\u4e00\u4e9b\u547d\u4ee4\u63a5\u53d7 SQL \u6807\u8bc6\u7b26\uff08\u4f8b\u5982\u8868\u540d\uff09\u4f5c\u4e3a\u53c2\u6570\u3002\u8fd9\u4e9b\u53c2\u6570\u9075\u5faa SQL \u8bed\u6cd5\u89c4\u5219\uff1a\u672a\u52a0\u5f15\u53f7\u7684\u5b57\u6bcd\u4f1a\u5f3a\u5236\u8f6c\u6362\u4e3a\u5c0f\u5199\uff0c\u800c\u53cc\u5f15\u53f7\uff08\"\uff09\u4f1a\u4fdd\u62a4\u5b57\u6bcd\u4e0d\u88ab\u8f6c\u6362\u5927\u5c0f\u5199\uff0c\u5e76\u5141\u8bb8\u6807\u8bc6\u7b26\u5305\u542b\u7a7a\u767d\u5b57\u7b26\u3002\u5728\u53cc\u5f15\u53f7\u5185\u90e8\uff0c\u8fde\u7eed\u4e24\u4e2a\u53cc\u5f15\u53f7\u4f1a\u5728\u6700\u7ec8\u540d\u79f0\u4e2d\u53d8\u4e3a\u4e00\u4e2a\u53cc\u5f15\u53f7\u3002\u4f8b\u5982\uff0cFOO\"BAR\"BAZ \u4f1a\u88ab\u89e3\u91ca\u4e3a fooBARbaz\uff0c\u800c \"A weird\"\" name\" \u4f1a\u53d8\u4e3a A weird\" name\u3002</p>\n<p lang=\"zh\">\u53c2\u6570\u89e3\u6790\u4f1a\u5728\u884c\u5c3e\u6216\u9047\u5230\u53e6\u4e00\u4e2a\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u65f6\u505c\u6b62\u3002\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u4f1a\u88ab\u89c6\u4e3a\u65b0\u5143\u547d\u4ee4\u7684\u5f00\u59cb\u3002\u7279\u6b8a\u5e8f\u5217<code class=\"literal\">\\\\</code>\uff08\u4e24\u4e2a\u53cd\u659c\u7ebf\uff09\u8868\u793a\u53c2\u6570\u7ed3\u675f\uff0c\u5e76\u7ee7\u7eed\u89e3\u6790<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\uff08\u5982\u679c\u8fd8\u6709\uff09\u3002\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u548c<span class=\"application\">psql</span>\u547d\u4ee4\u53ef\u4ee5\u81ea\u7531\u5730\u6df7\u5408\u5728\u540c\u4e00\u884c\u4e2d\u3002\u4f46\u65e0\u8bba\u5982\u4f55\uff0c\u5143\u547d\u4ee4\u7684\u53c2\u6570\u90fd\u4e0d\u80fd\u5ef6\u7eed\u5230\u4e0b\u4e00\u884c\u3002</p>\n<p lang=\"zh\">\u8bb8\u591a\u5143\u547d\u4ee4\u4f5c\u7528\u4e8e<em class=\"firstterm\">\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a</em>\u3002\u8fd9\u53ea\u662f\u4e00\u4e2a\u4fdd\u5b58\u5df2\u8f93\u5165\u4f46\u5c1a\u672a\u53d1\u9001\u5230\u670d\u52a1\u5668\u6267\u884c\u7684 SQL \u547d\u4ee4\u6587\u672c\u7684\u7f13\u51b2\u533a\u3002\u5176\u4e2d\u65e2\u5305\u62ec\u5148\u524d\u8f93\u5165\u7684\u884c\uff0c\u4e5f\u5305\u62ec\u540c\u4e00\u884c\u4e0a\u4f4d\u4e8e\u5143\u547d\u4ee4\u4e4b\u524d\u7684\u6587\u672c\u3002</p>\n<p lang=\"zh\">\u5b9a\u4e49\u4e86\u4ee5\u4e0b\u5143\u547d\u4ee4\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">\\a</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u5f53\u524d\u8868\u683c\u8f93\u51fa\u683c\u5f0f\u662f\u975e\u5bf9\u9f50\uff0c\u5219\u5207\u6362\u4e3a\u5bf9\u9f50\uff1b\u5426\u5219\u5207\u6362\u4e3a\u975e\u5bf9\u9f50\u3002\u4fdd\u7559\u6b64\u547d\u4ee4\u662f\u4e3a\u4e86\u5411\u540e\u517c\u5bb9\u3002\u66f4\u901a\u7528\u7684\u89e3\u51b3\u65b9\u6848\u8bf7\u53c2\u89c1<code class=\"command\">\\pset</code>\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\c</code> \u6216 <code class=\"literal\">\\connect [ -reuse-previous=<em class=\"replaceable\"><code>on|off</code></em> ] [ <em class=\"replaceable\"><code>dbname</code></em> [ <em class=\"replaceable\"><code>username</code></em> ] [ <em class=\"replaceable\"><code>host</code></em> ] [ <em class=\"replaceable\"><code>port</code></em> ] | <em class=\"replaceable\"><code>conninfo</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5efa\u7acb\u5230<span class=\"productname\">PostgreSQL</span>\u670d\u52a1\u5668\u7684\u65b0\u8fde\u63a5\u3002\u8fde\u63a5\u53c2\u6570\u65e2\u53ef\u4ee5\u4f7f\u7528\u6309\u4f4d\u7f6e\u6307\u5b9a\u7684\u8bed\u6cd5\uff08\u6570\u636e\u5e93\u540d\u3001\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\u4e2d\u7684\u4e00\u4e2a\u6216\u591a\u4e2a\uff09\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528<em class=\"replaceable\"><code>conninfo</code></em>\u8fde\u63a5\u5b57\u7b26\u4e32\uff0c\u8be6\u89c1<a class=\"xref\" href=\"/docs/10/libpq.html#LIBPQ-CONNSTRING\" title=\"33.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u7b2c\u00a033.1.1\u00a0\u8282</a>\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa\u53c2\u6570\uff0c\u5219\u4f7f\u7528\u4e0e\u4e4b\u524d\u76f8\u540c\u7684\u53c2\u6570\u5efa\u7acb\u65b0\u8fde\u63a5\u3002</p>\n<p lang=\"zh\">\u5c06<em class=\"replaceable\"><code>dbname</code></em>\u3001<em class=\"replaceable\"><code>username</code></em>\u3001<em class=\"replaceable\"><code>host</code></em>\u6216<em class=\"replaceable\"><code>port</code></em>\u4e2d\u7684\u4efb\u4f55\u4e00\u4e2a\u6307\u5b9a\u4e3a<code class=\"literal\">-</code>\uff0c\u90fd\u7b49\u4ef7\u4e8e\u7701\u7565\u8be5\u53c2\u6570\u3002</p>\n<p lang=\"zh\">\u65b0\u8fde\u63a5\u53ef\u4ee5\u91cd\u7528\u524d\u4e00\u4e2a\u8fde\u63a5\u7684\u8fde\u63a5\u53c2\u6570\uff1b\u4e0d\u4ec5\u5305\u62ec\u6570\u636e\u5e93\u540d\u79f0\u3001\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\uff0c\u8fd8\u5305\u62ec\u5176\u4ed6\u8bbe\u7f6e\uff0c\u5982<em class=\"replaceable\"><code>sslmode</code></em>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53c2\u6570\u5728\u4f4d\u7f6e\u8bed\u6cd5\u4e2d\u88ab\u91cd\u7528\uff0c\u4f46\u5728\u7ed9\u5b9a<em class=\"replaceable\"><code>conninfo</code></em>\u5b57\u7b26\u4e32\u65f6\u4e0d\u4f1a\u88ab\u91cd\u7528\u3002\u4f20\u9012<code class=\"literal\">-reuse-previous=on</code>\u6216<code class=\"literal\">-reuse-previous=off</code>\u4f5c\u4e3a\u7b2c\u4e00\u4e2a\u53c2\u6570\u5c06\u8986\u76d6\u8be5\u9ed8\u8ba4\u8bbe\u7f6e\u3002\u5982\u679c\u53c2\u6570\u88ab\u91cd\u7528\uff0c\u5219\u4efb\u4f55\u672a\u660e\u786e\u6307\u5b9a\u4e3a\u4f4d\u7f6e\u53c2\u6570\u6216\u5728<em class=\"replaceable\"><code>conninfo</code></em>\u5b57\u7b26\u4e32\u4e2d\u7684\u53c2\u6570\u5c06\u4ece\u73b0\u6709\u8fde\u63a5\u7684\u53c2\u6570\u4e2d\u83b7\u53d6\u3002\u4e00\u4e2a\u4f8b\u5916\u662f\uff0c\u5982\u679c\u4f7f\u7528\u4f4d\u7f6e\u8bed\u6cd5\u66f4\u6539<em class=\"replaceable\"><code>host</code></em>\u8bbe\u7f6e\uff0c\u4f7f\u5176\u4e0d\u540c\u4e8e\u5148\u524d\u7684\u503c\uff0c\u5219\u73b0\u6709\u8fde\u63a5\u53c2\u6570\u4e2d\u5b58\u5728\u7684\u4efb\u4f55<em class=\"replaceable\"><code>hostaddr</code></em>\u8bbe\u7f6e\u5c06\u88ab\u5220\u9664\u3002\u6b64\u5916\uff0c\u4ec5\u5f53\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\u8bbe\u7f6e\u672a\u66f4\u6539\u65f6\uff0c\u624d\u4f1a\u91cd\u7528\u73b0\u6709\u8fde\u63a5\u4f7f\u7528\u7684\u4efb\u4f55\u5bc6\u7801\u3002\u5f53\u547d\u4ee4\u65e2\u4e0d\u6307\u5b9a\u4e5f\u4e0d\u91cd\u7528\u7279\u5b9a\u53c2\u6570\u65f6\uff0c\u5c06\u4f7f\u7528<span class=\"application\">libpq</span>\u7684\u9ed8\u8ba4\u503c\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6210\u529f\u5efa\u7acb\u4e86\u65b0\u8fde\u63a5\uff0c\u5219\u5173\u95ed\u5148\u524d\u7684\u8fde\u63a5\u3002\u5982\u679c\u8fde\u63a5\u5c1d\u8bd5\u5931\u8d25\uff08\u7528\u6237\u540d\u9519\u8bef\u3001\u8bbf\u95ee\u88ab\u62d2\u7edd\u7b49\uff09\uff0c\u5f53<span class=\"application\">psql</span>\u5904\u4e8e\u4ea4\u4e92\u6a21\u5f0f\u65f6\uff0c\u4f1a\u4fdd\u7559\u5148\u524d\u7684\u8fde\u63a5\u3002\u4f46\u5728\u6267\u884c\u975e\u4ea4\u4e92\u5f0f\u811a\u672c\u65f6\uff0c\u4f1a\u7acb\u5373\u62a5\u9519\u5e76\u505c\u6b62\u5904\u7406\u3002\u8fd9\u4e00\u533a\u522b\u4e00\u65b9\u9762\u4f7f\u7528\u6237\u80fd\u591f\u65b9\u4fbf\u5730\u5e94\u5bf9\u8f93\u5165\u9519\u8bef\uff0c\u53e6\u4e00\u65b9\u9762\u4e5f\u4f5c\u4e3a\u5b89\u5168\u673a\u5236\uff0c\u9632\u6b62\u811a\u672c\u610f\u5916\u5730\u4f5c\u7528\u4e8e\u9519\u8bef\u7684\u6570\u636e\u5e93\u3002</p>\n<p lang=\"zh\">\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">=&gt; \\c mydb myuser host.dom 6432\n=&gt; \\c service=foo\n=&gt; \\c \"host=localhost port=5432 dbname=mydb connect_timeout=10 sslmode=disable\"\n=&gt; \\c -reuse-previous=on sslmode=require    -- changes only sslmode\n=&gt; \\c postgresql://tom@localhost/mydb?application_name=myapp\n</pre></dd>\n<dt><span class=\"term\"><code class=\"literal\">\\C [ <em class=\"replaceable\"><code>title</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u4f5c\u4e3a\u67e5\u8be2\u7ed3\u679c\u6253\u5370\u7684\u8868\u7684\u6807\u9898\uff0c\u6216\u53d6\u6d88\u6b64\u7c7b\u6807\u9898\u3002\u8be5\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset title <em class=\"replaceable\"><code>title</code></em></code>\u3002\uff08\u6b64\u547d\u4ee4\u7684\u540d\u79f0\u6e90\u81ea<span class=\"quote\">\u201c<span class=\"quote\">caption</span>\u201d</span>\uff0c\u56e0\u4e3a\u5b83\u8fc7\u53bb\u53ea\u7528\u4e8e\u8bbe\u7f6e<acronym class=\"acronym\">HTML</acronym>\u8868\u7684\u6807\u9898\u3002\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\cd [ <em class=\"replaceable\"><code>directory</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u66f4\u6539\u4e3a<em class=\"replaceable\"><code>directory</code></em>\u3002\u5982\u679c\u6ca1\u6709\u53c2\u6570\uff0c\u5219\u5207\u6362\u5230\u5f53\u524d\u7528\u6237\u7684\u4e3b\u76ee\u5f55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8981\u6253\u5370\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\uff0c\u8bf7\u4f7f\u7528<code class=\"literal\">\\! pwd</code>\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\conninfo</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa\u5f53\u524d\u6570\u636e\u5e93\u8fde\u63a5\u7684\u4fe1\u606f\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMANDS-COPY\"><span class=\"term\"><code class=\"literal\">\\copy { <em class=\"replaceable\"><code>table</code></em> [ ( <em class=\"replaceable\"><code>column_list</code></em> ) ] | ( <em class=\"replaceable\"><code>query</code></em> ) } { <code class=\"literal\">from</code> | <code class=\"literal\">to</code> } { <em class=\"replaceable\"><code>'filename'</code></em> | program <em class=\"replaceable\"><code>'command'</code></em> | stdin | stdout | pstdin | pstdout } [ [ with ] ( <em class=\"replaceable\"><code>option</code></em> [, ...] ) ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6267\u884c\u524d\u7aef\uff08\u5ba2\u6237\u7aef\uff09\u590d\u5236\u3002\u8be5\u64cd\u4f5c\u4f1a\u8fd0\u884c\u4e00\u4e2a<acronym class=\"acronym\">SQL</acronym> <a class=\"xref\" href=\"/docs/10/sql-copy.html\" title=\"COPY\"><span class=\"refentrytitle\">COPY</span></a>\u547d\u4ee4\uff0c\u4f46\u5e76\u4e0d\u662f\u7531\u670d\u52a1\u5668\u8bfb\u53d6\u6216\u5199\u5165\u6307\u5b9a\u6587\u4ef6\uff0c\u800c\u662f\u7531<span class=\"application\">psql</span>\u8bfb\u53d6\u6216\u5199\u5165\u6587\u4ef6\uff0c\u5e76\u5728\u670d\u52a1\u5668\u4e0e\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e4b\u95f4\u8f6c\u9001\u6570\u636e\u3002\u8fd9\u610f\u5473\u7740\u6587\u4ef6\u53ef\u8bbf\u95ee\u6027\u548c\u6743\u9650\u53d6\u51b3\u4e8e\u672c\u5730\u7528\u6237\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\uff0c\u4e5f\u4e0d\u9700\u8981 SQL \u8d85\u7ea7\u7528\u6237\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5f53\u6307\u5b9a<code class=\"literal\">program</code>\u65f6\uff0c<em class=\"replaceable\"><code>command</code></em> \u7531<span class=\"application\">psql</span>\u6267\u884c\uff0c\u4f20\u7ed9<em class=\"replaceable\"><code>command</code></em>\u7684\u6570\u636e\u6216\u4ece\u5176\u4e2d\u8bfb\u51fa\u7684\u6570\u636e\u90fd\u4f1a\u5728\u670d\u52a1\u5668\u4e0e\u5ba2\u6237\u7aef\u4e4b\u95f4\u8f6c\u9001\u3002\u518d\u6b21\u5f3a\u8c03\uff0c\u6267\u884c\u6743\u9650\u5c5e\u4e8e\u672c\u5730\u7528\u6237\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\uff0c\u4e5f\u4e0d\u9700\u8981 SQL \u8d85\u7ea7\u7528\u6237\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e \\copy ... from stdin\uff0c\u4ece\u53d1\u51fa\u547d\u4ee4\u7684\u540c\u4e00\u8f93\u5165\u6e90\u8bfb\u53d6\u6570\u636e\u884c\uff0c\u76f4\u5230\u8bfb\u53d6\u5230 \\.\u6216\u8f93\u5165\u6d41\u5230\u8fbe EOF\u3002\u8fd9\u9002\u5408\u5728 SQL \u811a\u672c\u4e2d\u5185\u8054\u586b\u5145\u8868\u3002\u5bf9\u4e8e \\copy ... to stdout\uff0c\u8f93\u51fa\u53d1\u5f80\u4e0e psql \u547d\u4ee4\u8f93\u51fa\u76f8\u540c\u7684\u4f4d\u7f6e\uff0c\u4e14\u4e0d\u6253\u5370 COPY count \u547d\u4ee4\u72b6\u6001\uff0c\u4ee5\u514d\u4e0e\u6570\u636e\u884c\u6df7\u6dc6\u3002\u82e5\u8981\u59cb\u7ec8\u8bfb\u5199 psql \u7684\u6807\u51c6\u8f93\u5165\u6216\u8f93\u51fa\uff0c\u800c\u4e0d\u53d7\u5f53\u524d\u547d\u4ee4\u6765\u6e90\u6216 \\o \u9009\u9879\u5f71\u54cd\uff0c\u8bf7\u4f7f\u7528 from pstdin \u6216 to pstdout\u3002</p>\n<p lang=\"zh\">\u8be5\u547d\u4ee4\u7684\u8bed\u6cd5\u4e0e<acronym class=\"acronym\">SQL</acronym> <a class=\"xref\" href=\"/docs/10/sql-copy.html\" title=\"COPY\"><span class=\"refentrytitle\">COPY</span></a>\u547d\u4ee4\u7c7b\u4f3c\u3002\u9664\u6570\u636e\u6e90\u6216\u76ee\u6807\u4e4b\u5916\uff0c\u5176\u4ed6\u6240\u6709\u9009\u9879\u90fd\u4e0e<a class=\"xref\" href=\"/docs/10/sql-copy.html\" title=\"COPY\"><span class=\"refentrytitle\">COPY</span></a>\u4e2d\u7684\u6307\u5b9a\u76f8\u540c\u3002\u56e0\u6b64\uff0c\u7279\u6b8a\u7684\u89e3\u6790\u89c4\u5219\u9002\u7528\u4e8e<code class=\"command\">\\copy</code>\u5143\u547d\u4ee4\u3002\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u5269\u4f59\u884c\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\copy</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u6267\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u53e6\u4e00\u79cd\u83b7\u5f97\u4e0e<code class=\"literal\">\\copy ... to</code>\u76f8\u540c\u7ed3\u679c\u7684\u65b9\u6cd5\u662f\u4f7f\u7528<acronym class=\"acronym\">SQL</acronym> <code class=\"literal\">COPY ... TO STDOUT</code>\u547d\u4ee4\uff0c\u5e76\u4ee5<code class=\"literal\">\\g <em class=\"replaceable\"><code>filename</code></em></code> \u6216<code class=\"literal\">\\g |<em class=\"replaceable\"><code>program</code></em></code>\u7ed3\u675f\u3002\u4e0e<code class=\"literal\">\\copy</code>\u4e0d\u540c\uff0c\u8fd9\u79cd\u65b9\u6cd5\u5141\u8bb8\u547d\u4ee4\u8de8\u8d8a\u591a\u884c\uff1b\u6b64\u5916\uff0c\u53ef\u4ee5\u4f7f\u7528\u53d8\u91cf\u63d2\u503c\u548c\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</div>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8fd9\u4e9b\u64cd\u4f5c\u4e0d\u5982\u4ee5\u6587\u4ef6\u6216\u7a0b\u5e8f\u4f5c\u4e3a\u6570\u636e\u6e90\u6216\u76ee\u6807\u7684 <acronym class=\"acronym\">SQL</acronym> <code class=\"command\">COPY</code> \u547d\u4ee4\u9ad8\u6548\uff0c\u56e0\u4e3a\u6240\u6709\u6570\u636e\u90fd\u5fc5\u987b\u901a\u8fc7\u5ba2\u6237\u7aef/\u670d\u52a1\u5668\u8fde\u63a5\u4f20\u8f93\u3002\u5bf9\u4e8e\u5927\u91cf\u6570\u636e\uff0c\u4f7f\u7528 <acronym class=\"acronym\">SQL</acronym> \u547d\u4ee4\u53ef\u80fd\u66f4\u5408\u9002\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\copyright</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"productname\">PostgreSQL</span>\u7684\u7248\u6743\u548c\u5206\u53d1\u6761\u6b3e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMANDS-CROSSTABVIEW\"><span class=\"term\"><code class=\"literal\">\\crosstabview [ <em class=\"replaceable\"><code>colV</code></em> [ <em class=\"replaceable\"><code>colH</code></em> [ <em class=\"replaceable\"><code>colD</code></em> [ <em class=\"replaceable\"><code>sortcolH</code></em> ] ] ] ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6267\u884c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\uff08\u4e0e<code class=\"literal\">\\g</code>\u7c7b\u4f3c\uff09\uff0c\u5e76\u4ee5\u4ea4\u53c9\u8868\u7f51\u683c\u663e\u793a\u7ed3\u679c\u3002\u67e5\u8be2\u5fc5\u987b\u8fd4\u56de\u81f3\u5c11\u4e09\u5217\u3002\u7531<em class=\"replaceable\"><code>colV</code></em>\u6807\u8bc6\u7684\u8f93\u51fa\u5217\u6210\u4e3a\u7eb5\u5411\u8868\u5934\uff0c\u7531<em class=\"replaceable\"><code>colH</code></em>\u6807\u8bc6\u7684\u8f93\u51fa\u5217\u6210\u4e3a\u6a2a\u5411\u8868\u5934\u3002<em class=\"replaceable\"><code>colD</code></em>\u6807\u8bc6\u8981\u5728\u7f51\u683c\u4e2d\u663e\u793a\u7684\u8f93\u51fa\u5217\u3002<em class=\"replaceable\"><code>sortcolH</code></em>\u6807\u8bc6\u6a2a\u5411\u8868\u5934\u7684\u53ef\u9009\u6392\u5e8f\u5217\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a\u5217\u6307\u5b9a\u9879\u53ef\u4ee5\u662f\u4ece 1 \u5f00\u59cb\u7684\u5217\u53f7\uff0c\u4e5f\u53ef\u4ee5\u662f\u5217\u540d\uff1b\u5217\u540d\u9075\u5faa\u5e38\u89c4 SQL \u5927\u5c0f\u5199\u6298\u53e0\u548c\u5f15\u53f7\u89c4\u5219\u3002\u7701\u7565\u65f6\uff0ccolV \u9ed8\u8ba4\u4e3a\u7b2c 1 \u5217\uff0ccolH \u9ed8\u8ba4\u4e3a\u7b2c 2 \u5217\u3002colH \u5fc5\u987b\u4e0e colV \u4e0d\u540c\u3002\u82e5\u4e0d\u6307\u5b9a colD\uff0c\u67e5\u8be2\u7ed3\u679c\u5fc5\u987b\u6070\u6709\u4e09\u5217\uff0c\u65e2\u975e colV \u4e5f\u975e colH \u7684\u90a3\u4e00\u5217\u4f5c\u4e3a colD\u3002</p>\n<p lang=\"zh\">\u7eb5\u5411\u8868\u5934\u663e\u793a\u4e3a\u6700\u5de6\u5217\uff0c\u5305\u542b<em class=\"replaceable\"><code>colV</code></em>\u5217\u4e2d\u7684\u503c\uff0c\u5176\u987a\u5e8f\u4e0e\u67e5\u8be2\u7ed3\u679c\u4e2d\u76f8\u540c\uff0c\u4f46\u4f1a\u79fb\u9664\u91cd\u590d\u503c\u3002</p>\n<p lang=\"zh\">\u6a2a\u5411\u8868\u5934\u663e\u793a\u4e3a\u7b2c\u4e00\u884c\uff0c\u5305\u542b<em class=\"replaceable\"><code>colH</code></em>\u5217\u4e2d\u7684\u503c\uff0c\u5e76\u79fb\u9664\u91cd\u590d\u503c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4eec\u6309\u67e5\u8be2\u7ed3\u679c\u4e2d\u7684\u76f8\u540c\u987a\u5e8f\u663e\u793a\u3002\u4f46\u5982\u679c\u7ed9\u51fa\u4e86\u53ef\u9009\u7684<em class=\"replaceable\"><code>sortcolH</code></em>\u53c2\u6570\uff0c\u5b83\u6240\u6807\u8bc6\u7684\u5217\u7684\u503c\u5fc5\u987b\u662f\u6574\u6570\uff0c\u800c<em class=\"replaceable\"><code>colH</code></em>\u4e2d\u7684\u503c\u4f1a\u6309\u7167\u5bf9\u5e94\u7684<em class=\"replaceable\"><code>sortcolH</code></em>\u503c\u6392\u5e8f\u540e\u663e\u793a\u5728\u6a2a\u5411\u8868\u5934\u4e2d\u3002</p>\n<p lang=\"zh\">\u4ea4\u53c9\u8868\u4e2d\uff0c\u5bf9\u4e8e colH \u7684\u6bcf\u4e2a\u4e0d\u540c\u503c x \u548c colV \u7684\u6bcf\u4e2a\u4e0d\u540c\u503c y\uff0c\u4ea4\u70b9 (x,y) \u7684\u5355\u5143\u683c\u4fdd\u5b58\u67e5\u8be2\u7ed3\u679c\u4e2d colH=x \u4e14 colV=y \u90a3\u4e00\u884c\u7684 colD \u503c\u3002\u6ca1\u6709\u5339\u914d\u884c\u65f6\u5355\u5143\u683c\u4e3a\u7a7a\uff1b\u5b58\u5728\u591a\u884c\u65f6\u4f1a\u62a5\u9519\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\d[S+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5bf9\u4e8e\u6bcf\u4e2a\u5339\u914d<em class=\"replaceable\"><code>pattern</code></em>\u7684\u5173\u7cfb\uff08\u8868\u3001\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u7d22\u5f15\u3001\u5e8f\u5217\u6216\u5916\u90e8\u8868\uff09\u6216\u590d\u5408\u7c7b\u578b\uff0c\u663e\u793a\u6240\u6709\u5217\u53ca\u5176\u7c7b\u578b\u3001\u8868\u7a7a\u95f4\uff08\u5982\u679c\u4e0d\u662f\u9ed8\u8ba4\u8868\u7a7a\u95f4\uff09\uff0c\u4ee5\u53ca<code class=\"literal\">NOT NULL</code>\u6216\u9ed8\u8ba4\u503c\u7b49\u7279\u6b8a\u5c5e\u6027\u3002\u8fd8\u4f1a\u663e\u793a\u5173\u8054\u7684\u7d22\u5f15\u3001\u7ea6\u675f\u3001\u89c4\u5219\u548c\u89e6\u53d1\u5668\u3002\u5bf9\u4e8e\u5916\u90e8\u8868\uff0c\u8fd8\u4f1a\u663e\u793a\u5173\u8054\u7684\u5916\u90e8\u670d\u52a1\u5668\u3002\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u5339\u914d\u6a21\u5f0f</span>\u201d</span>\u7684\u5b9a\u4e49\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"\u6a21\u5f0f\">\u6a21\u5f0f</a>\u3002\uff09</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u67d0\u4e9b\u5173\u7cfb\u7c7b\u578b\uff0c<code class=\"literal\">\\d</code>\u4f1a\u4e3a\u6bcf\u5217\u663e\u793a\u9644\u52a0\u4fe1\u606f\uff1a\u5e8f\u5217\u7684\u5217\u503c\u3001\u7d22\u5f15\u7684\u7d22\u5f15\u8868\u8fbe\u5f0f\uff0c\u4ee5\u53ca\u5916\u90e8\u8868\u7684\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u9009\u9879\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">\\d+</code>\u5f62\u5f0f\u7684\u547d\u4ee4\u4e0e\u4e4b\u76f8\u540c\uff0c\u4f46\u4f1a\u663e\u793a\u66f4\u591a\u4fe1\u606f\uff1a\u8868\u5404\u5217\u5173\u8054\u7684\u6ce8\u91ca\u3001\u8868\u4e2d\u662f\u5426\u5b58\u5728 OID\u3001\u89c6\u56fe\u5b9a\u4e49\uff08\u5982\u679c\u5173\u7cfb\u662f\u89c6\u56fe\uff09\uff0c\u4ee5\u53ca\u975e\u9ed8\u8ba4\u7684<a class=\"link\" href=\"/docs/10/sql-altertable.html#SQL-CREATETABLE-REPLICA-IDENTITY\">\u590d\u5236\u6807\u8bc6</a>\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528<code class=\"command\">\\d</code>\u800c\u6ca1\u6709<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\uff0c\u5b83\u7b49\u540c\u4e8e<code class=\"command\">\\dtvmsE</code>\uff0c\u5b83\u5c06\u663e\u793a\u6240\u6709\u53ef\u89c1\u7684\u8868\u3001\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u7684\u5217\u8868\u3002\u8fd9\u7eaf\u7cb9\u662f\u4e00\u79cd\u4fbf\u5229\u63aa\u65bd\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\da[S] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u805a\u5408\u51fd\u6570\u53ca\u5176\u8fd4\u56de\u7c7b\u578b\u548c\u64cd\u4f5c\u7684\u6570\u636e\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u805a\u5408\u51fd\u6570\u3002\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dA[+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8bbf\u95ee\u65b9\u6cd5\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u5217\u51fa\u6bcf\u4e2a\u8bbf\u95ee\u65b9\u6cd5\u5173\u8054\u7684\u5904\u7406\u5668\u51fd\u6570\u548c\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\db[+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8868\u7a7a\u95f4\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8868\u7a7a\u95f4\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u5217\u51fa\u6bcf\u4e2a\u8868\u7a7a\u95f4\u5173\u8054\u7684\u9009\u9879\u3001\u78c1\u76d8\u5927\u5c0f\u3001\u6743\u9650\u548c\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dc[S+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5b57\u7b26\u96c6\u7f16\u7801\u4e4b\u95f4\u7684\u8f6c\u6362\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8f6c\u6362\u3002\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u5217\u51fa\u6bcf\u4e2a\u5bf9\u8c61\u5173\u8054\u7684\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dC[+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u7c7b\u578b\u8f6c\u6362\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u6e90\u7c7b\u578b\u6216\u76ee\u6807\u7c7b\u578b\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u7c7b\u578b\u8f6c\u6362\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u5217\u51fa\u6bcf\u4e2a\u5bf9\u8c61\u5173\u8054\u7684\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dd[S] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u663e\u793a\u7c7b\u578b\u4e3a<code class=\"literal\">constraint</code>\u3001<code class=\"literal\">operator class</code>\u3001<code class=\"literal\">operator family</code>\u3001<code class=\"literal\">rule</code>\u548c<code class=\"literal\">trigger</code>\u7684\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002\u5176\u4ed6\u6240\u6709\u6ce8\u91ca\u90fd\u53ef\u4ee5\u901a\u8fc7\u76f8\u5e94\u5bf9\u8c61\u7c7b\u578b\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u67e5\u770b\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">\\dd</code>\u663e\u793a\u5339\u914d<em class=\"replaceable\"><code>pattern</code></em>\u7684\u5bf9\u8c61\u7684\u63cf\u8ff0\uff1b\u5982\u679c\u6ca1\u6709\u7ed9\u51fa\u53c2\u6570\uff0c\u5219\u663e\u793a\u9002\u5f53\u7c7b\u578b\u7684\u53ef\u89c1\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002\u4f46\u65e0\u8bba\u54ea\u79cd\u60c5\u51b5\uff0c\u90fd\u53ea\u5217\u51fa\u6709\u63cf\u8ff0\u7684\u5bf9\u8c61\u3002\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u7528<a class=\"xref\" href=\"/docs/10/sql-comment.html\" title=\"COMMENT\"><span class=\"refentrytitle\">COMMENT</span></a> <acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u4e3a\u5bf9\u8c61\u521b\u5efa\u63cf\u8ff0\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dD[S+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u57df\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u57df\u3002\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u5217\u51fa\u6bcf\u4e2a\u5bf9\u8c61\u5173\u8054\u7684\u6743\u9650\u548c\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\ddp [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u9ed8\u8ba4\u8bbf\u95ee\u6743\u9650\u8bbe\u7f6e\u3002\u5bf9\u4e8e\u9ed8\u8ba4\u6743\u9650\u8bbe\u7f6e\u5df2\u504f\u79bb\u5185\u7f6e\u9ed8\u8ba4\u503c\u7684\u6bcf\u4e2a\u89d2\u8272\uff08\u4ee5\u53ca\u6a21\u5f0f\uff0c\u5982\u679c\u9002\u7528\uff09\uff0c\u90fd\u4f1a\u663e\u793a\u4e00\u4e2a\u6761\u76ee\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u89d2\u8272\u540d\u6216\u6a21\u5f0f\u540d\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6761\u76ee\u3002</p>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/10/sql-alterdefaultprivileges.html\" title=\"ALTER DEFAULT PRIVILEGES\"><span class=\"refentrytitle\">ALTER DEFAULT PRIVILEGES</span></a>\u547d\u4ee4\u7528\u4e8e\u8bbe\u7f6e\u9ed8\u8ba4\u8bbf\u95ee\u6743\u9650\u3002\u6743\u9650\u663e\u793a\u7684\u542b\u4e49\u5728<a class=\"xref\" href=\"/docs/10/sql-grant.html\" title=\"GRANT\"><span class=\"refentrytitle\">GRANT</span></a>\u4e2d\u6709\u89e3\u91ca\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dE[S+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\di[S+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dm[S+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\ds[S+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dt[S+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dv[S+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd9\u7ec4\u547d\u4ee4\u4e2d\uff0c\u5b57\u6bcd<code class=\"literal\">E</code>\u3001<code class=\"literal\">i</code>\u3001<code class=\"literal\">m</code>\u3001<code class=\"literal\">s</code>\u3001<code class=\"literal\">t</code>\u548c<code class=\"literal\">v</code>\u5206\u522b\u4ee3\u8868\u5916\u90e8\u8868\u3001\u7d22\u5f15\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u3001\u8868\u548c\u89c6\u56fe\u3002\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u6307\u5b9a\u8fd9\u4e9b\u5b57\u6bcd\u4e2d\u7684\u4efb\u610f\u4e00\u4e2a\u6216\u5168\u90e8\uff0c\u4ee5\u83b7\u53d6\u76f8\u5e94\u7c7b\u578b\u7684\u5bf9\u8c61\u5217\u8868\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dit</code>\u5217\u51fa\u7d22\u5f15\u548c\u8868\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u5217\u51fa\u6bcf\u4e2a\u5bf9\u8c61\u7684\u78c1\u76d8\u4e0a\u7684\u7269\u7406\u5927\u5c0f\u4ee5\u53ca\u5173\u8054\u7684\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u5bf9\u8c61\u3002\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\des[+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u670d\u52a1\u5668\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external servers</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u670d\u52a1\u5668\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\des+</code>\u5f62\u5f0f\uff0c\u5219\u663e\u793a\u6bcf\u4e2a\u670d\u52a1\u5668\u7684\u5b8c\u6574\u8bf4\u660e\uff0c\u5305\u62ec\u670d\u52a1\u5668\u7684ACL\u3001\u7c7b\u578b\u3001\u7248\u672c\u3001\u9009\u9879\u548c\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\det[+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u8868\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external tables</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u8868\u540d\u6216\u6a21\u5f0f\u540d\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6761\u76ee\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\det+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u901a\u7528\u9009\u9879\u548c\u5916\u90e8\u8868\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\deu[+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u7528\u6237\u6620\u5c04\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external users</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u7528\u6237\u540d\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6620\u5c04\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\deu+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u6620\u5c04\u7684\u9644\u52a0\u4fe1\u606f\u3002</p>\n<div class=\"caution\">\n<h3 class=\"title\" lang=\"zh\">\u5c0f\u5fc3</h3>\n<p lang=\"zh\"><code class=\"literal\">\\deu+</code>\u8fd8\u53ef\u80fd\u663e\u793a\u8fdc\u7a0b\u7528\u6237\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u56e0\u6b64\u5e94\u6ce8\u610f\u4e0d\u8981\u6cc4\u9732\u5b83\u4eec\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dew[+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external wrappers</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dew+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u7684ACL\u3001\u9009\u9879\u548c\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\df[antwS+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u51fd\u6570\u53ca\u5176\u7ed3\u679c\u6570\u636e\u7c7b\u578b\u3001\u53c2\u6570\u6570\u636e\u7c7b\u578b\u548c\u51fd\u6570\u7c7b\u578b\u3002\u51fd\u6570\u7c7b\u578b\u5206\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">agg</span>\u201d</span>\uff08\u805a\u5408\uff09\u3001<span class=\"quote\">\u201c<span class=\"quote\">normal</span>\u201d</span>\u3001<span class=\"quote\">\u201c<span class=\"quote\">trigger</span>\u201d</span>\u6216<span class=\"quote\">\u201c<span class=\"quote\">window</span>\u201d</span>\u3002\u8981\u4ec5\u663e\u793a\u7279\u5b9a\u7c7b\u578b\u7684\u51fd\u6570\uff0c\u53ef\u5728\u547d\u4ee4\u4e2d\u6dfb\u52a0\u5bf9\u5e94\u7684\u5b57\u6bcd<code class=\"literal\">a</code>\u3001<code class=\"literal\">n</code>\u3001<code class=\"literal\">t</code>\u6216<code class=\"literal\">w</code>\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u51fd\u6570\u3002\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\df+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u51fd\u6570\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u6613\u53d8\u6027\u3001\u5e76\u884c\u5b89\u5168\u6027\u3001\u62e5\u6709\u8005\u3001\u5b89\u5168\u5206\u7c7b\u3001\u8bbf\u95ee\u6743\u9650\u3001\u8bed\u8a00\u3001\u6e90\u4ee3\u7801\u548c\u63cf\u8ff0\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8981\u67e5\u627e\u63a5\u53d7\u7279\u5b9a\u6570\u636e\u7c7b\u578b\u53c2\u6570\u6216\u8fd4\u56de\u7279\u5b9a\u6570\u636e\u7c7b\u578b\u503c\u7684\u51fd\u6570\uff0c\u8bf7\u4f7f\u7528\u5206\u9875\u5668\u7684\u641c\u7d22\u529f\u80fd\u6d4f\u89c8<code class=\"literal\">\\df</code>\u8f93\u51fa\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dF[+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u914d\u7f6e\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u914d\u7f6e\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dF+</code>\u5f62\u5f0f\uff0c\u5219\u663e\u793a\u6bcf\u4e2a\u914d\u7f6e\u7684\u5b8c\u6574\u8bf4\u660e\uff0c\u5305\u62ec\u5e95\u5c42\u5168\u6587\u68c0\u7d22\u89e3\u6790\u5668\u548c\u6bcf\u79cd\u89e3\u6790\u5668\u8bcd\u5143\u7c7b\u578b\u7684\u8bcd\u5178\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dFd[+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u8bcd\u5178\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bcd\u5178\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dFd+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u9009\u4e2d\u8bcd\u5178\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5e95\u5c42\u5168\u6587\u68c0\u7d22\u6a21\u677f\u548c\u9009\u9879\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dFp[+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u89e3\u6790\u5668\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u89e3\u6790\u5668\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dFp+</code>\u5f62\u5f0f\uff0c\u5219\u663e\u793a\u6bcf\u4e2a\u89e3\u6790\u5668\u7684\u5b8c\u6574\u8bf4\u660e\uff0c\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u548c\u53ef\u8bc6\u522b\u7684\u8bcd\u5143\u7c7b\u578b\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dFt[+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u6a21\u677f\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6a21\u677f\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dFt+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u6a21\u677f\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dg[S+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u5e93\u89d2\u8272\u3002\uff08\u7531\u4e8e<span class=\"quote\">\u201c<span class=\"quote\">\u7528\u6237</span>\u201d</span>\u548c<span class=\"quote\">\u201c<span class=\"quote\">\u7ec4</span>\u201d</span>\u7684\u6982\u5ff5\u5df2\u7ecf\u7edf\u4e00\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">\u89d2\u8272</span>\u201d</span>\uff0c\u6b64\u547d\u4ee4\u73b0\u5728\u7b49\u4ef7\u4e8e<code class=\"literal\">\\du</code>\u3002\uff09\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u89d2\u8272\uff1b\u63d0\u4f9b<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u89d2\u8272\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u89d2\u8272\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dg+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u89d2\u8272\u7684\u9644\u52a0\u4fe1\u606f\uff1b\u76ee\u524d\u4f1a\u589e\u52a0\u6bcf\u4e2a\u89d2\u8272\u7684\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dl</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u662f<code class=\"command\">\\lo_list</code>\u7684\u522b\u540d\uff0c\u7528\u4e8e\u663e\u793a\u5927\u5bf9\u8c61\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dL[S+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8fc7\u7a0b\u8bed\u8a00\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bed\u8a00\u3002\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u8bed\u8a00\uff1b\u63d0\u4f9b<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u5217\u51fa\u6bcf\u79cd\u8bed\u8a00\u7684\u8c03\u7528\u5904\u7406\u5668\u3001\u9a8c\u8bc1\u5668\u3001\u8bbf\u95ee\u6743\u9650\uff0c\u4ee5\u53ca\u5b83\u662f\u5426\u4e3a\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dn[S+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6a21\u5f0f\uff08\u547d\u540d\u7a7a\u95f4\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6a21\u5f0f\u3002\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u5217\u51fa\u6bcf\u4e2a\u5bf9\u8c61\u5173\u8054\u7684\u6743\u9650\u548c\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\do[S+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u64cd\u4f5c\u7b26\u53ca\u5176\u64cd\u4f5c\u6570\u7c7b\u578b\u548c\u7ed3\u679c\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u64cd\u4f5c\u7b26\u3002\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u76ee\u524d\u53ea\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dO[S+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6392\u5e8f\u89c4\u5219\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6392\u5e8f\u89c4\u5219\u3002\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u5217\u51fa\u6bcf\u4e2a\u6392\u5e8f\u89c4\u5219\u5173\u8054\u7684\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u3002\u8bf7\u6ce8\u610f\uff0c\u53ea\u4f1a\u663e\u793a\u53ef\u7528\u4e8e\u5f53\u524d\u6570\u636e\u5e93\u7f16\u7801\u7684\u6392\u5e8f\u89c4\u5219\uff0c\u56e0\u6b64\u540c\u4e00\u5b89\u88c5\u4e2d\u7684\u4e0d\u540c\u6570\u636e\u5e93\u53ef\u80fd\u4f1a\u5f97\u5230\u4e0d\u540c\u7ed3\u679c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dp [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u53ca\u5176\u5173\u8054\u7684\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u3002</p>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/10/sql-grant.html\" title=\"GRANT\"><span class=\"refentrytitle\">GRANT</span></a>\u548c<a class=\"xref\" href=\"/docs/10/sql-revoke.html\" title=\"REVOKE\"><span class=\"refentrytitle\">REVOKE</span></a>\u547d\u4ee4\u7528\u4e8e\u8bbe\u7f6e\u8bbf\u95ee\u6743\u9650\u3002\u6743\u9650\u663e\u793a\u7684\u542b\u4e49\u5728<a class=\"xref\" href=\"/docs/10/sql-grant.html\" title=\"GRANT\"><span class=\"refentrytitle\">GRANT</span></a>\u4e2d\u6709\u89e3\u91ca\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\drds [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>role-pattern</code></em></a> [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>database-pattern</code></em></a> ] ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5df2\u5b9a\u4e49\u7684\u914d\u7f6e\u8bbe\u7f6e\u3002\u8fd9\u4e9b\u8bbe\u7f6e\u53ef\u4ee5\u7279\u5b9a\u4e8e\u89d2\u8272\u3001\u7279\u5b9a\u4e8e\u6570\u636e\u5e93\uff0c\u6216\u540c\u65f6\u7279\u5b9a\u4e8e\u4e24\u8005\u3002<em class=\"replaceable\"><code>role-pattern</code></em>\u548c<em class=\"replaceable\"><code>database-pattern</code></em>\u5206\u522b\u7528\u4e8e\u9009\u62e9\u8981\u5217\u51fa\u7684\u89d2\u8272\u548c\u6570\u636e\u5e93\u3002\u7701\u7565\u67d0\u4e2a\u6a21\u5f0f\u53c2\u6570\u6216\u5c06\u5176\u6307\u5b9a\u4e3a<code class=\"literal\">*</code>\u65f6\uff0c\u4e0d\u4f1a\u6309\u8be5\u53c2\u6570\u7b5b\u9009\uff0c\u8fd8\u4f1a\u5206\u522b\u5305\u542b\u4e0d\u7279\u5b9a\u4e8e\u89d2\u8272\u6216\u4e0d\u7279\u5b9a\u4e8e\u6570\u636e\u5e93\u7684\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/10/sql-alterrole.html\" title=\"ALTER ROLE\"><span class=\"refentrytitle\">ALTER ROLE</span></a>\u548c<a class=\"xref\" href=\"/docs/10/sql-alterdatabase.html\" title=\"ALTER DATABASE\"><span class=\"refentrytitle\">ALTER DATABASE</span></a>\u547d\u4ee4\u7528\u4e8e\u5b9a\u4e49\u89d2\u8272\u4e13\u5c5e\u548c\u6570\u636e\u5e93\u4e13\u5c5e\u7684\u914d\u7f6e\u8bbe\u7f6e\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dRp[+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u590d\u5236\u53d1\u5e03\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u53d1\u5e03\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u663e\u793a\u4e0e\u6bcf\u4e2a\u53d1\u5e03\u5173\u8054\u7684\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dRs[+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u590d\u5236\u8ba2\u9605\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8ba2\u9605\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u663e\u793a\u8ba2\u9605\u7684\u9644\u52a0\u5c5e\u6027\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dT[S+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u7c7b\u578b\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u7c7b\u578b\u90fd\u4f1a\u8fde\u540c\u5176\u5185\u90e8\u540d\u79f0\u3001\u5927\u5c0f\u4ee5\u53ca\u76f8\u5173\u6743\u9650\u4e00\u8d77\u5217\u51fa\uff1b\u5bf9\u4e8e <code class=\"type\">enum</code> \u7c7b\u578b\uff0c\u8fd8\u4f1a\u663e\u793a\u5176\u5141\u8bb8\u503c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\du[S+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u5e93\u89d2\u8272\u3002\uff08\u7531\u4e8e<span class=\"quote\">\u201c<span class=\"quote\">\u7528\u6237</span>\u201d</span>\u548c<span class=\"quote\">\u201c<span class=\"quote\">\u7ec4</span>\u201d</span>\u7684\u6982\u5ff5\u5df2\u7ecf\u7edf\u4e00\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">\u89d2\u8272</span>\u201d</span>\uff0c\u6b64\u547d\u4ee4\u73b0\u5728\u7b49\u4ef7\u4e8e<code class=\"literal\">\\dg</code>\u3002\uff09\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u89d2\u8272\uff1b\u63d0\u4f9b<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u89d2\u8272\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u89d2\u8272\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\du+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u89d2\u8272\u7684\u9644\u52a0\u4fe1\u606f\uff1b\u76ee\u524d\u4f1a\u589e\u52a0\u6bcf\u4e2a\u89d2\u8272\u7684\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dx[+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5df2\u5b89\u88c5\u7684\u6269\u5c55\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6269\u5c55\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dx+</code>\u5f62\u5f0f\uff0c\u5219\u5217\u51fa\u5c5e\u4e8e\u6bcf\u4e2a\u5339\u914d\u6269\u5c55\u7684\u6240\u6709\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dy[+] [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u4e8b\u4ef6\u89e6\u53d1\u5668\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u4e8b\u4ef6\u89e6\u53d1\u5668\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u5217\u51fa\u6bcf\u4e2a\u5bf9\u8c61\u5173\u8054\u7684\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\e</code> \u6216 <code class=\"literal\">\\edit</code> <code class=\"literal\">[ <span class=\"optional\"><em class=\"replaceable\"><code>filename</code></em></span> ] [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5219\u7f16\u8f91\u8be5\u6587\u4ef6\uff1b\u7f16\u8f91\u5668\u9000\u51fa\u540e\uff0c\u5c06\u6587\u4ef6\u5185\u5bb9\u590d\u5236\u5230\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u3002\u5982\u679c\u672a\u7ed9\u51fa<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5219\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u590d\u5236\u5230\u4e34\u65f6\u6587\u4ef6\uff0c\u518d\u4ee5\u76f8\u540c\u65b9\u5f0f\u7f16\u8f91\u3002\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u5c06\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u590d\u5236\u5230\u4e34\u65f6\u6587\u4ef6\uff0c\u5e76\u4ee5\u76f8\u540c\u65b9\u5f0f\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u968f\u540e\uff0c\u6309\u7167<span class=\"application\">psql</span>\u7684\u6b63\u5e38\u89c4\u5219\u91cd\u65b0\u89e3\u6790\u67e5\u8be2\u7f13\u51b2\u533a\u7684\u65b0\u5185\u5bb9\uff0c\u5c06\u6574\u4e2a\u7f13\u51b2\u533a\u89c6\u4e3a\u4e00\u884c\u3002\u4efb\u4f55\u5b8c\u6574\u7684\u67e5\u8be2\u90fd\u4f1a\u7acb\u5373\u6267\u884c\uff1b\u4e5f\u5c31\u662f\u8bf4\uff0c\u5982\u679c\u67e5\u8be2\u7f13\u51b2\u533a\u5305\u542b\u5206\u53f7\u6216\u4ee5\u5206\u53f7\u7ed3\u675f\uff0c\u5c31\u4f1a\u6267\u884c\u5230\u8be5\u4f4d\u7f6e\u4e3a\u6b62\u7684\u6240\u6709\u5185\u5bb9\u3002\u5269\u4f59\u5185\u5bb9\u4f1a\u5728\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u7b49\u5f85\uff1b\u952e\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u952e\u5165<code class=\"literal\">\\r</code>\u6e05\u7a7a\u67e5\u8be2\u7f13\u51b2\u533a\u4ee5\u53d6\u6d88\u5b83\u3002\u5c06\u7f13\u51b2\u533a\u89c6\u4e3a\u4e00\u884c\u4e3b\u8981\u5f71\u54cd\u5143\u547d\u4ee4\uff1a\u7f13\u51b2\u533a\u4e2d\u4f4d\u4e8e\u5143\u547d\u4ee4\u4e4b\u540e\u7684\u6240\u6709\u5185\u5bb9\u90fd\u4f1a\u88ab\u89c6\u4e3a\u8be5\u5143\u547d\u4ee4\u7684\u53c2\u6570\uff0c\u5373\u4f7f\u5b83\u4eec\u8de8\u8d8a\u591a\u884c\u4e5f\u662f\u5982\u6b64\u3002\uff08\u56e0\u6b64\uff0c\u4e0d\u80fd\u7528\u8fd9\u79cd\u65b9\u5f0f\u7f16\u5199\u4f7f\u7528\u5143\u547d\u4ee4\u7684\u811a\u672c\u3002\u5e94\u4f7f\u7528<code class=\"command\">\\i</code>\u6765\u5904\u7406\u8fd9\u7c7b\u811a\u672c\u3002\uff09</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u4f1a\u5c06\u5149\u6807\u5b9a\u4f4d\u5230\u6587\u4ef6\u6216\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u7684\u6307\u5b9a\u884c\u3002\u8bf7\u6ce8\u610f\uff0c\u5982\u679c\u53ea\u7ed9\u51fa\u4e00\u4e2a\u5168\u7531\u6570\u5b57\u7ec4\u6210\u7684\u53c2\u6570\uff0c<span class=\"application\">psql</span>\u4f1a\u5047\u5b9a\u5b83\u662f\u884c\u53f7\uff0c\u800c\u4e0d\u662f\u6587\u4ef6\u540d\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u6709\u5173\u5982\u4f55\u914d\u7f6e\u548c\u5b9a\u5236\u7f16\u8f91\u5668\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/10/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"\u73af\u5883\">\u73af\u5883</a>\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\echo <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u53c2\u6570\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff0c\u53c2\u6570\u4e4b\u95f4\u7528\u4e00\u4e2a\u7a7a\u683c\u5206\u9694\uff0c\u672b\u5c3e\u8ddf\u968f\u6362\u884c\u7b26\u3002\u8fd9\u53ef\u7528\u4e8e\u5728\u811a\u672c\u8f93\u51fa\u4e2d\u63d2\u5165\u4fe1\u606f\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>\\echo `date`</code></strong>\nTue Oct 26 21:40:57 CEST 1999\n</pre>\n<p lang=\"zh\">\u5982\u679c\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f\u672a\u52a0\u5f15\u53f7\u7684<code class=\"literal\">-n</code>\uff0c\u5219\u4e0d\u8f93\u51fa\u672b\u5c3e\u7684\u6362\u884c\u7b26\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528<code class=\"command\">\\o</code>\u547d\u4ee4\u91cd\u5b9a\u5411\u67e5\u8be2\u8f93\u51fa\uff0c\u53ef\u80fd\u4f1a\u60f3\u7528<code class=\"command\">\\qecho</code>\u4ee3\u66ff\u8fd9\u4e2a\u547d\u4ee4\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\ef [ <span class=\"optional\"><em class=\"replaceable\"><code>function_description</code></em> [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</span> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u7f16\u8f91\u6307\u5b9a\u51fd\u6570\u7684\u5b9a\u4e49\uff0c\u5f62\u5f0f\u4e3a<code class=\"command\">CREATE OR REPLACE FUNCTION</code>\u547d\u4ee4\u3002\u7f16\u8f91\u65b9\u5f0f\u4e0e<code class=\"literal\">\\edit</code>\u76f8\u540c\u3002\u7f16\u8f91\u5668\u9000\u51fa\u540e\uff0c\u66f4\u65b0\u540e\u7684\u547d\u4ee4\u4f1a\u5728\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u7b49\u5f85\uff1b\u952e\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u7528<code class=\"literal\">\\r</code>\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u76ee\u6807\u51fd\u6570\u53ef\u4ec5\u7528\u540d\u79f0\u6307\u5b9a\uff0c\u4e5f\u53ef\u7528\u540d\u79f0\u548c\u53c2\u6570\u6307\u5b9a\uff0c\u4f8b\u5982 foo(integer, text)\u3002\u82e5\u6709\u591a\u4e2a\u540c\u540d\u51fd\u6570\uff0c\u5219\u5fc5\u987b\u63d0\u4f9b\u53c2\u6570\u7c7b\u578b\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u51fd\u6570\uff0c\u5219\u4f1a\u5448\u73b0\u4e00\u4e2a\u7a7a\u7684<code class=\"command\">CREATE FUNCTION</code>\u6a21\u677f\u4f9b\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u4f1a\u5c06\u5149\u6807\u5b9a\u4f4d\u5230\u51fd\u6570\u4f53\u4e2d\u7684\u6307\u5b9a\u884c\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u51fd\u6570\u4f53\u901a\u5e38\u5e76\u4e0d\u4ece\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u5f00\u59cb\u3002\uff09</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\ef</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u6709\u5173\u5982\u4f55\u914d\u7f6e\u548c\u5b9a\u5236\u7f16\u8f91\u5668\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/10/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"\u73af\u5883\">\u73af\u5883</a>\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\encoding [ <em class=\"replaceable\"><code>encoding</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5ba2\u6237\u7aef\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u6ca1\u6709\u53c2\u6570\u65f6\uff0c\u6b64\u547d\u4ee4\u663e\u793a\u5f53\u524d\u7f16\u7801\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\errverbose</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ee5\u6700\u5927\u7684\u8be6\u7ec6\u7a0b\u5ea6\u91cd\u590d\u6700\u8fd1\u7684\u670d\u52a1\u5668\u9519\u8bef\u6d88\u606f\uff0c\u5c31\u597d\u50cf<code class=\"varname\">VERBOSITY</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">verbose</code>\uff0c<code class=\"varname\">SHOW_CONTEXT</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">always</code>\u4e00\u6837\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\ev [ <span class=\"optional\"><em class=\"replaceable\"><code>view_name</code></em> [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</span> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u7f16\u8f91\u6307\u5b9a\u89c6\u56fe\u7684\u5b9a\u4e49\uff0c\u5f62\u5f0f\u4e3a<code class=\"command\">CREATE OR REPLACE VIEW</code>\u547d\u4ee4\u3002\u7f16\u8f91\u65b9\u5f0f\u4e0e<code class=\"literal\">\\edit</code>\u76f8\u540c\u3002\u7f16\u8f91\u5668\u9000\u51fa\u540e\uff0c\u66f4\u65b0\u540e\u7684\u547d\u4ee4\u4f1a\u5728\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u7b49\u5f85\uff1b\u8f93\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u7528<code class=\"literal\">\\r</code>\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u89c6\u56fe\uff0c\u5219\u4f1a\u5448\u73b0\u4e00\u4e2a\u7a7a\u7684<code class=\"command\">CREATE VIEW</code>\u6a21\u677f\u4f9b\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u4f1a\u5c06\u5149\u6807\u5b9a\u4f4d\u5230\u89c6\u56fe\u5b9a\u4e49\u4e2d\u7684\u6307\u5b9a\u884c\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\ev</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\f [ <em class=\"replaceable\"><code>string</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u67e5\u8be2\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u9ed8\u8ba4\u503c\u662f\u7ad6\u7ebf\uff08<code class=\"literal\">|</code>\uff09\u3002\u5b83\u7b49\u540c\u4e8e<code class=\"command\">\\pset fieldsep</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\g [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\g [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u6267\u884c\u3002\u5982\u679c\u7ed9\u51fa\u53c2\u6570\uff0c\u67e5\u8be2\u8f93\u51fa\u4f1a\u5199\u5165\u6307\u5b9a\u6587\u4ef6\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u9012\u7ed9\u7ed9\u5b9a\u7684 shell \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u6309\u901a\u5e38\u65b9\u5f0f\u663e\u793a\u3002\u53ea\u6709\u67e5\u8be2\u6210\u529f\u8fd4\u56de\u96f6\u4e2a\u6216\u66f4\u591a\u5143\u7ec4\u65f6\uff0c\u624d\u4f1a\u5411\u6587\u4ef6\u6216\u547d\u4ee4\u5199\u5165\u5185\u5bb9\uff1b\u5982\u679c\u67e5\u8be2\u5931\u8d25\u6216 SQL \u547d\u4ee4\u4e0d\u8fd4\u56de\u6570\u636e\uff0c\u5219\u4e0d\u4f1a\u5199\u5165\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u5c06\u88ab\u91cd\u65b0\u6267\u884c\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u6ca1\u6709\u4efb\u4f55\u53c2\u6570\u7684<code class=\"literal\">\\g</code>\u57fa\u672c\u4e0a\u7b49\u540c\u4e8e\u4e00\u4e2a\u5206\u53f7\u3002\u5e26\u6709\u53c2\u6570\u7684<code class=\"literal\">\\g</code>\u63d0\u4f9b\u4e86\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u4e00\u6b21\u6027</span>\u201d</span>\u66ff\u4ee3<code class=\"command\">\\o</code>\u547d\u4ee4\u7684\u9009\u62e9\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\uff0c\u5219\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u7684\u5185\u5bb9\u53ea\u4f1a\u539f\u6837\u4f20\u9012\u7ed9 shell\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\gexec</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u7136\u540e\u628a\u67e5\u8be2\u8f93\u51fa\uff08\u5982\u679c\u6709\uff09\u7684\u6bcf\u4e00\u884c\u7684\u6bcf\u4e00\u5217\u89c6\u4e3a\u8981\u6267\u884c\u7684 SQL \u8bed\u53e5\u3002\u4f8b\u5982\uff0c\u4e0b\u9762\u4e3a\u6bcf\u4e00\u5217\u521b\u5efa\u4e00\u4e2a\u7d22\u5f15\uff0c\u76ee\u6807\u8868\u662f <code class=\"structname\">my_table</code>\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT format('create index on my_table(%I)', attname)</code></strong>\n-&gt; <strong class=\"userinput\"><code>FROM pg_attribute</code></strong>\n-&gt; <strong class=\"userinput\"><code>WHERE attrelid = 'my_table'::regclass AND attnum &gt; 0</code></strong>\n-&gt; <strong class=\"userinput\"><code>ORDER BY attnum</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gexec</code></strong>\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\n</pre>\n<p lang=\"zh\">\u751f\u6210\u7684\u67e5\u8be2\u6309\u8fd4\u56de\u884c\u7684\u987a\u5e8f\u6267\u884c\uff1b\u540c\u4e00\u884c\u6709\u591a\u5217\u65f6\u4ece\u5de6\u5230\u53f3\u6267\u884c\uff0c\u5ffd\u7565 NULL \u5b57\u6bb5\u3002\u67e5\u8be2\u539f\u6837\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u56e0\u6b64\u4e0d\u80fd\u662f psql \u5143\u547d\u4ee4\uff0c\u4e5f\u4e0d\u80fd\u5305\u542b psql \u53d8\u91cf\u5f15\u7528\u3002\u9664\u975e\u8bbe\u7f6e ON_ERROR_STOP\uff0c\u67d0\u6761\u67e5\u8be2\u5931\u8d25\u540e\u4ecd\u7ee7\u7eed\u6267\u884c\u5176\u4f59\u67e5\u8be2\u3002\u6bcf\u6761\u67e5\u8be2\u5747\u9075\u5faa ECHO \u8bbe\u7f6e\uff08\u4f7f\u7528 \\gexec \u65f6\uff0c\u901a\u5e38\u5efa\u8bae\u5c06 ECHO \u8bbe\u4e3a all \u6216 queries\uff09\uff0c\u67e5\u8be2\u65e5\u5fd7\u3001\u5355\u6b65\u6a21\u5f0f\u3001\u8ba1\u65f6\u7b49\u6267\u884c\u529f\u80fd\u4e5f\u5206\u522b\u5e94\u7528\u4e8e\u6bcf\u6761\u751f\u6210\u7684\u67e5\u8be2\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\gset [ <em class=\"replaceable\"><code>prefix</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u5e76\u5c06\u67e5\u8be2\u8f93\u51fa\u5b58\u5165 <span class=\"application\">psql</span> \u53d8\u91cf\uff08\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/10/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\uff09\u3002\u8981\u6267\u884c\u7684\u67e5\u8be2\u5fc5\u987b\u6070\u597d\u8fd4\u56de\u4e00\u884c\u3002\u8be5\u884c\u7684\u6bcf\u4e00\u5217\u5206\u522b\u5b58\u5165\u4e00\u4e2a\u53d8\u91cf\uff0c\u53d8\u91cf\u540d\u4e0e\u5217\u540d\u76f8\u540c\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT 'hello' AS var1, 10 AS var2</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gset</code></strong>\n=&gt; <strong class=\"userinput\"><code>\\echo :var1 :var2</code></strong>\nhello 10\n</pre>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>prefix</code></em>\uff0c\u5219\u4f1a\u5c06\u8be5\u5b57\u7b26\u4e32\u52a0\u5230\u67e5\u8be2\u7684\u5217\u540d\u524d\u9762\uff0c\u4ee5\u6784\u6210\u8981\u4f7f\u7528\u7684\u53d8\u91cf\u540d\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT 'hello' AS var1, 10 AS var2</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gset result_</code></strong>\n=&gt; <strong class=\"userinput\"><code>\\echo :result_var1 :result_var2</code></strong>\nhello 10\n</pre>\n<p lang=\"zh\">\u5982\u679c\u67d0\u4e00\u5217\u7684\u7ed3\u679c\u4e3a NULL\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u5bf9\u5e94\u7684\u53d8\u91cf\uff0c\u800c\u4e0d\u662f\u8bbe\u7f6e\u5b83\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u67e5\u8be2\u5931\u8d25\u6216\u6ca1\u6709\u6070\u597d\u8fd4\u56de\u4e00\u884c\uff0c\u5219\u4e0d\u4f1a\u66f4\u6539\u4efb\u4f55\u53d8\u91cf\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\gx [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\gx [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"literal\">\\gx</code>\u7b49\u4ef7\u4e8e<code class=\"literal\">\\g</code>\uff0c\u4f46\u4f1a\u5bf9\u5f53\u524d\u67e5\u8be2\u5f3a\u5236\u4f7f\u7528\u6269\u5c55\u8f93\u51fa\u6a21\u5f0f\u3002\u53c2\u89c1<code class=\"literal\">\\x</code>\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\h</code> \u6216 <code class=\"literal\">\\help</code> <code class=\"literal\">[ <em class=\"replaceable\"><code>command</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u7ed9\u51fa\u6307\u5b9a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u7684\u8bed\u6cd5\u5e2e\u52a9\u3002\u5982\u679c\u672a\u6307\u5b9a<em class=\"replaceable\"><code>command</code></em>\uff0c\u5219<span class=\"application\">psql</span>\u5c06\u5217\u51fa\u6240\u6709\u53ef\u7528\u8bed\u6cd5\u5e2e\u52a9\u7684\u547d\u4ee4\u3002\u5982\u679c<em class=\"replaceable\"><code>command</code></em>\u662f\u661f\u53f7\uff08<code class=\"literal\">*</code>\uff09\uff0c\u5219\u663e\u793a\u6240\u6709<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u7684\u8bed\u6cd5\u5e2e\u52a9\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\help</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u4e3a\u4e86\u7b80\u5316\u8f93\u5165\uff0c\u7531\u591a\u4e2a\u5355\u8bcd\u7ec4\u6210\u7684\u547d\u4ee4\u4e0d\u9700\u8981\u52a0\u5f15\u53f7\u3002\u56e0\u6b64\uff0c\u53ef\u4ee5\u76f4\u63a5\u8f93\u5165<strong class=\"userinput\"><code>\\help alter table</code></strong>\u3002</p>\n</div>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\H</code> \u6216 <code class=\"literal\">\\html</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5f00<acronym class=\"acronym\">HTML</acronym>\u67e5\u8be2\u8f93\u51fa\u683c\u5f0f\u3002\u5982\u679c<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u5df2\u7ecf\u6253\u5f00\uff0c\u5219\u5207\u6362\u56de\u9ed8\u8ba4\u7684\u5bf9\u9f50\u6587\u672c\u683c\u5f0f\u3002\u6b64\u547d\u4ee4\u662f\u4e3a\u517c\u5bb9\u6027\u548c\u4fbf\u5229\u6027\u800c\u4fdd\u7559\u7684\uff1b\u8bbe\u7f6e\u5176\u4ed6\u8f93\u51fa\u9009\u9879\u7684\u65b9\u6cd5\u89c1<code class=\"command\">\\pset</code>\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\i</code> \u6216 <code class=\"literal\">\\include</code> <em class=\"replaceable\"><code>filename</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u8bfb\u53d6\u8f93\u5165\uff0c\u5e76\u50cf\u5728\u952e\u76d8\u4e0a\u8f93\u5165\u4e00\u6837\u6267\u884c\u5b83\u3002</p>\n<p lang=\"zh\">\u5982\u679c<em class=\"replaceable\"><code>filename</code></em>\u662f<code class=\"literal\">-</code>\uff08\u8fde\u5b57\u7b26\uff09\uff0c\u5219\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\uff0c\u76f4\u5230\u9047\u5230 EOF \u6307\u793a\u6216<code class=\"command\">\\q</code>\u5143\u547d\u4ee4\u3002\u8fd9\u53ef\u7528\u4e8e\u5c06\u4ea4\u4e92\u5f0f\u8f93\u5165\u4e0e\u6587\u4ef6\u8f93\u5165\u4ea4\u9519\u4f7f\u7528\u3002\u8bf7\u6ce8\u610f\uff0c\u53ea\u6709\u5728\u6700\u5916\u5c42\u542f\u7528\u4e86 Readline\uff0c\u6b64\u5904\u624d\u4f1a\u4f7f\u7528 Readline \u529f\u80fd\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5982\u679c\u60f3\u5728\u5c4f\u5e55\u4e0a\u770b\u5230\u88ab\u8bfb\u5165\u7684\u5404\u884c\uff0c\u8bf7\u5c06\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">all</code>\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\elif</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\else</code><br/></span><span class=\"term\"><code class=\"literal\">\\endif</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u7ec4\u547d\u4ee4\u5b9e\u73b0\u4e86\u53ef\u5d4c\u5957\u7684\u6761\u4ef6\u5757\u3002\u6761\u4ef6\u5757\u5fc5\u987b\u4ee5<code class=\"command\">\\if</code>\u5f00\u59cb\uff0c\u4ee5<code class=\"command\">\\endif</code>\u7ed3\u675f\u3002\u4e2d\u95f4\u53ef\u4ee5\u5305\u542b\u4efb\u610f\u6570\u91cf\u7684<code class=\"command\">\\elif</code>\u5b50\u53e5\uff0c\u540e\u9762\u8fd8\u53ef\u4ee5\u9009\u62e9\u8ddf\u968f\u4e00\u4e2a<code class=\"command\">\\else</code>\u5b50\u53e5\u3002\u666e\u901a\u67e5\u8be2\u548c\u5176\u4ed6\u7c7b\u578b\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u53ef\u4ee5\uff08\u901a\u5e38\u4e5f\u4f1a\uff09\u51fa\u73b0\u5728\u6784\u6210\u6761\u4ef6\u5757\u7684\u547d\u4ee4\u4e4b\u95f4\u3002</p>\n<p lang=\"zh\">\\if \u548c \\elif \u8bfb\u53d6\u53c2\u6570\u5e76\u5c06\u5176\u4f5c\u4e3a\u5e03\u5c14\u8868\u8fbe\u5f0f\u6c42\u503c\u3002\u7ed3\u679c\u4e3a\u771f\u65f6\u7ee7\u7eed\u6b63\u5e38\u5904\u7406\uff0c\u5426\u5219\u8df3\u8fc7\u540e\u7eed\u884c\uff0c\u76f4\u5230\u9047\u5230\u5339\u914d\u7684 \\elif\u3001\\else \u6216 \\endif\u3002\u67d0\u4e2a \\if \u6216 \\elif \u6761\u4ef6\u6210\u7acb\u540e\uff0c\u540c\u4e00\u5757\u4e2d\u540e\u7eed \\elif \u7684\u53c2\u6570\u4e0d\u518d\u6c42\u503c\uff0c\u76f4\u63a5\u89c6\u4e3a\u5047\u3002\u53ea\u6709\u4e4b\u524d\u5339\u914d\u7684 \\if \u548c \\elif \u5747\u672a\u6210\u7acb\uff0c\u624d\u5904\u7406 \\else \u540e\u7684\u884c\u3002</p>\n<p lang=\"zh\">\u4e0e\u5176\u4ed6\u53cd\u659c\u6760\u547d\u4ee4\u53c2\u6570\u4e00\u6837\uff0c\\if \u6216 \\elif \u7684\u8868\u8fbe\u5f0f\u53c2\u6570\u5148\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u548c\u53cd\u5f15\u53f7\u5c55\u5f00\uff0c\u7136\u540e\u50cf\u5f00\u5173\u9009\u9879\u53d8\u91cf\u4e00\u6837\u6c42\u503c\u3002\u6709\u6548\u503c\u4e3a true\u3001false\u30011\u30010\u3001on\u3001off\u3001yes\u3001no \u7684\u4efb\u610f\u65e0\u6b67\u4e49\u3001\u4e0d\u533a\u5206\u5927\u5c0f\u5199\u7684\u5339\u914d\u3002\u4f8b\u5982 t\u3001T \u548c tR \u90fd\u4f1a\u89c6\u4e3a\u771f\u3002</p>\n<p lang=\"zh\">\u4e0d\u80fd\u6b63\u786e\u6c42\u503c\u4e3a\u771f\u6216\u5047\u7684\u8868\u8fbe\u5f0f\u4f1a\u4ea7\u751f\u8b66\u544a\uff0c\u5e76\u88ab\u89c6\u4e3a\u5047\u3002</p>\n<p lang=\"zh\">\u88ab\u8df3\u8fc7\u7684\u884c\u4ecd\u4f1a\u6b63\u5e38\u89e3\u6790\uff0c\u4ee5\u8bc6\u522b\u67e5\u8be2\u548c\u53cd\u659c\u7ebf\u547d\u4ee4\uff0c\u4f46\u67e5\u8be2\u4e0d\u4f1a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u6761\u4ef6\u547d\u4ee4\uff08<code class=\"command\">\\if</code>\u3001<code class=\"command\">\\elif</code>\u3001<code class=\"command\">\\else</code>\u3001<code class=\"command\">\\endif</code>\uff09\u4ee5\u5916\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u4f1a\u88ab\u5ffd\u7565\u3002\u5bf9\u4e8e\u6761\u4ef6\u547d\u4ee4\uff0c\u53ea\u68c0\u67e5\u5d4c\u5957\u662f\u5426\u5408\u6cd5\u3002\u88ab\u8df3\u8fc7\u7684\u884c\u4e2d\u7684\u53d8\u91cf\u5f15\u7528\u4e0d\u4f1a\u5c55\u5f00\uff0c\u4e5f\u4e0d\u4f1a\u6267\u884c\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<p lang=\"zh\">\u540c\u4e00\u4e2a\u6761\u4ef6\u5757\u7684\u6240\u6709\u53cd\u659c\u7ebf\u547d\u4ee4\u5fc5\u987b\u51fa\u73b0\u5728\u540c\u4e00\u4e2a\u6e90\u6587\u4ef6\u4e2d\u3002\u5982\u679c\u4e3b\u8f93\u5165\u6587\u4ef6\u6216\u901a\u8fc7<code class=\"command\">\\include</code>\u5f15\u5165\u7684\u6587\u4ef6\u5230\u8fbe EOF \u65f6\uff0c\u4ecd\u6709\u672c\u5730<code class=\"command\">\\if</code>\u5757\u672a\u5173\u95ed\uff0c<span class=\"application\">psql</span>\u5c31\u4f1a\u62a5\u9519\u3002</p>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4e00\u4e2a\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">-- check for the existence of two separate records in the database and store\n-- the results in separate psql variables\nSELECT\n    EXISTS(SELECT 1 FROM customer WHERE customer_id = 123) as is_customer,\n    EXISTS(SELECT 1 FROM employee WHERE employee_id = 456) as is_employee\n\\gset\n\\if :is_customer\n    SELECT * FROM customer WHERE customer_id = 123;\n\\elif :is_employee\n    \\echo 'is not a customer but is an employee'\n    SELECT * FROM employee WHERE employee_id = 456;\n\\else\n    \\if yes\n        \\echo 'not a customer or employee'\n    \\else\n        \\echo 'this will never print'\n    \\endif\n\\endif\n</pre></dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\ir</code> \u6216 <code class=\"literal\">\\include_relative</code> <em class=\"replaceable\"><code>filename</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"literal\">\\ir</code>\u547d\u4ee4\u4e0e<code class=\"literal\">\\i</code>\u76f8\u4f3c\uff0c\u4f46\u89e3\u6790\u76f8\u5bf9\u6587\u4ef6\u540d\u7684\u65b9\u5f0f\u4e0d\u540c\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\u6267\u884c\u65f6\uff0c\u8fd9\u4e24\u4e2a\u547d\u4ee4\u7684\u884c\u4e3a\u76f8\u540c\u3002\u4e0d\u8fc7\uff0c\u5728\u811a\u672c\u4e2d\u8c03\u7528\u65f6\uff0c<code class=\"literal\">\\ir</code>\u4f1a\u76f8\u5bf9\u4e8e\u811a\u672c\u6240\u5728\u7684\u76ee\u5f55\u6765\u89e3\u91ca\u6587\u4ef6\u540d\uff0c\u800c\u4e0d\u662f\u76f8\u5bf9\u4e8e\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\l[+]</code> \u6216 <code class=\"literal\">\\list[+] [ <a class=\"link\" href=\"/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"\u6a21\u5f0f\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u670d\u52a1\u5668\u4e2d\u7684\u6570\u636e\u5e93\uff0c\u5e76\u663e\u793a\u5176\u540d\u79f0\u3001\u62e5\u6709\u8005\u3001\u5b57\u7b26\u96c6\u7f16\u7801\u548c\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6570\u636e\u5e93\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u663e\u793a\u6570\u636e\u5e93\u5927\u5c0f\u3001\u9ed8\u8ba4\u8868\u7a7a\u95f4\u548c\u63cf\u8ff0\u3002\uff08\u5927\u5c0f\u4fe1\u606f\u53ea\u5bf9\u5f53\u524d\u7528\u6237\u80fd\u591f\u8fde\u63a5\u7684\u6570\u636e\u5e93\u53ef\u7528\u3002\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\lo_export <em class=\"replaceable\"><code>loid</code></em> <em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6570\u636e\u5e93\u4e2d\u8bfb\u53d6\u5177\u6709<acronym class=\"acronym\">OID</acronym><em class=\"replaceable\"><code>loid</code></em>\u7684\u5927\u5bf9\u8c61\uff0c\u5e76\u5c06\u5176\u5199\u5165<em class=\"replaceable\"><code>filename</code></em>\u3002\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e0e\u670d\u52a1\u5668\u51fd\u6570 <code class=\"function\">lo_export</code>\u7565\u6709\u4e0d\u540c\uff0c\u540e\u8005\u4f7f\u7528\u8fd0\u884c\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7528\u6237\u7684\u6743\u9650\uff0c\u5e76\u5728\u670d\u52a1\u5668\u7684\u6587\u4ef6\u7cfb\u7edf\u4e0a\u64cd\u4f5c\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u4f7f\u7528 \\lo_list \u67e5\u627e\u5927\u5bf9\u8c61\u7684 OID\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\lo_import <em class=\"replaceable\"><code>filename</code></em> [ <em class=\"replaceable\"><code>comment</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6587\u4ef6\u5b58\u50a8\u5230\u4e00\u4e2a<span class=\"productname\">PostgreSQL</span>\u5927\u5bf9\u8c61\u4e2d\u3002\u53ef\u9009\u5730\uff0c\u5b83\u5c06\u7ed9\u5b9a\u7684\u6ce8\u91ca\u4e0e\u5bf9\u8c61\u5173\u8054\u8d77\u6765\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">foo=&gt; <strong class=\"userinput\"><code>\\lo_import '/home/peter/pictures/photo.xcf' 'a picture of me'</code></strong>\nlo_import 152801\n</pre>\n<p lang=\"zh\">\u54cd\u5e94\u8868\u660e\u5927\u5bf9\u8c61\u83b7\u5f97\u4e86\u5bf9\u8c61 ID 152801\uff0c\u8fd9\u4e2a ID \u53ef\u4ee5\u7528\u6765\u5728\u5c06\u6765\u8bbf\u95ee\u65b0\u521b\u5efa\u7684\u5927\u5bf9\u8c61\u3002\u4e3a\u4fbf\u4e8e\u9605\u8bfb\uff0c\u5efa\u8bae\u59cb\u7ec8\u4e3a\u6bcf\u4e2a\u5bf9\u8c61\u5173\u8054\u4e00\u6761\u4fbf\u4e8e\u4eba\u9605\u8bfb\u7684\u6ce8\u91ca\u3002\u67e5\u770b OID \u548c\u6ce8\u91ca\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528<code class=\"command\">\\lo_list</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u6b64\u547d\u4ee4\u4e0e\u670d\u52a1\u5668\u7aef\u7684<code class=\"function\">lo_import</code>\u7565\u6709\u4e0d\u540c\uff0c\u56e0\u4e3a\u5b83\u4f5c\u4e3a\u672c\u5730\u7528\u6237\u5728\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e0a\u64cd\u4f5c\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\u7684\u7528\u6237\u548c\u6587\u4ef6\u7cfb\u7edf\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\lo_list</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5f53\u524d\u5b58\u50a8\u5728\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709<span class=\"productname\">PostgreSQL</span>\u5927\u5bf9\u8c61\uff0c\u4ee5\u53ca\u4e3a\u5b83\u4eec\u63d0\u4f9b\u7684\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\lo_unlink <em class=\"replaceable\"><code>loid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6570\u636e\u5e93\u4e2d\u5220\u9664<acronym class=\"acronym\">OID</acronym> \u4e3a <em class=\"replaceable\"><code>loid</code></em>\u7684\u5927\u5bf9\u8c61\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u4f7f\u7528 \\lo_list \u67e5\u627e\u5927\u5bf9\u8c61\u7684 OID\u3002</p>\n</div>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\o</code> \u6216 <code class=\"literal\">\\out [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\o</code> \u6216 <code class=\"literal\">\\out [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u540e\u7eed\u67e5\u8be2\u7ed3\u679c\u4fdd\u5b58\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9 shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002\u5982\u679c\u6ca1\u6709\u6307\u5b9a\u53c2\u6570\uff0c\u67e5\u8be2\u8f93\u51fa\u5c06\u6062\u590d\u4e3a\u6807\u51c6\u8f93\u51fa\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\uff0c\u5219\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u7684\u5185\u5bb9\u53ea\u4f1a\u539f\u6837\u4f20\u9012\u7ed9 shell\u3002</p>\n<p lang=\"zh\"><span class=\"quote\">\u201c<span class=\"quote\">\u67e5\u8be2\u7ed3\u679c</span>\u201d</span>\u5305\u62ec\u4ece\u6570\u636e\u5e93\u670d\u52a1\u5668\u83b7\u53d6\u7684\u6240\u6709\u8868\u683c\u3001\u547d\u4ee4\u54cd\u5e94\u548c\u901a\u77e5\uff0c\u4ee5\u53ca\u67e5\u8be2\u6570\u636e\u5e93\u7684\u5404\u79cd\u53cd\u659c\u6760\u547d\u4ee4\u7684\u8f93\u51fa\uff08\u4f8b\u5982<code class=\"command\">\\d</code>\uff09\uff1b\u4f46\u4e0d\u5305\u62ec\u9519\u8bef\u6d88\u606f\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8981\u5728\u67e5\u8be2\u7ed3\u679c\u4e4b\u95f4\u63d2\u5165\u6587\u672c\u8f93\u51fa\uff0c\u4f7f\u7528<code class=\"command\">\\qecho</code>\u3002</p>\n</div>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\p</code> \u6216 <code class=\"literal\">\\print</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\u3002\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6253\u5370\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\password [ <em class=\"replaceable\"><code>username</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u66f4\u6539\u6307\u5b9a\u7528\u6237\uff08\u9ed8\u8ba4\u4e3a\u5f53\u524d\u7528\u6237\uff09\u7684\u5bc6\u7801\u3002\u6b64\u547d\u4ee4\u63d0\u793a\u8f93\u5165\u65b0\u5bc6\u7801\uff0c\u5bf9\u5176\u8fdb\u884c\u52a0\u5bc6\uff0c\u5e76\u5c06\u5176\u4f5c\u4e3a<code class=\"command\">ALTER ROLE</code>\u547d\u4ee4\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u65b0\u5bc6\u7801\u4e0d\u4f1a\u4ee5\u660e\u6587\u5f62\u5f0f\u51fa\u73b0\u5728\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\u3001\u670d\u52a1\u5668\u65e5\u5fd7\u6216\u5176\u4ed6\u5730\u65b9\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\prompt [ <em class=\"replaceable\"><code>text</code></em> ] <em class=\"replaceable\"><code>name</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u63d0\u793a\u7528\u6237\u63d0\u4f9b\u6587\u672c\uff0c\u5c06\u5176\u8d4b\u503c\u7ed9\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u3002\u53ef\u4ee5\u6307\u5b9a\u4e00\u4e2a\u53ef\u9009\u7684\u63d0\u793a\u5b57\u7b26\u4e32<em class=\"replaceable\"><code>text</code></em>\u3002\uff08\u5bf9\u4e8e\u591a\u4e2a\u5355\u8bcd\u7684\u63d0\u793a\uff0c\u7528\u5355\u5f15\u53f7\u62ec\u8d77\u6587\u672c\u3002\uff09</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"literal\">\\prompt</code> \u4f7f\u7528\u7ec8\u7aef\u8fdb\u884c\u8f93\u5165\u548c\u8f93\u51fa\u3002\u7136\u800c\uff0c\u5982\u679c\u4f7f\u7528\u4e86 <code class=\"option\">-f</code> \u547d\u4ee4\u884c\u5f00\u5173\uff0c<code class=\"literal\">\\prompt</code> \u5c06\u4f7f\u7528\u6807\u51c6\u8f93\u5165\u548c\u6807\u51c6\u8f93\u51fa\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\pset [ <em class=\"replaceable\"><code>option</code></em> [ <em class=\"replaceable\"><code>value</code></em> ] ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u8bbe\u7f6e\u5f71\u54cd\u67e5\u8be2\u7ed3\u679c\u8868\u8f93\u51fa\u7684\u9009\u9879\u3002<em class=\"replaceable\"><code>option</code></em>\u6307\u5b9a\u8981\u8bbe\u7f6e\u54ea\u4e2a\u9009\u9879\u3002<em class=\"replaceable\"><code>value</code></em>\u7684\u542b\u4e49\u53d6\u51b3\u4e8e\u6240\u9009\u7684\u9009\u9879\u3002\u5bf9\u4e8e\u67d0\u4e9b\u9009\u9879\uff0c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\u4f1a\u5207\u6362\u6216\u53d6\u6d88\u8bbe\u7f6e\u8be5\u9009\u9879\uff0c\u5177\u4f53\u89c1\u5404\u9009\u9879\u7684\u8bf4\u660e\u3002\u5982\u679c\u6ca1\u6709\u63d0\u53ca\u8fd9\u7c7b\u884c\u4e3a\uff0c\u90a3\u4e48\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\u53ea\u4f1a\u663e\u793a\u5f53\u524d\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\">\u4e0d\u5e26\u4efb\u4f55\u53c2\u6570\u7684<code class=\"command\">\\pset</code>\u4f1a\u663e\u793a\u6240\u6709\u6253\u5370\u9009\u9879\u7684\u5f53\u524d\u72b6\u6001\u3002</p>\n<p lang=\"zh\">\u53ef\u8c03\u6574\u7684\u6253\u5370\u9009\u9879\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">border</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><em class=\"replaceable\"><code>value</code></em>\u5fc5\u987b\u662f\u6570\u5b57\u3002\u4e00\u822c\u6765\u8bf4\uff0c\u6570\u5b57\u8d8a\u5927\uff0c\u8868\u683c\u7684\u8fb9\u6846\u548c\u5206\u9694\u7ebf\u5c31\u8d8a\u591a\uff0c\u4f46\u7ec6\u8282\u53d6\u51b3\u4e8e\u5177\u4f53\u683c\u5f0f\u3002\u5728<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u4e2d\uff0c\u5b83\u4f1a\u76f4\u63a5\u8f6c\u6362\u4e3a<code class=\"literal\">border=...</code>\u5c5e\u6027\u3002\u5728\u5927\u591a\u6570\u5176\u4ed6\u683c\u5f0f\u4e2d\uff0c\u53ea\u6709\u503c 0\uff08\u65e0\u8fb9\u6846\uff09\u30011\uff08\u5185\u90e8\u5206\u9694\u7ebf\uff09\u548c 2\uff08\u8868\u683c\u5916\u6846\uff09\u6709\u610f\u4e49\uff0c\u5927\u4e8e 2 \u7684\u503c\u4f1a\u4e0e<code class=\"literal\">border = 2</code>\u4f5c\u76f8\u540c\u5904\u7406\u3002<code class=\"literal\">latex</code>\u548c<code class=\"literal\">latex-longtable</code>\u683c\u5f0f\u8fd8\u5141\u8bb8\u4f7f\u7528\u503c 3\uff0c\u4ee5\u5728\u6570\u636e\u884c\u4e4b\u95f4\u6dfb\u52a0\u5206\u9694\u7ebf\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><em>\u5217</em></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u76ee\u6807\u5bbd\u5ea6\uff0c\u540c\u65f6\u4e5f\u662f\u786e\u5b9a\u8f93\u51fa\u662f\u5426\u8db3\u591f\u5bbd\u4ee5\u9700\u8981\u5206\u9875\u5668\u6216\u5728\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e0b\u5207\u6362\u5230\u5782\u76f4\u663e\u793a\u7684\u5bbd\u5ea6\u9650\u5236\u3002\u96f6\uff08\u9ed8\u8ba4\u503c\uff09\u4f1a\u5bfc\u81f4\u76ee\u6807\u5bbd\u5ea6\u7531\u73af\u5883\u53d8\u91cf<code class=\"envar\">COLUMNS</code>\u63a7\u5236\uff0c\u6216\u8005\u5982\u679c\u672a\u8bbe\u7f6e <code class=\"envar\">COLUMNS</code>\u5219\u7531\u68c0\u6d4b\u5230\u7684\u5c4f\u5e55\u5bbd\u5ea6\u63a7\u5236\u3002\u53e6\u5916\uff0c\u5982\u679c<code class=\"literal\">columns</code>\u4e3a\u96f6\uff0c\u5219<code class=\"literal\">wrapped</code>\u683c\u5f0f\u4ec5\u5f71\u54cd\u5c4f\u5e55\u8f93\u51fa\u3002\u5982\u679c<code class=\"literal\">columns</code>\u4e3a\u975e\u96f6\uff0c\u5219\u6587\u4ef6\u548c\u7ba1\u9053\u8f93\u51fa\u4e5f\u4f1a\u6309\u8be5\u5bbd\u5ea6\u6298\u884c\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">expanded</code>\uff08\u6216 <code class=\"literal\">x</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff08\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u6269\u5c55\u6a21\u5f0f\uff09\uff0c\u6216\u8005\u662f<code class=\"literal\">auto</code>\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5f00\u542f\u548c\u5173\u95ed\u8bbe\u7f6e\u4e4b\u95f4\u5207\u6362\u3002\u542f\u7528\u6269\u5c55\u6a21\u5f0f\u65f6\uff0c\u67e5\u8be2\u7ed3\u679c\u4ee5\u4e24\u5217\u663e\u793a\uff0c\u5de6\u4fa7\u4e3a\u5217\u540d\uff0c\u53f3\u4fa7\u4e3a\u6570\u636e\u3002\u5982\u679c\u6570\u636e\u5728\u901a\u5e38\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u6a2a\u5411</span>\u201d</span>\u6a21\u5f0f\u4e0b\u65e0\u6cd5\u9002\u5e94\u5c4f\u5e55\uff0c\u8fd9\u79cd\u6a21\u5f0f\u5c31\u5f88\u6709\u7528\u3002\u5728\u81ea\u52a8\u8bbe\u7f6e\u4e0b\uff0c\u5f53\u67e5\u8be2\u8f93\u51fa\u5305\u542b\u591a\u5217\u4e14\u5bbd\u5ea6\u8d85\u8fc7\u5c4f\u5e55\u65f6\uff0c\u4f1a\u4f7f\u7528\u6269\u5c55\u6a21\u5f0f\uff1b\u5426\u5219\u4f7f\u7528\u5e38\u89c4\u6a21\u5f0f\u3002\u81ea\u52a8\u8bbe\u7f6e\u53ea\u5728\u5bf9\u9f50\u548c\u6298\u884c\u683c\u5f0f\u4e2d\u6709\u6548\u3002\u5728\u5176\u4ed6\u683c\u5f0f\u4e2d\uff0c\u5b83\u7684\u884c\u4e3a\u59cb\u7ec8\u4e0e\u5173\u95ed\u6269\u5c55\u6a21\u5f0f\u76f8\u540c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">fieldsep</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u6837\u53ef\u4ee5\u521b\u5efa\u4f8b\u5982\u5236\u8868\u7b26\u6216\u9017\u53f7\u5206\u9694\u7684\u8f93\u51fa\uff0c\u8fd9\u53ef\u80fd\u66f4\u7b26\u5408\u5176\u4ed6\u7a0b\u5e8f\u7684\u9700\u8981\u3002\u8981\u5c06\u5236\u8868\u7b26\u8bbe\u7f6e\u4e3a\u5b57\u6bb5\u5206\u9694\u7b26\uff0c\u8bf7\u8f93\u5165<code class=\"literal\">\\pset fieldsep '\\t'</code>\u3002\u9ed8\u8ba4\u5b57\u6bb5\u5206\u9694\u7b26\u662f<code class=\"literal\">'|'</code>\uff08\u7ad6\u7ebf\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">fieldsep_zero</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u8bbe\u7f6e\u4e3a\u96f6\u5b57\u8282\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">footer</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u8868\u683c\u9875\u811a\uff08<code class=\"literal\">(<em class=\"replaceable\"><code>n</code></em> rows)</code>\u8ba1\u6570\uff09\u7684\u663e\u793a\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5207\u6362\u9875\u811a\u663e\u793a\u7684\u5f00\u5173\u72b6\u6001\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">format</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u8f93\u51fa\u683c\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">unaligned</code>\u3001<code class=\"literal\">aligned</code>\u3001<code class=\"literal\">wrapped</code>\u3001<code class=\"literal\">html</code>\u3001<code class=\"literal\">asciidoc</code>\u3001<code class=\"literal\">latex</code>\uff08\u4f7f\u7528<code class=\"literal\">tabular</code>\uff09\u3001<code class=\"literal\">latex-longtable</code>\u6216<code class=\"literal\">troff-ms</code>\u4e4b\u4e00\u3002\u5141\u8bb8\u4f7f\u7528\u4e0d\u4ea7\u751f\u6b67\u4e49\u7684\u7f29\u5199\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">unaligned</code>\u683c\u5f0f\u5c06\u4e00\u884c\u7684\u6240\u6709\u5217\u5199\u5728\u540c\u4e00\u884c\u4e0a\uff0c\u4ee5\u5f53\u524d\u751f\u6548\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u5206\u9694\u3002\u8fd9\u9002\u5408\u521b\u5efa\u4f9b\u5176\u4ed6\u7a0b\u5e8f\u8bfb\u53d6\u7684\u8f93\u51fa\uff08\u4f8b\u5982\u5236\u8868\u7b26\u5206\u9694\u6216\u9017\u53f7\u5206\u9694\u683c\u5f0f\uff09\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">aligned</code>\u683c\u5f0f\u662f\u6807\u51c6\u7684\u3001\u9002\u5408\u4eba\u9605\u8bfb\u4e14\u6392\u7248\u6574\u9f50\u7684\u6587\u672c\u8f93\u51fa\uff1b\u8fd9\u662f\u9ed8\u8ba4\u683c\u5f0f\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">wrapped</code>\u683c\u5f0f\u4e0e<code class=\"literal\">aligned</code>\u76f8\u4f3c\uff0c\u4f46\u4f1a\u5c06\u8f83\u5bbd\u7684\u6570\u636e\u503c\u6298\u6210\u591a\u884c\uff0c\u4f7f\u8f93\u51fa\u9002\u5e94\u76ee\u6807\u5217\u5bbd\u3002\u76ee\u6807\u5bbd\u5ea6\u7684\u786e\u5b9a\u65b9\u5f0f\u89c1<code class=\"literal\">columns</code>\u9009\u9879\u7684\u8bf4\u660e\u3002\u8bf7\u6ce8\u610f\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u5c1d\u8bd5\u5bf9\u5217\u6807\u9898\u6298\u884c\uff1b\u56e0\u6b64\uff0c\u5982\u679c\u5217\u6807\u9898\u6240\u9700\u7684\u603b\u5bbd\u5ea6\u8d85\u8fc7\u76ee\u6807\u5bbd\u5ea6\uff0c<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u884c\u4e3a\u5c31\u4e0e<code class=\"literal\">aligned</code>\u76f8\u540c\u3002</p>\n<p lang=\"zh\">html\u3001asciidoc\u3001latex\u3001latex-longtable \u548c troff-ms \u683c\u5f0f\u8f93\u51fa\u7684\u662f\u53ef\u5d4c\u5165\u76f8\u5e94\u6807\u8bb0\u8bed\u8a00\u6587\u6863\u7684\u8868\u683c\uff0c\u5e76\u975e\u5b8c\u6574\u6587\u6863\u3002HTML \u53ef\u80fd\u4e0d\u8981\u6c42\u5b8c\u6574\u5c01\u88c5\uff0c\u4f46 LaTeX \u5fc5\u987b\u6709\u5b8c\u6574\u6587\u6863\u7ed3\u6784\u3002latex-longtable \u8fd8\u9700\u8981 LaTeX \u7684 longtable \u548c booktabs \u5b8f\u5305\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">linestyle</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u8fb9\u6846\u7ebf\u7ed8\u5236\u6837\u5f0f\u4e3a<code class=\"literal\">ascii</code>\u3001<code class=\"literal\">old-ascii</code>\u6216<code class=\"literal\">unicode</code>\u4e4b\u4e00\u3002\u5141\u8bb8\u4f7f\u7528\u552f\u4e00\u7f29\u5199\u3002\uff08\u8fd9\u610f\u5473\u7740\u4e00\u4e2a\u5b57\u6bcd\u5c31\u8db3\u591f\u4e86\u3002\uff09\u9ed8\u8ba4\u8bbe\u7f6e\u4e3a<code class=\"literal\">ascii</code>\u3002\u6b64\u9009\u9879\u4ec5\u5f71\u54cd<code class=\"literal\">aligned</code>\u548c<code class=\"literal\">wrapped</code>\u8f93\u51fa\u683c\u5f0f\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">ascii</code>\u6837\u5f0f\u4f7f\u7528\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u53f3\u8fb9\u7f18\u7684<code class=\"literal\">+</code>\u7b26\u53f7\u8868\u793a\u3002\u5f53<code class=\"literal\">wrapped</code>\u683c\u5f0f\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u628a\u6570\u636e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u4f1a\u5728\u7b2c\u4e00\u884c\u7684\u53f3\u8fb9\u7f18\u663e\u793a\u4e00\u4e2a\u70b9\uff08<code class=\"literal\">.</code>\uff09\uff0c\u5e76\u5728\u4e0b\u4e00\u884c\u7684\u5de6\u8fb9\u7f18\u518d\u6b21\u663e\u793a\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">old-ascii</code>\u6837\u5f0f\u4f7f\u7528\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\uff0c\u91c7\u7528<span class=\"productname\">PostgreSQL</span> 8.4 \u53ca\u66f4\u65e9\u7248\u672c\u7684\u683c\u5f0f\u6837\u5f0f\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u66ff\u4ee3\u5de6\u4fa7\u5217\u5206\u9694\u7b26\u7684<code class=\"literal\">:</code>\u7b26\u53f7\u8868\u793a\u3002\u5f53\u6570\u636e\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u5219\u7528<code class=\"literal\">;</code>\u7b26\u53f7\u66ff\u4ee3\u5de6\u4fa7\u5217\u5206\u9694\u7b26\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">unicode</code>\u6837\u5f0f\u4f7f\u7528 Unicode \u6846\u7ebf\u7ed8\u5236\u5b57\u7b26\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u53f3\u8fb9\u7f18\u7684\u56de\u8f66\u7b26\u53f7\u8868\u793a\u3002\u5f53\u6570\u636e\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u4f1a\u5728\u7b2c\u4e00\u884c\u7684\u53f3\u8fb9\u7f18\u663e\u793a\u7701\u7565\u53f7\u7b26\u53f7\uff0c\u5e76\u5728\u4e0b\u4e00\u884c\u7684\u5de6\u8fb9\u7f18\u518d\u6b21\u663e\u793a\u3002</p>\n<p lang=\"zh\">\u5f53<code class=\"literal\">border</code>\u8bbe\u7f6e\u5927\u4e8e\u96f6\u65f6\uff0c<code class=\"literal\">linestyle</code>\u9009\u9879\u8fd8\u51b3\u5b9a\u7528\u54ea\u4e9b\u5b57\u7b26\u7ed8\u5236\u8fb9\u6846\u7ebf\u3002\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\u5728\u4efb\u4f55\u73af\u5883\u4e2d\u90fd\u53ef\u7528\uff0c\u4f46\u5728\u652f\u6301 Unicode \u7684\u663e\u793a\u8bbe\u5907\u4e0a\uff0cUnicode \u5b57\u7b26\u66f4\u7f8e\u89c2\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">null</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u7528\u4e8e\u4ee3\u66ff\u7a7a\u503c\u6253\u5370\u7684\u5b57\u7b26\u4e32\u3002\u9ed8\u8ba4\u4e0d\u6253\u5370\u4efb\u4f55\u5185\u5bb9\uff0c\u8fd9\u5f88\u5bb9\u6613\u88ab\u8bef\u8ba4\u4e3a\u7a7a\u5b57\u7b26\u4e32\u3002\u4f8b\u5982\uff0c\u4f60\u53ef\u80fd\u66f4\u559c\u6b22\u4f7f\u7528<code class=\"literal\">\\pset null '(null)'</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">numericlocale</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u4f7f\u7528\u533a\u57df\u8bbe\u7f6e\u7279\u5b9a\u7684\u5b57\u7b26\u6765\u5206\u9694\u5c0f\u6570\u70b9\u5de6\u4fa7\u7684\u6570\u5b57\u7ec4\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5e38\u89c4\u6570\u5b57\u8f93\u51fa\u548c\u533a\u57df\u8bbe\u7f6e\u7279\u5b9a\u7684\u6570\u5b57\u8f93\u51fa\u4e4b\u95f4\u5207\u6362\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">pager</code></span></dt>\n<dd>\n<p lang=\"zh\">\u63a7\u5236\u67e5\u8be2\u548c<span class=\"application\">psql</span>\u5e2e\u52a9\u8f93\u51fa\u662f\u5426\u4f7f\u7528\u5206\u9875\u5668\u7a0b\u5e8f\u3002\u5982\u679c\u8bbe\u7f6e\u4e86\u73af\u5883\u53d8\u91cf<code class=\"envar\">PAGER</code>\uff0c\u8f93\u51fa\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u9012\u7ed9\u6307\u5b9a\u7684\u7a0b\u5e8f\u3002\u5426\u5219\uff0c\u4f7f\u7528\u4e0e\u5e73\u53f0\u6709\u5173\u7684\u9ed8\u8ba4\u7a0b\u5e8f\uff08\u5982<code class=\"filename\">more</code>\uff09\u3002</p>\n<p lang=\"zh\">\u5f53 pager \u4e3a off \u65f6\uff0c\u4e0d\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\uff1b\u4e3a on \u65f6\uff0c\u5728\u9002\u5f53\u60c5\u51b5\u4e0b\u4f7f\u7528\uff0c\u5373\u8f93\u51fa\u76ee\u6807\u662f\u7ec8\u7aef\u4e14\u5185\u5bb9\u65e0\u6cd5\u5728\u5c4f\u5e55\u5185\u663e\u793a\u5b8c\u3002\u8bbe\u4e3a always \u65f6\uff0c\u6240\u6709\u7ec8\u7aef\u8f93\u51fa\u5747\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\uff0c\u65e0\u8bba\u662f\u5426\u80fd\u5728\u5c4f\u5e55\u5185\u663e\u793a\u5b8c\u3002\u4e0d\u5e26\u503c\u7684 \\pset pager \u4f1a\u5207\u6362\u5206\u9875\u7684\u5f00\u5173\u72b6\u6001\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">pager_min_lines</code></span></dt>\n<dd>\n<p lang=\"zh\">\u82e5 pager_min_lines \u5927\u4e8e\u5c4f\u5e55\u9875\u9ad8\uff0c\u53ea\u6709\u8f93\u51fa\u884c\u6570\u8fbe\u5230\u8be5\u503c\u65f6\u624d\u8c03\u7528\u5206\u9875\u7a0b\u5e8f\u3002\u9ed8\u8ba4\u503c\u4e3a 0\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">recordsep</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u8bb0\u5f55\uff08\u884c\uff09\u5206\u9694\u7b26\u3002\u9ed8\u8ba4\u4e3a\u6362\u884c\u7b26\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">recordsep_zero</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u8bbe\u7f6e\u4e3a\u96f6\u5b57\u8282\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">tableattr</code>\uff08\u6216 <code class=\"literal\">T</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\u5728<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u4e2d\uff0c\u8fd9\u6307\u5b9a\u8981\u653e\u5728<code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u5c5e\u6027\uff0c\u4f8b\u5982<code class=\"literal\">cellpadding</code>\u6216<code class=\"literal\">bgcolor</code>\u3002\u8bf7\u6ce8\u610f\uff0c\u4f60\u53ef\u80fd\u4e0d\u9700\u8981\u5728\u8fd9\u91cc\u6307\u5b9a<code class=\"literal\">border</code>\uff0c\u56e0\u4e3a<code class=\"literal\">\\pset border</code>\u5df2\u7ecf\u8d1f\u8d23\u5904\u7406\u5b83\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u8868\u683c\u5c5e\u6027\u3002</p>\n<p lang=\"zh\">\u5728<code class=\"literal\">latex-longtable</code>\u683c\u5f0f\u4e2d\uff0c\u8fd9\u63a7\u5236\u6bcf\u4e2a\u5305\u542b\u5de6\u5bf9\u9f50\u6570\u636e\u7c7b\u578b\u7684\u5217\u7684\u5bbd\u5ea6\u6bd4\u4f8b\u3002\u5b83\u4ee5\u7a7a\u767d\u5206\u9694\u7684\u503c\u5217\u8868\u6307\u5b9a\uff0c\u4f8b\u5982<code class=\"literal\">'0.2 0.2 0.6'</code>\u3002\u672a\u6307\u5b9a\u7684\u8f93\u51fa\u5217\u4f7f\u7528\u6700\u540e\u6307\u5b9a\u7684\u503c\u3002</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">title</code>\uff08\u6216 <code class=\"literal\">C</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u968f\u540e\u6253\u5370\u7684\u6240\u6709\u8868\u683c\u7684\u6807\u9898\u3002\u8fd9\u53ef\u4ee5\u4e3a\u8f93\u51fa\u63d0\u4f9b\u63cf\u8ff0\u6027\u6807\u7b7e\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u6807\u9898\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">tuples_only</code>\uff08\u6216 <code class=\"literal\">t</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u4ec5\u5143\u7ec4\u6a21\u5f0f\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5e38\u89c4\u8f93\u51fa\u548c\u4ec5\u5143\u7ec4\u8f93\u51fa\u4e4b\u95f4\u5207\u6362\u3002\u5e38\u89c4\u8f93\u51fa\u5305\u542b\u5217\u6807\u9898\u3001\u8868\u683c\u6807\u9898\u548c\u5404\u79cd\u9875\u811a\u7b49\u9644\u52a0\u4fe1\u606f\u3002\u5728\u4ec5\u5143\u7ec4\u6a21\u5f0f\u4e0b\uff0c\u53ea\u663e\u793a\u5b9e\u9645\u7684\u8868\u683c\u6570\u636e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">unicode_border_linestyle</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u8fb9\u6846\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">unicode_column_linestyle</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u5217\u5206\u9694\u7ebf\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">unicode_header_linestyle</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u8868\u5934\u5206\u9694\u7ebf\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8fd9\u4e9b\u4e0d\u540c\u683c\u5f0f\u7684\u5916\u89c2\u793a\u4f8b\u53ef\u53c2\u89c1<a class=\"xref\" href=\"/docs/10/app-psql.html#APP-PSQL-EXAMPLES\" title=\"\u793a\u4f8b\">\u793a\u4f8b</a>\u4e00\u8282\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u6709\u5404\u79cd\u5feb\u6377\u547d\u4ee4\u7528\u4e8e<code class=\"command\">\\pset</code>\u3002\u8bf7\u53c2\u89c1<code class=\"command\">\\a</code>\u3001<code class=\"command\">\\C</code>\u3001<code class=\"command\">\\f</code>\u3001<code class=\"command\">\\H</code>\u3001<code class=\"command\">\\t</code>\u3001<code class=\"command\">\\T</code>\u548c<code class=\"command\">\\x</code>\u3002</p>\n</div>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\q</code> \u6216 <code class=\"literal\">\\quit</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9000\u51fa<span class=\"application\">psql</span>\u7a0b\u5e8f\u3002\u5728\u811a\u672c\u6587\u4ef6\u4e2d\uff0c\u53ea\u4f1a\u7ec8\u6b62\u8be5\u811a\u672c\u7684\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\qecho <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u547d\u4ee4\u4e0e<code class=\"command\">\\echo</code>\u76f8\u540c\uff0c\u53ea\u662f\u8f93\u51fa\u4f1a\u5199\u5165\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u7684\u67e5\u8be2\u8f93\u51fa\u901a\u9053\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\r</code> \u6216 <code class=\"literal\">\\reset</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u91cd\u7f6e\uff08\u6e05\u7a7a\uff09\u67e5\u8be2\u7f13\u51b2\u533a\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\s [ <em class=\"replaceable\"><code>filename</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u5386\u53f2\u8bb0\u5f55\u5230<em class=\"replaceable\"><code>filename</code></em>\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5386\u53f2\u8bb0\u5f55\u5c06\u88ab\u5199\u5165\u6807\u51c6\u8f93\u51fa\uff08\u5982\u679c\u9002\u7528\uff0c\u5c06\u4f7f\u7528\u5206\u9875\u5668\uff09\u3002\u5982\u679c<span class=\"application\">psql</span>\u5728\u6784\u5efa\u65f6\u6ca1\u6709\u4f7f\u7528<span class=\"application\">Readline</span>\u652f\u6301\uff0c\u5219\u6b64\u547d\u4ee4\u4e0d\u53ef\u7528\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\set [ <em class=\"replaceable\"><code>name</code></em> [ <em class=\"replaceable\"><code>value</code></em> [ ... ] ] ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06<span class=\"application\">psql</span>\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u8bbe\u7f6e\u4e3a<em class=\"replaceable\"><code>value</code></em>\uff0c\u5982\u679c\u7ed9\u51fa\u591a\u4e2a\u503c\uff0c\u5219\u8bbe\u7f6e\u4e3a\u6240\u6709\u503c\u7684\u4e32\u63a5\u3002\u5982\u679c\u53ea\u7ed9\u51fa\u4e00\u4e2a\u53c2\u6570\uff0c\u5219\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\u503c\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u8bbe\u7f6e\uff0c\u8bf7\u4f7f\u7528<code class=\"command\">\\unset</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\"><code class=\"command\">\\set</code>\u6ca1\u6709\u4efb\u4f55\u53c2\u6570\u65f6\uff0c\u663e\u793a\u5f53\u524d\u8bbe\u7f6e\u7684\u6240\u6709<span class=\"application\">psql</span>\u53d8\u91cf\u7684\u540d\u79f0\u548c\u503c\u3002</p>\n<p lang=\"zh\">\u5408\u6cd5\u7684\u53d8\u91cf\u540d\u53ef\u4ee5\u5305\u542b\u5b57\u6bcd\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u3002\u8be6\u60c5\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/10/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002\u53d8\u91cf\u540d\u533a\u5206\u5927\u5c0f\u5199\u3002</p>\n<p lang=\"zh\">\u67d0\u4e9b\u53d8\u91cf\u662f\u7279\u6b8a\u7684\uff0c\u5b83\u4eec\u63a7\u5236<span class=\"application\">psql</span>\u7684\u884c\u4e3a\uff0c\u6216\u8005\u7531\u7cfb\u7edf\u81ea\u52a8\u8bbe\u7f6e\u4ee5\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u3002\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/10/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u4ecb\u7ecd\u4e86\u8fd9\u4e9b\u53d8\u91cf\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u4e0e<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4<a class=\"xref\" href=\"/docs/10/sql-set.html\" title=\"SET\"><span class=\"refentrytitle\">SET</span></a>\u65e0\u5173\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\setenv <em class=\"replaceable\"><code>name</code></em> [ <em class=\"replaceable\"><code>value</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u4e3a<em class=\"replaceable\"><code>value</code></em>\uff0c\u6216\u8005\u5982\u679c\u672a\u63d0\u4f9b<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3002\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\setenv PAGER less</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>\\setenv LESS -imx4F</code></strong>\n</pre></dd>\n<dt><span class=\"term\"><code class=\"literal\">\\sf[+] <em class=\"replaceable\"><code>function_description</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u663e\u793a\u6307\u5b9a\u51fd\u6570\u7684\u5b9a\u4e49\uff0c\u4ee5<code class=\"command\">CREATE OR REPLACE FUNCTION</code>\u547d\u4ee4\u7684\u5f62\u5f0f\u5448\u73b0\u3002\u5b9a\u4e49\u5c06\u6253\u5370\u5230\u5f53\u524d\u67e5\u8be2\u8f93\u51fa\u901a\u9053\uff0c\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\">\u76ee\u6807\u51fd\u6570\u53ef\u4ec5\u7528\u540d\u79f0\u6307\u5b9a\uff0c\u4e5f\u53ef\u7528\u540d\u79f0\u548c\u53c2\u6570\u6307\u5b9a\uff0c\u4f8b\u5982 foo(integer, text)\u3002\u82e5\u6709\u591a\u4e2a\u540c\u540d\u51fd\u6570\uff0c\u5219\u5fc5\u987b\u63d0\u4f9b\u53c2\u6570\u7c7b\u578b\u3002</p>\n<p lang=\"zh\">\u5728\u547d\u4ee4\u540d\u540e\u6dfb\u52a0 +\uff0c\u4f1a\u4e3a\u8f93\u51fa\u884c\u7f16\u53f7\uff0c\u51fd\u6570\u4f53\u7b2c\u4e00\u884c\u4e3a\u7b2c 1 \u884c\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\sf</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\sv[+] <em class=\"replaceable\"><code>view_name</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u6307\u5b9a\u89c6\u56fe\u7684\u5b9a\u4e49\uff0c\u5e76\u4ee5<code class=\"command\">CREATE OR REPLACE VIEW</code>\u547d\u4ee4\u7684\u5f62\u5f0f\u663e\u793a\u3002\u5b9a\u4e49\u4f1a\u6253\u5370\u5230\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u7684\u5f53\u524d\u67e5\u8be2\u8f93\u51fa\u901a\u9053\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u547d\u4ee4\u540d\u79f0\u540e\u6dfb\u52a0<code class=\"literal\">+</code>\uff0c\u90a3\u4e48\u8f93\u51fa\u884c\u5c06\u4ece1\u5f00\u59cb\u7f16\u53f7\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\sv</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\t</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u8f93\u51fa\u4e2d\u7684\u5217\u540d\u6807\u9898\u548c\u884c\u6570\u9875\u811a\u7684\u663e\u793a\u72b6\u6001\u3002\u8fd9\u4e2a\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset tuples_only</code>\uff0c\u63d0\u4f9b\u5b83\u662f\u4e3a\u4e86\u4f7f\u7528\u65b9\u4fbf\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\T <em class=\"replaceable\"><code>table_options</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728<acronym class=\"acronym\">HTML</acronym>\u8f93\u51fa\u683c\u5f0f\u4e2d\u653e\u5728<code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u5c5e\u6027\u3002\u8fd9\u4e2a\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset tableattr <em class=\"replaceable\"><code>table_options</code></em></code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\timing [ <em class=\"replaceable\"><code>on</code></em> | <em class=\"replaceable\"><code>off</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5e26\u53c2\u6570\u65f6\uff0c\u5f00\u542f\u6216\u5173\u95ed\u6bcf\u6761 SQL \u8bed\u53e5\u6267\u884c\u8017\u65f6\u7684\u663e\u793a\u3002\u4e0d\u5e26\u53c2\u6570\u65f6\uff0c\u5207\u6362\u663e\u793a\u7684\u5f00\u5173\u72b6\u6001\u3002\u8017\u65f6\u4ee5\u6beb\u79d2\u663e\u793a\uff1b\u8d85\u8fc7 1 \u79d2\u7684\u65f6\u95f4\u95f4\u9694\u8fd8\u4f1a\u4ee5\u5206\u949f:\u79d2\u7684\u683c\u5f0f\u663e\u793a\uff0c\u5fc5\u8981\u65f6\u6dfb\u52a0\u5c0f\u65f6\u548c\u5929\u5b57\u6bb5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\unset <em class=\"replaceable\"><code>name</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u53d6\u6d88\u8bbe\u7f6e\uff08\u5220\u9664\uff09<span class=\"application\">psql</span>\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u3002</p>\n<p lang=\"zh\">\u5927\u591a\u6570\u63a7\u5236<span class=\"application\">psql</span>\u884c\u4e3a\u7684\u53d8\u91cf\u4e0d\u80fd\u53d6\u6d88\u8bbe\u7f6e\uff1b\u5bf9\u4e8e\u8fd9\u4e9b\u53d8\u91cf\uff0c<code class=\"literal\">\\unset</code>\u547d\u4ee4\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u5176\u8bbe\u7f6e\u4e3a\u9ed8\u8ba4\u503c\u3002\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/10/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\w</code> \u6216 <code class=\"literal\">\\write</code> <em class=\"replaceable\"><code>filename</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\w</code> \u6216 <code class=\"literal\">\\write</code> <code class=\"literal\">|</code><em class=\"replaceable\"><code>command</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u5199\u5165\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u9012\u7ed9 shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6539\u4e3a\u5199\u5165\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\uff0c\u5219\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u7684\u5185\u5bb9\u53ea\u4f1a\u539f\u6837\u4f20\u9012\u7ed9 shell\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\watch [ <em class=\"replaceable\"><code>seconds</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u91cd\u590d\u6267\u884c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\uff08\u5982\u540c <code class=\"literal\">\\g</code> \u4e00\u6837\uff09\uff0c\u76f4\u5230\u88ab\u4e2d\u65ad\u6216\u67e5\u8be2\u5931\u8d25\u3002\u4e24\u6b21\u6267\u884c\u4e4b\u95f4\u7b49\u5f85\u6307\u5b9a\u7684\u79d2\u6570\uff08\u9ed8\u8ba4 2 \u79d2\uff09\u3002\u6bcf\u6b21\u67e5\u8be2\u7ed3\u679c\u90fd\u4f1a\u5e26\u6709\u4e00\u4e2a\u5934\u90e8\uff0c\u5176\u4e2d\u5305\u542b <code class=\"literal\">\\pset title</code> \u5b57\u7b26\u4e32\uff08\u5982\u679c\u6709\uff09\u3001\u67e5\u8be2\u5f00\u59cb\u65f6\u7684\u65f6\u95f4\u4ee5\u53ca\u5ef6\u8fdf\u95f4\u9694\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\x [ <em class=\"replaceable\"><code>on</code></em> | <em class=\"replaceable\"><code>off</code></em> | <em class=\"replaceable\"><code>auto</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u6216\u5207\u6362\u6269\u5c55\u8868\u683c\u683c\u5f0f\u6a21\u5f0f\u3002\u5b83\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset expanded</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\z [ <a class=\"link\" href=\"https://pg.center/docs/10/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u53ca\u5176\u5173\u8054\u7684\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u3002</p>\n<p lang=\"zh\">\u8fd9\u662f<code class=\"command\">\\dp</code>\u7684\u522b\u540d\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u663e\u793a\u6743\u9650</span>\u201d</span>\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\! [ <em class=\"replaceable\"><code>command</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u5e26\u53c2\u6570\u65f6\uff0c\u8fdb\u5165\u4e00\u4e2a\u5b50 shell\uff1b\u5b50 shell \u9000\u51fa\u540e\uff0c<span class=\"application\">psql</span>\u6062\u590d\u8fd0\u884c\u3002\u5e26\u53c2\u6570\u65f6\uff0c\u6267\u884c shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\!</code>\u7684\u53c2\u6570\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u5185\u5bb9\u4f1a\u539f\u6837\u4f20\u7ed9 shell\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\? [ <em class=\"replaceable\"><code>topic</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5e2e\u52a9\u4fe1\u606f\u3002\u53ef\u9009\u7684<em class=\"replaceable\"><code>topic</code></em>\u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a<code class=\"literal\">commands</code>\uff09\u9009\u62e9\u8981\u89e3\u91ca\u7684<span class=\"application\">psql</span>\u7684\u54ea\u4e2a\u90e8\u5206\uff1a<code class=\"literal\">commands</code>\u63cf\u8ff0<span class=\"application\">psql</span>\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b<code class=\"literal\">options</code>\u63cf\u8ff0\u53ef\u4ee5\u4f20\u9012\u7ed9<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c<code class=\"literal\">variables</code>\u663e\u793a\u5173\u4e8e<span class=\"application\">psql</span>\u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-PATTERNS\">\n<h4 lang=\"zh\">\u6a21\u5f0f</h4>\n<p lang=\"zh\">\u5f88\u591a<code class=\"literal\">\\d</code>\u547d\u4ee4\u90fd\u53ef\u4ee5\u7528\u4e00\u4e2a<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\u6765\u6307\u5b9a\u8981\u88ab\u663e\u793a\u7684\u5bf9\u8c61\u540d\u79f0\u3002\u5728\u6700\u7b80\u5355\u7684\u60c5\u51b5\u4e0b\uff0c\u6a21\u5f0f\u6b63\u597d\u5c31\u662f\u8be5\u5bf9\u8c61\u7684\u51c6\u786e\u540d\u79f0\u3002\u5728\u6a21\u5f0f\u4e2d\u7684\u5b57\u7b26\u901a\u5e38\u4f1a\u88ab\u53d8\u6210\u5c0f\u5199\u5f62\u5f0f\uff08\u5c31\u50cf\u5728 SQL \u540d\u79f0\u4e2d\u90a3\u6837\uff09\uff0c\u4f8b\u5982<code class=\"literal\">\\dt FOO</code>\u5c06\u4f1a\u663e\u793a\u540d\u4e3a<code class=\"literal\">foo</code>\u7684\u8868\u3002\u5c31\u50cf\u5728 SQL \u540d\u79f0\u4e2d\u90a3\u6837\uff0c\u628a\u6a21\u5f0f\u653e\u5728\u53cc\u5f15\u53f7\u4e2d\u53ef\u4ee5\u963b\u6b62\u5b83\u88ab\u8f6c\u6362\u6210\u5c0f\u5199\u5f62\u5f0f\u3002\u5982\u679c\u9700\u8981\u5728\u4e00\u4e2a\u6a21\u5f0f\u4e2d\u5305\u62ec\u4e00\u4e2a\u771f\u6b63\u7684\u53cc\u5f15\u53f7\u5b57\u7b26\uff0c\u5219\u9700\u8981\u5728\u53cc\u5f15\u53f7\u5305\u56f4\u7684\u6587\u672c\u5185\u628a\u5b83\u5199\u6210\u4e24\u4e2a\u76f8\u90bb\u7684\u53cc\u5f15\u53f7\uff0c\u8fd9\u540c\u6837\u662f\u7b26\u5408 SQL \u52a0\u5f15\u53f7\u6807\u8bc6\u7b26\u7684\u89c4\u5219\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dt \"FOO\"\"BAR\"</code>\u5c06\u663e\u793a\u540d\u4e3a<code class=\"literal\">FOO\"BAR</code>\uff08\u4e0d\u662f<code class=\"literal\">foo\"bar</code>\uff09\u7684\u8868\u3002\u548c\u666e\u901a\u7684 SQL \u540d\u79f0\u89c4\u5219\u4e0d\u540c\uff0c\u4f60\u53ef\u4ee5\u53ea\u5728\u6a21\u5f0f\u7684\u4e00\u90e8\u5206\u5468\u56f4\u653e\u4e0a\u53cc\u5f15\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">\\dt FOO\"FOO\"BAR</code>\u5c06\u4f1a\u663e\u793a\u540d\u4e3a<code class=\"literal\">fooFOObar</code>\u7684\u8868\u3002</p>\n<p lang=\"zh\">\u53ea\u8981\u5b8c\u5168\u7701\u7565<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\uff0c<code class=\"literal\">\\d</code>\u547d\u4ee4\u5c31\u4f1a\u663e\u793a\u5f53\u524d\u6a21\u5f0f\u641c\u7d22\u8def\u5f84\u4e2d\u53ef\u89c1\u7684\u5168\u90e8\u5bf9\u8c61 \u2014 \u8fd9\u7b49\u4ef7\u4e8e\u7528<code class=\"literal\">*</code>\u4f5c\u4e3a\u6a21\u5f0f\uff08\u5982\u679c\u4e00\u4e2a\u5bf9\u8c61\u6240\u5728\u7684\u6a21\u5f0f\u4f4d\u4e8e\u641c\u7d22\u8def\u5f84\u4e2d\uff0c\u5e76\u4e14\u5728\u641c\u7d22\u8def\u5f84\u4e2d\u8be5\u6a21\u5f0f\u4e4b\u524d\u6ca1\u6709\u540c\u7c7b\u4e14\u540c\u540d\u7684\u5bf9\u8c61\uff0c\u5219\u8be5\u5bf9\u8c61\u5c31\u662f<em class=\"firstterm\">\u53ef\u89c1</em>\u7684\u3002\u8fd9\u8868\u793a\u53ef\u4ee5\u76f4\u63a5\u7528\u540d\u79f0\u5f15\u7528\u8be5\u5bf9\u8c61\uff0c\u800c\u4e0d\u9700\u8981\u7528\u6a21\u5f0f\u6765\u9650\u5b9a\uff09\u3002\u8981\u67e5\u770b\u6570\u636e\u5e93\u4e2d\u6240\u6709\u5bf9\u8c61\u800c\u4e0d\u8003\u8651\u5176\u53ef\u89c1\u6027\uff0c\u53ef\u4ee5\u628a<code class=\"literal\">*.*</code>\u7528\u4f5c\u6a21\u5f0f\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u653e\u5728\u4e00\u4e2a\u6a21\u5f0f\u4e2d\uff0c<code class=\"literal\">*</code>\u5c06\u5339\u914d\u4efb\u610f\u5b57\u7b26\u5e8f\u5217\uff08\u5305\u62ec\u7a7a\u5e8f\u5217\uff09\uff0c\u800c<code class=\"literal\">?</code>\u4f1a\u5339\u914d\u4efb\u610f\u7684\u5355\u4e2a\u5b57\u7b26\uff08\u8fd9\u79cd\u8bb0\u53f7\u65b9\u6cd5\u5c31\u50cf Unix shell \u7684\u6587\u4ef6\u540d\u6a21\u5f0f\u4e00\u6837\uff09\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dt int*</code>\u4f1a\u663e\u793a\u540d\u79f0\u4ee5<code class=\"literal\">int</code>\u5f00\u59cb\u7684\u8868\u3002\u4f46\u662f\u5982\u679c\u88ab\u653e\u5728\u53cc\u5f15\u53f7\u5185\uff0c<code class=\"literal\">*</code>\u548c<code class=\"literal\">?</code>\u5c31\u4f1a\u5931\u53bb\u8fd9\u4e9b\u7279\u6b8a\u542b\u4e49\u800c\u53d8\u6210\u666e\u901a\u7684\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u5305\u542b\u70b9\u53f7\uff08.\uff09\u7684\u6a21\u5f0f\u4f1a\u88ab\u89e3\u91ca\u4e3a\u6a21\u5f0f\u540d\u5339\u914d\u6a21\u5f0f\uff0c\u540e\u63a5\u5bf9\u8c61\u540d\u5339\u914d\u6a21\u5f0f\u3002\u4f8b\u5982\uff0c\\dt foo*.*bar* \u4f1a\u663e\u793a\u6240\u6709\u6a21\u5f0f\u540d\u4ee5 foo \u5f00\u5934\u3001\u8868\u540d\u5305\u542b bar \u7684\u8868\u3002\u6ca1\u6709\u70b9\u53f7\u65f6\uff0c\u53ea\u5339\u914d\u5f53\u524d\u6a21\u5f0f\u641c\u7d22\u8def\u5f84\u4e2d\u53ef\u89c1\u7684\u5bf9\u8c61\u3002\u540c\u6837\uff0c\u53cc\u5f15\u53f7\u5185\u7684\u70b9\u53f7\u4e0d\u5177\u6709\u7279\u6b8a\u542b\u4e49\uff0c\u6309\u5b57\u9762\u5339\u914d\u3002</p>\n<p lang=\"zh\">\u9ad8\u7ea7\u7528\u6237\u53ef\u4ee5\u4f7f\u7528\u5b57\u7b26\u7c7b\u7b49\u6b63\u5219\u8868\u8fbe\u5f0f\u8bb0\u6cd5\uff0c\u5982<code class=\"literal\">[0-9]</code>\u53ef\u4ee5\u5339\u914d\u4efb\u610f\u6570\u5b57\u3002\u6240\u6709\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u90fd\u6309\u7167<a class=\"xref\" href=\"/docs/10/functions-matching.html#FUNCTIONS-POSIX-REGEXP\" title=\"9.7.3.\u00a0POSIX\u6b63\u5219\u8868\u8fbe\u5f0f\">\u7b2c\u00a09.7.3\u00a0\u8282</a>\u6240\u8bf4\u7684\u5de5\u4f5c\uff0c\u4ee5\u4e0b\u5b57\u7b26\u9664\u5916\uff1a<code class=\"literal\">.</code>\u4f1a\u6309\u7167\u4e0a\u9762\u6240\u8bf4\u7684\u4f5c\u4e3a\u4e00\u79cd\u5206\u9694\u7b26\uff0c<code class=\"literal\">*</code>\u4f1a\u88ab\u7ffb\u8bd1\u6210\u6b63\u5219\u8868\u8fbe\u5f0f\u8bb0\u53f7<code class=\"literal\">.*</code>\uff0c<code class=\"literal\">?</code>\u4f1a\u88ab\u7ffb\u8bd1\u6210<code class=\"literal\">.</code>\uff0c\u800c<code class=\"literal\">$</code>\u5219\u6309\u5b57\u9762\u610f\u601d\u5339\u914d\u3002\u6839\u636e\u9700\u8981\uff0c\u53ef\u4ee5\u7528<code class=\"literal\">?</code>\u6a21\u62df<code class=\"literal\">.</code>\uff0c\u7528<code class=\"literal\">(<em class=\"replaceable\"><code>R</code></em>+|)</code>\u6a21\u62df<code class=\"literal\"><em class=\"replaceable\"><code>R</code></em>*</code>\uff0c\u6216\u7528<code class=\"literal\">(<em class=\"replaceable\"><code>R</code></em>|)</code>\u6a21\u62df<code class=\"literal\"><em class=\"replaceable\"><code>R</code></em>?</code>\u3002<code class=\"literal\">$</code>\u4e0d\u9700\u8981\u4f5c\u4e3a\u4e00\u4e2a\u6b63\u5219\u8868\u8fbe\u5f0f\u5b57\u7b26\uff0c\u56e0\u4e3a\u6a21\u5f0f\u5fc5\u987b\u5339\u914d\u6574\u4e2a\u540d\u79f0\uff0c\u800c\u4e0d\u662f\u50cf\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5e38\u89c4\u7528\u6cd5\u90a3\u6837\u89e3\u91ca\uff08\u6362\u53e5\u8bdd\u8bf4\uff0c<code class=\"literal\">$</code>\u4f1a\u88ab\u81ea\u52a8\u5730\u8ffd\u52a0\u5230\u6a21\u5f0f\u4e0a\uff09\u3002\u5982\u679c\u4e0d\u5e0c\u671b\u8be5\u6a21\u5f0f\u7684\u5339\u914d\u4f4d\u7f6e\u88ab\u56fa\u5b9a\uff0c\u53ef\u4ee5\u5728\u5f00\u5934\u6216\u8005\u7ed3\u5c3e\u5199\u4e0a<code class=\"literal\">*</code>\u3002\u6ce8\u610f\u5728\u53cc\u5f15\u53f7\u5185\uff0c\u6240\u6709\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u4f1a\u5931\u53bb\u5176\u7279\u6b8a\u542b\u4e49\u5e76\u4e14\u6309\u7167\u5176\u5b57\u9762\u610f\u601d\u8fdb\u884c\u5339\u914d\u3002\u8fd8\u6709\uff0c\u5728\u64cd\u4f5c\u7b26\u540d\u79f0\u6a21\u5f0f\u4e2d\uff08\u5373\u4f5c\u4e3a<code class=\"literal\">\\do</code>\u7684\u53c2\u6570\uff09\uff0c\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u4e5f\u6309\u7167\u5b57\u9762\u610f\u601d\u8fdb\u884c\u5339\u914d\u3002</p>\n</div>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.18.8.5\">\n<h3 lang=\"zh\">\u9ad8\u7ea7\u7279\u6027</h3>\n<div class=\"refsect3\" id=\"APP-PSQL-VARIABLES\">\n<h4 lang=\"zh\">\u53d8\u91cf</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u63d0\u4f9b\u4e86\u548c\u666e\u901a Unix \u547d\u4ee4 shell \u76f8\u4f3c\u7684\u53d8\u91cf\u66ff\u6362\u7279\u6027\u3002\u53d8\u91cf\u7b80\u5355\u6765\u8bf4\u5c31\u662f\u4e00\u5bf9\u540d\u79f0/\u503c\uff0c\u5176\u4e2d\u503c\u53ef\u4ee5\u662f\u4efb\u610f\u957f\u5ea6\u7684\u4efb\u610f\u5b57\u7b26\u4e32\u3002\u540d\u79f0\u5fc5\u987b\u7531\u5b57\u6bcd\uff08\u5305\u62ec\u975e\u62c9\u4e01\u5b57\u6bcd\uff09\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u6784\u6210\u3002</p>\n<p lang=\"zh\">\u8981\u8bbe\u7f6e\u4e00\u4e2a\u53d8\u91cf\uff0c\u53ef\u4ee5\u4f7f\u7528<span class=\"application\">psql</span>\u7684\u5143\u547d\u4ee4<code class=\"command\">\\set</code>\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo bar</code></strong>\n</pre>\n<p lang=\"zh\">\u4f1a\u5c06<code class=\"literal\">foo</code>\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">bar</code>\u3002\u8981\u68c0\u7d22\u8be5\u53d8\u91cf\u7684\u5185\u5bb9\uff0c\u53ef\u4ee5\u5728\u540d\u79f0\u524d\u653e\u4e00\u4e2a\u5192\u53f7\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\echo :foo</code></strong>\nbar\n</pre>\n<p lang=\"zh\">\u8fd9\u5728\u5e38\u89c4 SQL \u547d\u4ee4\u548c\u5143\u547d\u4ee4\u4e2d\u5747\u6709\u6548\uff0c\u4e0b\u6587\u7684<a class=\"xref\" href=\"/docs/10/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL \u63d2\u503c\"><acronym class=\"acronym\">SQL</acronym> \u63d2\u503c</a>\u4e2d\u6709\u66f4\u591a\u7ec6\u8282\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u8c03\u7528<code class=\"command\">\\set</code>\u65f6\u6ca1\u6709\u7b2c\u4e8c\u4e2a\u53c2\u6570\uff0c\u8be5\u53d8\u91cf\u4f1a\u88ab\u8bbe\u7f6e\u4e3a\u4e00\u4e2a\u7a7a\u5b57\u7b26\u4e32\u503c\u3002\u8981\u53d6\u6d88\u8bbe\u7f6e\uff08\u5373\u5220\u9664\uff09\u4e00\u4e2a\u53d8\u91cf\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4<code class=\"command\">\\unset</code>\u3002\u8981\u663e\u793a\u6240\u6709\u53d8\u91cf\u7684\u503c\uff0c\u5728\u8c03\u7528<code class=\"command\">\\set</code>\u65f6\u4e0d\u5e26\u4efb\u4f55\u53c2\u6570\u5373\u53ef\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\"><code class=\"command\">\\set</code>\u7684\u53c2\u6570\u670d\u4ece\u4e0e\u5176\u4ed6\u547d\u4ee4\u76f8\u540c\u7684\u66ff\u6362\u89c4\u5219\u3002\u56e0\u6b64\u53ef\u4ee5\u6784\u9020\u6709\u8da3\u7684\u5f15\u7528\uff0c\u4f8b\u5982<code class=\"literal\">\\set :foo 'something'</code>\u4ee5\u53ca\u5206\u522b\u5f97\u5230<span class=\"productname\">Perl</span>\u6216\u8005<span class=\"productname\"><acronym class=\"acronym\">PHP</acronym></span>\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u8f6f\u94fe\u63a5</span>\u201d</span>\u6216\u8005<span class=\"quote\">\u201c<span class=\"quote\">\u53ef\u53d8\u53d8\u91cf</span>\u201d</span>\u3002\u4e0d\u5e78\u7684\u662f\uff08\u6216\u8005\u5e78\u8fd0\u7684\u662f\uff1f\uff09\uff0c\u8fd9\u4e9b\u6784\u9020\u51fa\u6765\u7684\u4e1c\u897f\u5e76\u6ca1\u6709\u4ec0\u4e48\u7528\u5904\u3002\u5728\u53e6\u4e00\u65b9\u9762\uff0c<code class=\"literal\">\\set bar :foo</code>\u662f\u4e00\u79cd\u5f88\u597d\u7684\u62f7\u8d1d\u53d8\u91cf\u7684\u65b9\u6cd5\u3002</p>\n</div>\n<p lang=\"zh\">\u6709\u4e00\u4e9b\u53d8\u91cf\u4f1a\u88ab<span class=\"application\">psql</span>\u7279\u6b8a\u5bf9\u5f85\u3002\u5b83\u4eec\u8868\u793a\u7279\u5b9a\u7684\u9009\u9879\u8bbe\u7f6e\uff0c\u8fd0\u884c\u65f6\u8fd9\u7c7b\u9009\u9879\u8bbe\u7f6e\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539\u8be5\u53d8\u91cf\u7684\u503c\u6765\u6539\u53d8\uff0c\u6216\u8005\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u5b83\u4eec\u8868\u793a<span class=\"application\">psql</span>\u7684\u53ef\u66f4\u6539\u7684\u72b6\u6001\u3002\u6309\u7167\u60ef\u4f8b\uff0c\u6240\u6709\u88ab\u7279\u6b8a\u5bf9\u5f85\u7684\u53d8\u91cf\u7684\u540d\u79f0\u7531\u5168\u90e8\u5927\u5199\u5f62\u5f0f\u7684 ASCII \u5b57\u6bcd\uff08\u8fd8\u6709\u53ef\u80fd\u662f\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\uff09\u7ec4\u6210\u3002\u4e3a\u4e86\u786e\u4fdd\u672a\u6765\u6700\u5927\u7684\u517c\u5bb9\u6027\uff0c\u6700\u597d\u907f\u514d\u628a\u8fd9\u7c7b\u53d8\u91cf\u540d\u7528\u4e8e\u81ea\u5df1\u7684\u76ee\u7684\u3002</p>\n<p lang=\"zh\">\u63a7\u5236<span class=\"application\">psql</span>\u884c\u4e3a\u7684\u53d8\u91cf\u901a\u5e38\u4e0d\u80fd\u88ab\u53d6\u6d88\u8bbe\u7f6e\u6216\u8005\u8bbe\u7f6e\u4e3a\u65e0\u6548\u503c\u3002\u5141\u8bb8<code class=\"literal\">\\unset</code>\u547d\u4ee4\uff0c\u4f46\u5b83\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u5b83\u7684\u9ed8\u8ba4\u503c\u3002\u6ca1\u6709\u7b2c\u4e8c\u53c2\u6570\u7684<code class=\"literal\">\\set</code>\u547d\u4ee4\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\uff08\u5bf9\u4e8e\u63a5\u53d7\u8be5\u503c\u7684\u63a7\u5236\u53d8\u91cf\uff09\uff0c\u5bf9\u4e0d\u63a5\u53d7\u8be5\u503c\u7684\u53d8\u91cf\u5219\u4f1a\u62d2\u7edd\u8fd9\u4e2a\u547d\u4ee4\u3002\u6b64\u5916\uff0c\u63a5\u53d7\u503c<code class=\"literal\">on</code>\u548c<code class=\"literal\">off</code>\u7684\u63a7\u5236\u53d8\u91cf\u4e5f\u80fd\u63a5\u53d7\u5176\u4ed6\u5e38\u89c1\u7684\u5e03\u5c14\u503c\u62fc\u5199\u65b9\u5f0f\uff0c\u4f8b\u5982<code class=\"literal\">true</code>\u548c<code class=\"literal\">false</code>\u3002</p>\n<p lang=\"zh\">\u88ab\u7279\u6b8a\u5bf9\u5f85\u7684\u53d8\u91cf\u662f\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"varname\">AUTOCOMMIT</code> </span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\uff08\u9ed8\u8ba4\uff09\u65f6\uff0c\u6bcf\u4e00\u4e2a SQL \u547d\u4ee4\u5728\u6210\u529f\u5b8c\u6210\u65f6\u4f1a\u88ab\u81ea\u52a8\u63d0\u4ea4\u3002\u5728\u8fd9\u79cd\u6a21\u5f0f\u4e2d\u8981\u63a8\u8fdf\u63d0\u4ea4\uff0c\u5fc5\u987b\u8f93\u5165\u4e00\u4e2a<code class=\"command\">BEGIN</code>\u6216\u8005<code class=\"command\">START TRANSACTION</code> SQL \u547d\u4ee4\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">off</code>\u6216\u8005\u88ab\u53d6\u6d88\u8bbe\u7f6e\u65f6\uff0c\u5728\u663e\u5f0f\u53d1\u51fa<code class=\"command\">COMMIT</code>\u6216\u8005<code class=\"command\">END</code>\u4e4b\u524d\uff0cSQL \u547d\u4ee4\u4e0d\u4f1a\u88ab\u63d0\u4ea4\u3002\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u4f1a\u4e3a\u4f60\u53d1\u51fa\u4e00\u4e2a\u9690\u5f0f\u7684<code class=\"command\">BEGIN</code>\uff0c\u8fd9\u4f1a\u53d1\u751f\u5728\u4efb\u4f55\u4e0d\u5728\u4e00\u4e2a\u4e8b\u52a1\u5757\u4e2d\u4e14\u672c\u8eab\u65e2\u4e0d\u662f<code class=\"command\">BEGIN</code>\u53ca\u5176\u4ed6\u4e8b\u52a1\u63a7\u5236\u547d\u4ee4\u4e14\u4e0d\u662f\u65e0\u6cd5\u5728\u4e8b\u52a1\u5757\u4e2d\u6267\u884c\u7684\u547d\u4ee4\uff08\u4f8b\u5982<code class=\"command\">VACUUM</code>\uff09\u4e4b\u524d\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u4e2d\uff0c\u5fc5\u987b\u901a\u8fc7<code class=\"command\">ABORT</code>\u6216\u8005<code class=\"command\">ROLLBACK</code>\u663e\u5f0f\u5730\u653e\u5f03\u4efb\u4f55\u5931\u8d25\u7684\u4e8b\u52a1\u3002\u8fd8\u8981\u8bb0\u4f4f\uff0c\u5982\u679c\u9000\u51fa\u4f1a\u8bdd\u65f6\u6ca1\u6709\u63d0\u4ea4\uff0c\u5219\u6240\u6709\u7684\u5de5\u4f5c\u90fd\u4f1a\u4e22\u5931\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u81ea\u52a8\u63d0\u4ea4\u6253\u5f00\u6a21\u5f0f\u662f<span class=\"productname\">PostgreSQL</span>\u7684\u4f20\u7edf\u884c\u4e3a\uff0c\u4f46\u662f\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u66f4\u63a5\u8fd1\u4e8e SQL \u7684\u89c4\u8303\u3002\u5982\u679c\u66f4\u559c\u6b22\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\uff0c\u53ef\u4ee5\u5728\u7cfb\u7edf\u7ea7\u7684<code class=\"filename\">psqlrc</code>\u6587\u4ef6\u6216\u8005\u4e2a\u4eba\u7684<code class=\"filename\">~/.psqlrc</code>\u6587\u4ef6\u4e2d\u8bbe\u7f6e\u5b83\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">COMP_KEYWORD_CASE</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u786e\u5b9a\u5728\u8865\u5168\u4e00\u4e2a SQL \u5173\u952e\u8bcd\u65f6\u8981\u4f7f\u7528\u7684\u5927\u5c0f\u5199\u5f62\u5f0f\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">lower</code>\u6216\u8005<code class=\"literal\">upper</code>\uff0c\u8865\u5168\u540e\u7684\u8bcd\u5c06\u5206\u522b\u662f\u5c0f\u5199\u6216\u8005\u5927\u5199\u5f62\u5f0f\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">preserve-lower</code>\u6216\u8005<code class=\"literal\">preserve-upper</code>\uff08\u9ed8\u8ba4\uff09\uff0c\u8865\u5168\u540e\u7684\u8bcd\u5c06\u4f1a\u4fdd\u6301\u8be5\u8bcd\u5df2\u8f93\u5165\u90e8\u5206\u7684\u5927\u5c0f\u5199\u5f62\u5f0f\uff0c\u4f46\u662f\u5982\u679c\u88ab\u8865\u5168\u7684\u8bcd\u8fd8\u6ca1\u6709\u88ab\u8f93\u5165\uff0c\u5219\u5b83\u4f1a\u88ab\u5206\u522b\u8865\u5168\u6210\u5c0f\u5199\u6216\u8005\u5927\u5199\u5f62\u5f0f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">DBNAME</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u5df2\u8fde\u63a5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u662f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ECHO</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">all</code>\uff0c\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u4f1a\u5728\u8bfb\u5165\u65f6\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u8bfb\u53d6\u7684\u884c\uff09\u3002\u8981\u5728\u7a0b\u5e8f\u5f00\u59cb\u65f6\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\uff0c\u53ef\u4ee5\u4f7f\u7528\u5f00\u5173<code class=\"option\">-a</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">queries</code>\uff0c<span class=\"application\">psql</span>\u4f1a\u5728\u53d1\u9001\u6bcf\u4e2a\u67e5\u8be2\u7ed9\u670d\u52a1\u5668\u65f6\u5c06\u5b83\u4eec\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\u3002\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\u7684\u5f00\u5173\u662f<code class=\"option\">-e</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">errors</code>\uff0c\u90a3\u4e48\u53ea\u6709\u5931\u8d25\u7684\u67e5\u8be2\u4f1a\u88ab\u663e\u793a\u5728\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u4e0a\u3002\u8fd9\u79cd\u884c\u4e3a\u7684\u5f00\u5173\u662f<code class=\"option\">-b</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">none</code>\uff08\u9ed8\u8ba4\u503c\uff09\u5219\u4e0d\u4f1a\u663e\u793a\u4efb\u4f55\u67e5\u8be2\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ECHO_HIDDEN</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u4e14\u4e00\u4e2a\u53cd\u659c\u7ebf\u547d\u4ee4\u67e5\u8be2\u6570\u636e\u5e93\u65f6\uff0c\u76f8\u5e94\u7684\u67e5\u8be2\u4f1a\u88ab\u5148\u663e\u793a\u3002\u8fd9\u79cd\u7279\u6027\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u5b66\u4e60<span class=\"productname\">PostgreSQL</span>\u7684\u5185\u90e8\u5e76\u4e14\u5728\u81ea\u5df1\u7684\u7a0b\u5e8f\u4e2d\u63d0\u4f9b\u7c7b\u4f3c\u7684\u529f\u80fd\uff08\u8981\u5728\u7a0b\u5e8f\u5f00\u59cb\u65f6\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\uff0c\u53ef\u4ee5\u4f7f\u7528\u5f00\u5173<code class=\"option\">-E</code>\uff09\u3002\u5982\u679c\u628a\u8fd9\u4e2a\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">noexec</code>\uff0c\u5219\u5bf9\u5e94\u7684\u67e5\u8be2\u53ea\u4f1a\u88ab\u663e\u793a\u800c\u5e76\u4e0d\u771f\u6b63\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u6267\u884c\u3002\u9ed8\u8ba4\u503c\u662f<code class=\"literal\">off</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ENCODING</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u7684\u5ba2\u6237\u7aef\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u6bcf\u4e00\u6b21\u4f60\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\uff09\u65f6\u4ee5\u53ca\u5f53\u4f60\u7528<code class=\"literal\">\\encoding</code>\u66f4\u6539\u7f16\u7801\u65f6\uff0c\u8fd9\u4e2a\u53d8\u91cf\u90fd\u4f1a\u88ab\u8bbe\u7f6e\uff0c\u4f46\u5b83\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">FETCH_COUNT</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a\u4e00\u4e2a\u5927\u4e8e\u96f6\u7684\u6574\u6570\u503c\uff0c<code class=\"command\">SELECT</code>\u67e5\u8be2\u7684\u7ed3\u679c\u4f1a\u4ee5\u4e00\u7ec4\u4e00\u7ec4\u7684\u65b9\u5f0f\u53d6\u51fa\u5e76\u4e14\u663e\u793a\uff08\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u7684\u90a3\u6837\u628a\u6574\u4e2a\u7ed3\u679c\u96c6\u62ff\u5230\u4ee5\u540e\u518d\u663e\u793a\uff09\uff0c\u6bcf\u7ec4\u5305\u542b\u7684\u884c\u6570\u7b49\u4e8e\u8be5\u6574\u6570\u503c\u3002\u56e0\u6b64\uff0c\u8fd9\u79cd\u65b9\u5f0f\u53ea\u4f1a\u4f7f\u7528\u6709\u9650\u7684\u5185\u5b58\u91cf\uff0c\u800c\u4e0d\u7ba1\u6574\u4e2a\u7ed3\u679c\u96c6\u7684\u5927\u5c0f\u3002\u5728\u542f\u7528\u8fd9\u4e2a\u7279\u6027\u65f6\uff0c\u901a\u5e38\u4f1a\u4f7f\u7528 100 \u5230 1000 \u7684\u8bbe\u7f6e\u3002\u8bb0\u4f4f\u5728\u4f7f\u7528\u8fd9\u79cd\u7279\u6027\u65f6\uff0c\u4e00\u4e2a\u67e5\u8be2\u53ef\u80fd\u4f1a\u5728\u5df2\u7ecf\u663e\u793a\u4e86\u4e00\u4e9b\u884c\u4e4b\u540e\u5931\u8d25\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5c3d\u7ba1\u53ef\u4ee5\u628a\u8fd9\u79cd\u7279\u6027\u7528\u4e8e\u4efb\u4f55\u7684\u8f93\u51fa\u683c\u5f0f\uff0c\u4f46\u662f\u9ed8\u8ba4\u7684<code class=\"literal\">aligned</code>\u683c\u5f0f\u770b\u8d77\u6765\u4f1a\u6bd4\u8f83\u7cdf\u7cd5\uff0c\u56e0\u4e3a\u6bcf\u4e00\u7ec4\u7684<code class=\"varname\">FETCH_COUNT</code>\u884c\u5c06\u88ab\u5355\u72ec\u683c\u5f0f\u5316\uff0c\u8fd9\u5c31\u4f1a\u5bfc\u81f4\u4e0d\u540c\u7684\u884c\u7ec4\u7684\u5217\u5bbd\u4e0d\u540c\u3002\u5176\u4ed6\u7684\u8f93\u51fa\u683c\u5f0f\u4f1a\u66f4\u597d\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">HISTCONTROL</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">ignorespace</code>\uff0c\u5219\u4ee5\u4e00\u4e2a\u7a7a\u683c\u5f00\u59cb\u7684\u884c\u4e0d\u4f1a\u88ab\u653e\u5165\u5230\u5386\u53f2\u5217\u8868\u4e2d\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">ignoredups</code>\uff0c\u5219\u4e0e\u4e0a\u4e00\u6761\u5386\u53f2\u8bb0\u5f55\u76f8\u540c\u7684\u884c\u4e0d\u4f1a\u88ab\u653e\u5165\u3002\u503c<code class=\"literal\">ignoreboth</code>\u7ec4\u5408\u4e86\u4e0a\u8ff0\u4e24\u79cd\u503c\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">none</code>\uff08\u9ed8\u8ba4\u503c\uff09\uff0c\u6240\u6709\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e2d\u88ab\u8bfb\u5165\u7684\u884c\u90fd\u4f1a\u4fdd\u5b58\u5728\u5386\u53f2\u5217\u8868\u4e2d\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">HISTFILE</code></span></dt>\n<dd>\n<p lang=\"zh\">\u7528\u4e8e\u5b58\u50a8\u5386\u53f2\u8bb0\u5f55\u5217\u8868\u7684\u6587\u4ef6\u540d\u3002\u5982\u679c\u672a\u8bbe\u7f6e\uff0c\u5219\u4ece\u73af\u5883\u53d8\u91cf <code class=\"envar\">PSQL_HISTORY</code> \u4e2d\u83b7\u53d6\u6587\u4ef6\u540d\u3002\u5982\u679c\u8be5\u73af\u5883\u53d8\u91cf\u4e5f\u672a\u8bbe\u7f6e\uff0c\u5219\u9ed8\u8ba4\u4f7f\u7528 <code class=\"filename\">~/.psql_history</code>\uff0c\u5728 Windows \u4e0a\u5219\u4f7f\u7528 <code class=\"filename\">%APPDATA%\\postgresql\\psql_history</code>\u3002\u4f8b\u5982\uff0c\u5c06\u4ee5\u4e0b\u5185\u5bb9\uff1a</p>\n<pre class=\"programlisting\">\\set HISTFILE ~/.psql_history- :DBNAME\n</pre>\n<p lang=\"zh\">\u653e\u5165 <code class=\"filename\">~/.psqlrc</code> \u4f1a\u4f7f <span class=\"application\">psql</span> \u4e3a\u6bcf\u4e2a\u6570\u636e\u5e93\u7ef4\u62a4\u5355\u72ec\u7684\u5386\u53f2\u8bb0\u5f55\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">HISTSIZE</code></span></dt>\n<dd>\n<p lang=\"zh\">\u547d\u4ee4\u5386\u53f2\u4e2d\u6700\u591a\u4fdd\u5b58\u7684\u547d\u4ee4\u6570\uff08\u9ed8\u8ba4 500\uff09\u3002\u8bbe\u4e3a\u8d1f\u503c\u65f6\uff0c\u4e0d\u8bbe\u4e0a\u9650\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">HOST</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e3b\u673a\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u4e5f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">IGNOREEOF</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8bbe\u4e3a 1 \u6216\u66f4\u5c0f\u7684\u503c\uff0c\u5411 psql \u4ea4\u4e92\u4f1a\u8bdd\u53d1\u9001 EOF \u5b57\u7b26\uff08\u901a\u5e38\u4e3a Control + D\uff09\u5c31\u4f1a\u7ec8\u6b62\u5e94\u7528\u3002\u5982\u679c\u8bbe\u4e3a\u66f4\u5927\u7684\u6570\u503c\uff0c\u5219\u5fc5\u987b\u8fde\u7eed\u8f93\u5165\u76f8\u5e94\u6b21\u6570\u7684 EOF \u5b57\u7b26\u624d\u4f1a\u7ec8\u6b62\u4ea4\u4e92\u4f1a\u8bdd\u3002\u5982\u679c\u53d8\u91cf\u8bbe\u4e3a\u975e\u6570\u503c\uff0c\u4f1a\u88ab\u89e3\u91ca\u4e3a 10\u3002\u9ed8\u8ba4\u503c\u4e3a 0\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">LASTOID</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u540e\u88ab\u5f71\u54cd\u7684 OID \u7684\u503c\uff0c\u8fd9\u53ef\u80fd\u4f1a\u7531<code class=\"command\">INSERT</code>\u6216\u8005<code class=\"command\">\\lo_import</code>\u547d\u4ee4\u8fd4\u56de\u3002\u8fd9\u4e2a\u53d8\u91cf\u53ea\u4fdd\u8bc1\u5728\u4e0b\u4e00\u4e2a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u7684\u7ed3\u679c\u88ab\u663e\u793a\u5b8c\u4e4b\u524d\u6709\u6548\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ON_ERROR_ROLLBACK</code> </span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u65f6\uff0c\u5982\u679c\u4e8b\u52a1\u5757\u4e2d\u7684\u4e00\u4e2a\u8bed\u53e5\u4ea7\u751f\u4e00\u4e2a\u9519\u8bef\uff0c\u8be5\u9519\u8bef\u4f1a\u88ab\u5ffd\u7565\u5e76\u4e14\u8be5\u4e8b\u52a1\u4f1a\u7ee7\u7eed\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">interactive</code>\u65f6\uff0c\u53ea\u5728\u4ea4\u4e92\u5f0f\u4f1a\u8bdd\u4e2d\u5ffd\u7565\u8fd9\u7c7b\u9519\u8bef\uff0c\u800c\u8bfb\u53d6\u811a\u672c\u6587\u4ef6\u65f6\u5219\u4e0d\u4f1a\u5ffd\u7565\u9519\u8bef\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">off</code>\uff08\u9ed8\u8ba4\u503c\uff09\u65f6\uff0c\u4e8b\u52a1\u5757\u4e2d\u4ea7\u751f\u9519\u8bef\u7684\u4e00\u4e2a\u8bed\u53e5\u4f1a\u4e2d\u6b62\u6574\u4e2a\u4e8b\u52a1\u3002\u9519\u8bef\u56de\u6eda\u6a21\u5f0f\u7684\u5de5\u4f5c\u539f\u7406\u662f\u5728\u4e8b\u52a1\u5757\u7684\u6bcf\u4e2a\u547d\u4ee4\u4e4b\u524d\u90fd\u4e3a\u4f60\u53d1\u51fa\u4e00\u4e2a\u9690\u5f0f\u7684<code class=\"command\">SAVEPOINT</code>\uff0c\u7136\u540e\u5728\u8be5\u547d\u4ee4\u5931\u8d25\u65f6\u56de\u6eda\u5230\u8be5\u4fdd\u5b58\u70b9\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ON_ERROR_STOP</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u51fa\u9519\u540e\u4ecd\u4f1a\u7ee7\u7eed\u5904\u7406\u547d\u4ee4\u3002\u5c06\u6b64\u53d8\u91cf\u8bbe\u4e3a on \u540e\uff0c\u5904\u7406\u4f1a\u7acb\u5373\u505c\u6b62\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\uff0cpsql \u4f1a\u8fd4\u56de\u547d\u4ee4\u63d0\u793a\u7b26\uff1b\u5426\u5219\uff0cpsql \u4f1a\u9000\u51fa\u5e76\u8fd4\u56de\u9519\u8bef\u7801 3\uff0c\u4ee5\u533a\u522b\u4e8e\u9519\u8bef\u7801 1 \u6240\u8868\u793a\u7684\u81f4\u547d\u9519\u8bef\u3002\u65e0\u8bba\u54ea\u79cd\u60c5\u51b5\uff0c\u5f53\u524d\u6b63\u5728\u8fd0\u884c\u7684\u6240\u6709\u811a\u672c\uff08\u5982\u679c\u5b58\u5728\u9876\u5c42\u811a\u672c\uff0c\u5219\u5305\u62ec\u8be5\u811a\u672c\u53ca\u5176\u8c03\u7528\u7684\u5176\u4ed6\u811a\u672c\uff09\u90fd\u4f1a\u7acb\u5373\u7ec8\u6b62\u3002\u5982\u679c\u9876\u5c42\u547d\u4ee4\u5b57\u7b26\u4e32\u5305\u542b\u591a\u6761 SQL \u547d\u4ee4\uff0c\u5219\u4f1a\u5728\u5f53\u524d\u547d\u4ee4\u5904\u505c\u6b62\u5904\u7406\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">PORT</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u7aef\u53e3\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u4e5f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">PROMPT1</code><br/></span><span class=\"term\"><code class=\"varname\">PROMPT2</code><br/></span><span class=\"term\"><code class=\"varname\">PROMPT3</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e9b\u53d8\u91cf\u6307\u5b9a<span class=\"application\">psql</span>\u53d1\u51fa\u7684\u63d0\u793a\u7b26\u7684\u6a21\u6837\u3002\u89c1\u4e0b\u6587\u7684<a class=\"xref\" href=\"/docs/10/app-psql.html#APP-PSQL-PROMPTING\" title=\"\u63d0\u793a\u7b26\">\u63d0\u793a\u7b26</a>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">QUIET</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u8fd9\u4e2a\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-q</code>\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\u53ef\u80fd\u7528\u5904\u4e0d\u5927\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">SERVER_VERSION_NAME</code><br/></span><span class=\"term\"><code class=\"varname\">SERVER_VERSION_NUM</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b57\u7b26\u4e32\u5f62\u5f0f\u7684\u670d\u52a1\u5668\u7248\u672c\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">9.6.2</code>\u3001<code class=\"literal\">10.1</code>\u6216\u8005<code class=\"literal\">11beta1</code>\uff0c\u4ee5\u53ca\u6570\u5b57\u5f62\u5f0f\u7684\u670d\u52a1\u5668\u7248\u672c\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">90602</code>\u6216\u8005<code class=\"literal\">100001</code>\u3002\u6bcf\u6b21\u4f60\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\uff09\u65f6\uff0c\u8fd9\u4e9b\u90fd\u4f1a\u88ab\u8bbe\u7f6e\uff0c\u4f46\u53ef\u4ee5\u88ab\u6539\u53d8\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">SHOW_CONTEXT</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u53d8\u91cf\u53ef\u4ee5\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">never</code>\u3001<code class=\"literal\">errors</code>\u6216\u8005<code class=\"literal\">always</code>\u6765\u63a7\u5236\u662f\u5426\u5728\u6765\u81ea\u670d\u52a1\u5668\u7684\u6d88\u606f\u4e2d\u663e\u793a<code class=\"literal\">CONTEXT</code>\u5b57\u6bb5\u3002\u9ed8\u8ba4\u662f<code class=\"literal\">errors</code>\uff08\u8868\u793a\u5728\u9519\u8bef\u6d88\u606f\u4e2d\u663e\u793a\u4e0a\u4e0b\u6587\uff0c\u4f46\u5728\u901a\u77e5\u548c\u8b66\u544a\u6d88\u606f\u4e2d\u4e0d\u663e\u793a\uff09\u3002\u5f53<code class=\"varname\">VERBOSITY</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">terse</code>\u65f6\uff0c\u8fd9\u4e2a\u8bbe\u7f6e\u65e0\u6548\uff08\u53e6\u89c1<code class=\"command\">\\errverbose</code>\uff0c\u5b83\u53ef\u4ee5\u7528\u6765\u5f97\u5230\u521a\u9047\u5230\u7684\u9519\u8bef\u7684\u8be6\u7ec6\u4fe1\u606f\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">SINGLELINE</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u8fd9\u4e2a\u53d8\u91cf\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-S</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">SINGLESTEP</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u8fd9\u4e2a\u53d8\u91cf\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-s</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">USER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7528\u6237\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u662f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">VERBOSITY</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u53d8\u91cf\u53ef\u4ee5\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">default</code>\u3001<code class=\"literal\">verbose</code>\u6216\u8005<code class=\"literal\">terse</code>\u6765\u63a7\u5236\u9519\u8bef\u62a5\u544a\u7684\u8be6\u7ec6\u7a0b\u5ea6\uff08\u53e6\u89c1<code class=\"command\">\\errverbose</code>\uff0c\u5728\u60f3\u5f97\u5230\u521a\u9047\u5230\u7684\u9519\u8bef\u7684\u8be6\u7ec6\u4fe1\u606f\u65f6\u4f7f\u7528\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">VERSION</code><br/></span><span class=\"term\"><code class=\"varname\">VERSION_NAME</code><br/></span><span class=\"term\"><code class=\"varname\">VERSION_NUM</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e9b\u53d8\u91cf\u5728\u7a0b\u5e8f\u542f\u52a8\u65f6\u88ab\u8bbe\u7f6e\u4ee5\u53cd\u6620<span class=\"application\">psql</span>\u7684\u7248\u672c\uff0c\u5206\u522b\u662f\u4e00\u4e2a\u8be6\u7ec6\u7684\u5b57\u7b26\u4e32\u3001\u4e00\u4e2a\u77ed\u5b57\u7b26\u4e32\uff08\u4f8b\u5982<code class=\"literal\">9.6.2</code>\u3001<code class=\"literal\">10.1</code>\u6216\u8005<code class=\"literal\">11beta1</code>\uff09\u4ee5\u53ca\u4e00\u4e2a\u6570\u5b57\uff08\u4f8b\u5982<code class=\"literal\">90602</code>\u6216\u8005<code class=\"literal\">100001</code>\uff09\u3002\u5b83\u4eec\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-INTERPOLATION\">\n<h4 lang=\"zh\"><acronym class=\"acronym\">SQL</acronym> \u63d2\u503c</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u53d8\u91cf\u7684\u4e00\u4e2a\u5173\u952e\u7279\u6027\u662f\u53ef\u4ee5\u628a\u5b83\u4eec\u66ff\u6362\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u63d2\u503c</span>\u201d</span>\uff09\u5230\u5e38\u89c4<acronym class=\"acronym\">SQL</acronym>\u8bed\u53e5\u4e2d\uff0c\u4e5f\u53ef\u4ee5\u628a\u5b83\u4eec\u66ff\u6362\u5230\u5143\u547d\u4ee4\u7684\u53c2\u6570\u4e2d\u3002\u6b64\u5916\uff0c<span class=\"application\">psql</span>\u8fd8\u63d0\u4f9b\u4e86\u529f\u80fd\u6765\u786e\u4fdd\u88ab\u7528\u4f5c SQL \u5b57\u9762\u91cf\u548c\u6807\u8bc6\u7b26\u7684\u53d8\u91cf\u503c\u4f1a\u88ab\u6b63\u786e\u5730\u52a0\u5f15\u53f7\u3002\u4e0d\u52a0\u5f15\u53f7\u5730\u63d2\u503c\u4e00\u4e2a\u503c\u7684\u8bed\u6cd5\u662f\u5728\u53d8\u91cf\u540d\u524d\u9762\u52a0\u4e0a\u4e00\u4e2a\u5192\u53f7\uff08<code class=\"literal\">:</code>\uff09\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo 'my_table'</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM :foo;</code></strong>\n</pre>\n<p lang=\"zh\">\u5c06\u67e5\u8be2\u8868<code class=\"literal\">my_table</code>\u3002\u6ce8\u610f\u8fd9\u53ef\u80fd\u4f1a\u4e0d\u5b89\u5168\uff1a\u8be5\u53d8\u91cf\u7684\u503c\u4f1a\u88ab\u6309\u5b57\u9762\u62f7\u8d1d\uff0c\u56e0\u6b64\u5b83\u53ef\u80fd\u5305\u542b\u4e0d\u5e73\u8861\u7684\u5f15\u53f7\u751a\u81f3\u53cd\u659c\u7ebf\u547d\u4ee4\u3002\u5fc5\u987b\u786e\u4fdd\u628a\u5b83\u653e\u5728\u90a3\u91cc\u662f\u6709\u610f\u4e49\u7684\u3002</p>\n<p lang=\"zh\">\u5f53\u4e00\u4e2a\u503c\u8981\u7528\u4f5c SQL \u5b57\u9762\u91cf\u6216\u6807\u8bc6\u7b26\u65f6\uff0c\u6700\u5b89\u5168\u7684\u505a\u6cd5\u662f\u4e3a\u5b83\u52a0\u4e0a\u5f15\u53f7\u3002\u8981\u5c06\u53d8\u91cf\u503c\u4f5c\u4e3a SQL \u5b57\u9762\u91cf\u52a0\u5f15\u53f7\uff0c\u5e94\u5199\u4e00\u4e2a\u5192\u53f7\uff0c\u540e\u9762\u8ddf\u7528\u5355\u5f15\u53f7\u62ec\u8d77\u6765\u7684\u53d8\u91cf\u540d\u3002\u8981\u5c06\u53d8\u91cf\u503c\u4f5c\u4e3a SQL \u6807\u8bc6\u7b26\u52a0\u5f15\u53f7\uff0c\u5219\u5728\u5192\u53f7\u540e\u9762\u7528\u53cc\u5f15\u53f7\u62ec\u8d77\u53d8\u91cf\u540d\u3002\u8fd9\u4e9b\u5199\u6cd5\u80fd\u6b63\u786e\u5904\u7406\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165\u7684\u5f15\u53f7\u548c\u5176\u4ed6\u7279\u6b8a\u5b57\u7b26\u3002\u524d\u9762\u7684\u793a\u4f8b\u53ef\u7528\u4ee5\u4e0b\u66f4\u5b89\u5168\u7684\u5199\u6cd5\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo 'my_table'</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM :\"foo\";</code></strong>\n</pre>\n<p lang=\"zh\">\u5728\u52a0\u5f15\u53f7\u7684<acronym class=\"acronym\">SQL</acronym>\u5b57\u9762\u91cf\u548c\u6807\u8bc6\u7b26\u5185\u90e8\uff0c\u4e0d\u4f1a\u6267\u884c\u53d8\u91cf\u63d2\u503c\u3002\u56e0\u6b64\uff0c<code class=\"literal\">':foo'</code>\u8fd9\u6837\u7684\u5199\u6cd5\u4e0d\u80fd\u6839\u636e\u53d8\u91cf\u503c\u751f\u6210\u52a0\u5f15\u53f7\u7684\u5b57\u9762\u91cf\uff08\u5373\u4f7f\u80fd\u591f\u751f\u6548\uff0c\u4e5f\u4e0d\u5b89\u5168\uff0c\u56e0\u4e3a\u5b83\u65e0\u6cd5\u6b63\u786e\u5904\u7406\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165\u7684\u5f15\u53f7\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8fd9\u79cd\u673a\u5236\u7684\u4e00\u4e2a\u793a\u4f8b\u662f\u628a\u4e00\u4e2a\u6587\u4ef6\u7684\u5185\u5bb9\u62f7\u8d1d\u5230\u4e00\u4e2a\u8868\u5217\u4e2d\u3002\u9996\u5148\u628a\u8be5\u6587\u4ef6\u8f7d\u5165\u5230\u4e00\u4e2a\u53d8\u91cf\uff0c\u7136\u540e\u628a\u8be5\u53d8\u91cf\u7684\u503c\u4f5c\u4e3a\u4e00\u4e2a\u52a0\u5f15\u53f7\u7684\u5b57\u7b26\u4e32\u8fdb\u884c\u63d2\u503c\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set content `cat my_file.txt`</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>INSERT INTO my_table VALUES (:'content');</code></strong>\n</pre>\n<p lang=\"zh\">\uff08\u6ce8\u610f\u5982\u679c<code class=\"filename\">my_file.txt</code>\u5305\u542b NUL \u5b57\u8282\uff0c\u8fd9\u6837\u4e5f\u4e0d\u884c\u3002<span class=\"application\">psql</span>\u4e0d\u652f\u6301\u5728\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165 NUL \u5b57\u8282\uff09\u3002</p>\n<p lang=\"zh\">\u56e0\u4e3a\u5192\u53f7\u53ef\u4ee5\u5408\u6cd5\u5730\u51fa\u73b0\u5728 SQL \u547d\u4ee4\u4e2d\uff0c\u4e00\u6b21\u660e\u663e\u7684\u63d2\u503c\u5c1d\u8bd5\uff08\u5373<code class=\"literal\">:name</code>\u3001<code class=\"literal\">:'name'</code>\u6216\u8005<code class=\"literal\">:\"name\"</code>\uff09\u4e0d\u4f1a\u88ab\u66ff\u6362\uff0c\u9664\u975e\u6240\u6307\u7684\u53d8\u91cf\u5f53\u524d\u5df2\u8bbe\u7f6e\u3002\u5728\u4efb\u4f55\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u7528\u4e00\u4e2a\u53cd\u659c\u7ebf\u5bf9\u5192\u53f7\u8fdb\u884c\u8f6c\u4e49\u4ee5\u907f\u514d\u5b83\u88ab\u66ff\u6362\u3002</p>\n<p lang=\"zh\">\u53d8\u91cf\u7684\u5192\u53f7\u8bed\u6cd5\u5bf9\u5d4c\u5165\u5f0f\u67e5\u8be2\u8bed\u8a00\uff08\u4f8b\u5982<span class=\"application\">ECPG</span>\uff09\u6765\u8bf4\u662f\u6807\u51c6\u7684<acronym class=\"acronym\">SQL</acronym>\u3002\u7528\u4e8e\u6570\u7ec4\u5207\u7247\u548c\u7c7b\u578b\u8f6c\u6362\u7684\u5192\u53f7\u8bed\u6cd5\u662f<span class=\"productname\">PostgreSQL</span>\u6269\u5c55\uff0c\u5b83\u6709\u65f6\u53ef\u80fd\u4f1a\u4e0e\u6807\u51c6\u7528\u6cd5\u51b2\u7a81\u3002\u628a\u4e00\u4e2a\u53d8\u91cf\u503c\u8f6c\u4e49\u6210 SQL \u5b57\u9762\u91cf\u6216\u8005\u6807\u8bc6\u7b26\u7684\u5192\u53f7\u52a0\u5f15\u53f7\u8bed\u6cd5\u662f\u4e00\u79cd<span class=\"application\">psql</span>\u6269\u5c55\u3002</p>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-PROMPTING\">\n<h4 lang=\"zh\">\u63d0\u793a\u7b26</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u53d1\u51fa\u7684\u63d0\u793a\u7b26\u53ef\u4ee5\u6309\u4f60\u7684\u559c\u597d\u8fdb\u884c\u5b9a\u5236\u3002<code class=\"varname\">PROMPT1</code>\u3001<code class=\"varname\">PROMPT2</code> \u548c <code class=\"varname\">PROMPT3</code> \u8fd9\u4e09\u4e2a\u53d8\u91cf\u5305\u542b\u63cf\u8ff0\u63d0\u793a\u7b26\u5916\u89c2\u7684\u5b57\u7b26\u4e32\u548c\u7279\u6b8a\u8f6c\u4e49\u5e8f\u5217\u3002\u63d0\u793a\u7b26 1 \u662f <span class=\"application\">psql</span> \u8bf7\u6c42\u65b0\u547d\u4ee4\u65f6\u53d1\u51fa\u7684\u5e38\u89c4\u63d0\u793a\u7b26\u3002\u63d0\u793a\u7b26 2 \u4f1a\u5728\u5f55\u5165\u547d\u4ee4\u671f\u95f4\u8fd8\u9700\u8981\u66f4\u591a\u8f93\u5165\u65f6\u53d1\u51fa\uff0c\u4f8b\u5982\u547d\u4ee4\u5c1a\u672a\u4ee5\u5206\u53f7\u7ed3\u675f\uff0c\u6216\u8005\u5f15\u53f7\u5c1a\u672a\u95ed\u5408\u65f6\u3002\u5728\u6267\u884c <acronym class=\"acronym\">SQL</acronym> <code class=\"command\">COPY FROM STDIN</code> \u547d\u4ee4\u5e76\u9700\u8981\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4e00\u884c\u503c\u65f6\uff0c\u4f1a\u53d1\u51fa\u63d0\u793a\u7b26 3\u3002</p>\n<p lang=\"zh\">\u6240\u9009\u63d0\u793a\u7b26\u53d8\u91cf\u7684\u503c\u4f1a\u539f\u6837\u6253\u5370\uff0c\u9664\u975e\u9047\u5230\u767e\u5206\u53f7\uff08<code class=\"literal\">%</code>\uff09\u3002\u6b64\u65f6\u4f1a\u6839\u636e\u4e0b\u4e00\u4e2a\u5b57\u7b26\u66ff\u6362\u4e3a\u5176\u4ed6\u6587\u672c\u3002\u5df2\u5b9a\u4e49\u7684\u66ff\u6362\u9879\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">%M</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5b8c\u6574\u4e3b\u673a\u540d\uff08\u542b\u57df\u540d\uff09\uff1b\u5982\u679c\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\uff0c\u5219\u4e3a<code class=\"literal\">[local]</code>\uff1b\u5982\u679c Unix \u57df\u5957\u63a5\u5b57\u4e0d\u5728\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u9ed8\u8ba4\u4f4d\u7f6e\uff0c\u5219\u4e3a<code class=\"literal\">[local:<em class=\"replaceable\"><code>/dir/name</code></em>]</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%m</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\uff0c\u5728\u7b2c\u4e00\u4e2a\u70b9\u53f7\u5904\u622a\u65ad\uff1b\u5982\u679c\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\uff0c\u5219\u4e3a<code class=\"literal\">[local]</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%&gt;</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u76d1\u542c\u7684\u7aef\u53e3\u53f7\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%n</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u4f1a\u8bdd\u7528\u6237\u540d\u3002\uff08\u5728\u6570\u636e\u5e93\u4f1a\u8bdd\u671f\u95f4\uff0c<code class=\"command\">SET SESSION AUTHORIZATION</code>\u547d\u4ee4\u53ef\u80fd\u6539\u53d8\u8be5\u503c\u7684\u6269\u5c55\u7ed3\u679c\u3002\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%/</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%~</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7c7b\u4f3c <code class=\"literal\">%/</code>\uff0c\u4f46\u5982\u679c\u8be5\u6570\u636e\u5e93\u662f\u4f60\u7684\u9ed8\u8ba4\u6570\u636e\u5e93\uff0c\u5219\u8f93\u51fa <code class=\"literal\">~</code>\uff08\u6ce2\u6d6a\u53f7\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%#</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u4f1a\u8bdd\u7528\u6237\u662f\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\uff0c\u5219\u4e3a<code class=\"literal\">#</code>\uff0c\u5426\u5219\u4e3a<code class=\"literal\">&gt;</code>\u3002\uff08\u5728\u6570\u636e\u5e93\u4f1a\u8bdd\u671f\u95f4\uff0c<code class=\"command\">SET SESSION AUTHORIZATION</code>\u547d\u4ee4\u53ef\u80fd\u6539\u53d8\u8be5\u503c\u7684\u6269\u5c55\u7ed3\u679c\u3002\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%p</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u6240\u8fde\u63a5\u540e\u7aef\u7684\u8fdb\u7a0b ID\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%R</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u63d0\u793a\u7b26 1 \u4e2d\uff0c\u901a\u5e38\u663e\u793a =\uff1b\u4f46\u5982\u679c\u4f1a\u8bdd\u5904\u4e8e\u6761\u4ef6\u5757\u4e2d\u672a\u6fc0\u6d3b\u7684\u5206\u652f\uff0c\u5219\u663e\u793a @\uff1b\u5982\u679c\u5904\u4e8e\u5355\u884c\u6a21\u5f0f\uff0c\u5219\u663e\u793a ^\uff1b\u5982\u679c\u4f1a\u8bdd\u5df2\u65ad\u5f00\u6570\u636e\u5e93\u8fde\u63a5\uff08\u4f8b\u5982 \\connect \u5931\u8d25\u65f6\uff09\uff0c\u5219\u663e\u793a !\u3002\u5728\u63d0\u793a\u7b26 2 \u4e2d\uff0c%R \u4f1a\u66ff\u6362\u4e3a\u8868\u793a psql \u7b49\u5f85\u66f4\u591a\u8f93\u5165\u539f\u56e0\u7684\u5b57\u7b26\uff1a\u547d\u4ee4\u5c1a\u672a\u7ed3\u675f\u65f6\u4e3a -\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684 /* ... */ \u6ce8\u91ca\u65f6\u4e3a *\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u5e26\u5f15\u53f7\u5b57\u7b26\u4e32\u65f6\u4e3a\u5355\u5f15\u53f7\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u5e26\u5f15\u53f7\u6807\u8bc6\u7b26\u65f6\u4e3a\u53cc\u5f15\u53f7\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u7f8e\u5143\u5f15\u7528\u5b57\u7b26\u4e32\u65f6\u4e3a\u7f8e\u5143\u7b26\u53f7\uff1b\u5b58\u5728\u672a\u5339\u914d\u7684\u5de6\u62ec\u53f7\u65f6\u4e3a (\u3002\u5728\u63d0\u793a\u7b26 3 \u4e2d\uff0c%R \u4e0d\u4ea7\u751f\u4efb\u4f55\u5185\u5bb9\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%x</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u72b6\u6001\uff1a\u5982\u679c\u5f53\u524d\u4e0d\u5728\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff1b\u5982\u679c\u5904\u4e8e\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a <code class=\"literal\">*</code>\uff1b\u5982\u679c\u5904\u4e8e\u5931\u8d25\u7684\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a <code class=\"literal\">!</code>\uff1b\u5982\u679c\u4e8b\u52a1\u72b6\u6001\u4e0d\u786e\u5b9a\uff08\u4f8b\u5982\u56e0\u4e3a\u5f53\u524d\u6ca1\u6709\u8fde\u63a5\uff09\uff0c\u5219\u4e3a <code class=\"literal\">?</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%l</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8bed\u53e5\u4e2d\u7684\u884c\u53f7\uff0c\u4ece <code class=\"literal\">1</code> \u5f00\u59cb\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%</code><em class=\"replaceable\"><code>digits</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u66ff\u6362\u4e3a\u6307\u5b9a\u516b\u8fdb\u5236\u4ee3\u7801\u5bf9\u5e94\u7684\u5b57\u7b26\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%:</code><em class=\"replaceable\"><code>name</code></em><code class=\"literal\">:</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><span class=\"application\">psql</span> \u53d8\u91cf <em class=\"replaceable\"><code>name</code></em> \u7684\u503c\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/10/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%`</code><em class=\"replaceable\"><code>command</code></em><code class=\"literal\">`</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><em class=\"replaceable\"><code>command</code></em> \u7684\u8f93\u51fa\uff0c\u7c7b\u4f3c\u666e\u901a\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u53cd\u5f15\u53f7</span>\u201d</span>\u66ff\u6362\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%[</code> ... <code class=\"literal\">%]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u63d0\u793a\u7b26\u4e2d\u53ef\u4ee5\u5305\u542b\u7ec8\u7aef\u63a7\u5236\u5b57\u7b26\uff0c\u4f8b\u5982\u6539\u53d8\u63d0\u793a\u6587\u672c\u7684\u989c\u8272\u3001\u80cc\u666f\u6216\u6837\u5f0f\uff0c\u6216\u8005\u6539\u53d8\u7ec8\u7aef\u7a97\u53e3\u6807\u9898\u3002\u4e3a\u4e86\u8ba9 <span class=\"application\">Readline</span> \u7684\u884c\u7f16\u8f91\u529f\u80fd\u6b63\u5e38\u5de5\u4f5c\uff0c\u8fd9\u4e9b\u4e0d\u53ef\u6253\u5370\u7684\u63a7\u5236\u5b57\u7b26\u5fc5\u987b\u7528 <code class=\"literal\">%[</code> \u548c <code class=\"literal\">%]</code> \u5305\u56f4\u8d77\u6765\uff0c\u4ee5\u6807\u8bb0\u4e3a\u4e0d\u53ef\u89c1\u5b57\u7b26\u3002\u63d0\u793a\u7b26\u4e2d\u53ef\u4ee5\u51fa\u73b0\u591a\u7ec4\u8fd9\u6837\u7684\u6807\u8bb0\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; \\set PROMPT1 '%[%033[1;33;40m%]%n@%/%R%[%033[0m%]%# '\n</pre>\n<p lang=\"zh\">\u5176\u6548\u679c\u662f\u5728\u517c\u5bb9 VT100 \u4e14\u652f\u6301\u989c\u8272\u7684\u7ec8\u7aef\u4e0a\uff0c\u751f\u6210\u4e00\u4e2a\u7c97\u4f53\uff08<code class=\"literal\">1;</code>\uff09\u7684\u9ed1\u5e95\u9ec4\u5b57\u63d0\u793a\u7b26\uff08<code class=\"literal\">33;40</code>\uff09\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8981\u5728\u63d0\u793a\u7b26\u4e2d\u63d2\u5165\u767e\u5206\u53f7\uff0c\u8bf7\u5199 %%\u3002\u63d0\u793a\u7b26 1 \u548c 2 \u7684\u9ed8\u8ba4\u503c\u4e3a '%/%R%# '\uff0c\u63d0\u793a\u7b26 3 \u7684\u9ed8\u8ba4\u503c\u4e3a '&gt;&gt; '\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">tcsh</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</div>\n<div class=\"refsect3\" id=\"id-1.9.4.18.8.5.5\">\n<h4 lang=\"zh\">\u547d\u4ee4\u884c\u7f16\u8f91</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u652f\u6301 <span class=\"application\">Readline</span> \u5e93\uff0c\u4fbf\u4e8e\u7f16\u8f91\u548c\u68c0\u7d22\u8f93\u5165\u884c\u3002\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\u4f1a\u5728 <span class=\"application\">psql</span> \u9000\u51fa\u65f6\u81ea\u52a8\u4fdd\u5b58\uff0c\u5e76\u5728 <span class=\"application\">psql</span> \u542f\u52a8\u65f6\u91cd\u65b0\u8f7d\u5165\u3002\u4e5f\u652f\u6301 Tab \u8865\u5168\uff0c\u4e0d\u8fc7\u5176\u8865\u5168\u903b\u8f91\u5e76\u4e0d\u58f0\u79f0\u81ea\u5df1\u662f <acronym class=\"acronym\">SQL</acronym> \u89e3\u6790\u5668\u3002Tab \u8865\u5168\u751f\u6210\u7684\u67e5\u8be2\u8fd8\u53ef\u80fd\u5e72\u6270\u5176\u4ed6 SQL \u547d\u4ee4\uff0c\u4f8b\u5982 <code class=\"literal\">SET TRANSACTION ISOLATION LEVEL</code>\u3002\u5982\u679c\u51fa\u4e8e\u67d0\u79cd\u539f\u56e0\u4f60\u4e0d\u559c\u6b22 Tab \u8865\u5168\uff0c\u53ef\u4ee5\u5c06\u4ee5\u4e0b\u5185\u5bb9\u653e\u5165\u4e3b\u76ee\u5f55\u4e0b\u540d\u4e3a <code class=\"filename\">.inputrc</code> \u7684\u6587\u4ef6\u4e2d\uff0c\u5c06\u5176\u5173\u95ed\uff1a</p>\n<pre class=\"programlisting\">$if psql\nset disable-completion on\n$endif\n</pre>\n<p lang=\"zh\">\uff08\u8fd9\u4e0d\u662f <span class=\"application\">psql</span> \u7684\u529f\u80fd\uff0c\u800c\u662f <span class=\"application\">Readline</span> \u7684\u529f\u80fd\u3002\u66f4\u591a\u7ec6\u8282\u8bf7\u9605\u8bfb\u5176\u6587\u6863\u3002\uff09</p>\n</div>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PSQL-ENVIRONMENT\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">COLUMNS</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c<code class=\"literal\">\\pset columns</code>\u4e3a\u96f6\uff0c\u8fd9\u4e2a\u73af\u5883\u53d8\u91cf\u63a7\u5236\u7528\u4e8e<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u5bbd\u5ea6\u4ee5\u53ca\u7528\u6765\u786e\u5b9a\u662f\u5426\u8f93\u51fa\u9700\u8981\u7528\u5230\u5206\u9875\u5668\u6216\u8005\u5207\u6362\u5230\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e2d\u7684\u5782\u76f4\u683c\u5f0f\u7684\u5bbd\u5ea6\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PAGER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u67e5\u8be2\u7ed3\u679c\u65e0\u6cd5\u5728\u5c4f\u5e55\u4e0a\u5b8c\u6574\u663e\u793a\uff0c\u5219\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u9012\u7ed9\u8fd9\u4e2a\u547d\u4ee4\u3002\u5178\u578b\u503c\u4e3a<code class=\"literal\">more</code>\u6216<code class=\"literal\">less</code>\u3002\u9ed8\u8ba4\u503c\u53d6\u51b3\u4e8e\u5e73\u53f0\u3002\u53ef\u4ee5\u5c06<code class=\"envar\">PAGER</code>\u8bbe\u7f6e\u4e3a\u7a7a\uff0c\u6216\u4f7f\u7528<code class=\"command\">\\pset</code>\u547d\u4ee4\u4e2d\u4e0e\u5206\u9875\u5668\u6709\u5173\u7684\u9009\u9879\u6765\u7981\u7528\u5206\u9875\u5668\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PGDATABASE</code><br/></span><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\uff08\u89c1<a class=\"xref\" href=\"/docs/10/libpq-envars.html\" title=\"33.14.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a033.14\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PSQL_EDITOR</code><br/></span><span class=\"term\"><code class=\"envar\">EDITOR</code><br/></span><span class=\"term\"><code class=\"envar\">VISUAL</code></span></dt>\n<dd>\n<p lang=\"zh\"><code class=\"command\">\\e</code>\u3001<code class=\"command\">\\ef</code>\u548c<code class=\"command\">\\ev</code>\u547d\u4ee4\u4f7f\u7528\u7684\u7f16\u8f91\u5668\u3002\u6309\u5217\u51fa\u7684\u987a\u5e8f\u68c0\u67e5\u8fd9\u4e9b\u53d8\u91cf\uff0c\u4f7f\u7528\u7b2c\u4e00\u4e2a\u5df2\u8bbe\u7f6e\u7684\u53d8\u91cf\u3002</p>\n<p lang=\"zh\">\u5185\u7f6e\u7684\u9ed8\u8ba4\u7f16\u8f91\u5668\u5728 Unix \u7cfb\u7edf\u4e0a\u4e3a<code class=\"filename\">vi</code>\uff0c\u5728 Windows \u7cfb\u7edf\u4e0a\u4e3a<code class=\"filename\">notepad.exe</code>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PSQL_EDITOR_LINENUMBER_ARG</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f53 <code class=\"command\">\\e</code>\u3001<code class=\"command\">\\ef</code> \u6216 <code class=\"command\">\\ev</code> \u5e26\u6709\u884c\u53f7\u53c2\u6570\u4f7f\u7528\u65f6\uff0c\u6b64\u53d8\u91cf\u6307\u5b9a\u5c06\u8d77\u59cb\u884c\u53f7\u4f20\u7ed9\u7528\u6237\u7f16\u8f91\u5668\u65f6\u6240\u7528\u7684\u547d\u4ee4\u884c\u53c2\u6570\u3002\u5bf9\u4e8e <span class=\"productname\">Emacs</span> \u6216 <span class=\"productname\">vi</span> \u4e4b\u7c7b\u7684\u7f16\u8f91\u5668\uff0c\u8fd9\u4e2a\u53c2\u6570\u662f\u4e00\u4e2a\u52a0\u53f7\u3002\u5982\u679c\u9009\u9879\u540d\u548c\u884c\u53f7\u4e4b\u95f4\u9700\u8981\u7a7a\u683c\uff0c\u8bf7\u5728\u53d8\u91cf\u503c\u4e2d\u5305\u542b\u672b\u5c3e\u7a7a\u683c\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">PSQL_EDITOR_LINENUMBER_ARG='+'\nPSQL_EDITOR_LINENUMBER_ARG='--line '\n</pre>\n<p lang=\"zh\">\u5728 Unix \u7cfb\u7edf\u4e0a\u9ed8\u8ba4\u662f<code class=\"literal\">+</code>\uff08\u5bf9\u5e94\u4e8e\u9ed8\u8ba4\u7f16\u8f91\u5668<code class=\"filename\">vi</code>\uff0c\u4e14\u5bf9\u5f88\u591a\u5176\u4ed6\u5e38\u89c1\u7f16\u8f91\u5668\u53ef\u7528\uff09\u3002\u5728 Windows \u7cfb\u7edf\u4e0a\u6ca1\u6709\u9ed8\u8ba4\u503c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PSQL_HISTORY</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u547d\u4ee4\u5386\u53f2\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08<code class=\"literal\">~</code>\uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PSQLRC</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7528\u6237\u7684<code class=\"filename\">.psqlrc</code>\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08<code class=\"literal\">~</code>\uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">SHELL</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u88ab<code class=\"command\">\\!</code>\u547d\u4ee4\u6267\u884c\u7684\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">TMPDIR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b58\u50a8\u4e34\u65f6\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u662f<code class=\"filename\">/tmp</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u548c\u5927\u90e8\u5206\u5176\u4ed6<span class=\"productname\">PostgreSQL</span>\u5de5\u5177\u4e00\u6837\uff0c\u8fd9\u4e2a\u5de5\u5177\u4e5f\u4f7f\u7528<span class=\"application\">libpq</span>\u6240\u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/10/libpq-envars.html\" title=\"33.14.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a033.14\u00a0\u8282</a>\uff09\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.18.10\">\n<h2 lang=\"zh\">\u6587\u4ef6</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt lang=\"zh\"><span class=\"term\"><code class=\"filename\">psqlrc</code> \u548c <code class=\"filename\">~/.psqlrc</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u6ca1\u6709<code class=\"option\">-X</code>\u9009\u9879\uff0c\u5728\u8fde\u63a5\u5230\u6570\u636e\u5e93\u540e\u4f46\u5728\u63a5\u6536\u6b63\u5e38\u7684\u547d\u4ee4\u4e4b\u524d\uff0c<span class=\"application\">psql</span>\u4f1a\u5c1d\u8bd5\u4f9d\u6b21\u4ece\u7cfb\u7edf\u7ea7\u7684\u542f\u52a8\u6587\u4ef6\uff08<code class=\"filename\">psqlrc</code>\uff09\u548c\u7528\u6237\u7684\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\uff08<code class=\"filename\">~/.psqlrc</code>\uff09\u4e2d\u8bfb\u53d6\u5e76\u4e14\u6267\u884c\u547d\u4ee4\u3002\u8fd9\u4e9b\u6587\u4ef6\u53ef\u4ee5\u88ab\u7528\u6765\u8bbe\u7f6e\u5ba2\u6237\u7aef\u6216\u8005\u670d\u52a1\u5668\uff0c\u901a\u5e38\u662f\u4e00\u4e9b<code class=\"command\">\\set</code>\u548c<code class=\"command\">SET</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u7cfb\u7edf\u8303\u56f4\u7684\u542f\u52a8\u6587\u4ef6\u540d\u4e3a <code class=\"filename\">psqlrc</code>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4f1a\u5728\u5b89\u88c5\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u7cfb\u7edf\u914d\u7f6e</span>\u201d</span>\u76ee\u5f55\u4e2d\u67e5\u627e\u5b83\uff0c\u6700\u53ef\u9760\u7684\u8bc6\u522b\u65b9\u5f0f\u662f\u8fd0\u884c <code class=\"literal\">pg_config --sysconfdir</code>\u3002\u901a\u5e38\u8fd9\u4e2a\u76ee\u5f55\u662f\u76f8\u5bf9\u4e8e\u5305\u542b <span class=\"productname\">PostgreSQL</span> \u53ef\u6267\u884c\u6587\u4ef6\u7684\u76ee\u5f55\u7684 <code class=\"filename\">../etc/</code>\u3002\u4e5f\u53ef\u4ee5\u901a\u8fc7 <code class=\"envar\">PGSYSCONFDIR</code> \u73af\u5883\u53d8\u91cf\u663e\u5f0f\u6307\u5b9a\u67e5\u627e\u76ee\u5f55\u3002</p>\n<p lang=\"zh\">\u7528\u6237\u7684\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\u540d\u4e3a<code class=\"filename\">.psqlrc</code>\uff0c\u5e76\u4e14\u5728\u8c03\u7528\u7528\u6237\u7684\u4e3b\u76ee\u5f55\u4e2d\u5bfb\u627e\u3002Windows \u6ca1\u6709\u4e3b\u76ee\u5f55\u8fd9\u4e00\u6982\u5ff5\uff0c\u5728 Windows \u4e0a\uff0c\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\u7684\u540d\u79f0\u4e3a<code class=\"filename\">%APPDATA%\\postgresql\\psqlrc.conf</code>\u3002\u5728\u4efb\u4f55\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e<code class=\"envar\">PSQLRC</code>\u73af\u5883\u53d8\u91cf\u6765\u8986\u76d6\u6b64\u9ed8\u8ba4\u6587\u4ef6\u8def\u5f84\u3002</p>\n<p lang=\"zh\">\u7cfb\u7edf\u8303\u56f4\u7684\u542f\u52a8\u6587\u4ef6\u548c\u7528\u6237\u4e2a\u4eba\u7684\u542f\u52a8\u6587\u4ef6\u90fd\u53ef\u4ee5\u901a\u8fc7\u5728\u6587\u4ef6\u540d\u540e\u9644\u52a0\u8fde\u5b57\u7b26\u548c<span class=\"productname\">PostgreSQL</span>\u7684\u5927\u7248\u672c\u6216\u5c0f\u7248\u672c\u53f7\u6765\u4f7f\u5176\u4e0e<span class=\"application\">psql</span>\u7248\u672c\u76f8\u5173\uff0c\u4f8b\u5982<code class=\"filename\">~/.psqlrc-9.2</code>\u6216<code class=\"filename\">~/.psqlrc-9.2.5</code>\u3002\u6700\u5177\u4f53\u7248\u672c\u5339\u914d\u7684\u6587\u4ef6\u5c06\u4f18\u5148\u8bfb\u53d6\uff0c\u800c\u4e0d\u662f\u975e\u7279\u5b9a\u7248\u672c\u7684\u6587\u4ef6\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"filename\">.psql_history</code></span></dt>\n<dd>\n<p lang=\"zh\">\u547d\u4ee4\u884c\u5386\u53f2\u88ab\u5b58\u50a8\u5728\u6587\u4ef6<code class=\"filename\">~/.psql_history</code>\u4e2d\uff0c\u6216\u8005\u662f Windows \u7684\u6587\u4ef6<code class=\"filename\">%APPDATA%\\postgresql\\psql_history</code>\u4e2d\u3002</p>\n<p lang=\"zh\">\u5386\u53f2\u6587\u4ef6\u7684\u4f4d\u7f6e\u53ef\u4ee5\u901a\u8fc7<code class=\"varname\">HISTFILE</code> <span class=\"application\">psql</span>\u53d8\u91cf\u6216\u8005<code class=\"envar\">PSQL_HISTORY</code>\u73af\u5883\u53d8\u91cf\u663e\u5f0f\u8bbe\u7f6e\u3002</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.18.11\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">psql</span>\u6700\u9002\u5408\u4e0e\u76f8\u540c\u6216\u8f83\u65e7\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\u914d\u5408\u4f7f\u7528\u3002\u5982\u679c\u670d\u52a1\u5668\u7684\u7248\u672c\u6bd4<span class=\"application\">psql</span>\u672c\u8eab\u66f4\u65b0\uff0c\u53cd\u659c\u7ebf\u547d\u4ee4\u7279\u522b\u5bb9\u6613\u5931\u8d25\u3002\u7136\u800c\uff0c<code class=\"literal\">\\d</code>\u7cfb\u5217\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u5e94\u8be5\u53ef\u4ee5\u5728\u6700\u4f4e\u81f3 7.4 \u7248\u672c\u7684\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\uff0c\u4f46\u4e0d\u4e00\u5b9a\u9002\u7528\u4e8e\u6bd4<span class=\"application\">psql</span>\u672c\u8eab\u66f4\u65b0\u7684\u670d\u52a1\u5668\u3002\u8fd0\u884cSQL\u547d\u4ee4\u548c\u663e\u793a\u67e5\u8be2\u7ed3\u679c\u7684\u4e00\u822c\u529f\u80fd\u4e5f\u5e94\u8be5\u53ef\u4ee5\u5728\u66f4\u65b0\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\uff0c\u4f46\u4e0d\u80fd\u4fdd\u8bc1\u5728\u6240\u6709\u60c5\u51b5\u4e0b\u90fd\u80fd\u5b9e\u73b0\u3002</p>\n<p>\u5982\u679c\u4f60\u60f3\u7528<span class=\"application\">psql</span>\u8fde\u63a5\u5230\u591a\u4e2a\u5177\u6709\u4e0d\u540c\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\uff0c\u63a8\u8350\u4f7f\u7528\u6700\u65b0\u7248\u672c\u7684<span class=\"application\">psql</span>\u3002\u6216\u8005\uff0c\u4f60\u53ef\u4ee5\u4e3a\u6bcf\u4e00\u4e2a\u5927\u7248\u672c\u4fdd\u7559\u4e00\u4efd<span class=\"application\">psql</span>\u62f7\u8d1d\uff0c\u5e76\u4e14\u9488\u5bf9\u76f8\u5e94\u7684\u670d\u52a1\u5668\u4f7f\u7528\u5339\u914d\u7684\u7248\u672c\u3002\u4f46\u5b9e\u9645\u4e0a\uff0c\u8fd9\u79cd\u989d\u5916\u7684\u9ebb\u70e6\u662f\u4e0d\u5fc5\u8981\u7684\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5728 <span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\uff0c<code class=\"option\">-c</code> \u9009\u9879\u610f\u5473\u7740 <code class=\"option\">-X</code>\uff08<code class=\"option\">--no-psqlrc</code>\uff09\uff1b\u73b0\u5728\u5df2\u7ecf\u4e0d\u662f\u8fd9\u6837\u4e86\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5728<span class=\"productname\">PostgreSQL</span> 8.4 \u4e4b\u524d\uff0c<span class=\"application\">psql</span>\u5141\u8bb8\u4e00\u4e2a\u5355\u5b57\u6bcd\u53cd\u659c\u7ebf\u547d\u4ee4\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u76f4\u63a5\u5199\u5728\u8be5\u547d\u4ee4\u540e\u9762\uff0c\u4e2d\u95f4\u4e0d\u9700\u8981\u7a7a\u767d\u3002\u73b0\u5728\u5219\u8981\u6c42\u7528\u7a7a\u767d\u5206\u9694\u3002</p>\n</li>\n</ul>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.18.12\">\n<h2 lang=\"zh\">\u7ed9 Windows \u7528\u6237\u7684\u6ce8\u89e3</h2>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u662f\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u63a7\u5236\u53f0\u5e94\u7528</span>\u201d</span>\u3002\u7531\u4e8e Windows \u7684\u63a7\u5236\u53f0\u7a97\u53e3\u4f7f\u7528\u7684\u662f\u4e00\u79cd\u548c\u7cfb\u7edf\u4e2d\u5176\u4ed6\u5e94\u7528\u4e0d\u540c\u7684\u7f16\u7801\uff0c\u5728<span class=\"application\">psql</span>\u4e2d\u4f7f\u7528 8 \u4f4d\u5b57\u7b26\u65f6\u8981\u7279\u522b\u6ce8\u610f\u3002\u5982\u679c<span class=\"application\">psql</span>\u68c0\u6d4b\u5230\u4e00\u4e2a\u6709\u95ee\u9898\u7684\u63a7\u5236\u53f0\u4ee3\u7801\u9875\uff0c\u5b83\u5c06\u4f1a\u5728\u542f\u52a8\u65f6\u8b66\u544a\u4f60\u3002\u8981\u66f4\u6539\u63a7\u5236\u53f0\u4ee3\u7801\u9875\uff0c\u6709\u4e24\u4ef6\u4e8b\u662f\u5fc5\u8981\u7684\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u8f93\u5165<strong class=\"userinput\"><code>cmd.exe /c chcp 1252</code></strong>\u53ef\u4ee5\u8bbe\u7f6e\u4ee3\u7801\u9875\uff081252 \u662f\u9002\u7528\u4e8e\u5fb7\u8bed\u7684\u4e00\u4e2a\u4ee3\u7801\u9875\uff0c\u8bf7\u5728\u8fd9\u91cc\u66ff\u6362\u6210\u4f60\u7684\u503c\uff09\u3002\u5982\u679c\u6b63\u5728\u4f7f\u7528 Cygwin\uff0c\u53ef\u4ee5\u628a\u8fd9\u4e2a\u547d\u4ee4\u653e\u5728<code class=\"filename\">/etc/profile</code>\u4e2d\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u628a\u63a7\u5236\u53f0\u5b57\u4f53\u8bbe\u7f6e\u4e3a<code class=\"literal\">Lucida Console</code>\uff0c\u56e0\u4e3a\u6805\u683c\u5b57\u4f53\u65e0\u6cd5\u4e0e ANSI \u4ee3\u7801\u9875\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</li>\n</ul>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PSQL-EXAMPLES\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u7b2c\u4e00\u4e2a\u793a\u4f8b\u5c55\u793a\u5982\u4f55\u5c06\u4e00\u4e2a\u547d\u4ee4\u5206\u6563\u5728\u591a\u884c\u8f93\u5165\u4e2d\u3002\u8bf7\u6ce8\u610f\u63d0\u793a\u7b26\u7684\u53d8\u5316\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>CREATE TABLE my_table (</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code> first integer not null default 0,</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code> second text)</code></strong>\ntestdb-&gt; <strong class=\"userinput\"><code>;</code></strong>\nCREATE TABLE\n</pre>\n<p lang=\"zh\">\u73b0\u5728\u518d\u770b\u770b\u8868\u5b9a\u4e49\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\d my_table</code></strong>\n              Table \"public.my_table\"\n Column |  Type   | Collation | Nullable | Default\n--------+---------+-----------+----------+---------\n first  | integer |           | not null | 0\n second | text    |           |          | \n</pre>\n<p lang=\"zh\">\u73b0\u5728\u6211\u4eec\u628a\u63d0\u793a\u7b26\u6539\u5f97\u66f4\u6709\u8da3\u4e00\u4e9b\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set PROMPT1 '%n@%m %~%R%# '</code></strong>\npeter@localhost testdb=&gt;\n</pre>\n<p lang=\"zh\">\u5047\u8bbe\u4f60\u5df2\u7ecf\u5728\u8868\u4e2d\u586b\u5165\u6570\u636e\uff0c\u5e76\u60f3\u67e5\u770b\u4e00\u4e0b\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; SELECT * FROM my_table;\n first | second\n-------+--------\n     1 | one\n     2 | two\n     3 | three\n     4 | four\n(4 rows)\n</pre>\n<p lang=\"zh\">\u8981\u4ee5\u4e0d\u540c\u65b9\u5f0f\u663e\u793a\u8868\u683c\uff0c\u53ef\u4ee5\u4f7f\u7528<code class=\"command\">\\pset</code>\u547d\u4ee4\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 2</code></strong>\nBorder style is 2.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\n+-------+--------+\n| first | second |\n+-------+--------+\n|     1 | one    |\n|     2 | two    |\n|     3 | three  |\n|     4 | four   |\n+-------+--------+\n(4 rows)\n\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 0</code></strong>\nBorder style is 0.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\nfirst second\n----- ------\n    1 one\n    2 two\n    3 three\n    4 four\n(4 rows)\n\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 1</code></strong>\nBorder style is 1.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset format unaligned</code></strong>\nOutput format is unaligned.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset fieldsep \",\"</code></strong>\nField separator is \",\".\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset tuples_only</code></strong>\nShowing only tuples.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT second, first FROM my_table;</code></strong>\none,1\ntwo,2\nthree,3\nfour,4\n</pre>\n<p lang=\"zh\">\u4e5f\u53ef\u4ee5\u4f7f\u7528\u7b80\u77ed\u547d\u4ee4\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\a \\t \\x</code></strong>\nOutput format is aligned.\nTuples only is off.\nExpanded display is on.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\n-[ RECORD 1 ]-\nfirst  | 1\nsecond | one\n-[ RECORD 2 ]-\nfirst  | 2\nsecond | two\n-[ RECORD 3 ]-\nfirst  | 3\nsecond | three\n-[ RECORD 4 ]-\nfirst  | 4\nsecond | four\n</pre>\n<p lang=\"zh\">\u5728\u9002\u5408\u7684\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u4f7f\u7528 <code class=\"command\">\\crosstabview</code> \u547d\u4ee4\u5c06\u67e5\u8be2\u7ed3\u679c\u663e\u793a\u4e3a\u4ea4\u53c9\u8868\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>SELECT first, second, first &gt; 2 AS gt2 FROM my_table;</code></strong>\n first | second | gt2 \n-------+--------+-----\n     1 | one    | f\n     2 | two    | f\n     3 | three  | t\n     4 | four   | t\n(4 rows)\n\ntestdb=&gt; <strong class=\"userinput\"><code>\\crosstabview first second</code></strong>\n first | one | two | three | four \n-------+-----+-----+-------+------\n     1 | f   |     |       | \n     2 |     | f   |       | \n     3 |     |     | t     | \n     4 |     |     |       | t\n(4 rows)\n</pre>\n<p lang=\"zh\">\u7b2c\u4e8c\u4e2a\u793a\u4f8b\u5c55\u793a\u4e86\u4e00\u4e2a\u4e58\u6cd5\u8868\uff0c\u5176\u4e2d\u884c\u6309\u6570\u5b57\u5012\u5e8f\u6392\u5217\uff0c\u800c\u5217\u6309\u72ec\u7acb\u7684\u5347\u5e8f\u6570\u5b57\u6392\u5217\u3002</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>SELECT t1.first as \"A\", t2.first+100 AS \"B\", t1.first*(t2.first+100) as \"AxB\",</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code>row_number() over(order by t2.first) AS ord</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code>FROM my_table t1 CROSS JOIN my_table t2 ORDER BY 1 DESC</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code>\\crosstabview \"A\" \"B\" \"AxB\" ord</code></strong>\n A | 101 | 102 | 103 | 104 \n---+-----+-----+-----+-----\n 4 | 404 | 408 | 412 | 416\n 3 | 303 | 306 | 309 | 312\n 2 | 202 | 204 | 206 | 208\n 1 | 101 | 102 | 103 | 104\n(4 rows)\n</pre></div>\n</div></div>", "manual_path": "app-psql.html", "localization": {"status": "complete", "sources": [{"url": "/docs/10/app-psql.html", "method": "same-major semantic node", "sha256": "07e2383663e136e49c565dc43b76b773af4caa89393ce1854d32ec8cc15f2d3c", "language": "zh", "matched_nodes": ["#APP-PSQL/div[10]/div[1]/ul[0]/li[0]", "#APP-PSQL/div[10]/div[1]/ul[0]/li[1]", "#APP-PSQL/div[10]/div[1]/ul[0]/li[2]", "#APP-PSQL/div[10]/h2[0]", "#APP-PSQL/div[11]/div[2]/ul[0]/li[0]", "#APP-PSQL/div[11]/div[2]/ul[0]/li[1]", "#APP-PSQL/div[11]/h2[0]", "#APP-PSQL/div[11]/p[1]", "#APP-PSQL/div[12]/p[11]", "#APP-PSQL/div[12]/p[13]", "#APP-PSQL/div[12]/p[15]", "#APP-PSQL/div[12]/p[1]", "#APP-PSQL/div[12]/p[3]", "#APP-PSQL/div[12]/p[5]", "#APP-PSQL/div[12]/p[7]", "#APP-PSQL/div[12]/p[9]", "#APP-PSQL/div[2]/p[1]", "#APP-PSQL/div[3]/h2[0]", "#APP-PSQL/div[4]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[11]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[13]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[15]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[15]/p[2]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[19]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[21]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[23]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[23]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[25]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[27]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[29]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[33]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[35]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[37]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[39]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[3]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[41]/div[1]/h3[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[41]/div[1]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[41]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[45]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[47]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[49]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[51]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[53]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[53]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[55]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[55]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[57]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[59]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[5]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[61]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[63]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[65]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[65]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[67]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[3]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[5]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[6]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[7]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[9]", "#APP-PSQL/div[6]/h2[0]", "#APP-PSQL/div[6]/p[1]", "#APP-PSQL/div[7]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[1]/p[1]", "#APP-PSQL/div[7]/div[1]/p[2]", "#APP-PSQL/div[7]/div[1]/p[5]", "#APP-PSQL/div[7]/div[1]/p[6]", "#APP-PSQL/div[7]/div[1]/p[7]", "#APP-PSQL/div[7]/div[2]/h3[0]", "#APP-PSQL/div[7]/div[2]/p[1]", "#APP-PSQL/div[7]/div[2]/p[3]", "#APP-PSQL/div[7]/div[2]/p[4]", "#APP-PSQL/div[7]/div[2]/p[5]", "#APP-PSQL/div[7]/div[2]/p[6]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[101]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[101]/p[0]/a[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[101]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[101]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[101]/p[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[103]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[105]/div[2]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[105]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[105]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[107]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[109]/div[2]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[109]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[109]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[111]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[111]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[111]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[111]/p[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[111]/p[6]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[113]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[115]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[117]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[119]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[119]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[119]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]/div[5]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[121]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[123]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[125]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[125]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[125]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[127]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[129]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[131]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[131]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[3]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[3]/dl[0]/dd[13]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[3]/dl[0]/dd[13]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[3]/dl[0]/dd[13]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[3]/dl[0]/dd[13]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[3]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[3]/dl[0]/dd[15]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[3]/dl[0]/dd[15]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[3]/dl[0]/dd[15]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[3]/dl[0]/dd[15]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[3]/dl[0]/dd[17]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[3]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[3]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[3]/dl[0]/dd[21]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[3]/dl[0]/dd[25]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[3]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[3]/dl[0]/dd[29]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[3]/dl[0]/dd[29]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[3]/dl[0]/dd[31]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[3]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[3]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[3]/dl[0]/dd[37]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[3]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[3]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[3]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[3]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[3]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[3]/dl[0]/dt[28]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[3]/dl[0]/dt[30]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[3]/dl[0]/dt[32]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[3]/dl[0]/dt[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/div[5]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/p[4]/a[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[139]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[141]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[143]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[143]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[143]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[143]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[143]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[149]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[149]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[149]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[153]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[157]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[157]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[159]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[15]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[15]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[161]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[163]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[165]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[165]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[167]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[167]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[169]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[0]/a[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[21]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[23]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[25]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[29]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[29]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[29]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[31]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[33]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[33]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[37]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[41]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[41]/div[1]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[41]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[43]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[45]/div[1]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[45]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[47]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[49]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[51]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[53]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[55]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[57]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[59]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[61]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[63]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[65]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[67]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[67]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[69]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[69]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[71]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[73]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[75]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[77]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[79]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[7]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[7]/div[1]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[7]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[81]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[83]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[83]/div[3]/p[1]/a[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[83]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[83]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[83]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[85]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[85]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[85]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[87]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[87]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[87]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[87]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[89]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[91]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[93]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[93]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[93]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[93]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[95]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[97]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[97]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[97]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[99]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[104]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[106]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[108]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[112]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[114]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[124]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[126]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[134]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[138]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[158]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[82]", "#APP-PSQL/div[7]/div[3]/div[11]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/p[6]", "#APP-PSQL/div[7]/div[3]/h3[0]", "#APP-PSQL/div[7]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/p[2]", "#APP-PSQL/div[7]/div[3]/p[3]", "#APP-PSQL/div[7]/div[3]/p[4]", "#APP-PSQL/div[7]/div[3]/p[4]/a[2]", "#APP-PSQL/div[7]/div[3]/p[5]", "#APP-PSQL/div[7]/div[3]/p[7]", "#APP-PSQL/div[7]/div[3]/p[8]", "#APP-PSQL/div[7]/div[3]/p[9]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[13]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[13]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[15]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[17]/p[2]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/div[2]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[21]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[25]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[31]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[33]/p[0]/a[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[37]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[41]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[43]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[45]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[47]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[49]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[4]/div[1]/div[8]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/p[10]", "#APP-PSQL/div[7]/div[4]/div[1]/p[11]", "#APP-PSQL/div[7]/div[4]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/p[2]", "#APP-PSQL/div[7]/div[4]/div[1]/p[4]", "#APP-PSQL/div[7]/div[4]/div[1]/p[6]", "#APP-PSQL/div[7]/div[4]/div[1]/p[7]", "#APP-PSQL/div[7]/div[4]/div[1]/p[9]", "#APP-PSQL/div[7]/div[4]/div[2]/p[10]", "#APP-PSQL/div[7]/div[4]/div[2]/p[11]", "#APP-PSQL/div[7]/div[4]/div[2]/p[1]", "#APP-PSQL/div[7]/div[4]/div[2]/p[3]", "#APP-PSQL/div[7]/div[4]/div[2]/p[4]", "#APP-PSQL/div[7]/div[4]/div[2]/p[6]", "#APP-PSQL/div[7]/div[4]/div[2]/p[7]", "#APP-PSQL/div[7]/div[4]/div[2]/p[9]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[15]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[21]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[23]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[25]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[29]/p[0]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[29]/p[2]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[4]/div[3]/div[5]/p[1]", "#APP-PSQL/div[7]/div[4]/div[3]/p[1]", "#APP-PSQL/div[7]/div[4]/div[3]/p[2]", "#APP-PSQL/div[7]/div[4]/div[4]/h4[0]", "#APP-PSQL/div[7]/div[4]/div[4]/p[1]", "#APP-PSQL/div[7]/div[4]/div[4]/p[3]", "#APP-PSQL/div[7]/div[4]/h3[0]", "#APP-PSQL/div[7]/h2[0]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[11]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[13]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[15]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[17]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[1]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[3]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[5]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[7]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[7]/p[0]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[7]/p[1]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]/p[0]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]/p[2]", "#APP-PSQL/div[8]/p[2]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[0]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[1]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[2]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[3]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[3]/p[0]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[3]/p[1]", "#APP-PSQL/div[9]/div[1]/dl[0]/dt[0]", "#APP-PSQL/div[9]/h2[0]"]}, {"url": "/docs/10/indexes-index-only-scans.html", "method": "same-major semantic node", "sha256": "5a260324b303f554b069d3652848efeadce5bdd3822e03a8b15661eb18fca08b", "language": "zh", "matched_nodes": ["#INDEXES-INDEX-ONLY-SCANS/p[13]/span[2]"]}], "language": "zh", "original_text": {"/versions/10/description/0": "psql \u2014 PostgreSQL interactive terminal", "/versions/10/facts/0/label": "Documented executable", "/versions/10/facts/1/label": "Executable version", "/versions/10/facts/2/label": "Reference inventory", "/versions/10/facts/2/value": "Client applications", "/versions/10/facts/3/label": "Option definition groups", "/versions/10/tables/0/title": "Documented options", "/versions/10/tables/1/title": "Environment variables", "/versions/10/related/0/label": "psql meta-commands", "/versions/10/related/1/label": "libpq connection parameters", "/versions/10/tables/0/rows/0/summary": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all .", "/versions/10/tables/0/rows/1/summary": "Switches to unaligned output mode. (The default output mode is otherwise aligned.) This is equivalent to \\pset format unaligned .", "/versions/10/tables/0/rows/2/summary": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors .", "/versions/10/tables/0/rows/3/summary": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence.", "/versions/10/tables/0/rows/4/summary": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "/versions/10/tables/0/rows/5/summary": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries .", "/versions/10/tables/0/rows/6/summary": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on .", "/versions/10/tables/0/rows/7/summary": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i .", "/versions/10/tables/0/rows/8/summary": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f .", "/versions/10/tables/0/rows/9/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket.", "/versions/10/tables/0/columns/0/label": "Option and arguments", "/versions/10/tables/0/columns/1/label": "Description", "/versions/10/tables/0/rows/10/summary": "Turn on HTML tabular output. This is equivalent to \\pset format html or the \\H command.", "/versions/10/tables/0/rows/11/summary": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list .", "/versions/10/tables/0/rows/12/summary": "Write all query output into file filename , in addition to the normal output destination.", "/versions/10/tables/0/rows/13/summary": "Do not use Readline for line editing and do not use the command history. This can be useful to turn off tab expansion when cutting and pasting.", "/versions/10/tables/0/rows/14/summary": "Put all query output into file filename . This is equivalent to the command \\o .", "/versions/10/tables/0/rows/15/summary": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432.", "/versions/10/tables/0/rows/16/summary": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex .", "/versions/10/tables/0/rows/17/summary": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on .", "/versions/10/tables/0/rows/18/summary": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep .", "/versions/10/tables/0/rows/19/summary": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts.", "/versions/10/tables/0/rows/20/summary": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does.", "/versions/10/tables/0/rows/21/summary": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only .", "/versions/10/tables/0/rows/22/summary": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details.", "/versions/10/tables/0/rows/23/summary": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)", "/versions/10/tables/0/rows/24/summary": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later.", "/versions/10/tables/0/rows/25/summary": "Print the psql version and exit.", "/versions/10/tables/0/rows/26/summary": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/10/tables/0/rows/27/summary": "Force psql to prompt for a password before connecting to a database, even if the password will not be used.", "/versions/10/tables/0/rows/28/summary": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded .", "/versions/10/tables/0/rows/29/summary": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file).", "/versions/10/tables/0/rows/30/summary": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero .", "/versions/10/tables/0/rows/31/summary": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero .", "/versions/10/tables/0/rows/32/summary": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. This ensures that either all the commands complete successfully, or no changes are applied.", "/versions/10/tables/0/rows/33/summary": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables.", "/versions/10/tables/1/columns/0/label": "Variable", "/versions/10/tables/1/columns/1/label": "Meaning", "/versions/10/tables/1/rows/0/description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode.", "/versions/10/tables/1/rows/1/description": "If the query results do not fit on the screen, they are piped through this command. Typical values are more or less . The default is platform-dependent. Use of the pager can be disabled by setting PAGER to empty, or by using pager-related options of the \\pset command.", "/versions/10/tables/1/rows/2/description": "Default connection parameters (see Section 33.14 ).", "/versions/10/tables/1/rows/3/description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. The built-in default editors are vi on Unix systems and notepad.exe on Windows systems.", "/versions/10/tables/1/rows/4/description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems.", "/versions/10/tables/1/rows/5/description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed.", "/versions/10/tables/1/rows/6/description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed.", "/versions/10/tables/1/rows/7/description": "Command executed by the \\! command.", "/versions/10/tables/1/rows/8/description": "Directory for storing temporary files. The default is /tmp ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "299f2b216d903b85503c13a32e1743bea252c62bb820a17e91d3ea99875e80f0"}, "comparison_data": {"options": [{"names": ["-a", "--echo-all"], "signature": "-a --echo-all", "description": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all ."}, {"names": ["-A", "--no-align"], "signature": "-A --no-align", "description": "Switches to unaligned output mode. (The default output mode is otherwise aligned.) This is equivalent to \\pset format unaligned ."}, {"names": ["-b", "--echo-errors"], "signature": "-b --echo-errors", "description": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors ."}, {"names": ["-c command", "--command= command"], "signature": "-c command --command= command", "description": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. command must be either a command string that is completely parsable by the server (i.e., it contains no psql -specific features), or a single backslash command. Thus you cannot mix SQL and psql meta-commands within a -c option. To achieve that, you could use repeated -c options or pipe the string into psql , for example: psql -c '\\x' -c 'SELECT * FROM foo;' or echo '\\x \\\\ SELECT * FROM foo;' | psql ( \\\\ is the separator meta-command.) Each SQL command string passed to -c is sent to the server as a single query. Because of this, the server executes it as a single transaction even if the string contains multiple SQL commands, unless there are explicit BEGIN / COMMIT commands included in the string to divide it into multiple transactions. Also, psql only prints the result of the last SQL command in the string. This is different from the behavior when the same string is read from a file or fed to psql 's standard input, because then psql sends each SQL command separately. Because of this behavior, putting more than one command in a single -c string often has unexpected results. It's better to use repeated -c commands or feed multiple commands to psql 's standard input, either using echo as illustrated above, or via a shell here-document, for example: psql <<EOF \\x SELECT * FROM foo; EOF"}, {"names": ["-d dbname", "--dbname= dbname"], "signature": "-d dbname --dbname= dbname", "description": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--echo-queries"], "signature": "-e --echo-queries", "description": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries ."}, {"names": ["-E", "--echo-hidden"], "signature": "-E --echo-hidden", "description": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on ."}, {"names": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i . If filename is - (hyphen), then standard input is read until an EOF indication or \\q meta-command. This can be used to intersperse interactive input with input from files. Note however that Readline is not used in this case (much as if -n had been specified). Using this option is subtly different from writing psql < filename . In general, both will do what you expect, but using -f enables some nice features such as error messages with line numbers. There is also a slight chance that using this option will reduce the start-up overhead. On the other hand, the variant using the shell's input redirection is (in theory) guaranteed to yield exactly the same output you would have received had you entered everything by hand."}, {"names": ["-F separator", "--field-separator= separator"], "signature": "-F separator --field-separator= separator", "description": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f ."}, {"names": ["-h hostname", "--host= hostname"], "signature": "-h hostname --host= hostname", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket."}, {"names": ["-H", "--html"], "signature": "-H --html", "description": "Turn on HTML tabular output. This is equivalent to \\pset format html or the \\H command."}, {"names": ["-l", "--list"], "signature": "-l --list", "description": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list . When this option is used, psql will connect to the database postgres , unless a different database is named on the command line (option -d or non-option argument, possibly via a service entry, but not via an environment variable)."}, {"names": ["-L filename", "--log-file= filename"], "signature": "-L filename --log-file= filename", "description": "Write all query output into file filename , in addition to the normal output destination."}, {"names": ["-n", "--no-readline"], "signature": "-n --no-readline", "description": "Do not use Readline for line editing and do not use the command history. This can be useful to turn off tab expansion when cutting and pasting."}, {"names": ["-o filename", "--output= filename"], "signature": "-o filename --output= filename", "description": "Put all query output into file filename . This is equivalent to the command \\o ."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432."}, {"names": ["-P assignment", "--pset= assignment"], "signature": "-P assignment --pset= assignment", "description": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex ."}, {"names": ["-q", "--quiet"], "signature": "-q --quiet", "description": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on ."}, {"names": ["-R separator", "--record-separator= separator"], "signature": "-R separator --record-separator= separator", "description": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep ."}, {"names": ["-s", "--single-step"], "signature": "-s --single-step", "description": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts."}, {"names": ["-S", "--single-line"], "signature": "-S --single-line", "description": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does. Note This mode is provided for those who insist on it, but you are not necessarily encouraged to use it. In particular, if you mix SQL and meta-commands on a line the order of execution might not always be clear to the inexperienced user."}, {"names": ["-t", "--tuples-only"], "signature": "-t --tuples-only", "description": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only ."}, {"names": ["-T table_options", "--table-attr= table_options"], "signature": "-T table_options --table-attr= table_options", "description": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)"}, {"names": ["-v assignment", "--set= assignment", "--variable= assignment"], "signature": "-v assignment --set= assignment --variable= assignment", "description": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the psql version and exit."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Force psql to prompt for a password before connecting to a database, even if the password will not be used. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, psql will prompt for a password in any case. However, psql will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-x", "--expanded"], "signature": "-x --expanded", "description": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded ."}, {"names": ["-X,", "--no-psqlrc"], "signature": "-X, --no-psqlrc", "description": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file)."}, {"names": ["-z", "--field-separator-zero"], "signature": "-z --field-separator-zero", "description": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero ."}, {"names": ["-0", "--record-separator-zero"], "signature": "-0 --record-separator-zero", "description": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero ."}, {"names": ["-1", "--single-transaction"], "signature": "-1 --single-transaction", "description": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. This ensures that either all the commands complete successfully, or no changes are applied. If the commands themselves contain BEGIN , COMMIT , or ROLLBACK , this option will not have the desired effects. Also, if an individual command cannot be executed inside a transaction block, specifying this option will cause the whole transaction to fail."}, {"names": ["-?", "--help[= topic ]"], "signature": "-? --help[= topic ]", "description": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables."}], "synopsis": ["psql [ option ...] [ dbname [ username ]]"], "environment": [{"name": "COLUMNS", "description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode."}, {"name": "PAGER", "description": "If the query results do not fit on the screen, they are piped through this command. Typical values are more or less . The default is platform-dependent. Use of the pager can be disabled by setting PAGER to empty, or by using pager-related options of the \\pset command."}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters (see Section 33.14 )."}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. The built-in default editors are vi on Unix systems and notepad.exe on Windows systems."}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems."}, {"name": "PSQL_HISTORY", "description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed."}, {"name": "PSQLRC", "description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed."}, {"name": "SHELL", "description": "Command executed by the \\! command."}, {"name": "TMPDIR", "description": "Directory for storing temporary files. The default is /tmp ."}]}, "comparison_hash": "25e064dc85daa6c220411d4e1e082a6fbc5a816bef7b9c15ceb5124e2e898eb5", "manual_language": "zh"}, "11": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "psql"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "11.22"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "34"}], "tables": [{"key": "options", "rows": [{"summary": "\u5728\u8bfb\u5165\u65f6\u5c06\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u884c\u8bfb\u53d6\uff09\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a all \u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-a --echo-all"}}, {"summary": "\u5207\u6362\u5230\u975e\u5bf9\u9f50\u8f93\u51fa\u6a21\u5f0f\uff08\u9ed8\u8ba4\u8f93\u51fa\u6a21\u5f0f\u662f\u5bf9\u9f50\u7684\uff09\u3002\u8fd9\u7b49\u6548\u4e8e \\pset format unaligned \u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-A --no-align"}}, {"summary": "\u628a\u5931\u8d25\u7684 SQL \u547d\u4ee4\u6253\u5370\u5230\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a errors \u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-b --echo-errors"}}, {"summary": "\u6307\u5b9a psql \u6267\u884c\u4e00\u4e2a\u7ed9\u5b9a\u7684\u547d\u4ee4\u5b57\u7b26\u4e32 command \u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u591a\u6b21\u5e76\u4e14\u4ee5\u4efb\u4f55\u987a\u5e8f\u4e0e -f \u9009\u9879\u7ec4\u5408\u5728\u4e00\u8d77\u3002\u5f53 -c \u6216\u8005 -f \u88ab\u6307\u5b9a\u65f6\uff0c psql \u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709 -c \u548c -f \u9009\u9879\u540e\u7ec8\u6b62\u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-c command --command= command"}}, {"summary": "\u6307\u5b9a\u8981\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002\u8fd9\u7b49\u6548\u4e8e\u6307\u5b9a dbname \u4e3a\u547d\u4ee4\u884c\u4e0a\u7684\u7b2c\u4e00\u4e2a\u975e\u9009\u9879\u53c2\u6570\u3002 dbname \u53ef\u4ee5\u662f \u8fde\u63a5\u5b57\u7b26\u4e32 \u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u5c06\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-d dbname --dbname= dbname"}}, {"summary": "\u4e5f\u628a\u53d1\u9001\u5230\u670d\u52a1\u5668\u7684\u6240\u6709 SQL \u547d\u4ee4\u590d\u5236\u5230\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a queries \u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-e --echo-queries"}}, {"summary": "\u56de\u663e \\d \u4ee5\u53ca\u5176\u4ed6\u53cd\u659c\u7ebf\u547d\u4ee4\u751f\u6210\u7684\u5b9e\u9645\u67e5\u8be2\u3002\u53ef\u4ee5\u7528\u5b83\u6765\u5b66\u4e60 psql \u7684\u5185\u90e8\u64cd\u4f5c\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO_HIDDEN \u8bbe\u7f6e\u4e3a on \u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-E --echo-hidden"}}, {"summary": "\u4ece\u6587\u4ef6 filename \u800c\u4e0d\u662f\u6807\u51c6\u8f93\u5165\u4e2d\u8bfb\u53d6\u547d\u4ee4\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u6307\u5b9a\uff0c\u4e5f\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u4e0e -c \u9009\u9879\u7ec4\u5408\u4f7f\u7528\u3002\u5f53\u6307\u5b9a\u4e86 -c \u6216 -f \u65f6\uff0c psql \u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709 -c \u548c -f \u9009\u9879\u540e\u7ec8\u6b62\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u7b49\u4ef7\u4e8e\u5143\u547d\u4ee4 \\i \u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-f filename --file= filename"}}, {"summary": "\u4f7f\u7528 separator \u4f5c\u4e3a\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e \\pset fieldsep \u6216\u8005 \\f \u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-F separator --field-separator= separator"}}, {"summary": "\u6307\u5b9a\u8fd0\u884c\u670d\u52a1\u5668\u7684\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u6240\u5728\u7684\u76ee\u5f55\u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-h hostname --host= hostname"}}, {"summary": "\u5207\u6362\u5230 HTML \u8868\u683c\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e \\pset format html \u6216\u8005 \\H \u547d\u4ee4\u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-H --html"}}, {"summary": "\u5217\u51fa\u6240\u6709\u53ef\u7528\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u9000\u51fa\u3002\u5176\u4ed6\u975e\u8fde\u63a5\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002\u8fd9\u4e0e\u5143\u547d\u4ee4 \\list \u7c7b\u4f3c\u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-l --list"}}, {"summary": "\u9664\u4e86\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u5199\u5230\u666e\u901a\u8f93\u51fa\u76ee\u6807\u4e4b\u5916\uff0c\u8fd8\u5199\u5230\u6587\u4ef6 filename \u4e2d\u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-L filename --log-file= filename"}}, {"summary": "\u4e0d\u8981\u4f7f\u7528 Readline \u8fdb\u884c\u884c\u7f16\u8f91\uff0c\u4e5f\u4e0d\u8981\u4f7f\u7528\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\u3002\u8fd9\u6709\u52a9\u4e8e\u5728\u526a\u5207\u548c\u7c98\u8d34\u65f6\u5173\u95edTAB \u8865\u5168\u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-n --no-readline"}}, {"summary": "\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u653e\u5230\u6587\u4ef6 filename \u4e2d\u3002\u8fd9\u7b49\u6548\u4e8e\u547d\u4ee4 \\o \u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-o filename --output= filename"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u7684\u6587\u4ef6\u540d\u540e\u7f00\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u7684\u503c\uff1b\u672a\u8bbe\u7f6e\u65f6\uff0c\u4f7f\u7528\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u7aef\u53e3\uff0c\u901a\u5e38\u4e3a 5432\u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-p port --port= port"}}, {"summary": "\u4ee5 \\pset \u7684\u5f62\u5f0f\u6307\u5b9a\u6253\u5370\u9009\u9879\u3002\u6ce8\u610f\uff0c\u8fd9\u91cc\u4f60\u5fc5\u987b\u7528\u4e00\u4e2a\u7b49\u53f7\u800c\u4e0d\u662f\u7a7a\u683c\u6765\u5206\u9694\u540d\u79f0\u548c\u503c\u3002\u4f8b\u5982\uff0c\u8981\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a LaTeX \uff0c\u5e94\u8be5\u5199\u6210 -P format=latex \u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-P assignment --pset= assignment"}}, {"summary": "\u6307\u5b9a psql \u5e94\u8be5\u5b89\u9759\u5730\u5de5\u4f5c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4f1a\u6253\u5370\u51fa\u6b22\u8fce\u6d88\u606f\u548c\u5404\u79cd\u63d0\u793a\u4fe1\u606f\u3002\u5982\u679c\u4f7f\u7528\u4e86\u8fd9\u4e2a\u9009\u9879\uff0c\u4ee5\u4e0a\u90a3\u4e9b\u5c31\u90fd\u4e0d\u4f1a\u8f93\u51fa\u3002\u5728\u4f7f\u7528 -c \u9009\u9879\u65f6\uff0c\u914d\u5408\u8fd9\u4e2a\u9009\u9879\u5f88\u6709\u7528\u3002\u8fd9\u7b49\u6548\u4e8e\u8bbe\u7f6e\u53d8\u91cf QUIET \u4e3a on \u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-q --quiet"}}, {"summary": "\u628a separator \u7528\u4f5c\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e \\pset recordsep \u547d\u4ee4\u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-R separator --record-separator= separator"}}, {"summary": "\u8fd0\u884c\u5728\u5355\u6b65\u6a21\u5f0f\u4e2d\u3002\u8fd9\u610f\u5473\u7740\u5728\u6bcf\u4e2a\u547d\u4ee4\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u4e4b\u524d\u90fd\u4f1a\u63d0\u793a\u7528\u6237\uff0c\u5e76\u5141\u8bb8\u53d6\u6d88\u6267\u884c\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u8c03\u8bd5\u811a\u672c\u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-s --single-step"}}, {"summary": "\u8fd0\u884c\u5728\u5355\u884c\u6a21\u5f0f\u4e2d\uff0c\u5176\u4e2d\u6362\u884c\u7b26\u4f1a\u7ec8\u6b62\u4e00\u4e2a SQL \u547d\u4ee4\uff0c\u5c31\u50cf\u5206\u53f7\u7684\u4f5c\u7528\u4e00\u6837\u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-S --single-line"}}, {"summary": "\u5173\u95ed\u6253\u5370\u5217\u540d\u548c\u7ed3\u679c\u884c\u8ba1\u6570\u9875\u811a\u7b49\u3002\u8fd9\u7b49\u6548\u4e8e \\t \u6216\u8005 \\pset tuples_only \u547d\u4ee4\u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-t --tuples-only"}}, {"summary": "\u6307\u5b9a\u8981\u653e\u5728 HTML table \u6807\u7b7e\u5185\u7684\u9009\u9879\u3002\u8be6\u89c1 \\pset tableattr \u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-T table_options --table-attr= table_options"}}, {"summary": "\u4f5c\u4e3a\u7528\u6237 username \u800c\u4e0d\u662f\u9ed8\u8ba4\u7528\u6237\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff08\u5f53\u7136\uff0c\u4f60\u5fc5\u987b\u5177\u6709\u8fd9\u6837\u505a\u7684\u6743\u9650\uff09\u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-U username --username= username"}}, {"summary": "\u6267\u884c\u4e00\u6b21\u53d8\u91cf\u8d4b\u503c\uff0c\u548c \\set \u5143\u547d\u4ee4\u76f8\u4f3c\u3002\u6ce8\u610f\u4f60\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u7528\u7b49\u53f7\u5206\u9694\u540d\u5b57\u548c\u503c\uff08\u5982\u679c\u6709\uff09\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u7684\u8bbe\u7f6e\uff0c\u53bb\u6389\u7b49\u53f7\u5c31\u884c\u3002\u8981\u628a\u4e00\u4e2a\u53d8\u91cf\u8bbe\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u4f7f\u7528\u7b49\u53f7\u4f46\u662f\u53bb\u6389\u503c\u3002\u8fd9\u4e9b\u8d4b\u503c\u5728\u547d\u4ee4\u884c\u5904\u7406\u671f\u95f4\u88ab\u5b8c\u6210\uff0c\u56e0\u6b64\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u7684\u53d8\u91cf\u5c06\u5728\u7a0d\u540e\u88ab\u8986\u76d6\u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-v assignment --set= assignment --variable= assignment"}}, {"summary": "\u6253\u5370 psql \u7248\u672c\u5e76\u4e14\u9000\u51fa\u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-V --version"}}, {"summary": "\u6c38\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982 .pgpass \u6587\u4ef6\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u8fd9\u4e2a\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4efb\u52a1\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u65f6\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 psql \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\uff0c\u5373\u4f7f\u8be5\u5bc6\u7801\u5b9e\u9645\u4e0a\u4e0d\u4f1a\u88ab\u4f7f\u7528\u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-W --password"}}, {"summary": "\u6253\u5f00\u6269\u5c55\u8868\u683c\u5f0f\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e \\x \u6216\u8005 \\pset expanded \u547d\u4ee4\u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-x --expanded"}}, {"summary": "\u4e0d\u8bfb\u53d6\u542f\u52a8\u6587\u4ef6\uff08\u65e2\u4e0d\u8bfb\u53d6\u7cfb\u7edf\u8303\u56f4\u7684 psqlrc \u6587\u4ef6\uff0c\u4e5f\u4e0d\u8bfb\u53d6\u7528\u6237\u7684 ~/.psqlrc \u6587\u4ef6\uff09\u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-X, --no-psqlrc"}}, {"summary": "\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u8fd9\u7b49\u6548\u4e8e \\pset fieldsep_zero \u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-z --field-separator-zero"}}, {"summary": "\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u4f8b\u5982\uff0c\u8fd9\u6709\u52a9\u4e8e\u4e0e xargs -0 \u914d\u5408\u4f7f\u7528\u3002\u8fd9\u7b49\u6548\u4e8e \\pset recordsep_zero \u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-0 --record-separator-zero"}}, {"summary": "\u8fd9\u4e2a\u9009\u9879\u53ea\u80fd\u4e0e\u4e00\u4e2a\u6216\u591a\u4e2a -c \u548c/\u6216 -f \u9009\u9879\u7ed3\u5408\u4f7f\u7528\u3002\u5b83\u4f1a\u5bfc\u81f4 psql \u5728\u7b2c\u4e00\u4e2a\u8fd9\u6837\u7684\u9009\u9879\u4e4b\u524d\u53d1\u51fa\u4e00\u4e2a BEGIN \u547d\u4ee4\uff0c\u5e76\u5728\u6700\u540e\u4e00\u4e2a\u9009\u9879\u4e4b\u540e\u53d1\u51fa\u4e00\u4e2a COMMIT \u547d\u4ee4\uff0c\u4ece\u800c\u5c06\u6240\u6709\u547d\u4ee4\u5305\u88c5\u6210\u4e00\u4e2a\u5355\u72ec\u7684\u4e8b\u52a1\u3002\u8fd9\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-1 --single-transaction"}}, {"summary": "\u663e\u793a\u6709\u5173 psql \u7684\u5e2e\u52a9\u5e76\u4e14\u9000\u51fa\u3002\u53ef\u9009\u7684 topic \u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a options \uff09\u9009\u62e9\u8981\u89e3\u91ca psql \u7684\u54ea\u4e00\u90e8\u5206\uff1a commands \u63cf\u8ff0 psql \u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b options \u63cf\u8ff0\u53ef\u4ee5\u88ab\u4f20\u9012\u7ed9 psql \u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c variables \u5219\u663e\u793a\u6709\u5173 psql \u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002", "signature": {"url": "/docs/11/app-psql.html", "text": "-? --help[= topic ]"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "COLUMNS", "description": "\u5982\u679c \\pset columns \u4e3a\u96f6\uff0c\u8fd9\u4e2a\u73af\u5883\u53d8\u91cf\u63a7\u5236\u7528\u4e8e wrapped \u683c\u5f0f\u7684\u5bbd\u5ea6\u4ee5\u53ca\u7528\u6765\u786e\u5b9a\u662f\u5426\u8f93\u51fa\u9700\u8981\u7528\u5230\u5206\u9875\u5668\u6216\u8005\u5207\u6362\u5230\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e2d\u7684\u5782\u76f4\u683c\u5f0f\u7684\u5bbd\u5ea6\u3002"}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\uff08\u89c1 \u7b2c 34.14 \u8282 \uff09\u3002"}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "\\e \u3001 \\ef \u4ee5\u53ca \\ev \u547d\u4ee4\u6240\u4f7f\u7528\u7684\u7f16\u8f91\u5668\u3002\u4f1a\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u68c0\u67e5\u8fd9\u4e9b\u53d8\u91cf\uff0c\u7b2c\u4e00\u4e2a\u88ab\u8bbe\u7f6e\u7684\u5c06\u88ab\u4f7f\u7528\u3002\u5982\u679c\u90fd\u6ca1\u6709\u88ab\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u662f\u4f7f\u7528Unix\u7cfb\u7edf\u4e0a\u7684 vi \u6216\u8005Windows\u7cfb\u7edf\u4e0a\u7684 notepad.exe \u3002"}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "\u5f53 \\e \u3001 \\ef \u6216 \\ev \u5e26\u6709\u884c\u53f7\u53c2\u6570\u4f7f\u7528\u65f6\uff0c\u6b64\u53d8\u91cf\u6307\u5b9a\u5c06\u8d77\u59cb\u884c\u53f7\u4f20\u7ed9\u7528\u6237\u7f16\u8f91\u5668\u65f6\u6240\u7528\u7684\u547d\u4ee4\u884c\u53c2\u6570\u3002\u5bf9\u4e8e Emacs \u6216 vi \u4e4b\u7c7b\u7684\u7f16\u8f91\u5668\uff0c\u8fd9\u4e2a\u53c2\u6570\u662f\u4e00\u4e2a\u52a0\u53f7\u3002\u5982\u679c\u9009\u9879\u540d\u548c\u884c\u53f7\u4e4b\u95f4\u9700\u8981\u7a7a\u683c\uff0c\u8bf7\u5728\u53d8\u91cf\u503c\u4e2d\u5305\u542b\u672b\u5c3e\u7a7a\u683c\u3002\u4f8b\u5982\uff1a PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' \u5728 Unix \u7cfb\u7edf\u4e0a\u9ed8\u8ba4\u662f + \uff08\u5bf9\u5e94\u4e8e\u9ed8\u8ba4\u7f16\u8f91\u5668 vi \uff0c\u4e14\u5bf9\u5f88\u591a\u5176\u4ed6\u5e38\u89c1\u7f16\u8f91\u5668\u53ef\u7528\uff09\u3002\u5728 Windows \u7cfb\u7edf\u4e0a\u6ca1\u6709\u9ed8\u8ba4\u503c\u3002"}, {"name": "PSQL_HISTORY", "description": "\u547d\u4ee4\u5386\u53f2\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08 ~ \uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002"}, {"name": "PSQL_PAGER PAGER", "description": "\u5982\u679c\u67e5\u8be2\u7ed3\u679c\u65e0\u6cd5\u5728\u5c4f\u5e55\u4e0a\u663e\u793a\u5b8c\u6574\uff0c\u5b83\u4eec\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6b64\u547d\u4ee4\u3002\u5178\u578b\u7684\u503c\u662f more \u6216 less \u3002\u53ef\u4ee5\u901a\u8fc7\u5c06 PSQL_PAGER \u6216 PAGER \u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u6216\u901a\u8fc7\u8c03\u6574 \\pset \u547d\u4ee4\u7684\u4e0e\u5206\u9875\u76f8\u5173\u7684\u9009\u9879\u6765\u7981\u7528\u5206\u9875\u5668\u3002\u8fd9\u4e9b\u53d8\u91cf\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u8fdb\u884c\u68c0\u67e5\uff1b\u4f7f\u7528\u6309\u8be5\u987a\u5e8f\u627e\u5230\u7684\u7b2c\u4e00\u4e2a\u5df2\u8bbe\u7f6e\u7684\u53d8\u91cf\u3002\u5982\u679c\u5b83\u4eec\u90fd\u6ca1\u6709\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5728\u5927\u591a\u6570\u5e73\u53f0\u4e0a\u4f7f\u7528 more \uff0c\u4f46\u5728Cygwin\u4e0a\u4f7f\u7528 less \u3002"}, {"name": "PSQLRC", "description": "\u7528\u6237\u7684 .psqlrc \u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08 ~ \uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002"}, {"name": "SHELL", "description": "\u88ab \\! \u547d\u4ee4\u6267\u884c\u7684\u547d\u4ee4\u3002"}, {"name": "TMPDIR", "description": "\u5b58\u50a8\u4e34\u65f6\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u662f /tmp \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-a", "--echo-all"], "summary": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all .", "signature": "-a --echo-all", "source_url": "/docs/11/app-psql.html", "description": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all ."}, {"names": ["-A", "--no-align"], "summary": "Switches to unaligned output mode. (The default output mode is otherwise aligned.) This is equivalent to \\pset format unaligned .", "signature": "-A --no-align", "source_url": "/docs/11/app-psql.html", "description": "Switches to unaligned output mode. (The default output mode is otherwise aligned.) This is equivalent to \\pset format unaligned ."}, {"names": ["-b", "--echo-errors"], "summary": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors .", "signature": "-b --echo-errors", "source_url": "/docs/11/app-psql.html", "description": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors ."}, {"names": ["-c command", "--command= command"], "summary": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence.", "signature": "-c command --command= command", "source_url": "/docs/11/app-psql.html", "description": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. command must be either a command string that is completely parsable by the server (i.e., it contains no psql -specific features), or a single backslash command. Thus you cannot mix SQL and psql meta-commands within a -c option. To achieve that, you could use repeated -c options or pipe the string into psql , for example: psql -c '\\x' -c 'SELECT * FROM foo;' or echo '\\x \\\\ SELECT * FROM foo;' | psql ( \\\\ is the separator meta-command.) Each SQL command string passed to -c is sent to the server as a single request. Because of this, the server executes it as a single transaction even if the string contains multiple SQL commands, unless there are explicit BEGIN / COMMIT commands included in the string to divide it into multiple transactions. (See Section 53.2.2.1 for more details about how the server handles multi-query strings.) Also, psql only prints the result of the last SQL command in the string. This is different from the behavior when the same string is read from a file or fed to psql 's standard input, because then psql sends each SQL command separately. Because of this behavior, putting more than one SQL command in a single -c string often has unexpected results. It's better to use repeated -c commands or feed multiple commands to psql 's standard input, either using echo as illustrated above, or via a shell here-document, for example: psql <<EOF \\x SELECT * FROM foo; EOF"}, {"names": ["-d dbname", "--dbname= dbname"], "summary": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "signature": "-d dbname --dbname= dbname", "source_url": "/docs/11/app-psql.html", "description": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--echo-queries"], "summary": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries .", "signature": "-e --echo-queries", "source_url": "/docs/11/app-psql.html", "description": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries ."}, {"names": ["-E", "--echo-hidden"], "summary": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on .", "signature": "-E --echo-hidden", "source_url": "/docs/11/app-psql.html", "description": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on ."}, {"names": ["-f filename", "--file= filename"], "summary": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i .", "signature": "-f filename --file= filename", "source_url": "/docs/11/app-psql.html", "description": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i . If filename is - (hyphen), then standard input is read until an EOF indication or \\q meta-command. This can be used to intersperse interactive input with input from files. Note however that Readline is not used in this case (much as if -n had been specified). Using this option is subtly different from writing psql < filename . In general, both will do what you expect, but using -f enables some nice features such as error messages with line numbers. There is also a slight chance that using this option will reduce the start-up overhead. On the other hand, the variant using the shell's input redirection is (in theory) guaranteed to yield exactly the same output you would have received had you entered everything by hand."}, {"names": ["-F separator", "--field-separator= separator"], "summary": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f .", "signature": "-F separator --field-separator= separator", "source_url": "/docs/11/app-psql.html", "description": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f ."}, {"names": ["-h hostname", "--host= hostname"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket.", "signature": "-h hostname --host= hostname", "source_url": "/docs/11/app-psql.html", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket."}, {"names": ["-H", "--html"], "summary": "Turn on HTML tabular output. This is equivalent to \\pset format html or the \\H command.", "signature": "-H --html", "source_url": "/docs/11/app-psql.html", "description": "Turn on HTML tabular output. This is equivalent to \\pset format html or the \\H command."}, {"names": ["-l", "--list"], "summary": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list .", "signature": "-l --list", "source_url": "/docs/11/app-psql.html", "description": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list . When this option is used, psql will connect to the database postgres , unless a different database is named on the command line (option -d or non-option argument, possibly via a service entry, but not via an environment variable)."}, {"names": ["-L filename", "--log-file= filename"], "summary": "Write all query output into file filename , in addition to the normal output destination.", "signature": "-L filename --log-file= filename", "source_url": "/docs/11/app-psql.html", "description": "Write all query output into file filename , in addition to the normal output destination."}, {"names": ["-n", "--no-readline"], "summary": "Do not use Readline for line editing and do not use the command history. This can be useful to turn off tab expansion when cutting and pasting.", "signature": "-n --no-readline", "source_url": "/docs/11/app-psql.html", "description": "Do not use Readline for line editing and do not use the command history. This can be useful to turn off tab expansion when cutting and pasting."}, {"names": ["-o filename", "--output= filename"], "summary": "Put all query output into file filename . This is equivalent to the command \\o .", "signature": "-o filename --output= filename", "source_url": "/docs/11/app-psql.html", "description": "Put all query output into file filename . This is equivalent to the command \\o ."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432.", "signature": "-p port --port= port", "source_url": "/docs/11/app-psql.html", "description": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432."}, {"names": ["-P assignment", "--pset= assignment"], "summary": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex .", "signature": "-P assignment --pset= assignment", "source_url": "/docs/11/app-psql.html", "description": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex ."}, {"names": ["-q", "--quiet"], "summary": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on .", "signature": "-q --quiet", "source_url": "/docs/11/app-psql.html", "description": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on ."}, {"names": ["-R separator", "--record-separator= separator"], "summary": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep .", "signature": "-R separator --record-separator= separator", "source_url": "/docs/11/app-psql.html", "description": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep ."}, {"names": ["-s", "--single-step"], "summary": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts.", "signature": "-s --single-step", "source_url": "/docs/11/app-psql.html", "description": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts."}, {"names": ["-S", "--single-line"], "summary": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does.", "signature": "-S --single-line", "source_url": "/docs/11/app-psql.html", "description": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does. Note This mode is provided for those who insist on it, but you are not necessarily encouraged to use it. In particular, if you mix SQL and meta-commands on a line the order of execution might not always be clear to the inexperienced user."}, {"names": ["-t", "--tuples-only"], "summary": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only .", "signature": "-t --tuples-only", "source_url": "/docs/11/app-psql.html", "description": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only ."}, {"names": ["-T table_options", "--table-attr= table_options"], "summary": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details.", "signature": "-T table_options --table-attr= table_options", "source_url": "/docs/11/app-psql.html", "description": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details."}, {"names": ["-U username", "--username= username"], "summary": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)", "signature": "-U username --username= username", "source_url": "/docs/11/app-psql.html", "description": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)"}, {"names": ["-v assignment", "--set= assignment", "--variable= assignment"], "summary": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later.", "signature": "-v assignment --set= assignment --variable= assignment", "source_url": "/docs/11/app-psql.html", "description": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later."}, {"names": ["-V", "--version"], "summary": "Print the psql version and exit.", "signature": "-V --version", "source_url": "/docs/11/app-psql.html", "description": "Print the psql version and exit."}, {"names": ["-w", "--no-password"], "summary": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/11/app-psql.html", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-W", "--password"], "summary": "Force psql to prompt for a password before connecting to a database, even if the password will not be used.", "signature": "-W --password", "source_url": "/docs/11/app-psql.html", "description": "Force psql to prompt for a password before connecting to a database, even if the password will not be used. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, psql will prompt for a password in any case. However, psql will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-x", "--expanded"], "summary": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded .", "signature": "-x --expanded", "source_url": "/docs/11/app-psql.html", "description": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded ."}, {"names": ["-X,", "--no-psqlrc"], "summary": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file).", "signature": "-X, --no-psqlrc", "source_url": "/docs/11/app-psql.html", "description": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file)."}, {"names": ["-z", "--field-separator-zero"], "summary": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero .", "signature": "-z --field-separator-zero", "source_url": "/docs/11/app-psql.html", "description": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero ."}, {"names": ["-0", "--record-separator-zero"], "summary": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero .", "signature": "-0 --record-separator-zero", "source_url": "/docs/11/app-psql.html", "description": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero ."}, {"names": ["-1", "--single-transaction"], "summary": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. This ensures that either all the commands complete successfully, or no changes are applied.", "signature": "-1 --single-transaction", "source_url": "/docs/11/app-psql.html", "description": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. This ensures that either all the commands complete successfully, or no changes are applied. If the commands themselves contain BEGIN , COMMIT , or ROLLBACK , this option will not have the desired effects. Also, if an individual command cannot be executed inside a transaction block, specifying this option will cause the whole transaction to fail."}, {"names": ["-?", "--help[= topic ]"], "summary": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables.", "signature": "-? --help[= topic ]", "source_url": "/docs/11/app-psql.html", "description": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables."}], "related": [{"url": "/wiki/psql/?v=11", "label": "psql \u5143\u547d\u4ee4"}, {"url": "/wiki/conn/?v=11", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v11.22/postgresql-11.22.tar.bz2", "label": "11.22", "major": "11", "channel": "historical", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/11/postgresql-11-A4.pdf", "bytes": 13057499, "pages": 2732, "sha256": "41d75855e610d0d9b8802b87dc5b080bef8d7e91c7cf69401fbf8d3cf801b4b5", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/11/postgresql-11-US.pdf", "bytes": 12961189, "pages": 2883, "sha256": "6a8899ef36935a5b7ed2b436207564a567a4ef1eb1c2200195876b8de4d4fa30", "built_at": "2026-09-26"}}, "tree": "11", "index": "index.html", "major": "11", "pages": 1125, "release": "11.22", "source_url": "https://ftp.postgresql.org/pub/source/v11.22/postgresql-11.22.tar.bz2", "svg_assets": 0, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "2cb7c97d7a0d7278851bbc9c61f467b69c094c72b81740b751108e7892ebe1f0"}, "revision": "53315ddaf3b3f9e6669fd1edc096bbb2cd4a65ea3e836c89e542b43af9ba3a7f", "evidence_kind": "English manual and source declarations", "source_sha256": "2cb7c97d7a0d7278851bbc9c61f467b69c094c72b81740b751108e7892ebe1f0"}, "sources": [{"url": "https://pg.center/docs/11/app-psql.html", "file": "app-psql.html", "label": "11.22 English manual \u00b7 app-psql.html", "anchor": "", "sha256": "32c4d489e91e59715de2f7c3264fcccab3dd1eca54673dbfeac61304b0c54d4d", "language": "en", "original_url": "/docs/11/app-psql.html"}, {"url": "https://pg.center/docs/11/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "3a30e696058b118a55cc42892c39671d9bae86f77e1024d5ebcc4688ad9ab4c3", "language": "en", "original_url": "/docs/11/reference-client.html"}], "sections": [], "synopsis": ["psql [ option ...] [ dbname [ username ]]"], "signature": "psql [ option ...] [ dbname [ username ]]", "description": ["psql \u2014 PostgreSQL \u7684\u4ea4\u4e92\u5f0f\u7ec8\u7aef"], "environment": [{"name": "COLUMNS", "description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode."}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters (see Section 34.14 )."}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems."}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems."}, {"name": "PSQL_HISTORY", "description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed."}, {"name": "PSQL_PAGER PAGER", "description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use more on most platforms, but less on Cygwin."}, {"name": "PSQLRC", "description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed."}, {"name": "SHELL", "description": "Command executed by the \\! command."}, {"name": "TMPDIR", "description": "Directory for storing temporary files. The default is /tmp ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PSQL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></h2>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u2014 <span class=\"productname\">PostgreSQL</span>\u7684\u4ea4\u4e92\u5f0f\u7ec8\u7aef</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.18.4.1\"><code class=\"command\">psql</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em> [<em class=\"replaceable\"><code>username</code></em>]]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.18.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u662f<span class=\"productname\">PostgreSQL</span>\u7684\u4e00\u4e2a\u57fa\u4e8e\u7ec8\u7aef\u7684\u524d\u7aef\u3002\u5b83\u4f7f\u4f60\u80fd\u591f\u4ea4\u4e92\u5f0f\u5730\u8f93\u5165\u67e5\u8be2\uff0c\u5c06\u5176\u53d1\u9001\u7ed9<span class=\"productname\">PostgreSQL</span>\uff0c\u5e76\u67e5\u770b\u67e5\u8be2\u7ed3\u679c\u3002\u4e5f\u53ef\u4ee5\u4ece\u6587\u4ef6\u6216\u547d\u4ee4\u884c\u53c2\u6570\u63d0\u4f9b\u8f93\u5165\u3002\u6b64\u5916\uff0c<span class=\"application\">psql</span>\u8fd8\u63d0\u4f9b\u4e86\u82e5\u5e72\u5143\u547d\u4ee4\u548c\u591a\u79cd\u7c7b\u4f3c shell \u7684\u7279\u6027\uff0c\u4ee5\u4fbf\u4e8e\u7f16\u5199\u811a\u672c\u548c\u81ea\u52a8\u5316\u6267\u884c\u5404\u79cd\u4efb\u52a1\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-PSQL-3\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-a</code><br/></span><span class=\"term\"><code class=\"option\">--echo-all</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8bfb\u5165\u65f6\u5c06\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u884c\u8bfb\u53d6\uff09\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a <code class=\"literal\">all</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-A</code><br/></span><span class=\"term\"><code class=\"option\">--no-align</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230\u975e\u5bf9\u9f50\u8f93\u51fa\u6a21\u5f0f\uff08\u9ed8\u8ba4\u8f93\u51fa\u6a21\u5f0f\u662f\u5bf9\u9f50\u7684\uff09\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset format unaligned</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-b</code><br/></span><span class=\"term\"><code class=\"option\">--echo-errors</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u5931\u8d25\u7684 SQL \u547d\u4ee4\u6253\u5370\u5230\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">errors</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>command</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--command=<em class=\"replaceable\"><code>command</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a<span class=\"application\">psql</span>\u6267\u884c\u4e00\u4e2a\u7ed9\u5b9a\u7684\u547d\u4ee4\u5b57\u7b26\u4e32<em class=\"replaceable\"><code>command</code></em>\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u591a\u6b21\u5e76\u4e14\u4ee5\u4efb\u4f55\u987a\u5e8f\u4e0e<code class=\"option\">-f</code>\u9009\u9879\u7ec4\u5408\u5728\u4e00\u8d77\u3002\u5f53<code class=\"option\">-c</code>\u6216\u8005<code class=\"option\">-f</code>\u88ab\u6307\u5b9a\u65f6\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709<code class=\"option\">-c</code>\u548c<code class=\"option\">-f</code>\u9009\u9879\u540e\u7ec8\u6b62\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>command</code></em>\u5fc5\u987b\u662f\u4e00\u4e2a\u670d\u52a1\u5668\u5b8c\u5168\u53ef\u89e3\u6790\u7684\u547d\u4ee4\u5b57\u7b26\u4e32\uff08\u5373\u4e0d\u5305\u542b<span class=\"application\">psql</span>\u4e13\u6709\u7684\u7279\u6027\uff09\u6216\u8005\u5355\u4e2a\u53cd\u659c\u7ebf\u547d\u4ee4\u3002\u56e0\u6b64\u4e0d\u80fd\u5728\u4e00\u4e2a<code class=\"option\">-c</code>\u9009\u9879\u4e2d\u6df7\u5408<acronym class=\"acronym\">SQL</acronym>\u548c<span class=\"application\">psql</span>\u5143\u547d\u4ee4\u3002\u8981\u90a3\u6837\u505a\uff0c\u53ef\u4ee5\u4f7f\u7528\u591a\u4e2a<code class=\"option\">-c</code>\u9009\u9879\u6216\u8005\u628a\u5b57\u7b26\u4e32\u7528\u7ba1\u9053\u8f93\u9001\u5230<span class=\"application\">psql</span>\u4e2d\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">psql -c '\\x' -c 'SELECT * FROM foo;'\n</pre>\n<p lang=\"zh\">\u6216\u8005</p>\n<pre class=\"programlisting\">echo '\\x \\\\ SELECT * FROM foo;' | psql\n</pre>\n<p lang=\"zh\">\uff08<code class=\"literal\">\\\\</code>\u662f\u5206\u9694\u7b26\u5143\u547d\u4ee4\uff09\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u5b57\u7b26\u4e32\u4f20\u9012\u7ed9<code class=\"option\">-c</code>\u90fd\u4f5c\u4e3a\u4e00\u4e2a\u5355\u72ec\u7684\u8bf7\u6c42\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u56e0\u6b64\uff0c\u5373\u4f7f\u5b57\u7b26\u4e32\u5305\u542b\u591a\u4e2a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\uff0c\u670d\u52a1\u5668\u4e5f\u4f1a\u5c06\u5176\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff0c\u9664\u975e\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u663e\u5f0f\u7684<code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code>\u547d\u4ee4\u5c06\u5176\u5206\u6210\u591a\u4e2a\u4e8b\u52a1\u3002\uff08\u6709\u5173\u670d\u52a1\u5668\u5982\u4f55\u5904\u7406\u591a\u67e5\u8be2\u5b57\u7b26\u4e32\u7684\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/11/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT\" title=\"53.2.2.1.\u00a0\u4e00\u4e2a\u7b80\u5355\u67e5\u8be2\u4e2d\u7684\u591a\u6761\u8bed\u53e5\">\u7b2c\u00a053.2.2.1\u00a0\u8282</a>\u3002\uff09\u6b64\u5916\uff0c<span class=\"application\">psql</span>\u53ea\u6253\u5370\u5b57\u7b26\u4e32\u4e2d\u6700\u540e\u4e00\u6761<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u7684\u7ed3\u679c\u3002\u8fd9\u4e0e\u4ece\u6587\u4ef6\u8bfb\u53d6\u540c\u4e00\u5b57\u7b26\u4e32\u6216\u5c06\u5176\u9001\u5165<span class=\"application\">psql</span>\u6807\u51c6\u8f93\u5165\u65f6\u7684\u884c\u4e3a\u4e0d\u540c\uff0c\u56e0\u4e3a\u5728\u8fd9\u4e9b\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">psql</span>\u4f1a\u5206\u522b\u53d1\u9001\u6bcf\u6761<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u7531\u4e8e\u8fd9\u79cd\u884c\u4e3a\uff0c\u5728\u5355\u4e2a <code class=\"option\">-c</code> \u5b57\u7b26\u4e32\u4e2d\u653e\u5165\u591a\u6761 SQL \u547d\u4ee4\u5e38\u5e38\u4f1a\u4ea7\u751f\u610f\u5916\u7ed3\u679c\u3002\u6700\u597d\u91cd\u590d\u4f7f\u7528 <code class=\"option\">-c</code> \u547d\u4ee4\uff0c\u6216\u5c06\u591a\u6761\u547d\u4ee4\u9001\u5165 <span class=\"application\">psql</span> \u7684\u6807\u51c6\u8f93\u5165\uff0c\u53ef\u4ee5\u50cf\u4e0a\u9762\u6240\u793a\u4f7f\u7528 <span class=\"application\">echo</span>\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528 shell \u7684 here-document\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">psql &lt;&lt;EOF\n\\x\nSELECT * FROM foo;\nEOF\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>dbname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>dbname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002\u8fd9\u7b49\u6548\u4e8e\u6307\u5b9a<em class=\"replaceable\"><code>dbname</code></em>\u4e3a\u547d\u4ee4\u884c\u4e0a\u7684\u7b2c\u4e00\u4e2a\u975e\u9009\u9879\u53c2\u6570\u3002<em class=\"replaceable\"><code>dbname</code></em> \u53ef\u4ee5\u662f<a class=\"link\" href=\"/docs/11/libpq.html#LIBPQ-CONNSTRING\" title=\"34.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u5c06\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-e</code><br/></span><span class=\"term\"><code class=\"option\">--echo-queries</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e5f\u628a\u53d1\u9001\u5230\u670d\u52a1\u5668\u7684\u6240\u6709 SQL \u547d\u4ee4\u590d\u5236\u5230\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">queries</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-E</code><br/></span><span class=\"term\"><code class=\"option\">--echo-hidden</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u56de\u663e<code class=\"command\">\\d</code>\u4ee5\u53ca\u5176\u4ed6\u53cd\u659c\u7ebf\u547d\u4ee4\u751f\u6210\u7684\u5b9e\u9645\u67e5\u8be2\u3002\u53ef\u4ee5\u7528\u5b83\u6765\u5b66\u4e60<span class=\"application\">psql</span>\u7684\u5185\u90e8\u64cd\u4f5c\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO_HIDDEN</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u800c\u4e0d\u662f\u6807\u51c6\u8f93\u5165\u4e2d\u8bfb\u53d6\u547d\u4ee4\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u6307\u5b9a\uff0c\u4e5f\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u4e0e<code class=\"option\">-c</code>\u9009\u9879\u7ec4\u5408\u4f7f\u7528\u3002\u5f53\u6307\u5b9a\u4e86<code class=\"option\">-c</code>\u6216<code class=\"option\">-f</code>\u65f6\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709<code class=\"option\">-c</code>\u548c<code class=\"option\">-f</code>\u9009\u9879\u540e\u7ec8\u6b62\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u7b49\u4ef7\u4e8e\u5143\u547d\u4ee4<code class=\"command\">\\i</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c<em class=\"replaceable\"><code>filename</code></em>\u662f<code class=\"literal\">-</code>\uff08\u8fde\u5b57\u7b26\uff09\uff0c\u5219\u4f1a\u8bfb\u53d6\u6807\u51c6\u8f93\u5165\uff0c\u76f4\u5230\u9047\u5230 <acronym class=\"acronym\">EOF</acronym> \u6307\u793a\u6216<code class=\"command\">\\q</code>\u5143\u547d\u4ee4\u3002\u8fd9\u53ef\u7528\u4e8e\u5c06\u4ea4\u4e92\u5f0f\u8f93\u5165\u4e0e\u6587\u4ef6\u8f93\u5165\u4ea4\u9519\u4f7f\u7528\u3002\u4e0d\u8fc7\u8bf7\u6ce8\u610f\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\u4e0d\u4f1a\u4f7f\u7528 <span class=\"application\">Readline</span>\uff08\u5f88\u50cf\u6307\u5b9a\u4e86<code class=\"option\">-n</code>\u65f6\u7684\u60c5\u51b5\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u4e0e\u5199\u6210<code class=\"literal\">psql &lt; <em class=\"replaceable\"><code>filename</code></em></code>\u6709\u7ec6\u5fae\u5dee\u522b\u3002\u901a\u5e38\u4e24\u79cd\u5f62\u5f0f\u90fd\u4f1a\u5f97\u5230\u4f60\u671f\u671b\u7684\u7ed3\u679c\uff0c\u4f46\u4f7f\u7528<code class=\"literal\">-f</code>\u53ef\u4ee5\u542f\u7528\u4e00\u4e9b\u6709\u7528\u7684\u7279\u6027\uff0c\u4f8b\u5982\u5e26\u884c\u53f7\u7684\u9519\u8bef\u6d88\u606f\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u4e5f\u8fd8\u6709\u4e00\u70b9\u673a\u4f1a\u964d\u4f4e\u542f\u52a8\u5f00\u9500\u3002\u53e6\u4e00\u65b9\u9762\uff0c\u4f7f\u7528 shell \u8f93\u5165\u91cd\u5b9a\u5411\u7684\u5f62\u5f0f\u5728\u7406\u8bba\u4e0a\u80fd\u4fdd\u8bc1\u5f97\u5230\u4e0e\u4f60\u624b\u5de5\u9010\u884c\u8f93\u5165\u65f6\u5b8c\u5168\u76f8\u540c\u7684\u8f93\u51fa\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>separator</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--field-separator=<em class=\"replaceable\"><code>separator</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f7f\u7528<em class=\"replaceable\"><code>separator</code></em>\u4f5c\u4e3a\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset fieldsep</code>\u6216\u8005<code class=\"command\">\\f</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>hostname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>hostname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8fd0\u884c\u670d\u52a1\u5668\u7684\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u6240\u5728\u7684\u76ee\u5f55\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-H</code><br/></span><span class=\"term\"><code class=\"option\">--html</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230<acronym class=\"acronym\">HTML</acronym>\u8868\u683c\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"literal\">\\pset format html</code>\u6216\u8005<code class=\"command\">\\H</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--list</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u6240\u6709\u53ef\u7528\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u9000\u51fa\u3002\u5176\u4ed6\u975e\u8fde\u63a5\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002\u8fd9\u4e0e\u5143\u547d\u4ee4<code class=\"command\">\\list</code>\u7c7b\u4f3c\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8be5\u9009\u9879\u65f6\uff0c<span class=\"application\">psql</span>\u5c06\u8fde\u63a5\u5230\u6570\u636e\u5e93<code class=\"literal\">postgres</code>\uff0c\u9664\u975e\u547d\u4ee4\u884c\u4e0a\u6307\u5b9a\u4e86\u5176\u4ed6\u6570\u636e\u5e93\uff08\u901a\u8fc7<code class=\"option\">-d</code>\u9009\u9879\u6216\u975e\u9009\u9879\u53c2\u6570\uff0c\u4e5f\u53ef\u80fd\u901a\u8fc7\u670d\u52a1\u9879\uff0c\u4f46\u4e0d\u80fd\u901a\u8fc7\u73af\u5883\u53d8\u91cf\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--log-file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9664\u4e86\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u5199\u5230\u666e\u901a\u8f93\u51fa\u76ee\u6807\u4e4b\u5916\uff0c\u8fd8\u5199\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-readline</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8981\u4f7f\u7528<span class=\"application\">Readline</span>\u8fdb\u884c\u884c\u7f16\u8f91\uff0c\u4e5f\u4e0d\u8981\u4f7f\u7528\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\u3002\u8fd9\u6709\u52a9\u4e8e\u5728\u526a\u5207\u548c\u7c98\u8d34\u65f6\u5173\u95edTAB \u8865\u5168\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-o <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--output=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u653e\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u3002\u8fd9\u7b49\u6548\u4e8e\u547d\u4ee4<code class=\"command\">\\o</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u7684\u6587\u4ef6\u540d\u540e\u7f00\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u7684\u503c\uff1b\u672a\u8bbe\u7f6e\u65f6\uff0c\u4f7f\u7528\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u7aef\u53e3\uff0c\u901a\u5e38\u4e3a 5432\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P <em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--pset=<em class=\"replaceable\"><code>assignment</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ee5<code class=\"command\">\\pset</code>\u7684\u5f62\u5f0f\u6307\u5b9a\u6253\u5370\u9009\u9879\u3002\u6ce8\u610f\uff0c\u8fd9\u91cc\u4f60\u5fc5\u987b\u7528\u4e00\u4e2a\u7b49\u53f7\u800c\u4e0d\u662f\u7a7a\u683c\u6765\u5206\u9694\u540d\u79f0\u548c\u503c\u3002\u4f8b\u5982\uff0c\u8981\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a<span class=\"application\">LaTeX</span>\uff0c\u5e94\u8be5\u5199\u6210<code class=\"literal\">-P format=latex</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-q</code><br/></span><span class=\"term\"><code class=\"option\">--quiet</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a<span class=\"application\">psql</span>\u5e94\u8be5\u5b89\u9759\u5730\u5de5\u4f5c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4f1a\u6253\u5370\u51fa\u6b22\u8fce\u6d88\u606f\u548c\u5404\u79cd\u63d0\u793a\u4fe1\u606f\u3002\u5982\u679c\u4f7f\u7528\u4e86\u8fd9\u4e2a\u9009\u9879\uff0c\u4ee5\u4e0a\u90a3\u4e9b\u5c31\u90fd\u4e0d\u4f1a\u8f93\u51fa\u3002\u5728\u4f7f\u7528<code class=\"option\">-c</code>\u9009\u9879\u65f6\uff0c\u914d\u5408\u8fd9\u4e2a\u9009\u9879\u5f88\u6709\u7528\u3002\u8fd9\u7b49\u6548\u4e8e\u8bbe\u7f6e\u53d8\u91cf<code class=\"varname\">QUIET</code>\u4e3a<code class=\"literal\">on</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R <em class=\"replaceable\"><code>separator</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--record-separator=<em class=\"replaceable\"><code>separator</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a<em class=\"replaceable\"><code>separator</code></em>\u7528\u4f5c\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset recordsep</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code><br/></span><span class=\"term\"><code class=\"option\">--single-step</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5728\u5355\u6b65\u6a21\u5f0f\u4e2d\u3002\u8fd9\u610f\u5473\u7740\u5728\u6bcf\u4e2a\u547d\u4ee4\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u4e4b\u524d\u90fd\u4f1a\u63d0\u793a\u7528\u6237\uff0c\u5e76\u5141\u8bb8\u53d6\u6d88\u6267\u884c\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u8c03\u8bd5\u811a\u672c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S</code><br/></span><span class=\"term\"><code class=\"option\">--single-line</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd0\u884c\u5728\u5355\u884c\u6a21\u5f0f\u4e2d\uff0c\u5176\u4e2d\u6362\u884c\u7b26\u4f1a\u7ec8\u6b62\u4e00\u4e2a SQL \u547d\u4ee4\uff0c\u5c31\u50cf\u5206\u53f7\u7684\u4f5c\u7528\u4e00\u6837\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u79cd\u6a21\u5f0f\u662f\u4e3a\u575a\u6301\u4f7f\u7528\u5b83\u7684\u7528\u6237\u63d0\u4f9b\u7684\uff0c\u4f46\u5e76\u4e0d\u4e00\u5b9a\u503c\u5f97\u63a8\u8350\u3002\u7279\u522b\u662f\uff0c\u5982\u679c\u5728\u4e00\u884c\u4e2d\u6df7\u5408\u4e86<acronym class=\"acronym\">SQL</acronym>\u548c\u5143\u547d\u4ee4\uff0c\u5bf9\u4e8e\u6ca1\u6709\u7ecf\u9a8c\u7684\u7528\u6237\u6765\u8bf4\uff0c\u5b83\u4eec\u7684\u6267\u884c\u987a\u5e8f\u672a\u5fc5\u603b\u662f\u6e05\u695a\u7684\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t</code><br/></span><span class=\"term\"><code class=\"option\">--tuples-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5173\u95ed\u6253\u5370\u5217\u540d\u548c\u7ed3\u679c\u884c\u8ba1\u6570\u9875\u811a\u7b49\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\t</code>\u6216\u8005<code class=\"command\">\\pset tuples_only</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>table_options</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--table-attr=<em class=\"replaceable\"><code>table_options</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u653e\u5728<acronym class=\"acronym\">HTML</acronym> <code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u9009\u9879\u3002\u8be6\u89c1<code class=\"command\">\\pset tableattr</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f5c\u4e3a\u7528\u6237<em class=\"replaceable\"><code>username</code></em>\u800c\u4e0d\u662f\u9ed8\u8ba4\u7528\u6237\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff08\u5f53\u7136\uff0c\u4f60\u5fc5\u987b\u5177\u6709\u8fd9\u6837\u505a\u7684\u6743\u9650\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v <em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--set=<em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--variable=<em class=\"replaceable\"><code>assignment</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6267\u884c\u4e00\u6b21\u53d8\u91cf\u8d4b\u503c\uff0c\u548c<code class=\"command\">\\set</code>\u5143\u547d\u4ee4\u76f8\u4f3c\u3002\u6ce8\u610f\u4f60\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u7528\u7b49\u53f7\u5206\u9694\u540d\u5b57\u548c\u503c\uff08\u5982\u679c\u6709\uff09\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u7684\u8bbe\u7f6e\uff0c\u53bb\u6389\u7b49\u53f7\u5c31\u884c\u3002\u8981\u628a\u4e00\u4e2a\u53d8\u91cf\u8bbe\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u4f7f\u7528\u7b49\u53f7\u4f46\u662f\u53bb\u6389\u503c\u3002\u8fd9\u4e9b\u8d4b\u503c\u5728\u547d\u4ee4\u884c\u5904\u7406\u671f\u95f4\u88ab\u5b8c\u6210\uff0c\u56e0\u6b64\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u7684\u53d8\u91cf\u5c06\u5728\u7a0d\u540e\u88ab\u8986\u76d6\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">psql</span>\u7248\u672c\u5e76\u4e14\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6c38\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u8fd9\u4e2a\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4efb\u52a1\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u65f6\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u6574\u4e2a\u4f1a\u8bdd\u671f\u95f4\u90fd\u4f1a\u4fdd\u6301\u751f\u6548\uff0c\u56e0\u6b64\u5b83\u4e0d\u4ec5\u5f71\u54cd\u521d\u59cb\u8fde\u63a5\u5c1d\u8bd5\uff0c\u4e5f\u4f1a\u5f71\u54cd\u5143\u547d\u4ee4<code class=\"command\">\\connect</code>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236<span class=\"application\">psql</span>\u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\uff0c\u5373\u4f7f\u8be5\u5bc6\u7801\u5b9e\u9645\u4e0a\u4e0d\u4f1a\u88ab\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff0c\u5219<span class=\"application\">psql</span>\u65e0\u8bba\u5982\u4f55\u90fd\u4f1a\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">psql</span>\u9700\u8981\u5148\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\uff0c\u624d\u80fd\u77e5\u9053\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u663e\u5f0f\u6307\u5b9a<code class=\"option\">-W</code>\u503c\u5f97\u7528\u6765\u907f\u514d\u8fd9\u6b21\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u6574\u4e2a\u4f1a\u8bdd\u671f\u95f4\u90fd\u4f1a\u4fdd\u6301\u751f\u6548\uff0c\u56e0\u6b64\u5b83\u4e0d\u4ec5\u5f71\u54cd\u521d\u59cb\u8fde\u63a5\u5c1d\u8bd5\uff0c\u4e5f\u4f1a\u5f71\u54cd\u5143\u547d\u4ee4<code class=\"command\">\\connect</code>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x</code><br/></span><span class=\"term\"><code class=\"option\">--expanded</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5f00\u6269\u5c55\u8868\u683c\u5f0f\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\x</code>\u6216\u8005<code class=\"command\">\\pset expanded</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-X,</code><br/></span><span class=\"term\"><code class=\"option\">--no-psqlrc</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8bfb\u53d6\u542f\u52a8\u6587\u4ef6\uff08\u65e2\u4e0d\u8bfb\u53d6\u7cfb\u7edf\u8303\u56f4\u7684<code class=\"filename\">psqlrc</code>\u6587\u4ef6\uff0c\u4e5f\u4e0d\u8bfb\u53d6\u7528\u6237\u7684<code class=\"filename\">~/.psqlrc</code>\u6587\u4ef6\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-z</code><br/></span><span class=\"term\"><code class=\"option\">--field-separator-zero</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset fieldsep_zero</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-0</code><br/></span><span class=\"term\"><code class=\"option\">--record-separator-zero</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u4f8b\u5982\uff0c\u8fd9\u6709\u52a9\u4e8e\u4e0e<code class=\"literal\">xargs -0</code>\u914d\u5408\u4f7f\u7528\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset recordsep_zero</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-1</code><br/></span><span class=\"term\"><code class=\"option\">--single-transaction</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u9009\u9879\u53ea\u80fd\u4e0e\u4e00\u4e2a\u6216\u591a\u4e2a<code class=\"option\">-c</code>\u548c/\u6216<code class=\"option\">-f</code>\u9009\u9879\u7ed3\u5408\u4f7f\u7528\u3002\u5b83\u4f1a\u5bfc\u81f4<span class=\"application\">psql</span>\u5728\u7b2c\u4e00\u4e2a\u8fd9\u6837\u7684\u9009\u9879\u4e4b\u524d\u53d1\u51fa\u4e00\u4e2a<code class=\"command\">BEGIN</code>\u547d\u4ee4\uff0c\u5e76\u5728\u6700\u540e\u4e00\u4e2a\u9009\u9879\u4e4b\u540e\u53d1\u51fa\u4e00\u4e2a<code class=\"command\">COMMIT</code>\u547d\u4ee4\uff0c\u4ece\u800c\u5c06\u6240\u6709\u547d\u4ee4\u5305\u88c5\u6210\u4e00\u4e2a\u5355\u72ec\u7684\u4e8b\u52a1\u3002\u8fd9\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u547d\u4ee4\u672c\u8eab\u5305\u542b<code class=\"command\">BEGIN</code>\u3001<code class=\"command\">COMMIT</code>\u6216<code class=\"command\">ROLLBACK</code>\uff0c\u8fd9\u4e2a\u9009\u9879\u5c31\u4e0d\u4f1a\u4ea7\u751f\u671f\u671b\u7684\u6548\u679c\u3002\u53e6\u5916\uff0c\u5982\u679c\u67d0\u4e2a\u5355\u72ec\u547d\u4ee4\u4e0d\u80fd\u5728\u4e8b\u52a1\u5757\u4e2d\u6267\u884c\uff0c\u6307\u5b9a\u8fd9\u4e2a\u9009\u9879\u5c06\u5bfc\u81f4\u6574\u4e2a\u4e8b\u52a1\u5931\u8d25\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help[=<em class=\"replaceable\"><code>topic</code></em>]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u6709\u5173<span class=\"application\">psql</span>\u7684\u5e2e\u52a9\u5e76\u4e14\u9000\u51fa\u3002\u53ef\u9009\u7684<em class=\"replaceable\"><code>topic</code></em>\u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a<code class=\"literal\">options</code>\uff09\u9009\u62e9\u8981\u89e3\u91ca<span class=\"application\">psql</span>\u7684\u54ea\u4e00\u90e8\u5206\uff1a<code class=\"literal\">commands</code>\u63cf\u8ff0<span class=\"application\">psql</span>\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b<code class=\"literal\">options</code>\u63cf\u8ff0\u53ef\u4ee5\u88ab\u4f20\u9012\u7ed9<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c<code class=\"literal\">variables</code>\u5219\u663e\u793a\u6709\u5173<span class=\"application\">psql</span>\u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.18.7\">\n<h2 lang=\"zh\">\u9000\u51fa\u72b6\u6001</h2>\n<p lang=\"zh\">\u5982\u679c<span class=\"application\">psql</span>\u6b63\u5e38\u7ed3\u675f\uff0c\u5b83\u4f1a\u5411 shell \u8fd4\u56de 0\uff1b\u5982\u679c\u5b83\u81ea\u8eab\u53d1\u751f\u81f4\u547d\u9519\u8bef\uff08\u4f8b\u5982\u5185\u5b58\u8017\u5c3d\u3001\u627e\u4e0d\u5230\u6587\u4ef6\uff09\uff0c\u5219\u8fd4\u56de 1\uff1b\u5982\u679c\u5230\u670d\u52a1\u5668\u7684\u8fde\u63a5\u53d1\u751f\u6545\u969c\u4e14\u8be5\u4f1a\u8bdd\u4e0d\u662f\u4ea4\u4e92\u5f0f\u7684\uff0c\u5219\u8fd4\u56de 2\uff1b\u5982\u679c\u811a\u672c\u4e2d\u53d1\u751f\u9519\u8bef\u4e14\u53d8\u91cf<code class=\"varname\">ON_ERROR_STOP</code>\u5df2\u8bbe\u7f6e\uff0c\u5219\u8fd4\u56de 3\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.18.8\">\n<h2 lang=\"zh\">\u7528\u6cd5</h2>\n<div class=\"refsect2\" id=\"R2-APP-PSQL-CONNECTING\">\n<h3 lang=\"zh\">\u8fde\u63a5\u5230\u6570\u636e\u5e93</h3>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u662f\u5e38\u89c4\u7684 <span class=\"productname\">PostgreSQL</span> \u5ba2\u6237\u7aef\u5e94\u7528\u7a0b\u5e8f\u3002\u8981\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff0c\u4f60\u9700\u8981\u77e5\u9053\u76ee\u6807\u6570\u636e\u5e93\u540d\u79f0\u3001\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u548c\u7aef\u53e3\u53f7\uff0c\u4ee5\u53ca\u8981\u4ee5\u54ea\u4e2a\u6570\u636e\u5e93\u7528\u6237\u540d\u8fde\u63a5\u3002<span class=\"application\">psql</span> \u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u9009\u9879 <code class=\"option\">-d</code>\u3001<code class=\"option\">-h</code>\u3001<code class=\"option\">-p</code> \u548c <code class=\"option\">-U</code> \u5206\u522b\u6307\u5b9a\u8fd9\u4e9b\u53c2\u6570\u3002\u5982\u679c\u9047\u5230\u4e00\u4e2a\u4e0d\u5c5e\u4e8e\u4efb\u4f55\u9009\u9879\u7684\u53c2\u6570\uff0c\u5b83\u5c06\u88ab\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u540d\uff08\u5982\u679c\u6570\u636e\u5e93\u540d\u5df2\u7ecf\u7ed9\u51fa\uff0c\u5219\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u7528\u6237\u540d\uff09\u3002\u5e76\u975e\u6240\u6709\u8fd9\u4e9b\u9009\u9879\u90fd\u662f\u5fc5\u9700\u7684\uff1b\u5b83\u4eec\u90fd\u6709\u6709\u7528\u7684\u9ed8\u8ba4\u503c\u3002\u5982\u679c\u7701\u7565\u4e3b\u673a\u540d\uff0c<span class=\"application\">psql</span> \u5c06\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u5230\u672c\u5730\u4e3b\u673a\u4e0a\u7684\u670d\u52a1\u5668\uff0c\u800c\u5728\u6ca1\u6709 Unix \u57df\u5957\u63a5\u5b57\u7684\u673a\u5668\u4e0a\u5219\u901a\u8fc7 TCP/IP \u8fde\u63a5\u5230 <code class=\"literal\">localhost</code>\u3002\u9ed8\u8ba4\u7aef\u53e3\u53f7\u5728\u7f16\u8bd1\u65f6\u786e\u5b9a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u670d\u52a1\u5668\u4f7f\u7528\u76f8\u540c\u7684\u9ed8\u8ba4\u503c\uff0c\u56e0\u6b64\u5728\u5927\u591a\u6570\u60c5\u51b5\u4e0b\u4e0d\u5fc5\u6307\u5b9a\u7aef\u53e3\u3002\u9ed8\u8ba4\u7528\u6237\u540d\u662f\u4f60\u7684\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\uff0c\u9ed8\u8ba4\u6570\u636e\u5e93\u540d\u4e5f\u662f\u5982\u6b64\u3002\u8bf7\u6ce8\u610f\uff0c\u4f60\u4e0d\u80fd\u968f\u610f\u4ee5\u4efb\u610f\u6570\u636e\u5e93\u7528\u6237\u540d\u8fde\u63a5\u5230\u4efb\u610f\u6570\u636e\u5e93\u3002\u6570\u636e\u5e93\u7ba1\u7406\u5458\u5e94\u5f53\u5df2\u7ecf\u544a\u77e5\u4f60\u62e5\u6709\u7684\u8bbf\u95ee\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5f53\u9ed8\u8ba4\u503c\u4e0d\u5b8c\u5168\u5408\u9002\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7\u628a\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGDATABASE</code>\u3001<code class=\"envar\">PGHOST</code>\u3001<code class=\"envar\">PGPORT</code>\u548c<code class=\"envar\">PGUSER</code>\u8bbe\u7f6e\u4e3a\u9002\u5f53\u7684\u503c\u6765\u5c11\u6572\u4e00\u4e9b\u952e\u76d8\uff08\u989d\u5916\u7684\u73af\u5883\u53d8\u91cf\u89c1<a class=\"xref\" href=\"/docs/11/libpq-envars.html\" title=\"34.14.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a034.14\u00a0\u8282</a>\uff09\u3002\u53e6\u5916\uff0c\u51c6\u5907\u4e00\u4e2a<code class=\"filename\">~/.pgpass</code>\u6587\u4ef6\u4e5f\u5f88\u65b9\u4fbf\uff0c\u8fd9\u6837\u5c31\u4e0d\u5fc5\u7ecf\u5e38\u624b\u5de5\u8f93\u5165\u5bc6\u7801\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/11/libpq-pgpass.html\" title=\"34.15.\u00a0\u5bc6\u7801\u6587\u4ef6\">\u7b2c\u00a034.15\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u53e6\u4e00\u79cd\u6307\u5b9a\u8fde\u63a5\u53c2\u6570\u7684\u65b9\u6cd5\u662f\u4f7f\u7528 conninfo \u5b57\u7b26\u4e32\u6216 URI \u6765\u4ee3\u66ff\u6570\u636e\u5e93\u540d\u3002\u6b64\u673a\u5236\u5141\u8bb8\u5bf9\u8fde\u63a5\u8fdb\u884c\u975e\u5e38\u5e7f\u6cdb\u7684\u63a7\u5236\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">$ <strong class=\"userinput\"><code>psql \"service=myservice sslmode=require\"</code></strong>\n$ <strong class=\"userinput\"><code>psql postgresql://dbmaster:5433/mydb?sslmode=require</code></strong>\n</pre>\n<p lang=\"zh\">\u7528\u8fd9\u79cd\u65b9\u5f0f\uff0c\u4f60\u4e5f\u53ef\u4ee5\u628a<acronym class=\"acronym\">LDAP</acronym>\u7528\u4e8e<a class=\"xref\" href=\"/docs/11/libpq-ldap.html\" title=\"34.17.\u00a0\u8fde\u63a5\u53c2\u6570\u7684 LDAP \u67e5\u627e\">\u7b2c\u00a034.17\u00a0\u8282</a>\u4e2d\u63cf\u8ff0\u7684\u8fde\u63a5\u53c2\u6570\u67e5\u627e\u3002\u53ef\u7528\u8fde\u63a5\u9009\u9879\u7684\u66f4\u591a\u4fe1\u606f\u8bf7\u89c1<a class=\"xref\" href=\"/docs/11/libpq.html#LIBPQ-PARAMKEYWORDS\" title=\"34.1.2.\u00a0\u53c2\u6570\u5173\u952e\u8bcd\">\u7b2c\u00a034.1.2\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7531\u4e8e\u4efb\u4f55\u539f\u56e0\uff08\u4f8b\u5982\u6743\u9650\u4e0d\u8db3\u3001\u670d\u52a1\u5668\u6ca1\u6709\u5728\u76ee\u6807\u4e3b\u673a\u4e0a\u8fd0\u884c\u7b49\uff09\u5bfc\u81f4\u8fde\u63a5\u65e0\u6cd5\u5efa\u7acb\uff0c<span class=\"application\">psql</span>\u5c06\u8fd4\u56de\u4e00\u4e2a\u9519\u8bef\u5e76\u4e14\u7ec8\u6b62\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6807\u51c6\u8f93\u5165\u548c\u6807\u51c6\u8f93\u51fa\u90fd\u662f\u7ec8\u7aef\uff0c\u90a3\u4e48<span class=\"application\">psql</span>\u4f1a\u628a\u5ba2\u6237\u7aef\u7f16\u7801\u8bbe\u7f6e\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">auto</span>\u201d</span>\uff0c\u4ece\u533a\u57df\u8bbe\u7f6e\u4e2d\u68c0\u6d4b\u5408\u9002\u7684\u5ba2\u6237\u7aef\u7f16\u7801\uff08\u5728 Unix \u7cfb\u7edf\u4e0a\u662f<code class=\"envar\">LC_CTYPE</code>\u73af\u5883\u53d8\u91cf\uff09\u3002\u5982\u679c\u7ed3\u679c\u4e0d\u7b26\u5408\u9884\u671f\uff0c\u53ef\u4ee5\u4f7f\u7528\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGCLIENTENCODING</code>\u8986\u76d6\u5ba2\u6237\u7aef\u7f16\u7801\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"R2-APP-PSQL-4\">\n<h3 lang=\"zh\">\u8f93\u5165 SQL \u547d\u4ee4</h3>\n<p lang=\"zh\">\u5728\u6b63\u5e38\u64cd\u4f5c\u65f6\uff0c<span class=\"application\">psql</span>\u4f1a\u63d0\u4f9b\u4e00\u4e2a\u63d0\u793a\u7b26\uff0c\u8be5\u63d0\u793a\u7b26\u662f<span class=\"application\">psql</span>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u540d\u79f0\u540e\u9762\u8ddf\u4e0a\u5b57\u7b26\u4e32<code class=\"literal\">=&gt;</code>\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">$ <strong class=\"userinput\"><code>psql testdb</code></strong>\npsql (11.22)\nType \"help\" for help.\n\ntestdb=&gt;\n</pre>\n<p lang=\"zh\">\u5728\u63d0\u793a\u7b26\u4e0b\uff0c\u7528\u6237\u53ef\u4ee5\u8f93\u5165<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u3002\u901a\u5e38\uff0c\u5f53\u9047\u5230\u8868\u793a\u547d\u4ee4\u7ed3\u675f\u7684\u5206\u53f7\u65f6\uff0c\u8f93\u5165\u7684\u5185\u5bb9\u5c31\u4f1a\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u3002\u884c\u7ed3\u675f\u5e76\u4e0d\u4f1a\u7ec8\u6b62\u4e00\u6761\u547d\u4ee4\uff0c\u56e0\u6b64\u4e3a\u4e86\u63d0\u9ad8\u6e05\u6670\u5ea6\uff0c\u547d\u4ee4\u53ef\u4ee5\u5206\u5e03\u5728\u591a\u884c\u4e0a\u3002\u5982\u679c\u547d\u4ee4\u88ab\u53d1\u9001\u5e76\u6210\u529f\u6267\u884c\uff0c\u5176\u7ed3\u679c\u5c31\u4f1a\u663e\u793a\u5728\u5c4f\u5e55\u4e0a\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u53d7\u4fe1\u4efb\u7684\u7528\u6237\u80fd\u591f\u8bbf\u95ee\u5c1a\u672a\u91c7\u7528<a class=\"link\" href=\"/docs/11/ddl-schemas.html#DDL-SCHEMAS-PATTERNS\" title=\"5.8.6.\u00a0\u4f7f\u7528\u65b9\u5f0f\">\u6a21\u5f0f\u7684\u5b89\u5168\u4f7f\u7528\u65b9\u5f0f</a>\u7684\u6570\u636e\u5e93\uff0c\u8bf7\u5728\u4f1a\u8bdd\u5f00\u59cb\u65f6\u4ece<code class=\"varname\">search_path</code>\u4e2d\u79fb\u9664\u6240\u6709\u516c\u4f17\u53ef\u5199\u7684\u6a21\u5f0f\u3002\u53ef\u4ee5\u5728\u8fde\u63a5\u5b57\u7b26\u4e32\u4e2d\u52a0\u5165<code class=\"literal\">options=-csearch_path=</code>\uff0c\u6216\u8005\u5728\u6267\u884c\u5176\u4ed6 SQL \u547d\u4ee4\u4e4b\u524d\u53d1\u51fa<code class=\"literal\">SELECT pg_catalog.set_config('search_path', '', false)</code>\u3002\u8fd9\u79cd\u8003\u8651\u5e76\u975e<span class=\"application\">psql</span>\u7279\u6709\uff1b\u5b83\u9002\u7528\u4e8e\u4efb\u4f55\u6267\u884c\u4efb\u610f SQL \u547d\u4ee4\u7684\u63a5\u53e3\u3002</p>\n<p lang=\"zh\">\u6bcf\u5f53\u6267\u884c\u547d\u4ee4\u65f6\uff0c<span class=\"application\">psql</span>\u4e5f\u4f1a\u8f6e\u8be2\u7531<a class=\"xref\" href=\"/docs/11/sql-listen.html\" title=\"LISTEN\"><span class=\"refentrytitle\">LISTEN</span></a>\u548c<a class=\"xref\" href=\"/docs/11/sql-notify.html\" title=\"NOTIFY\"><span class=\"refentrytitle\">NOTIFY</span></a>\u751f\u6210\u7684\u5f02\u6b65\u901a\u77e5\u4e8b\u4ef6\u3002</p>\n<p lang=\"zh\">\u867d\u7136 C \u98ce\u683c\u7684\u5757\u6ce8\u91ca\u4f1a\u88ab\u4f20\u7ed9\u670d\u52a1\u5668\u5904\u7406\u5e76\u79fb\u9664\uff0c\u4f46 SQL \u6807\u51c6\u6ce8\u91ca\u4f1a\u7531<span class=\"application\">psql</span>\u81ea\u884c\u79fb\u9664\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"APP-PSQL-META-COMMANDS\">\n<h3 lang=\"zh\">\u5143\u547d\u4ee4</h3>\n<p lang=\"zh\">\u4f60\u8f93\u5165\u5230<span class=\"application\">psql</span>\u4e2d\u7684\u4efb\u4f55\u4ee5\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u5f00\u59cb\u7684\u4e1c\u897f\u90fd\u662f\u4e00\u4e2a<span class=\"application\">psql</span>\u5143\u547d\u4ee4\uff0c\u5b83\u4eec\u7531<span class=\"application\">psql</span>\u81ea\u884c\u5904\u7406\u3002\u8fd9\u4e9b\u547d\u4ee4\u8ba9<span class=\"application\">psql</span>\u5bf9\u7ba1\u7406\u548c\u7f16\u5199\u811a\u672c\u66f4\u6709\u7528\u3002\u5143\u547d\u4ee4\u5e38\u5e38\u88ab\u79f0\u4f5c\u659c\u7ebf\u6216\u8005\u53cd\u659c\u7ebf\u547d\u4ee4\u3002</p>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u547d\u4ee4\u7684\u683c\u5f0f\u662f\u7528\u53cd\u659c\u7ebf\u540e\u9762\u76f4\u63a5\u8ddf\u4e0a\u4e00\u4e2a\u547d\u4ee4\u52a8\u8bcd\uff0c\u7136\u540e\u662f\u4e00\u4e9b\u53c2\u6570\u3002\u53c2\u6570\u4e0e\u547d\u4ee4\u52a8\u8bcd\u548c\u5176\u4ed6\u53c2\u6570\u4e4b\u95f4\u7528\u4efb\u610f\u591a\u4e2a\u7a7a\u767d\u5b57\u7b26\u5206\u9694\u5f00\u3002</p>\n<p lang=\"zh\">\u8981\u5728\u53c2\u6570\u4e2d\u5305\u542b\u7a7a\u767d\uff0c\u53ef\u4ee5\u7528\u5355\u5f15\u53f7\u5c06\u5b83\u62ec\u8d77\u6765\u3002\u8981\u5728\u53c2\u6570\u4e2d\u5305\u542b\u4e00\u4e2a\u5355\u5f15\u53f7\uff0c\u53ef\u4ee5\u5728\u5355\u5f15\u53f7\u6587\u672c\u5185\u5199\u4e24\u4e2a\u5355\u5f15\u53f7\u3002\u5355\u5f15\u53f7\u4e2d\u7684\u5185\u5bb9\u8fd8\u4f1a\u63a5\u53d7\u7c7b\u4f3c C \u8bed\u8a00\u7684\u66ff\u6362\uff1a<code class=\"literal\">\\n</code>\uff08\u6362\u884c\uff09\u3001<code class=\"literal\">\\t</code>\uff08\u5236\u8868\u7b26\uff09\u3001<code class=\"literal\">\\b</code>\uff08\u9000\u683c\uff09\u3001<code class=\"literal\">\\r</code>\uff08\u56de\u8f66\uff09\u3001<code class=\"literal\">\\f</code>\uff08\u6362\u9875\uff09\u3001<code class=\"literal\">\\</code><em class=\"replaceable\"><code>digits</code></em>\uff08\u516b\u8fdb\u5236\uff09\u4ee5\u53ca<code class=\"literal\">\\x</code><em class=\"replaceable\"><code>digits</code></em>\uff08\u5341\u516d\u8fdb\u5236\uff09\u3002\u5728\u5355\u5f15\u53f7\u6587\u672c\u5185\uff0c\u53cd\u659c\u7ebf\u51fa\u73b0\u5728\u4efb\u4f55\u5176\u4ed6\u5b57\u7b26\u524d\u9762\u65f6\uff0c\u53ea\u662f\u5bf9\u8be5\u5355\u4e2a\u5b57\u7b26\u8fdb\u884c\u8f6c\u4e49\uff0c\u4e0d\u8bba\u5b83\u662f\u4ec0\u4e48\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u53c2\u6570\u4e2d\u51fa\u73b0\u4e00\u4e2a\u672a\u52a0\u5f15\u53f7\u7684\u5192\u53f7\uff08<code class=\"literal\">:</code>\uff09\uff0c\u540e\u9762\u7d27\u8ddf\u4e00\u4e2a<span class=\"application\">psql</span>\u53d8\u91cf\u540d\uff0c\u5b83\u5c31\u4f1a\u88ab\u8be5\u53d8\u91cf\u7684\u503c\u66ff\u6362\uff0c\u5982\u4e0b\u9762<a class=\"xref\" href=\"/docs/11/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL \u63d2\u503c\"><acronym class=\"acronym\">SQL</acronym> \u63d2\u503c</a>\u6240\u8ff0\u3002\u5176\u4e2d\u4ecb\u7ecd\u7684<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u548c<code class=\"literal\">:\"<em class=\"replaceable\"><code>variable_name</code></em>\"</code>\u5f62\u5f0f\u4e5f\u540c\u6837\u9002\u7528\u3002<code class=\"literal\">:{?<em class=\"replaceable\"><code>variable_name</code></em>}</code>\u8bed\u6cd5\u5141\u8bb8\u6d4b\u8bd5\u53d8\u91cf\u662f\u5426\u5df2\u5b9a\u4e49\uff1b\u5b83\u4f1a\u88ab TRUE \u6216 FALSE \u66ff\u6362\u3002\u7528\u53cd\u659c\u7ebf\u8f6c\u4e49\u8be5\u5192\u53f7\u53ef\u4ee5\u9632\u6b62\u66ff\u6362\u53d1\u751f\u3002</p>\n<p lang=\"zh\">\u5728\u53c2\u6570\u4e2d\uff0c\u7528\u53cd\u5f15\u53f7\uff08<code class=\"literal\">`</code>\uff09\u5305\u56f4\u7684\u6587\u672c\u4f1a\u88ab\u89c6\u4e3a\u4f20\u7ed9 shell \u7684\u547d\u4ee4\u884c\u3002\u8be5\u547d\u4ee4\u7684\u8f93\u51fa\uff08\u53bb\u6389\u672b\u5c3e\u7684\u6362\u884c\u7b26\uff09\u4f1a\u66ff\u6362\u53cd\u5f15\u53f7\u4e2d\u7684\u6587\u672c\u3002\u5728\u53cd\u5f15\u53f7\u5305\u56f4\u7684\u6587\u672c\u5185\u90e8\uff0c\u4e0d\u4f1a\u8fdb\u884c\u7279\u6b8a\u7684\u5f15\u53f7\u5904\u7406\u6216\u5176\u4ed6\u5904\u7406\uff0c\u4f46\u51fa\u73b0<code class=\"literal\">:<em class=\"replaceable\"><code>variable_name</code></em></code>\u65f6\uff0c\u5982\u679c<em class=\"replaceable\"><code>variable_name</code></em>\u662f<span class=\"application\">psql</span>\u53d8\u91cf\u540d\uff0c\u5c31\u4f1a\u88ab\u66ff\u6362\u4e3a\u8be5\u53d8\u91cf\u7684\u503c\u3002\u6b64\u5916\uff0c<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u4e5f\u4f1a\u88ab\u66ff\u6362\u4e3a\u8be5\u53d8\u91cf\u7684\u503c\uff0c\u5e76\u4f1a\u9002\u5f53\u5730\u52a0\u4e0a\u5f15\u53f7\uff0c\u4f7f\u5176\u6210\u4e3a\u5355\u4e2a shell \u547d\u4ee4\u53c2\u6570\u3002\uff08\u540e\u4e00\u79cd\u5f62\u5f0f\u51e0\u4e4e\u603b\u662f\u66f4\u53ef\u53d6\uff0c\u9664\u975e\u4f60\u975e\u5e38\u786e\u5b9a\u53d8\u91cf\u4e2d\u5305\u542b\u4ec0\u4e48\u3002\uff09\u7531\u4e8e\u65e0\u6cd5\u4fdd\u8bc1\u5728\u6240\u6709\u5e73\u53f0\u4e0a\u90fd\u80fd\u5bf9\u56de\u8f66\u548c\u6362\u884c\u5b57\u7b26\u5b89\u5168\u5730\u52a0\u5f15\u53f7\uff0c\u5f53\u53d8\u91cf\u503c\u4e2d\u51fa\u73b0\u8fd9\u7c7b\u5b57\u7b26\u65f6\uff0c<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u5f62\u5f0f\u4f1a\u6253\u5370\u9519\u8bef\u6d88\u606f\uff0c\u5e76\u4e14\u4e0d\u4f1a\u66ff\u6362\u53d8\u91cf\u503c\u3002</p>\n<p lang=\"zh\">\u4e00\u4e9b\u547d\u4ee4\u63a5\u53d7 SQL \u6807\u8bc6\u7b26\uff08\u4f8b\u5982\u8868\u540d\uff09\u4f5c\u4e3a\u53c2\u6570\u3002\u8fd9\u4e9b\u53c2\u6570\u9075\u5faa SQL \u8bed\u6cd5\u89c4\u5219\uff1a\u672a\u52a0\u5f15\u53f7\u7684\u5b57\u6bcd\u4f1a\u5f3a\u5236\u8f6c\u6362\u4e3a\u5c0f\u5199\uff0c\u800c\u53cc\u5f15\u53f7\uff08\"\uff09\u4f1a\u4fdd\u62a4\u5b57\u6bcd\u4e0d\u88ab\u8f6c\u6362\u5927\u5c0f\u5199\uff0c\u5e76\u5141\u8bb8\u6807\u8bc6\u7b26\u5305\u542b\u7a7a\u767d\u5b57\u7b26\u3002\u5728\u53cc\u5f15\u53f7\u5185\u90e8\uff0c\u8fde\u7eed\u4e24\u4e2a\u53cc\u5f15\u53f7\u4f1a\u5728\u6700\u7ec8\u540d\u79f0\u4e2d\u53d8\u4e3a\u4e00\u4e2a\u53cc\u5f15\u53f7\u3002\u4f8b\u5982\uff0cFOO\"BAR\"BAZ \u4f1a\u88ab\u89e3\u91ca\u4e3a fooBARbaz\uff0c\u800c \"A weird\"\" name\" \u4f1a\u53d8\u4e3a A weird\" name\u3002</p>\n<p lang=\"zh\">\u53c2\u6570\u89e3\u6790\u4f1a\u5728\u884c\u5c3e\u6216\u9047\u5230\u53e6\u4e00\u4e2a\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u65f6\u505c\u6b62\u3002\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u4f1a\u88ab\u89c6\u4e3a\u65b0\u5143\u547d\u4ee4\u7684\u5f00\u59cb\u3002\u7279\u6b8a\u5e8f\u5217<code class=\"literal\">\\\\</code>\uff08\u4e24\u4e2a\u53cd\u659c\u7ebf\uff09\u8868\u793a\u53c2\u6570\u7ed3\u675f\uff0c\u5e76\u7ee7\u7eed\u89e3\u6790<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\uff08\u5982\u679c\u8fd8\u6709\uff09\u3002\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u548c<span class=\"application\">psql</span>\u547d\u4ee4\u53ef\u4ee5\u81ea\u7531\u5730\u6df7\u5408\u5728\u540c\u4e00\u884c\u4e2d\u3002\u4f46\u65e0\u8bba\u5982\u4f55\uff0c\u5143\u547d\u4ee4\u7684\u53c2\u6570\u90fd\u4e0d\u80fd\u5ef6\u7eed\u5230\u4e0b\u4e00\u884c\u3002</p>\n<p lang=\"zh\">\u8bb8\u591a\u5143\u547d\u4ee4\u4f5c\u7528\u4e8e<em class=\"firstterm\">\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a</em>\u3002\u8fd9\u53ea\u662f\u4e00\u4e2a\u4fdd\u5b58\u5df2\u8f93\u5165\u4f46\u5c1a\u672a\u53d1\u9001\u5230\u670d\u52a1\u5668\u6267\u884c\u7684 SQL \u547d\u4ee4\u6587\u672c\u7684\u7f13\u51b2\u533a\u3002\u5176\u4e2d\u65e2\u5305\u62ec\u5148\u524d\u8f93\u5165\u7684\u884c\uff0c\u4e5f\u5305\u62ec\u540c\u4e00\u884c\u4e0a\u4f4d\u4e8e\u5143\u547d\u4ee4\u4e4b\u524d\u7684\u6587\u672c\u3002</p>\n<p lang=\"zh\">\u5b9a\u4e49\u4e86\u4ee5\u4e0b\u5143\u547d\u4ee4\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">\\a</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u5f53\u524d\u8868\u683c\u8f93\u51fa\u683c\u5f0f\u662f\u975e\u5bf9\u9f50\uff0c\u5219\u5207\u6362\u4e3a\u5bf9\u9f50\uff1b\u5426\u5219\u5207\u6362\u4e3a\u975e\u5bf9\u9f50\u3002\u4fdd\u7559\u6b64\u547d\u4ee4\u662f\u4e3a\u4e86\u5411\u540e\u517c\u5bb9\u3002\u66f4\u901a\u7528\u7684\u89e3\u51b3\u65b9\u6848\u8bf7\u53c2\u89c1<code class=\"command\">\\pset</code>\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\c</code> \u6216 <code class=\"literal\">\\connect [ -reuse-previous=<em class=\"replaceable\"><code>on|off</code></em> ] [ <em class=\"replaceable\"><code>dbname</code></em> [ <em class=\"replaceable\"><code>username</code></em> ] [ <em class=\"replaceable\"><code>host</code></em> ] [ <em class=\"replaceable\"><code>port</code></em> ] | <em class=\"replaceable\"><code>conninfo</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5efa\u7acb\u5230<span class=\"productname\">PostgreSQL</span>\u670d\u52a1\u5668\u7684\u65b0\u8fde\u63a5\u3002\u8fde\u63a5\u53c2\u6570\u65e2\u53ef\u4ee5\u4f7f\u7528\u6309\u4f4d\u7f6e\u6307\u5b9a\u7684\u8bed\u6cd5\uff08\u6570\u636e\u5e93\u540d\u3001\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\u4e2d\u7684\u4e00\u4e2a\u6216\u591a\u4e2a\uff09\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528<em class=\"replaceable\"><code>conninfo</code></em>\u8fde\u63a5\u5b57\u7b26\u4e32\uff0c\u8be6\u89c1<a class=\"xref\" href=\"/docs/11/libpq.html#LIBPQ-CONNSTRING\" title=\"34.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u7b2c\u00a034.1.1\u00a0\u8282</a>\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa\u53c2\u6570\uff0c\u5219\u4f7f\u7528\u4e0e\u4e4b\u524d\u76f8\u540c\u7684\u53c2\u6570\u5efa\u7acb\u65b0\u8fde\u63a5\u3002</p>\n<p lang=\"zh\">\u5c06<em class=\"replaceable\"><code>dbname</code></em>\u3001<em class=\"replaceable\"><code>username</code></em>\u3001<em class=\"replaceable\"><code>host</code></em>\u6216<em class=\"replaceable\"><code>port</code></em>\u4e2d\u7684\u4efb\u4f55\u4e00\u4e2a\u6307\u5b9a\u4e3a<code class=\"literal\">-</code>\uff0c\u90fd\u7b49\u4ef7\u4e8e\u7701\u7565\u8be5\u53c2\u6570\u3002</p>\n<p lang=\"zh\">\u65b0\u8fde\u63a5\u53ef\u4ee5\u91cd\u7528\u524d\u4e00\u4e2a\u8fde\u63a5\u7684\u8fde\u63a5\u53c2\u6570\uff1b\u4e0d\u4ec5\u5305\u62ec\u6570\u636e\u5e93\u540d\u79f0\u3001\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\uff0c\u8fd8\u5305\u62ec\u5176\u4ed6\u8bbe\u7f6e\uff0c\u5982<em class=\"replaceable\"><code>sslmode</code></em>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53c2\u6570\u5728\u4f4d\u7f6e\u8bed\u6cd5\u4e2d\u88ab\u91cd\u7528\uff0c\u4f46\u5728\u7ed9\u5b9a<em class=\"replaceable\"><code>conninfo</code></em>\u5b57\u7b26\u4e32\u65f6\u4e0d\u4f1a\u88ab\u91cd\u7528\u3002\u4f20\u9012<code class=\"literal\">-reuse-previous=on</code>\u6216<code class=\"literal\">-reuse-previous=off</code>\u4f5c\u4e3a\u7b2c\u4e00\u4e2a\u53c2\u6570\u5c06\u8986\u76d6\u8be5\u9ed8\u8ba4\u8bbe\u7f6e\u3002\u5982\u679c\u53c2\u6570\u88ab\u91cd\u7528\uff0c\u5219\u4efb\u4f55\u672a\u660e\u786e\u6307\u5b9a\u4e3a\u4f4d\u7f6e\u53c2\u6570\u6216\u5728<em class=\"replaceable\"><code>conninfo</code></em>\u5b57\u7b26\u4e32\u4e2d\u7684\u53c2\u6570\u5c06\u4ece\u73b0\u6709\u8fde\u63a5\u7684\u53c2\u6570\u4e2d\u83b7\u53d6\u3002\u4e00\u4e2a\u4f8b\u5916\u662f\uff0c\u5982\u679c\u4f7f\u7528\u4f4d\u7f6e\u8bed\u6cd5\u66f4\u6539<em class=\"replaceable\"><code>host</code></em>\u8bbe\u7f6e\uff0c\u4f7f\u5176\u4e0d\u540c\u4e8e\u5148\u524d\u7684\u503c\uff0c\u5219\u73b0\u6709\u8fde\u63a5\u53c2\u6570\u4e2d\u5b58\u5728\u7684\u4efb\u4f55<em class=\"replaceable\"><code>hostaddr</code></em>\u8bbe\u7f6e\u5c06\u88ab\u5220\u9664\u3002\u6b64\u5916\uff0c\u4ec5\u5f53\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\u8bbe\u7f6e\u672a\u66f4\u6539\u65f6\uff0c\u624d\u4f1a\u91cd\u7528\u73b0\u6709\u8fde\u63a5\u4f7f\u7528\u7684\u4efb\u4f55\u5bc6\u7801\u3002\u5f53\u547d\u4ee4\u65e2\u4e0d\u6307\u5b9a\u4e5f\u4e0d\u91cd\u7528\u7279\u5b9a\u53c2\u6570\u65f6\uff0c\u5c06\u4f7f\u7528<span class=\"application\">libpq</span>\u7684\u9ed8\u8ba4\u503c\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6210\u529f\u5efa\u7acb\u4e86\u65b0\u8fde\u63a5\uff0c\u5219\u5173\u95ed\u5148\u524d\u7684\u8fde\u63a5\u3002\u5982\u679c\u8fde\u63a5\u5c1d\u8bd5\u5931\u8d25\uff08\u7528\u6237\u540d\u9519\u8bef\u3001\u8bbf\u95ee\u88ab\u62d2\u7edd\u7b49\uff09\uff0c\u5f53<span class=\"application\">psql</span>\u5904\u4e8e\u4ea4\u4e92\u6a21\u5f0f\u65f6\uff0c\u4f1a\u4fdd\u7559\u5148\u524d\u7684\u8fde\u63a5\u3002\u4f46\u5728\u6267\u884c\u975e\u4ea4\u4e92\u5f0f\u811a\u672c\u65f6\uff0c\u4f1a\u7acb\u5373\u62a5\u9519\u5e76\u505c\u6b62\u5904\u7406\u3002\u8fd9\u4e00\u533a\u522b\u4e00\u65b9\u9762\u4f7f\u7528\u6237\u80fd\u591f\u65b9\u4fbf\u5730\u5e94\u5bf9\u8f93\u5165\u9519\u8bef\uff0c\u53e6\u4e00\u65b9\u9762\u4e5f\u4f5c\u4e3a\u5b89\u5168\u673a\u5236\uff0c\u9632\u6b62\u811a\u672c\u610f\u5916\u5730\u4f5c\u7528\u4e8e\u9519\u8bef\u7684\u6570\u636e\u5e93\u3002</p>\n<p lang=\"zh\">\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">=&gt; \\c mydb myuser host.dom 6432\n=&gt; \\c service=foo\n=&gt; \\c \"host=localhost port=5432 dbname=mydb connect_timeout=10 sslmode=disable\"\n=&gt; \\c -reuse-previous=on sslmode=require    -- changes only sslmode\n=&gt; \\c postgresql://tom@localhost/mydb?application_name=myapp\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\C [ <em class=\"replaceable\"><code>title</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u4f5c\u4e3a\u67e5\u8be2\u7ed3\u679c\u6253\u5370\u7684\u8868\u7684\u6807\u9898\uff0c\u6216\u53d6\u6d88\u6b64\u7c7b\u6807\u9898\u3002\u8be5\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset title <em class=\"replaceable\"><code>title</code></em></code>\u3002\uff08\u6b64\u547d\u4ee4\u7684\u540d\u79f0\u6e90\u81ea<span class=\"quote\">\u201c<span class=\"quote\">caption</span>\u201d</span>\uff0c\u56e0\u4e3a\u5b83\u8fc7\u53bb\u53ea\u7528\u4e8e\u8bbe\u7f6e<acronym class=\"acronym\">HTML</acronym>\u8868\u7684\u6807\u9898\u3002\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\cd [ <em class=\"replaceable\"><code>directory</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u66f4\u6539\u4e3a<em class=\"replaceable\"><code>directory</code></em>\u3002\u5982\u679c\u6ca1\u6709\u53c2\u6570\uff0c\u5219\u5207\u6362\u5230\u5f53\u524d\u7528\u6237\u7684\u4e3b\u76ee\u5f55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8981\u6253\u5370\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\uff0c\u8bf7\u4f7f\u7528<code class=\"literal\">\\! pwd</code>\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\conninfo</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa\u5f53\u524d\u6570\u636e\u5e93\u8fde\u63a5\u7684\u4fe1\u606f\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMANDS-COPY\"><span class=\"term\"><code class=\"literal\">\\copy { <em class=\"replaceable\"><code>table</code></em> [ ( <em class=\"replaceable\"><code>column_list</code></em> ) ] | ( <em class=\"replaceable\"><code>query</code></em> ) } { <code class=\"literal\">from</code> | <code class=\"literal\">to</code> } { <em class=\"replaceable\"><code>'filename'</code></em> | program <em class=\"replaceable\"><code>'command'</code></em> | stdin | stdout | pstdin | pstdout } [ [ with ] ( <em class=\"replaceable\"><code>option</code></em> [, ...] ) ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6267\u884c\u524d\u7aef\uff08\u5ba2\u6237\u7aef\uff09\u590d\u5236\u3002\u8be5\u64cd\u4f5c\u4f1a\u8fd0\u884c\u4e00\u4e2a<acronym class=\"acronym\">SQL</acronym> <a class=\"xref\" href=\"/docs/11/sql-copy.html\" title=\"COPY\"><span class=\"refentrytitle\">COPY</span></a>\u547d\u4ee4\uff0c\u4f46\u5e76\u4e0d\u662f\u7531\u670d\u52a1\u5668\u8bfb\u53d6\u6216\u5199\u5165\u6307\u5b9a\u6587\u4ef6\uff0c\u800c\u662f\u7531<span class=\"application\">psql</span>\u8bfb\u53d6\u6216\u5199\u5165\u6587\u4ef6\uff0c\u5e76\u5728\u670d\u52a1\u5668\u4e0e\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e4b\u95f4\u8f6c\u9001\u6570\u636e\u3002\u8fd9\u610f\u5473\u7740\u6587\u4ef6\u53ef\u8bbf\u95ee\u6027\u548c\u6743\u9650\u53d6\u51b3\u4e8e\u672c\u5730\u7528\u6237\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\uff0c\u4e5f\u4e0d\u9700\u8981 SQL \u8d85\u7ea7\u7528\u6237\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5f53\u6307\u5b9a<code class=\"literal\">program</code>\u65f6\uff0c<em class=\"replaceable\"><code>command</code></em> \u7531<span class=\"application\">psql</span>\u6267\u884c\uff0c\u4f20\u7ed9<em class=\"replaceable\"><code>command</code></em>\u7684\u6570\u636e\u6216\u4ece\u5176\u4e2d\u8bfb\u51fa\u7684\u6570\u636e\u90fd\u4f1a\u5728\u670d\u52a1\u5668\u4e0e\u5ba2\u6237\u7aef\u4e4b\u95f4\u8f6c\u9001\u3002\u518d\u6b21\u5f3a\u8c03\uff0c\u6267\u884c\u6743\u9650\u5c5e\u4e8e\u672c\u5730\u7528\u6237\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\uff0c\u4e5f\u4e0d\u9700\u8981 SQL \u8d85\u7ea7\u7528\u6237\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e \\copy ... from stdin\uff0c\u4ece\u53d1\u51fa\u547d\u4ee4\u7684\u540c\u4e00\u8f93\u5165\u6e90\u8bfb\u53d6\u6570\u636e\u884c\uff0c\u76f4\u5230\u8bfb\u53d6\u5230 \\.\u6216\u8f93\u5165\u6d41\u5230\u8fbe EOF\u3002\u8fd9\u9002\u5408\u5728 SQL \u811a\u672c\u4e2d\u5185\u8054\u586b\u5145\u8868\u3002\u5bf9\u4e8e \\copy ... to stdout\uff0c\u8f93\u51fa\u53d1\u5f80\u4e0e psql \u547d\u4ee4\u8f93\u51fa\u76f8\u540c\u7684\u4f4d\u7f6e\uff0c\u4e14\u4e0d\u6253\u5370 COPY count \u547d\u4ee4\u72b6\u6001\uff0c\u4ee5\u514d\u4e0e\u6570\u636e\u884c\u6df7\u6dc6\u3002\u82e5\u8981\u59cb\u7ec8\u8bfb\u5199 psql \u7684\u6807\u51c6\u8f93\u5165\u6216\u8f93\u51fa\uff0c\u800c\u4e0d\u53d7\u5f53\u524d\u547d\u4ee4\u6765\u6e90\u6216 \\o \u9009\u9879\u5f71\u54cd\uff0c\u8bf7\u4f7f\u7528 from pstdin \u6216 to pstdout\u3002</p>\n<p lang=\"zh\">\u8be5\u547d\u4ee4\u7684\u8bed\u6cd5\u4e0e<acronym class=\"acronym\">SQL</acronym> <a class=\"xref\" href=\"/docs/11/sql-copy.html\" title=\"COPY\"><span class=\"refentrytitle\">COPY</span></a>\u547d\u4ee4\u7c7b\u4f3c\u3002\u9664\u6570\u636e\u6e90\u6216\u76ee\u6807\u4e4b\u5916\uff0c\u5176\u4ed6\u6240\u6709\u9009\u9879\u90fd\u4e0e<a class=\"xref\" href=\"/docs/11/sql-copy.html\" title=\"COPY\"><span class=\"refentrytitle\">COPY</span></a>\u4e2d\u7684\u6307\u5b9a\u76f8\u540c\u3002\u56e0\u6b64\uff0c\u7279\u6b8a\u7684\u89e3\u6790\u89c4\u5219\u9002\u7528\u4e8e<code class=\"command\">\\copy</code>\u5143\u547d\u4ee4\u3002\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u5269\u4f59\u884c\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\copy</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u6267\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u53e6\u4e00\u79cd\u83b7\u5f97\u4e0e<code class=\"literal\">\\copy ... to</code>\u76f8\u540c\u7ed3\u679c\u7684\u65b9\u6cd5\u662f\u4f7f\u7528<acronym class=\"acronym\">SQL</acronym> <code class=\"literal\">COPY ... TO STDOUT</code>\u547d\u4ee4\uff0c\u5e76\u4ee5<code class=\"literal\">\\g <em class=\"replaceable\"><code>filename</code></em></code> \u6216<code class=\"literal\">\\g |<em class=\"replaceable\"><code>program</code></em></code>\u7ed3\u675f\u3002\u4e0e<code class=\"literal\">\\copy</code>\u4e0d\u540c\uff0c\u8fd9\u79cd\u65b9\u6cd5\u5141\u8bb8\u547d\u4ee4\u8de8\u8d8a\u591a\u884c\uff1b\u6b64\u5916\uff0c\u53ef\u4ee5\u4f7f\u7528\u53d8\u91cf\u63d2\u503c\u548c\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</div>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8fd9\u4e9b\u64cd\u4f5c\u4e0d\u5982\u4ee5\u6587\u4ef6\u6216\u7a0b\u5e8f\u4f5c\u4e3a\u6570\u636e\u6e90\u6216\u76ee\u6807\u7684<acronym class=\"acronym\">SQL</acronym> <code class=\"command\">COPY</code>\u547d\u4ee4\u9ad8\u6548\uff0c\u56e0\u4e3a\u6240\u6709\u6570\u636e\u90fd\u5fc5\u987b\u901a\u8fc7\u5ba2\u6237\u7aef/\u670d\u52a1\u5668\u8fde\u63a5\u4f20\u8f93\u3002\u5bf9\u4e8e\u5927\u91cf\u6570\u636e\uff0c\u4f7f\u7528<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u53ef\u80fd\u66f4\u5408\u9002\u3002\u53e6\u5916\uff0c\u7531\u4e8e\u91c7\u7528\u8fd9\u79cd\u6570\u636e\u8f6c\u9001\u65b9\u5f0f\uff0c<acronym class=\"acronym\">CSV</acronym>\u6a21\u5f0f\u4e0b\u7684<code class=\"literal\">\\copy ... from</code>\u4f1a\u9519\u8bef\u5730\u628a\u5355\u72ec\u5360\u636e\u4e00\u884c\u7684<code class=\"literal\">\\.</code>\u6570\u636e\u503c\u5f53\u4f5c\u8f93\u5165\u7ed3\u675f\u6807\u8bb0\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\copyright</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"productname\">PostgreSQL</span>\u7684\u7248\u6743\u548c\u5206\u53d1\u6761\u6b3e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMANDS-CROSSTABVIEW\"><span class=\"term\"><code class=\"literal\">\\crosstabview [ <em class=\"replaceable\"><code>colV</code></em> [ <em class=\"replaceable\"><code>colH</code></em> [ <em class=\"replaceable\"><code>colD</code></em> [ <em class=\"replaceable\"><code>sortcolH</code></em> ] ] ] ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6267\u884c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\uff08\u4e0e<code class=\"literal\">\\g</code>\u7c7b\u4f3c\uff09\uff0c\u5e76\u4ee5\u4ea4\u53c9\u8868\u7f51\u683c\u663e\u793a\u7ed3\u679c\u3002\u67e5\u8be2\u5fc5\u987b\u8fd4\u56de\u81f3\u5c11\u4e09\u5217\u3002\u7531<em class=\"replaceable\"><code>colV</code></em>\u6807\u8bc6\u7684\u8f93\u51fa\u5217\u6210\u4e3a\u7eb5\u5411\u8868\u5934\uff0c\u7531<em class=\"replaceable\"><code>colH</code></em>\u6807\u8bc6\u7684\u8f93\u51fa\u5217\u6210\u4e3a\u6a2a\u5411\u8868\u5934\u3002<em class=\"replaceable\"><code>colD</code></em>\u6807\u8bc6\u8981\u5728\u7f51\u683c\u4e2d\u663e\u793a\u7684\u8f93\u51fa\u5217\u3002<em class=\"replaceable\"><code>sortcolH</code></em>\u6807\u8bc6\u6a2a\u5411\u8868\u5934\u7684\u53ef\u9009\u6392\u5e8f\u5217\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a\u5217\u6307\u5b9a\u9879\u53ef\u4ee5\u662f\u4ece 1 \u5f00\u59cb\u7684\u5217\u53f7\uff0c\u4e5f\u53ef\u4ee5\u662f\u5217\u540d\uff1b\u5217\u540d\u9075\u5faa\u5e38\u89c4 SQL \u5927\u5c0f\u5199\u6298\u53e0\u548c\u5f15\u53f7\u89c4\u5219\u3002\u7701\u7565\u65f6\uff0ccolV \u9ed8\u8ba4\u4e3a\u7b2c 1 \u5217\uff0ccolH \u9ed8\u8ba4\u4e3a\u7b2c 2 \u5217\u3002colH \u5fc5\u987b\u4e0e colV \u4e0d\u540c\u3002\u82e5\u4e0d\u6307\u5b9a colD\uff0c\u67e5\u8be2\u7ed3\u679c\u5fc5\u987b\u6070\u6709\u4e09\u5217\uff0c\u65e2\u975e colV \u4e5f\u975e colH \u7684\u90a3\u4e00\u5217\u4f5c\u4e3a colD\u3002</p>\n<p lang=\"zh\">\u7eb5\u5411\u8868\u5934\u663e\u793a\u4e3a\u6700\u5de6\u5217\uff0c\u5305\u542b<em class=\"replaceable\"><code>colV</code></em>\u5217\u4e2d\u7684\u503c\uff0c\u5176\u987a\u5e8f\u4e0e\u67e5\u8be2\u7ed3\u679c\u4e2d\u76f8\u540c\uff0c\u4f46\u4f1a\u79fb\u9664\u91cd\u590d\u503c\u3002</p>\n<p lang=\"zh\">\u6a2a\u5411\u8868\u5934\u663e\u793a\u4e3a\u7b2c\u4e00\u884c\uff0c\u5305\u542b<em class=\"replaceable\"><code>colH</code></em>\u5217\u4e2d\u7684\u503c\uff0c\u5e76\u79fb\u9664\u91cd\u590d\u503c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4eec\u6309\u67e5\u8be2\u7ed3\u679c\u4e2d\u7684\u76f8\u540c\u987a\u5e8f\u663e\u793a\u3002\u4f46\u5982\u679c\u7ed9\u51fa\u4e86\u53ef\u9009\u7684<em class=\"replaceable\"><code>sortcolH</code></em>\u53c2\u6570\uff0c\u5b83\u6240\u6807\u8bc6\u7684\u5217\u7684\u503c\u5fc5\u987b\u662f\u6574\u6570\uff0c\u800c<em class=\"replaceable\"><code>colH</code></em>\u4e2d\u7684\u503c\u4f1a\u6309\u7167\u5bf9\u5e94\u7684<em class=\"replaceable\"><code>sortcolH</code></em>\u503c\u6392\u5e8f\u540e\u663e\u793a\u5728\u6a2a\u5411\u8868\u5934\u4e2d\u3002</p>\n<p lang=\"zh\">\u4ea4\u53c9\u8868\u4e2d\uff0c\u5bf9\u4e8e colH \u7684\u6bcf\u4e2a\u4e0d\u540c\u503c x \u548c colV \u7684\u6bcf\u4e2a\u4e0d\u540c\u503c y\uff0c\u4ea4\u70b9 (x,y) \u7684\u5355\u5143\u683c\u4fdd\u5b58\u67e5\u8be2\u7ed3\u679c\u4e2d colH=x \u4e14 colV=y \u90a3\u4e00\u884c\u7684 colD \u503c\u3002\u6ca1\u6709\u5339\u914d\u884c\u65f6\u5355\u5143\u683c\u4e3a\u7a7a\uff1b\u5b58\u5728\u591a\u884c\u65f6\u4f1a\u62a5\u9519\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\d[S+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5bf9\u4e8e\u6bcf\u4e2a\u5339\u914d<em class=\"replaceable\"><code>pattern</code></em>\u7684\u5173\u7cfb\uff08\u8868\u3001\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u7d22\u5f15\u3001\u5e8f\u5217\u6216\u5916\u90e8\u8868\uff09\u6216\u590d\u5408\u7c7b\u578b\uff0c\u663e\u793a\u6240\u6709\u5217\u53ca\u5176\u7c7b\u578b\u3001\u8868\u7a7a\u95f4\uff08\u5982\u679c\u4e0d\u662f\u9ed8\u8ba4\u8868\u7a7a\u95f4\uff09\uff0c\u4ee5\u53ca<code class=\"literal\">NOT NULL</code>\u6216\u9ed8\u8ba4\u503c\u7b49\u7279\u6b8a\u5c5e\u6027\u3002\u8fd8\u4f1a\u663e\u793a\u5173\u8054\u7684\u7d22\u5f15\u3001\u7ea6\u675f\u3001\u89c4\u5219\u548c\u89e6\u53d1\u5668\u3002\u5bf9\u4e8e\u5916\u90e8\u8868\uff0c\u8fd8\u4f1a\u663e\u793a\u5173\u8054\u7684\u5916\u90e8\u670d\u52a1\u5668\u3002\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u5339\u914d\u6a21\u5f0f</span>\u201d</span>\u7684\u5b9a\u4e49\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"\u6a21\u5f0f\">\u6a21\u5f0f</a>\u3002\uff09</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u67d0\u4e9b\u5173\u7cfb\u7c7b\u578b\uff0c<code class=\"literal\">\\d</code>\u4f1a\u4e3a\u6bcf\u5217\u663e\u793a\u9644\u52a0\u4fe1\u606f\uff1a\u5e8f\u5217\u7684\u5217\u503c\u3001\u7d22\u5f15\u7684\u7d22\u5f15\u8868\u8fbe\u5f0f\uff0c\u4ee5\u53ca\u5916\u90e8\u8868\u7684\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u9009\u9879\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">\\d+</code>\u5f62\u5f0f\u7684\u547d\u4ee4\u4e0e\u4e4b\u76f8\u540c\uff0c\u4f46\u4f1a\u663e\u793a\u66f4\u591a\u4fe1\u606f\uff1a\u8868\u5404\u5217\u5173\u8054\u7684\u6ce8\u91ca\u3001\u8868\u4e2d\u662f\u5426\u5b58\u5728 OID\u3001\u89c6\u56fe\u5b9a\u4e49\uff08\u5982\u679c\u5173\u7cfb\u662f\u89c6\u56fe\uff09\uff0c\u4ee5\u53ca\u975e\u9ed8\u8ba4\u7684<a class=\"link\" href=\"/docs/11/sql-altertable.html#SQL-CREATETABLE-REPLICA-IDENTITY\">\u590d\u5236\u6807\u8bc6</a>\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528<code class=\"command\">\\d</code>\u800c\u6ca1\u6709<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\uff0c\u5b83\u7b49\u540c\u4e8e<code class=\"command\">\\dtvmsE</code>\uff0c\u5b83\u5c06\u663e\u793a\u6240\u6709\u53ef\u89c1\u7684\u8868\u3001\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u7684\u5217\u8868\u3002\u8fd9\u7eaf\u7cb9\u662f\u4e00\u79cd\u4fbf\u5229\u63aa\u65bd\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\da[S] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u805a\u5408\u51fd\u6570\uff0c\u4ee5\u53ca\u5b83\u4eec\u7684\u8fd4\u56de\u7c7b\u578b\u548c\u6240\u4f5c\u7528\u7684\u6570\u636e\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u805a\u5408\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dA[+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8bbf\u95ee\u65b9\u6cd5\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bbf\u95ee\u65b9\u6cd5\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u8bbf\u95ee\u65b9\u6cd5\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u7684\u5904\u7406\u5668\u51fd\u6570\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\db[+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8868\u7a7a\u95f4\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8868\u7a7a\u95f4\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u8868\u7a7a\u95f4\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u9009\u9879\u3001\u78c1\u76d8\u5927\u5c0f\u3001\u6743\u9650\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dc[S+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5b57\u7b26\u96c6\u7f16\u7801\u4e4b\u95f4\u7684\u8f6c\u6362\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8f6c\u6362\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dC[+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u7c7b\u578b\u8f6c\u6362\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u6e90\u7c7b\u578b\u6216\u76ee\u6807\u7c7b\u578b\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u7c7b\u578b\u8f6c\u6362\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u5217\u51fa\u6bcf\u4e2a\u5bf9\u8c61\u5173\u8054\u7684\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dd[S] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u663e\u793a\u7c7b\u578b\u4e3a<code class=\"literal\">constraint</code>\u3001<code class=\"literal\">operator class</code>\u3001<code class=\"literal\">operator family</code>\u3001<code class=\"literal\">rule</code>\u548c<code class=\"literal\">trigger</code>\u7684\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002\u5176\u4ed6\u6240\u6709\u6ce8\u91ca\u90fd\u53ef\u4ee5\u901a\u8fc7\u76f8\u5e94\u5bf9\u8c61\u7c7b\u578b\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u67e5\u770b\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">\\dd</code>\u663e\u793a\u5339\u914d<em class=\"replaceable\"><code>pattern</code></em>\u7684\u5bf9\u8c61\u7684\u63cf\u8ff0\uff1b\u5982\u679c\u6ca1\u6709\u7ed9\u51fa\u53c2\u6570\uff0c\u5219\u663e\u793a\u9002\u5f53\u7c7b\u578b\u7684\u53ef\u89c1\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002\u4f46\u65e0\u8bba\u54ea\u79cd\u60c5\u51b5\uff0c\u90fd\u53ea\u5217\u51fa\u6709\u63cf\u8ff0\u7684\u5bf9\u8c61\u3002\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528<a class=\"xref\" href=\"/docs/11/sql-comment.html\" title=\"COMMENT\"><span class=\"refentrytitle\">COMMENT</span></a> <acronym class=\"acronym\">SQL</acronym> \u547d\u4ee4\u521b\u5efa\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dD[S+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u57df\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u57df\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u6743\u9650\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\ddp [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u9ed8\u8ba4\u8bbf\u95ee\u6743\u9650\u8bbe\u7f6e\u3002\u5bf9\u4e8e\u9ed8\u8ba4\u6743\u9650\u8bbe\u7f6e\u5df2\u504f\u79bb\u5185\u7f6e\u9ed8\u8ba4\u503c\u7684\u6bcf\u4e2a\u89d2\u8272\uff08\u4ee5\u53ca\u6a21\u5f0f\uff0c\u5982\u679c\u9002\u7528\uff09\uff0c\u90fd\u4f1a\u663e\u793a\u4e00\u4e2a\u6761\u76ee\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u89d2\u8272\u540d\u6216\u6a21\u5f0f\u540d\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6761\u76ee\u3002</p>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/11/sql-alterdefaultprivileges.html\" title=\"ALTER DEFAULT PRIVILEGES\"><span class=\"refentrytitle\">ALTER DEFAULT PRIVILEGES</span></a>\u547d\u4ee4\u7528\u4e8e\u8bbe\u7f6e\u9ed8\u8ba4\u8bbf\u95ee\u6743\u9650\u3002\u6743\u9650\u663e\u793a\u7684\u542b\u4e49\u5728<a class=\"xref\" href=\"/docs/11/sql-grant.html\" title=\"GRANT\"><span class=\"refentrytitle\">GRANT</span></a>\u4e2d\u6709\u89e3\u91ca\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dE[S+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\di[S+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dm[S+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\ds[S+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dt[S+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dv[S+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd9\u7ec4\u547d\u4ee4\u4e2d\uff0c\u5b57\u6bcd<code class=\"literal\">E</code>\u3001<code class=\"literal\">i</code>\u3001<code class=\"literal\">m</code>\u3001<code class=\"literal\">s</code>\u3001<code class=\"literal\">t</code>\u548c<code class=\"literal\">v</code>\u5206\u522b\u4ee3\u8868\u5916\u90e8\u8868\u3001\u7d22\u5f15\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u3001\u8868\u548c\u89c6\u56fe\u3002\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u6307\u5b9a\u8fd9\u4e9b\u5b57\u6bcd\u4e2d\u7684\u4efb\u610f\u4e00\u4e2a\u6216\u5168\u90e8\uff0c\u4ee5\u83b7\u53d6\u76f8\u5e94\u7c7b\u578b\u7684\u5bf9\u8c61\u5217\u8868\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dit</code>\u5217\u51fa\u7d22\u5f15\u548c\u8868\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u5217\u51fa\u6bcf\u4e2a\u5bf9\u8c61\u7684\u78c1\u76d8\u4e0a\u7684\u7269\u7406\u5927\u5c0f\u4ee5\u53ca\u5173\u8054\u7684\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u5bf9\u8c61\u3002\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\des[+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u670d\u52a1\u5668\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external servers</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u670d\u52a1\u5668\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\des+</code>\u5f62\u5f0f\uff0c\u5219\u663e\u793a\u6bcf\u4e2a\u670d\u52a1\u5668\u7684\u5b8c\u6574\u8bf4\u660e\uff0c\u5305\u62ec\u670d\u52a1\u5668\u7684ACL\u3001\u7c7b\u578b\u3001\u7248\u672c\u3001\u9009\u9879\u548c\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\det[+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u8868\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external tables</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u8868\u540d\u6216\u6a21\u5f0f\u540d\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6761\u76ee\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\det+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u901a\u7528\u9009\u9879\u548c\u5916\u90e8\u8868\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\deu[+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u7528\u6237\u6620\u5c04\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external users</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u7528\u6237\u540d\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6620\u5c04\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\deu+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u6620\u5c04\u7684\u9644\u52a0\u4fe1\u606f\u3002</p>\n<div class=\"caution\">\n<h3 class=\"title\" lang=\"zh\">\u5c0f\u5fc3</h3>\n<p lang=\"zh\"><code class=\"literal\">\\deu+</code>\u8fd8\u53ef\u80fd\u663e\u793a\u8fdc\u7a0b\u7528\u6237\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u56e0\u6b64\u5e94\u6ce8\u610f\u4e0d\u8981\u6cc4\u9732\u5b83\u4eec\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dew[+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external wrappers</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dew+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u7684ACL\u3001\u9009\u9879\u548c\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\df[anptwS+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u51fd\u6570\u53ca\u5176\u7ed3\u679c\u6570\u636e\u7c7b\u578b\u3001\u53c2\u6570\u6570\u636e\u7c7b\u578b\u548c\u51fd\u6570\u7c7b\u578b\u3002\u51fd\u6570\u7c7b\u578b\u5206\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">agg</span>\u201d</span>\uff08\u805a\u5408\uff09\u3001<span class=\"quote\">\u201c<span class=\"quote\">normal</span>\u201d</span>\u3001<span class=\"quote\">\u201c<span class=\"quote\">procedure</span>\u201d</span>\u3001<span class=\"quote\">\u201c<span class=\"quote\">trigger</span>\u201d</span>\u6216<span class=\"quote\">\u201c<span class=\"quote\">window</span>\u201d</span>\u3002\u8981\u4ec5\u663e\u793a\u7279\u5b9a\u7c7b\u578b\u7684\u51fd\u6570\uff0c\u53ef\u5728\u547d\u4ee4\u4e2d\u6dfb\u52a0\u5bf9\u5e94\u7684\u5b57\u6bcd<code class=\"literal\">a</code>\u3001<code class=\"literal\">n</code>\u3001<code class=\"literal\">p</code>\u3001<code class=\"literal\">t</code>\u6216<code class=\"literal\">w</code>\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u51fd\u6570\u3002\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\df+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u51fd\u6570\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u6613\u53d8\u6027\u3001\u5e76\u884c\u5b89\u5168\u6027\u3001\u62e5\u6709\u8005\u3001\u5b89\u5168\u5206\u7c7b\u3001\u8bbf\u95ee\u6743\u9650\u3001\u8bed\u8a00\u3001\u6e90\u4ee3\u7801\u548c\u63cf\u8ff0\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8981\u67e5\u627e\u63a5\u53d7\u7279\u5b9a\u6570\u636e\u7c7b\u578b\u53c2\u6570\u6216\u8fd4\u56de\u7279\u5b9a\u6570\u636e\u7c7b\u578b\u503c\u7684\u51fd\u6570\uff0c\u8bf7\u4f7f\u7528\u5206\u9875\u5668\u7684\u641c\u7d22\u529f\u80fd\u6d4f\u89c8<code class=\"literal\">\\df</code>\u8f93\u51fa\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dF[+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u914d\u7f6e\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u914d\u7f6e\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dF+</code>\u5f62\u5f0f\uff0c\u5219\u663e\u793a\u6bcf\u4e2a\u914d\u7f6e\u7684\u5b8c\u6574\u8bf4\u660e\uff0c\u5305\u62ec\u5e95\u5c42\u5168\u6587\u68c0\u7d22\u89e3\u6790\u5668\u548c\u6bcf\u79cd\u89e3\u6790\u5668\u8bcd\u5143\u7c7b\u578b\u7684\u8bcd\u5178\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dFd[+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u8bcd\u5178\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bcd\u5178\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dFd+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u9009\u4e2d\u8bcd\u5178\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5e95\u5c42\u5168\u6587\u68c0\u7d22\u6a21\u677f\u548c\u9009\u9879\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dFp[+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u89e3\u6790\u5668\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u89e3\u6790\u5668\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dFp+</code>\u5f62\u5f0f\uff0c\u5219\u663e\u793a\u6bcf\u4e2a\u89e3\u6790\u5668\u7684\u5b8c\u6574\u8bf4\u660e\uff0c\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u548c\u53ef\u8bc6\u522b\u7684\u8bcd\u5143\u7c7b\u578b\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dFt[+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u6a21\u677f\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6a21\u677f\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dFt+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u6a21\u677f\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dg[S+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u5e93\u89d2\u8272\u3002\uff08\u7531\u4e8e<span class=\"quote\">\u201c<span class=\"quote\">\u7528\u6237</span>\u201d</span>\u548c<span class=\"quote\">\u201c<span class=\"quote\">\u7ec4</span>\u201d</span>\u7684\u6982\u5ff5\u5df2\u7ecf\u7edf\u4e00\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">\u89d2\u8272</span>\u201d</span>\uff0c\u6b64\u547d\u4ee4\u73b0\u5728\u7b49\u4ef7\u4e8e<code class=\"literal\">\\du</code>\u3002\uff09\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u89d2\u8272\uff1b\u63d0\u4f9b<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u89d2\u8272\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u89d2\u8272\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dg+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u89d2\u8272\u7684\u9644\u52a0\u4fe1\u606f\uff1b\u76ee\u524d\u4f1a\u589e\u52a0\u6bcf\u4e2a\u89d2\u8272\u7684\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dl</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u662f<code class=\"command\">\\lo_list</code>\u7684\u522b\u540d\uff0c\u7528\u4e8e\u663e\u793a\u5927\u5bf9\u8c61\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dL[S+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8fc7\u7a0b\u8bed\u8a00\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bed\u8a00\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u8bed\u8a00\uff1b\u63d0\u4f9b <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u79cd\u8bed\u8a00\u90fd\u4f1a\u8fde\u540c\u5176\u8c03\u7528\u5904\u7406\u5668\u3001\u9a8c\u8bc1\u5668\u3001\u8bbf\u95ee\u6743\u9650\u4ee5\u53ca\u5b83\u662f\u5426\u4e3a\u7cfb\u7edf\u5bf9\u8c61\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dn[S+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6a21\u5f0f\uff08\u547d\u540d\u7a7a\u95f4\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6a21\u5f0f\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u6743\u9650\u548c\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\do[S+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u64cd\u4f5c\u7b26\u53ca\u5176\u64cd\u4f5c\u6570\u7c7b\u578b\u548c\u7ed3\u679c\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u64cd\u4f5c\u7b26\u3002\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u76ee\u524d\u53ea\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dO[S+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6392\u5e8f\u89c4\u5219\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6392\u5e8f\u89c4\u5219\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u6392\u5e8f\u89c4\u5219\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u4e00\u8d77\u5217\u51fa\u3002\u8bf7\u6ce8\u610f\uff0c\u53ea\u4f1a\u663e\u793a\u4e0e\u5f53\u524d\u6570\u636e\u5e93\u7f16\u7801\u517c\u5bb9\u7684\u6392\u5e8f\u89c4\u5219\uff0c\u56e0\u6b64\u5728\u540c\u4e00\u5b89\u88c5\u4e2d\u7684\u4e0d\u540c\u6570\u636e\u5e93\u91cc\u7ed3\u679c\u53ef\u80fd\u4e0d\u540c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dp [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u53ca\u5176\u5173\u8054\u7684\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u3002</p>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/11/sql-grant.html\" title=\"GRANT\"><span class=\"refentrytitle\">GRANT</span></a>\u548c<a class=\"xref\" href=\"/docs/11/sql-revoke.html\" title=\"REVOKE\"><span class=\"refentrytitle\">REVOKE</span></a>\u547d\u4ee4\u7528\u4e8e\u8bbe\u7f6e\u8bbf\u95ee\u6743\u9650\u3002\u6743\u9650\u663e\u793a\u7684\u542b\u4e49\u5728<a class=\"xref\" href=\"/docs/11/sql-grant.html\" title=\"GRANT\"><span class=\"refentrytitle\">GRANT</span></a>\u4e2d\u6709\u89e3\u91ca\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\drds [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>role-pattern</code></em></a> [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>database-pattern</code></em></a> ] ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5df2\u5b9a\u4e49\u7684\u914d\u7f6e\u8bbe\u7f6e\u3002\u8fd9\u4e9b\u8bbe\u7f6e\u53ef\u4ee5\u7279\u5b9a\u4e8e\u89d2\u8272\u3001\u7279\u5b9a\u4e8e\u6570\u636e\u5e93\uff0c\u6216\u540c\u65f6\u7279\u5b9a\u4e8e\u4e24\u8005\u3002<em class=\"replaceable\"><code>role-pattern</code></em>\u548c<em class=\"replaceable\"><code>database-pattern</code></em>\u5206\u522b\u7528\u4e8e\u9009\u62e9\u8981\u5217\u51fa\u7684\u89d2\u8272\u548c\u6570\u636e\u5e93\u3002\u7701\u7565\u67d0\u4e2a\u6a21\u5f0f\u53c2\u6570\u6216\u5c06\u5176\u6307\u5b9a\u4e3a<code class=\"literal\">*</code>\u65f6\uff0c\u4e0d\u4f1a\u6309\u8be5\u53c2\u6570\u7b5b\u9009\uff0c\u8fd8\u4f1a\u5206\u522b\u5305\u542b\u4e0d\u7279\u5b9a\u4e8e\u89d2\u8272\u6216\u4e0d\u7279\u5b9a\u4e8e\u6570\u636e\u5e93\u7684\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/11/sql-alterrole.html\" title=\"ALTER ROLE\"><span class=\"refentrytitle\">ALTER ROLE</span></a>\u548c<a class=\"xref\" href=\"/docs/11/sql-alterdatabase.html\" title=\"ALTER DATABASE\"><span class=\"refentrytitle\">ALTER DATABASE</span></a>\u547d\u4ee4\u7528\u4e8e\u5b9a\u4e49\u89d2\u8272\u4e13\u5c5e\u548c\u6570\u636e\u5e93\u4e13\u5c5e\u7684\u914d\u7f6e\u8bbe\u7f6e\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dRp[+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u590d\u5236\u53d1\u5e03\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u53d1\u5e03\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u663e\u793a\u4e0e\u6bcf\u4e2a\u53d1\u5e03\u5173\u8054\u7684\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dRs[+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u903b\u8f91\u590d\u5236\u8ba2\u9605\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8ba2\u9605\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u8ba2\u9605\u7684\u5176\u4ed6\u5c5e\u6027\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dT[S+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u7c7b\u578b\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u7c7b\u578b\u90fd\u4f1a\u8fde\u540c\u5176\u5185\u90e8\u540d\u79f0\u3001\u5927\u5c0f\u4ee5\u53ca\u76f8\u5173\u6743\u9650\u4e00\u8d77\u5217\u51fa\uff1b\u5bf9\u4e8e <code class=\"type\">enum</code> \u7c7b\u578b\uff0c\u8fd8\u4f1a\u663e\u793a\u5176\u5141\u8bb8\u503c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\du[S+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u5e93\u89d2\u8272\u3002\uff08\u7531\u4e8e<span class=\"quote\">\u201c<span class=\"quote\">\u7528\u6237</span>\u201d</span>\u548c<span class=\"quote\">\u201c<span class=\"quote\">\u7ec4</span>\u201d</span>\u7684\u6982\u5ff5\u5df2\u7ecf\u7edf\u4e00\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">\u89d2\u8272</span>\u201d</span>\uff0c\u6b64\u547d\u4ee4\u73b0\u5728\u7b49\u4ef7\u4e8e<code class=\"literal\">\\dg</code>\u3002\uff09\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u89d2\u8272\uff1b\u63d0\u4f9b<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u89d2\u8272\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u89d2\u8272\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\du+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u89d2\u8272\u7684\u9644\u52a0\u4fe1\u606f\uff1b\u76ee\u524d\u4f1a\u589e\u52a0\u6bcf\u4e2a\u89d2\u8272\u7684\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dx[+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5df2\u5b89\u88c5\u7684\u6269\u5c55\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6269\u5c55\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dx+</code>\u5f62\u5f0f\uff0c\u5219\u5217\u51fa\u5c5e\u4e8e\u6bcf\u4e2a\u5339\u914d\u6269\u5c55\u7684\u6240\u6709\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dy[+] [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u4e8b\u4ef6\u89e6\u53d1\u5668\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u4e8b\u4ef6\u89e6\u53d1\u5668\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\e</code> \u6216 <code class=\"literal\">\\edit</code> <code class=\"literal\">[ <span class=\"optional\"><em class=\"replaceable\"><code>filename</code></em></span> ] [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5219\u7f16\u8f91\u8be5\u6587\u4ef6\uff1b\u7f16\u8f91\u5668\u9000\u51fa\u540e\uff0c\u5c06\u6587\u4ef6\u5185\u5bb9\u590d\u5236\u5230\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u3002\u5982\u679c\u672a\u7ed9\u51fa<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5219\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u590d\u5236\u5230\u4e34\u65f6\u6587\u4ef6\uff0c\u518d\u4ee5\u76f8\u540c\u65b9\u5f0f\u7f16\u8f91\u3002\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u5c06\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u590d\u5236\u5230\u4e34\u65f6\u6587\u4ef6\uff0c\u5e76\u4ee5\u76f8\u540c\u65b9\u5f0f\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u968f\u540e\uff0c\u6309\u7167<span class=\"application\">psql</span>\u7684\u6b63\u5e38\u89c4\u5219\u91cd\u65b0\u89e3\u6790\u67e5\u8be2\u7f13\u51b2\u533a\u7684\u65b0\u5185\u5bb9\uff0c\u5c06\u6574\u4e2a\u7f13\u51b2\u533a\u89c6\u4e3a\u4e00\u884c\u3002\u4efb\u4f55\u5b8c\u6574\u7684\u67e5\u8be2\u90fd\u4f1a\u7acb\u5373\u6267\u884c\uff1b\u4e5f\u5c31\u662f\u8bf4\uff0c\u5982\u679c\u67e5\u8be2\u7f13\u51b2\u533a\u5305\u542b\u5206\u53f7\u6216\u4ee5\u5206\u53f7\u7ed3\u675f\uff0c\u5c31\u4f1a\u6267\u884c\u5230\u8be5\u4f4d\u7f6e\u4e3a\u6b62\u7684\u6240\u6709\u5185\u5bb9\u3002\u5269\u4f59\u5185\u5bb9\u4f1a\u5728\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u7b49\u5f85\uff1b\u952e\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u952e\u5165<code class=\"literal\">\\r</code>\u6e05\u7a7a\u67e5\u8be2\u7f13\u51b2\u533a\u4ee5\u53d6\u6d88\u5b83\u3002\u5c06\u7f13\u51b2\u533a\u89c6\u4e3a\u4e00\u884c\u4e3b\u8981\u5f71\u54cd\u5143\u547d\u4ee4\uff1a\u7f13\u51b2\u533a\u4e2d\u4f4d\u4e8e\u5143\u547d\u4ee4\u4e4b\u540e\u7684\u6240\u6709\u5185\u5bb9\u90fd\u4f1a\u88ab\u89c6\u4e3a\u8be5\u5143\u547d\u4ee4\u7684\u53c2\u6570\uff0c\u5373\u4f7f\u5b83\u4eec\u8de8\u8d8a\u591a\u884c\u4e5f\u662f\u5982\u6b64\u3002\uff08\u56e0\u6b64\uff0c\u4e0d\u80fd\u7528\u8fd9\u79cd\u65b9\u5f0f\u7f16\u5199\u4f7f\u7528\u5143\u547d\u4ee4\u7684\u811a\u672c\u3002\u5e94\u4f7f\u7528<code class=\"command\">\\i</code>\u6765\u5904\u7406\u8fd9\u7c7b\u811a\u672c\u3002\uff09</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u4f1a\u5c06\u5149\u6807\u5b9a\u4f4d\u5230\u6587\u4ef6\u6216\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u7684\u6307\u5b9a\u884c\u3002\u8bf7\u6ce8\u610f\uff0c\u5982\u679c\u53ea\u7ed9\u51fa\u4e00\u4e2a\u5168\u7531\u6570\u5b57\u7ec4\u6210\u7684\u53c2\u6570\uff0c<span class=\"application\">psql</span>\u4f1a\u5047\u5b9a\u5b83\u662f\u884c\u53f7\uff0c\u800c\u4e0d\u662f\u6587\u4ef6\u540d\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u6709\u5173\u5982\u4f55\u914d\u7f6e\u548c\u5b9a\u5236\u7f16\u8f91\u5668\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/11/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"\u73af\u5883\">\u73af\u5883</a>\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\echo <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u53c2\u6570\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff0c\u53c2\u6570\u4e4b\u95f4\u7528\u4e00\u4e2a\u7a7a\u683c\u5206\u9694\uff0c\u672b\u5c3e\u8ddf\u968f\u6362\u884c\u7b26\u3002\u8fd9\u53ef\u7528\u4e8e\u5728\u811a\u672c\u8f93\u51fa\u4e2d\u63d2\u5165\u4fe1\u606f\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>\\echo `date`</code></strong>\nTue Oct 26 21:40:57 CEST 1999\n</pre>\n<p lang=\"zh\">\u5982\u679c\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f\u672a\u52a0\u5f15\u53f7\u7684<code class=\"literal\">-n</code>\uff0c\u5219\u4e0d\u8f93\u51fa\u672b\u5c3e\u7684\u6362\u884c\u7b26\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528<code class=\"command\">\\o</code>\u547d\u4ee4\u91cd\u5b9a\u5411\u67e5\u8be2\u8f93\u51fa\uff0c\u53ef\u80fd\u4f1a\u60f3\u7528<code class=\"command\">\\qecho</code>\u4ee3\u66ff\u8fd9\u4e2a\u547d\u4ee4\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\ef [ <span class=\"optional\"><em class=\"replaceable\"><code>function_description</code></em> [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</span> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u7f16\u8f91\u6307\u5b9a\u51fd\u6570\u6216\u8fc7\u7a0b\u7684\u5b9a\u4e49\uff0c\u5f62\u5f0f\u4e3a<code class=\"command\">CREATE OR REPLACE FUNCTION</code>\u6216 <code class=\"command\">CREATE OR REPLACE PROCEDURE</code>\u547d\u4ee4\u3002\u7f16\u8f91\u65b9\u5f0f\u4e0e<code class=\"literal\">\\edit</code>\u76f8\u540c\u3002\u7f16\u8f91\u5668\u9000\u51fa\u540e\uff0c\u66f4\u65b0\u540e\u7684\u547d\u4ee4\u4f1a\u5728\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u7b49\u5f85\uff1b\u952e\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u7528<code class=\"literal\">\\r</code>\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u76ee\u6807\u51fd\u6570\u53ef\u4ec5\u7528\u540d\u79f0\u6307\u5b9a\uff0c\u4e5f\u53ef\u7528\u540d\u79f0\u548c\u53c2\u6570\u6307\u5b9a\uff0c\u4f8b\u5982 foo(integer, text)\u3002\u82e5\u6709\u591a\u4e2a\u540c\u540d\u51fd\u6570\uff0c\u5219\u5fc5\u987b\u63d0\u4f9b\u53c2\u6570\u7c7b\u578b\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u51fd\u6570\uff0c\u5219\u4f1a\u5448\u73b0\u4e00\u4e2a\u7a7a\u7684<code class=\"command\">CREATE FUNCTION</code>\u6a21\u677f\u4f9b\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u4f1a\u5c06\u5149\u6807\u5b9a\u4f4d\u5230\u51fd\u6570\u4f53\u4e2d\u7684\u6307\u5b9a\u884c\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u51fd\u6570\u4f53\u901a\u5e38\u5e76\u4e0d\u4ece\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u5f00\u59cb\u3002\uff09</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\ef</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u6709\u5173\u5982\u4f55\u914d\u7f6e\u548c\u5b9a\u5236\u7f16\u8f91\u5668\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/11/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"\u73af\u5883\">\u73af\u5883</a>\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\encoding [ <em class=\"replaceable\"><code>encoding</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5ba2\u6237\u7aef\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u6ca1\u6709\u53c2\u6570\u65f6\uff0c\u6b64\u547d\u4ee4\u663e\u793a\u5f53\u524d\u7f16\u7801\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\errverbose</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ee5\u6700\u5927\u7684\u8be6\u7ec6\u7a0b\u5ea6\u91cd\u590d\u6700\u8fd1\u7684\u670d\u52a1\u5668\u9519\u8bef\u6d88\u606f\uff0c\u5c31\u597d\u50cf<code class=\"varname\">VERBOSITY</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">verbose</code>\uff0c<code class=\"varname\">SHOW_CONTEXT</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">always</code>\u4e00\u6837\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\ev [ <span class=\"optional\"><em class=\"replaceable\"><code>view_name</code></em> [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</span> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u7f16\u8f91\u6307\u5b9a\u89c6\u56fe\u7684\u5b9a\u4e49\uff0c\u5f62\u5f0f\u4e3a<code class=\"command\">CREATE OR REPLACE VIEW</code>\u547d\u4ee4\u3002\u7f16\u8f91\u65b9\u5f0f\u4e0e<code class=\"literal\">\\edit</code>\u76f8\u540c\u3002\u7f16\u8f91\u5668\u9000\u51fa\u540e\uff0c\u66f4\u65b0\u540e\u7684\u547d\u4ee4\u4f1a\u5728\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u7b49\u5f85\uff1b\u8f93\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u7528<code class=\"literal\">\\r</code>\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u89c6\u56fe\uff0c\u5219\u4f1a\u5448\u73b0\u4e00\u4e2a\u7a7a\u7684<code class=\"command\">CREATE VIEW</code>\u6a21\u677f\u4f9b\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u4f1a\u5c06\u5149\u6807\u5b9a\u4f4d\u5230\u89c6\u56fe\u5b9a\u4e49\u4e2d\u7684\u6307\u5b9a\u884c\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\ev</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\f [ <em class=\"replaceable\"><code>string</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u67e5\u8be2\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u9ed8\u8ba4\u503c\u662f\u7ad6\u7ebf\uff08<code class=\"literal\">|</code>\uff09\u3002\u5b83\u7b49\u540c\u4e8e<code class=\"command\">\\pset fieldsep</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\g [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\g [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u6267\u884c\u3002\u5982\u679c\u7ed9\u51fa\u53c2\u6570\uff0c\u67e5\u8be2\u8f93\u51fa\u4f1a\u5199\u5165\u6307\u5b9a\u6587\u4ef6\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u9012\u7ed9\u7ed9\u5b9a\u7684 shell \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u6309\u901a\u5e38\u65b9\u5f0f\u663e\u793a\u3002\u53ea\u6709\u67e5\u8be2\u6210\u529f\u8fd4\u56de\u96f6\u4e2a\u6216\u66f4\u591a\u5143\u7ec4\u65f6\uff0c\u624d\u4f1a\u5411\u6587\u4ef6\u6216\u547d\u4ee4\u5199\u5165\u5185\u5bb9\uff1b\u5982\u679c\u67e5\u8be2\u5931\u8d25\u6216 SQL \u547d\u4ee4\u4e0d\u8fd4\u56de\u6570\u636e\uff0c\u5219\u4e0d\u4f1a\u5199\u5165\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u5c06\u88ab\u91cd\u65b0\u6267\u884c\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u6ca1\u6709\u4efb\u4f55\u53c2\u6570\u7684<code class=\"literal\">\\g</code>\u57fa\u672c\u4e0a\u7b49\u540c\u4e8e\u4e00\u4e2a\u5206\u53f7\u3002\u5e26\u6709\u53c2\u6570\u7684<code class=\"literal\">\\g</code>\u63d0\u4f9b\u4e86\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u4e00\u6b21\u6027</span>\u201d</span>\u66ff\u4ee3<code class=\"command\">\\o</code>\u547d\u4ee4\u7684\u9009\u62e9\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\uff0c\u5219\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u7684\u5185\u5bb9\u53ea\u4f1a\u539f\u6837\u4f20\u9012\u7ed9 shell\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\gdesc</code></span></dt>\n<dd>\n<p lang=\"zh\">\u663e\u793a\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u67e5\u8be2\u7ed3\u679c\u7684\u63cf\u8ff0\uff08\u5373\u5217\u540d\u548c\u6570\u636e\u7c7b\u578b\uff09\u3002\u67e5\u8be2\u5e76\u4e0d\u4f1a\u5b9e\u9645\u6267\u884c\uff1b\u4e0d\u8fc7\uff0c\u5982\u679c\u5176\u4e2d\u5b58\u5728\u8bed\u6cd5\u9519\u8bef\uff0c\u4f1a\u6309\u901a\u5e38\u7684\u65b9\u5f0f\u62a5\u544a\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6539\u4e3a\u63cf\u8ff0\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\gexec</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u7136\u540e\u628a\u67e5\u8be2\u8f93\u51fa\uff08\u5982\u679c\u6709\uff09\u7684\u6bcf\u4e00\u884c\u7684\u6bcf\u4e00\u5217\u89c6\u4e3a\u8981\u6267\u884c\u7684 SQL \u8bed\u53e5\u3002\u4f8b\u5982\uff0c\u4e0b\u9762\u4e3a\u6bcf\u4e00\u5217\u521b\u5efa\u4e00\u4e2a\u7d22\u5f15\uff0c\u76ee\u6807\u8868\u662f <code class=\"structname\">my_table</code>\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT format('create index on my_table(%I)', attname)</code></strong>\n-&gt; <strong class=\"userinput\"><code>FROM pg_attribute</code></strong>\n-&gt; <strong class=\"userinput\"><code>WHERE attrelid = 'my_table'::regclass AND attnum &gt; 0</code></strong>\n-&gt; <strong class=\"userinput\"><code>ORDER BY attnum</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gexec</code></strong>\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\n</pre>\n<p lang=\"zh\">\u751f\u6210\u7684\u67e5\u8be2\u6309\u8fd4\u56de\u884c\u7684\u987a\u5e8f\u6267\u884c\uff1b\u540c\u4e00\u884c\u6709\u591a\u5217\u65f6\u4ece\u5de6\u5230\u53f3\u6267\u884c\uff0c\u5ffd\u7565 NULL \u5b57\u6bb5\u3002\u67e5\u8be2\u539f\u6837\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u56e0\u6b64\u4e0d\u80fd\u662f psql \u5143\u547d\u4ee4\uff0c\u4e5f\u4e0d\u80fd\u5305\u542b psql \u53d8\u91cf\u5f15\u7528\u3002\u9664\u975e\u8bbe\u7f6e ON_ERROR_STOP\uff0c\u67d0\u6761\u67e5\u8be2\u5931\u8d25\u540e\u4ecd\u7ee7\u7eed\u6267\u884c\u5176\u4f59\u67e5\u8be2\u3002\u6bcf\u6761\u67e5\u8be2\u5747\u9075\u5faa ECHO \u8bbe\u7f6e\uff08\u4f7f\u7528 \\gexec \u65f6\uff0c\u901a\u5e38\u5efa\u8bae\u5c06 ECHO \u8bbe\u4e3a all \u6216 queries\uff09\uff0c\u67e5\u8be2\u65e5\u5fd7\u3001\u5355\u6b65\u6a21\u5f0f\u3001\u8ba1\u65f6\u7b49\u6267\u884c\u529f\u80fd\u4e5f\u5206\u522b\u5e94\u7528\u4e8e\u6bcf\u6761\u751f\u6210\u7684\u67e5\u8be2\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\gset [ <em class=\"replaceable\"><code>prefix</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u5e76\u5c06\u67e5\u8be2\u8f93\u51fa\u5b58\u5165 <span class=\"application\">psql</span> \u53d8\u91cf\uff08\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/11/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\uff09\u3002\u8981\u6267\u884c\u7684\u67e5\u8be2\u5fc5\u987b\u6070\u597d\u8fd4\u56de\u4e00\u884c\u3002\u8be5\u884c\u7684\u6bcf\u4e00\u5217\u5206\u522b\u5b58\u5165\u4e00\u4e2a\u53d8\u91cf\uff0c\u53d8\u91cf\u540d\u4e0e\u5217\u540d\u76f8\u540c\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT 'hello' AS var1, 10 AS var2</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gset</code></strong>\n=&gt; <strong class=\"userinput\"><code>\\echo :var1 :var2</code></strong>\nhello 10\n</pre>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>prefix</code></em>\uff0c\u5219\u4f1a\u5c06\u8be5\u5b57\u7b26\u4e32\u52a0\u5230\u67e5\u8be2\u7684\u5217\u540d\u524d\u9762\uff0c\u4ee5\u6784\u6210\u8981\u4f7f\u7528\u7684\u53d8\u91cf\u540d\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT 'hello' AS var1, 10 AS var2</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gset result_</code></strong>\n=&gt; <strong class=\"userinput\"><code>\\echo :result_var1 :result_var2</code></strong>\nhello 10\n</pre>\n<p lang=\"zh\">\u5982\u679c\u67d0\u4e00\u5217\u7684\u7ed3\u679c\u4e3a NULL\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u5bf9\u5e94\u7684\u53d8\u91cf\uff0c\u800c\u4e0d\u662f\u8bbe\u7f6e\u5b83\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u67e5\u8be2\u5931\u8d25\u6216\u6ca1\u6709\u6070\u597d\u8fd4\u56de\u4e00\u884c\uff0c\u5219\u4e0d\u4f1a\u66f4\u6539\u4efb\u4f55\u53d8\u91cf\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\gx [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\gx [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"literal\">\\gx</code>\u7b49\u4ef7\u4e8e<code class=\"literal\">\\g</code>\uff0c\u4f46\u4f1a\u5bf9\u5f53\u524d\u67e5\u8be2\u5f3a\u5236\u4f7f\u7528\u6269\u5c55\u8f93\u51fa\u6a21\u5f0f\u3002\u53c2\u89c1<code class=\"literal\">\\x</code>\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\h</code> \u6216 <code class=\"literal\">\\help</code> <code class=\"literal\">[ <em class=\"replaceable\"><code>command</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u7ed9\u51fa\u6307\u5b9a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u7684\u8bed\u6cd5\u5e2e\u52a9\u3002\u5982\u679c\u672a\u6307\u5b9a<em class=\"replaceable\"><code>command</code></em>\uff0c\u5219<span class=\"application\">psql</span>\u5c06\u5217\u51fa\u6240\u6709\u53ef\u7528\u8bed\u6cd5\u5e2e\u52a9\u7684\u547d\u4ee4\u3002\u5982\u679c<em class=\"replaceable\"><code>command</code></em>\u662f\u661f\u53f7\uff08<code class=\"literal\">*</code>\uff09\uff0c\u5219\u663e\u793a\u6240\u6709<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u7684\u8bed\u6cd5\u5e2e\u52a9\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\help</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u4e3a\u4e86\u7b80\u5316\u8f93\u5165\uff0c\u7531\u591a\u4e2a\u5355\u8bcd\u7ec4\u6210\u7684\u547d\u4ee4\u4e0d\u9700\u8981\u52a0\u5f15\u53f7\u3002\u56e0\u6b64\uff0c\u53ef\u4ee5\u76f4\u63a5\u8f93\u5165<strong class=\"userinput\"><code>\\help alter table</code></strong>\u3002</p>\n</div>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\H</code> \u6216 <code class=\"literal\">\\html</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5f00<acronym class=\"acronym\">HTML</acronym>\u67e5\u8be2\u8f93\u51fa\u683c\u5f0f\u3002\u5982\u679c<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u5df2\u7ecf\u6253\u5f00\uff0c\u5219\u5207\u6362\u56de\u9ed8\u8ba4\u7684\u5bf9\u9f50\u6587\u672c\u683c\u5f0f\u3002\u6b64\u547d\u4ee4\u662f\u4e3a\u517c\u5bb9\u6027\u548c\u4fbf\u5229\u6027\u800c\u4fdd\u7559\u7684\uff1b\u8bbe\u7f6e\u5176\u4ed6\u8f93\u51fa\u9009\u9879\u7684\u65b9\u6cd5\u89c1<code class=\"command\">\\pset</code>\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\i</code> \u6216 <code class=\"literal\">\\include</code> <em class=\"replaceable\"><code>filename</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u8bfb\u53d6\u8f93\u5165\uff0c\u5e76\u50cf\u5728\u952e\u76d8\u4e0a\u8f93\u5165\u4e00\u6837\u6267\u884c\u5b83\u3002</p>\n<p lang=\"zh\">\u5982\u679c<em class=\"replaceable\"><code>filename</code></em>\u662f<code class=\"literal\">-</code>\uff08\u8fde\u5b57\u7b26\uff09\uff0c\u5219\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\uff0c\u76f4\u5230\u9047\u5230 EOF \u6307\u793a\u6216<code class=\"command\">\\q</code>\u5143\u547d\u4ee4\u3002\u8fd9\u53ef\u7528\u4e8e\u5c06\u4ea4\u4e92\u5f0f\u8f93\u5165\u4e0e\u6587\u4ef6\u8f93\u5165\u4ea4\u9519\u4f7f\u7528\u3002\u8bf7\u6ce8\u610f\uff0c\u53ea\u6709\u5728\u6700\u5916\u5c42\u542f\u7528\u4e86 Readline\uff0c\u6b64\u5904\u624d\u4f1a\u4f7f\u7528 Readline \u529f\u80fd\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5982\u679c\u60f3\u5728\u5c4f\u5e55\u4e0a\u770b\u5230\u88ab\u8bfb\u5165\u7684\u5404\u884c\uff0c\u8bf7\u5c06\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">all</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"PSQL-METACOMMAND-IF\"><span class=\"term\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\elif</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\else</code><br/></span><span class=\"term\"><code class=\"literal\">\\endif</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u7ec4\u547d\u4ee4\u5b9e\u73b0\u4e86\u53ef\u5d4c\u5957\u7684\u6761\u4ef6\u5757\u3002\u6761\u4ef6\u5757\u5fc5\u987b\u4ee5<code class=\"command\">\\if</code>\u5f00\u59cb\uff0c\u4ee5<code class=\"command\">\\endif</code>\u7ed3\u675f\u3002\u4e2d\u95f4\u53ef\u4ee5\u5305\u542b\u4efb\u610f\u6570\u91cf\u7684<code class=\"command\">\\elif</code>\u5b50\u53e5\uff0c\u540e\u9762\u8fd8\u53ef\u4ee5\u9009\u62e9\u8ddf\u968f\u4e00\u4e2a<code class=\"command\">\\else</code>\u5b50\u53e5\u3002\u666e\u901a\u67e5\u8be2\u548c\u5176\u4ed6\u7c7b\u578b\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u53ef\u4ee5\uff08\u901a\u5e38\u4e5f\u4f1a\uff09\u51fa\u73b0\u5728\u6784\u6210\u6761\u4ef6\u5757\u7684\u547d\u4ee4\u4e4b\u95f4\u3002</p>\n<p lang=\"zh\">\\if \u548c \\elif \u8bfb\u53d6\u53c2\u6570\u5e76\u5c06\u5176\u4f5c\u4e3a\u5e03\u5c14\u8868\u8fbe\u5f0f\u6c42\u503c\u3002\u7ed3\u679c\u4e3a\u771f\u65f6\u7ee7\u7eed\u6b63\u5e38\u5904\u7406\uff0c\u5426\u5219\u8df3\u8fc7\u540e\u7eed\u884c\uff0c\u76f4\u5230\u9047\u5230\u5339\u914d\u7684 \\elif\u3001\\else \u6216 \\endif\u3002\u67d0\u4e2a \\if \u6216 \\elif \u6761\u4ef6\u6210\u7acb\u540e\uff0c\u540c\u4e00\u5757\u4e2d\u540e\u7eed \\elif \u7684\u53c2\u6570\u4e0d\u518d\u6c42\u503c\uff0c\u76f4\u63a5\u89c6\u4e3a\u5047\u3002\u53ea\u6709\u4e4b\u524d\u5339\u914d\u7684 \\if \u548c \\elif \u5747\u672a\u6210\u7acb\uff0c\u624d\u5904\u7406 \\else \u540e\u7684\u884c\u3002</p>\n<p lang=\"zh\">\u4e0e\u5176\u4ed6\u53cd\u659c\u6760\u547d\u4ee4\u53c2\u6570\u4e00\u6837\uff0c\\if \u6216 \\elif \u7684\u8868\u8fbe\u5f0f\u53c2\u6570\u5148\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u548c\u53cd\u5f15\u53f7\u5c55\u5f00\uff0c\u7136\u540e\u50cf\u5f00\u5173\u9009\u9879\u53d8\u91cf\u4e00\u6837\u6c42\u503c\u3002\u6709\u6548\u503c\u4e3a true\u3001false\u30011\u30010\u3001on\u3001off\u3001yes\u3001no \u7684\u4efb\u610f\u65e0\u6b67\u4e49\u3001\u4e0d\u533a\u5206\u5927\u5c0f\u5199\u7684\u5339\u914d\u3002\u4f8b\u5982 t\u3001T \u548c tR \u90fd\u4f1a\u89c6\u4e3a\u771f\u3002</p>\n<p lang=\"zh\">\u4e0d\u80fd\u6b63\u786e\u6c42\u503c\u4e3a\u771f\u6216\u5047\u7684\u8868\u8fbe\u5f0f\u4f1a\u4ea7\u751f\u8b66\u544a\uff0c\u5e76\u88ab\u89c6\u4e3a\u5047\u3002</p>\n<p lang=\"zh\">\u88ab\u8df3\u8fc7\u7684\u884c\u4ecd\u4f1a\u6b63\u5e38\u89e3\u6790\uff0c\u4ee5\u8bc6\u522b\u67e5\u8be2\u548c\u53cd\u659c\u7ebf\u547d\u4ee4\uff0c\u4f46\u67e5\u8be2\u4e0d\u4f1a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u6761\u4ef6\u547d\u4ee4\uff08<code class=\"command\">\\if</code>\u3001<code class=\"command\">\\elif</code>\u3001<code class=\"command\">\\else</code>\u3001<code class=\"command\">\\endif</code>\uff09\u4ee5\u5916\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u4f1a\u88ab\u5ffd\u7565\u3002\u5bf9\u4e8e\u6761\u4ef6\u547d\u4ee4\uff0c\u53ea\u68c0\u67e5\u5d4c\u5957\u662f\u5426\u5408\u6cd5\u3002\u88ab\u8df3\u8fc7\u7684\u884c\u4e2d\u7684\u53d8\u91cf\u5f15\u7528\u4e0d\u4f1a\u5c55\u5f00\uff0c\u4e5f\u4e0d\u4f1a\u6267\u884c\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<p lang=\"zh\">\u540c\u4e00\u4e2a\u6761\u4ef6\u5757\u7684\u6240\u6709\u53cd\u659c\u7ebf\u547d\u4ee4\u5fc5\u987b\u51fa\u73b0\u5728\u540c\u4e00\u4e2a\u6e90\u6587\u4ef6\u4e2d\u3002\u5982\u679c\u4e3b\u8f93\u5165\u6587\u4ef6\u6216\u901a\u8fc7<code class=\"command\">\\include</code>\u5f15\u5165\u7684\u6587\u4ef6\u5230\u8fbe EOF \u65f6\uff0c\u4ecd\u6709\u672c\u5730<code class=\"command\">\\if</code>\u5757\u672a\u5173\u95ed\uff0c<span class=\"application\">psql</span>\u5c31\u4f1a\u62a5\u9519\u3002</p>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4e00\u4e2a\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">-- check for the existence of two separate records in the database and store\n-- the results in separate psql variables\nSELECT\n    EXISTS(SELECT 1 FROM customer WHERE customer_id = 123) as is_customer,\n    EXISTS(SELECT 1 FROM employee WHERE employee_id = 456) as is_employee\n\\gset\n\\if :is_customer\n    SELECT * FROM customer WHERE customer_id = 123;\n\\elif :is_employee\n    \\echo 'is not a customer but is an employee'\n    SELECT * FROM employee WHERE employee_id = 456;\n\\else\n    \\if yes\n        \\echo 'not a customer or employee'\n    \\else\n        \\echo 'this will never print'\n    \\endif\n\\endif\n</pre>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\ir</code> \u6216 <code class=\"literal\">\\include_relative</code> <em class=\"replaceable\"><code>filename</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"literal\">\\ir</code>\u547d\u4ee4\u4e0e<code class=\"literal\">\\i</code>\u76f8\u4f3c\uff0c\u4f46\u89e3\u6790\u76f8\u5bf9\u6587\u4ef6\u540d\u7684\u65b9\u5f0f\u4e0d\u540c\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\u6267\u884c\u65f6\uff0c\u8fd9\u4e24\u4e2a\u547d\u4ee4\u7684\u884c\u4e3a\u76f8\u540c\u3002\u4e0d\u8fc7\uff0c\u5728\u811a\u672c\u4e2d\u8c03\u7528\u65f6\uff0c<code class=\"literal\">\\ir</code>\u4f1a\u76f8\u5bf9\u4e8e\u811a\u672c\u6240\u5728\u7684\u76ee\u5f55\u6765\u89e3\u91ca\u6587\u4ef6\u540d\uff0c\u800c\u4e0d\u662f\u76f8\u5bf9\u4e8e\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\l[+]</code> \u6216 <code class=\"literal\">\\list[+] [ <a class=\"link\" href=\"/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"\u6a21\u5f0f\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u670d\u52a1\u5668\u4e2d\u7684\u6570\u636e\u5e93\uff0c\u5e76\u663e\u793a\u5176\u540d\u79f0\u3001\u62e5\u6709\u8005\u3001\u5b57\u7b26\u96c6\u7f16\u7801\u548c\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6570\u636e\u5e93\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u663e\u793a\u6570\u636e\u5e93\u5927\u5c0f\u3001\u9ed8\u8ba4\u8868\u7a7a\u95f4\u548c\u63cf\u8ff0\u3002\uff08\u5927\u5c0f\u4fe1\u606f\u53ea\u5bf9\u5f53\u524d\u7528\u6237\u80fd\u591f\u8fde\u63a5\u7684\u6570\u636e\u5e93\u53ef\u7528\u3002\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\lo_export <em class=\"replaceable\"><code>loid</code></em> <em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6570\u636e\u5e93\u4e2d\u8bfb\u53d6\u5177\u6709<acronym class=\"acronym\">OID</acronym><em class=\"replaceable\"><code>loid</code></em>\u7684\u5927\u5bf9\u8c61\uff0c\u5e76\u5c06\u5176\u5199\u5165<em class=\"replaceable\"><code>filename</code></em>\u3002\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e0e\u670d\u52a1\u5668\u51fd\u6570 <code class=\"function\">lo_export</code>\u7565\u6709\u4e0d\u540c\uff0c\u540e\u8005\u4f7f\u7528\u8fd0\u884c\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7528\u6237\u7684\u6743\u9650\uff0c\u5e76\u5728\u670d\u52a1\u5668\u7684\u6587\u4ef6\u7cfb\u7edf\u4e0a\u64cd\u4f5c\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u4f7f\u7528 \\lo_list \u67e5\u627e\u5927\u5bf9\u8c61\u7684 OID\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\lo_import <em class=\"replaceable\"><code>filename</code></em> [ <em class=\"replaceable\"><code>comment</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6587\u4ef6\u5b58\u50a8\u5230\u4e00\u4e2a<span class=\"productname\">PostgreSQL</span>\u5927\u5bf9\u8c61\u4e2d\u3002\u53ef\u9009\u5730\uff0c\u5b83\u5c06\u7ed9\u5b9a\u7684\u6ce8\u91ca\u4e0e\u5bf9\u8c61\u5173\u8054\u8d77\u6765\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">foo=&gt; <strong class=\"userinput\"><code>\\lo_import '/home/peter/pictures/photo.xcf' 'a picture of me'</code></strong>\nlo_import 152801\n</pre>\n<p lang=\"zh\">\u54cd\u5e94\u8868\u660e\u5927\u5bf9\u8c61\u83b7\u5f97\u4e86\u5bf9\u8c61 ID 152801\uff0c\u8fd9\u4e2a ID \u53ef\u4ee5\u7528\u6765\u5728\u5c06\u6765\u8bbf\u95ee\u65b0\u521b\u5efa\u7684\u5927\u5bf9\u8c61\u3002\u4e3a\u4fbf\u4e8e\u9605\u8bfb\uff0c\u5efa\u8bae\u59cb\u7ec8\u4e3a\u6bcf\u4e2a\u5bf9\u8c61\u5173\u8054\u4e00\u6761\u4fbf\u4e8e\u4eba\u9605\u8bfb\u7684\u6ce8\u91ca\u3002\u67e5\u770b OID \u548c\u6ce8\u91ca\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528<code class=\"command\">\\lo_list</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u6b64\u547d\u4ee4\u4e0e\u670d\u52a1\u5668\u7aef\u7684<code class=\"function\">lo_import</code>\u7565\u6709\u4e0d\u540c\uff0c\u56e0\u4e3a\u5b83\u4f5c\u4e3a\u672c\u5730\u7528\u6237\u5728\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e0a\u64cd\u4f5c\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\u7684\u7528\u6237\u548c\u6587\u4ef6\u7cfb\u7edf\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\lo_list</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5f53\u524d\u5b58\u50a8\u5728\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709<span class=\"productname\">PostgreSQL</span>\u5927\u5bf9\u8c61\uff0c\u4ee5\u53ca\u4e3a\u5b83\u4eec\u63d0\u4f9b\u7684\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\lo_unlink <em class=\"replaceable\"><code>loid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6570\u636e\u5e93\u4e2d\u5220\u9664<acronym class=\"acronym\">OID</acronym> \u4e3a <em class=\"replaceable\"><code>loid</code></em>\u7684\u5927\u5bf9\u8c61\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u4f7f\u7528 \\lo_list \u67e5\u627e\u5927\u5bf9\u8c61\u7684 OID\u3002</p>\n</div>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\o</code> \u6216 <code class=\"literal\">\\out [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\o</code> \u6216 <code class=\"literal\">\\out [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u540e\u7eed\u67e5\u8be2\u7ed3\u679c\u4fdd\u5b58\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9 shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002\u5982\u679c\u6ca1\u6709\u6307\u5b9a\u53c2\u6570\uff0c\u67e5\u8be2\u8f93\u51fa\u5c06\u6062\u590d\u4e3a\u6807\u51c6\u8f93\u51fa\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\uff0c\u5219\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u7684\u5185\u5bb9\u53ea\u4f1a\u539f\u6837\u4f20\u9012\u7ed9 shell\u3002</p>\n<p lang=\"zh\"><span class=\"quote\">\u201c<span class=\"quote\">\u67e5\u8be2\u7ed3\u679c</span>\u201d</span>\u5305\u62ec\u4ece\u6570\u636e\u5e93\u670d\u52a1\u5668\u83b7\u53d6\u7684\u6240\u6709\u8868\u683c\u3001\u547d\u4ee4\u54cd\u5e94\u548c\u901a\u77e5\uff0c\u4ee5\u53ca\u67e5\u8be2\u6570\u636e\u5e93\u7684\u5404\u79cd\u53cd\u659c\u6760\u547d\u4ee4\u7684\u8f93\u51fa\uff08\u4f8b\u5982<code class=\"command\">\\d</code>\uff09\uff1b\u4f46\u4e0d\u5305\u62ec\u9519\u8bef\u6d88\u606f\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8981\u5728\u67e5\u8be2\u7ed3\u679c\u4e4b\u95f4\u63d2\u5165\u6587\u672c\u8f93\u51fa\uff0c\u4f7f\u7528<code class=\"command\">\\qecho</code>\u3002</p>\n</div>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\p</code> \u6216 <code class=\"literal\">\\print</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\u3002\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6253\u5370\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\password [ <em class=\"replaceable\"><code>username</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u66f4\u6539\u6307\u5b9a\u7528\u6237\uff08\u9ed8\u8ba4\u4e3a\u5f53\u524d\u7528\u6237\uff09\u7684\u5bc6\u7801\u3002\u6b64\u547d\u4ee4\u63d0\u793a\u8f93\u5165\u65b0\u5bc6\u7801\uff0c\u5bf9\u5176\u8fdb\u884c\u52a0\u5bc6\uff0c\u5e76\u5c06\u5176\u4f5c\u4e3a<code class=\"command\">ALTER ROLE</code>\u547d\u4ee4\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u65b0\u5bc6\u7801\u4e0d\u4f1a\u4ee5\u660e\u6587\u5f62\u5f0f\u51fa\u73b0\u5728\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\u3001\u670d\u52a1\u5668\u65e5\u5fd7\u6216\u5176\u4ed6\u5730\u65b9\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\prompt [ <em class=\"replaceable\"><code>text</code></em> ] <em class=\"replaceable\"><code>name</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u63d0\u793a\u7528\u6237\u63d0\u4f9b\u6587\u672c\uff0c\u5c06\u5176\u8d4b\u503c\u7ed9\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u3002\u53ef\u4ee5\u6307\u5b9a\u4e00\u4e2a\u53ef\u9009\u7684\u63d0\u793a\u5b57\u7b26\u4e32<em class=\"replaceable\"><code>text</code></em>\u3002\uff08\u5bf9\u4e8e\u591a\u4e2a\u5355\u8bcd\u7684\u63d0\u793a\uff0c\u7528\u5355\u5f15\u53f7\u62ec\u8d77\u6587\u672c\u3002\uff09</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"literal\">\\prompt</code> \u4f7f\u7528\u7ec8\u7aef\u8fdb\u884c\u8f93\u5165\u548c\u8f93\u51fa\u3002\u7136\u800c\uff0c\u5982\u679c\u4f7f\u7528\u4e86 <code class=\"option\">-f</code> \u547d\u4ee4\u884c\u5f00\u5173\uff0c<code class=\"literal\">\\prompt</code> \u5c06\u4f7f\u7528\u6807\u51c6\u8f93\u5165\u548c\u6807\u51c6\u8f93\u51fa\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\pset [ <em class=\"replaceable\"><code>option</code></em> [ <em class=\"replaceable\"><code>value</code></em> ] ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u8bbe\u7f6e\u5f71\u54cd\u67e5\u8be2\u7ed3\u679c\u8868\u8f93\u51fa\u7684\u9009\u9879\u3002<em class=\"replaceable\"><code>option</code></em>\u6307\u5b9a\u8981\u8bbe\u7f6e\u54ea\u4e2a\u9009\u9879\u3002<em class=\"replaceable\"><code>value</code></em>\u7684\u542b\u4e49\u53d6\u51b3\u4e8e\u6240\u9009\u7684\u9009\u9879\u3002\u5bf9\u4e8e\u67d0\u4e9b\u9009\u9879\uff0c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\u4f1a\u5207\u6362\u6216\u53d6\u6d88\u8bbe\u7f6e\u8be5\u9009\u9879\uff0c\u5177\u4f53\u89c1\u5404\u9009\u9879\u7684\u8bf4\u660e\u3002\u5982\u679c\u6ca1\u6709\u63d0\u53ca\u8fd9\u7c7b\u884c\u4e3a\uff0c\u90a3\u4e48\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\u53ea\u4f1a\u663e\u793a\u5f53\u524d\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\">\u4e0d\u5e26\u4efb\u4f55\u53c2\u6570\u7684<code class=\"command\">\\pset</code>\u4f1a\u663e\u793a\u6240\u6709\u6253\u5370\u9009\u9879\u7684\u5f53\u524d\u72b6\u6001\u3002</p>\n<p lang=\"zh\">\u53ef\u8c03\u6574\u7684\u6253\u5370\u9009\u9879\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">border</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><em class=\"replaceable\"><code>value</code></em>\u5fc5\u987b\u662f\u6570\u5b57\u3002\u4e00\u822c\u6765\u8bf4\uff0c\u6570\u5b57\u8d8a\u5927\uff0c\u8868\u683c\u7684\u8fb9\u6846\u548c\u5206\u9694\u7ebf\u5c31\u8d8a\u591a\uff0c\u4f46\u7ec6\u8282\u53d6\u51b3\u4e8e\u5177\u4f53\u683c\u5f0f\u3002\u5728<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u4e2d\uff0c\u5b83\u4f1a\u76f4\u63a5\u8f6c\u6362\u4e3a<code class=\"literal\">border=...</code>\u5c5e\u6027\u3002\u5728\u5927\u591a\u6570\u5176\u4ed6\u683c\u5f0f\u4e2d\uff0c\u53ea\u6709\u503c 0\uff08\u65e0\u8fb9\u6846\uff09\u30011\uff08\u5185\u90e8\u5206\u9694\u7ebf\uff09\u548c 2\uff08\u8868\u683c\u5916\u6846\uff09\u6709\u610f\u4e49\uff0c\u5927\u4e8e 2 \u7684\u503c\u4f1a\u4e0e<code class=\"literal\">border = 2</code>\u4f5c\u76f8\u540c\u5904\u7406\u3002<code class=\"literal\">latex</code>\u548c<code class=\"literal\">latex-longtable</code>\u683c\u5f0f\u8fd8\u5141\u8bb8\u4f7f\u7528\u503c 3\uff0c\u4ee5\u5728\u6570\u636e\u884c\u4e4b\u95f4\u6dfb\u52a0\u5206\u9694\u7ebf\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><em>\u5217</em></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u76ee\u6807\u5bbd\u5ea6\uff0c\u540c\u65f6\u4e5f\u662f\u786e\u5b9a\u8f93\u51fa\u662f\u5426\u8db3\u591f\u5bbd\u4ee5\u9700\u8981\u5206\u9875\u5668\u6216\u5728\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e0b\u5207\u6362\u5230\u5782\u76f4\u663e\u793a\u7684\u5bbd\u5ea6\u9650\u5236\u3002\u96f6\uff08\u9ed8\u8ba4\u503c\uff09\u4f1a\u5bfc\u81f4\u76ee\u6807\u5bbd\u5ea6\u7531\u73af\u5883\u53d8\u91cf<code class=\"envar\">COLUMNS</code>\u63a7\u5236\uff0c\u6216\u8005\u5982\u679c\u672a\u8bbe\u7f6e <code class=\"envar\">COLUMNS</code>\u5219\u7531\u68c0\u6d4b\u5230\u7684\u5c4f\u5e55\u5bbd\u5ea6\u63a7\u5236\u3002\u53e6\u5916\uff0c\u5982\u679c<code class=\"literal\">columns</code>\u4e3a\u96f6\uff0c\u5219<code class=\"literal\">wrapped</code>\u683c\u5f0f\u4ec5\u5f71\u54cd\u5c4f\u5e55\u8f93\u51fa\u3002\u5982\u679c<code class=\"literal\">columns</code>\u4e3a\u975e\u96f6\uff0c\u5219\u6587\u4ef6\u548c\u7ba1\u9053\u8f93\u51fa\u4e5f\u4f1a\u6309\u8be5\u5bbd\u5ea6\u6298\u884c\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">expanded</code>\uff08\u6216 <code class=\"literal\">x</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff08\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u6269\u5c55\u6a21\u5f0f\uff09\uff0c\u6216\u8005\u662f<code class=\"literal\">auto</code>\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5f00\u542f\u548c\u5173\u95ed\u8bbe\u7f6e\u4e4b\u95f4\u5207\u6362\u3002\u542f\u7528\u6269\u5c55\u6a21\u5f0f\u65f6\uff0c\u67e5\u8be2\u7ed3\u679c\u4ee5\u4e24\u5217\u663e\u793a\uff0c\u5de6\u4fa7\u4e3a\u5217\u540d\uff0c\u53f3\u4fa7\u4e3a\u6570\u636e\u3002\u5982\u679c\u6570\u636e\u5728\u901a\u5e38\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u6a2a\u5411</span>\u201d</span>\u6a21\u5f0f\u4e0b\u65e0\u6cd5\u9002\u5e94\u5c4f\u5e55\uff0c\u8fd9\u79cd\u6a21\u5f0f\u5c31\u5f88\u6709\u7528\u3002\u5728\u81ea\u52a8\u8bbe\u7f6e\u4e0b\uff0c\u5f53\u67e5\u8be2\u8f93\u51fa\u5305\u542b\u591a\u5217\u4e14\u5bbd\u5ea6\u8d85\u8fc7\u5c4f\u5e55\u65f6\uff0c\u4f1a\u4f7f\u7528\u6269\u5c55\u6a21\u5f0f\uff1b\u5426\u5219\u4f7f\u7528\u5e38\u89c4\u6a21\u5f0f\u3002\u81ea\u52a8\u8bbe\u7f6e\u53ea\u5728\u5bf9\u9f50\u548c\u6298\u884c\u683c\u5f0f\u4e2d\u6709\u6548\u3002\u5728\u5176\u4ed6\u683c\u5f0f\u4e2d\uff0c\u5b83\u7684\u884c\u4e3a\u59cb\u7ec8\u4e0e\u5173\u95ed\u6269\u5c55\u6a21\u5f0f\u76f8\u540c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">fieldsep</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u6837\u53ef\u4ee5\u521b\u5efa\u4f8b\u5982\u5236\u8868\u7b26\u6216\u9017\u53f7\u5206\u9694\u7684\u8f93\u51fa\uff0c\u8fd9\u53ef\u80fd\u66f4\u7b26\u5408\u5176\u4ed6\u7a0b\u5e8f\u7684\u9700\u8981\u3002\u8981\u5c06\u5236\u8868\u7b26\u8bbe\u7f6e\u4e3a\u5b57\u6bb5\u5206\u9694\u7b26\uff0c\u8bf7\u8f93\u5165<code class=\"literal\">\\pset fieldsep '\\t'</code>\u3002\u9ed8\u8ba4\u5b57\u6bb5\u5206\u9694\u7b26\u662f<code class=\"literal\">'|'</code>\uff08\u7ad6\u7ebf\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">fieldsep_zero</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u8bbe\u7f6e\u4e3a\u96f6\u5b57\u8282\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">footer</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u8868\u683c\u9875\u811a\uff08<code class=\"literal\">(<em class=\"replaceable\"><code>n</code></em> rows)</code>\u8ba1\u6570\uff09\u7684\u663e\u793a\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5207\u6362\u9875\u811a\u663e\u793a\u7684\u5f00\u5173\u72b6\u6001\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">format</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u8f93\u51fa\u683c\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">unaligned</code>\u3001<code class=\"literal\">aligned</code>\u3001<code class=\"literal\">wrapped</code>\u3001<code class=\"literal\">html</code>\u3001<code class=\"literal\">asciidoc</code>\u3001<code class=\"literal\">latex</code>\uff08\u4f7f\u7528<code class=\"literal\">tabular</code>\uff09\u3001<code class=\"literal\">latex-longtable</code>\u6216<code class=\"literal\">troff-ms</code>\u4e4b\u4e00\u3002\u5141\u8bb8\u4f7f\u7528\u4e0d\u4ea7\u751f\u6b67\u4e49\u7684\u7f29\u5199\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">unaligned</code>\u683c\u5f0f\u5c06\u4e00\u884c\u7684\u6240\u6709\u5217\u5199\u5728\u540c\u4e00\u884c\u4e0a\uff0c\u4ee5\u5f53\u524d\u751f\u6548\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u5206\u9694\u3002\u8fd9\u9002\u5408\u521b\u5efa\u4f9b\u5176\u4ed6\u7a0b\u5e8f\u8bfb\u53d6\u7684\u8f93\u51fa\uff08\u4f8b\u5982\u5236\u8868\u7b26\u5206\u9694\u6216\u9017\u53f7\u5206\u9694\u683c\u5f0f\uff09\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">aligned</code>\u683c\u5f0f\u662f\u6807\u51c6\u7684\u3001\u9002\u5408\u4eba\u9605\u8bfb\u4e14\u6392\u7248\u6574\u9f50\u7684\u6587\u672c\u8f93\u51fa\uff1b\u8fd9\u662f\u9ed8\u8ba4\u683c\u5f0f\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">wrapped</code>\u683c\u5f0f\u4e0e<code class=\"literal\">aligned</code>\u76f8\u4f3c\uff0c\u4f46\u4f1a\u5c06\u8f83\u5bbd\u7684\u6570\u636e\u503c\u6298\u6210\u591a\u884c\uff0c\u4f7f\u8f93\u51fa\u9002\u5e94\u76ee\u6807\u5217\u5bbd\u3002\u76ee\u6807\u5bbd\u5ea6\u7684\u786e\u5b9a\u65b9\u5f0f\u89c1<code class=\"literal\">columns</code>\u9009\u9879\u7684\u8bf4\u660e\u3002\u8bf7\u6ce8\u610f\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u5c1d\u8bd5\u5bf9\u5217\u6807\u9898\u6298\u884c\uff1b\u56e0\u6b64\uff0c\u5982\u679c\u5217\u6807\u9898\u6240\u9700\u7684\u603b\u5bbd\u5ea6\u8d85\u8fc7\u76ee\u6807\u5bbd\u5ea6\uff0c<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u884c\u4e3a\u5c31\u4e0e<code class=\"literal\">aligned</code>\u76f8\u540c\u3002</p>\n<p lang=\"zh\">html\u3001asciidoc\u3001latex\u3001latex-longtable \u548c troff-ms \u683c\u5f0f\u8f93\u51fa\u7684\u662f\u53ef\u5d4c\u5165\u76f8\u5e94\u6807\u8bb0\u8bed\u8a00\u6587\u6863\u7684\u8868\u683c\uff0c\u5e76\u975e\u5b8c\u6574\u6587\u6863\u3002HTML \u53ef\u80fd\u4e0d\u8981\u6c42\u5b8c\u6574\u5c01\u88c5\uff0c\u4f46 LaTeX \u5fc5\u987b\u6709\u5b8c\u6574\u6587\u6863\u7ed3\u6784\u3002latex-longtable \u8fd8\u9700\u8981 LaTeX \u7684 longtable \u548c booktabs \u5b8f\u5305\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">linestyle</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u8fb9\u6846\u7ebf\u7ed8\u5236\u6837\u5f0f\u4e3a<code class=\"literal\">ascii</code>\u3001<code class=\"literal\">old-ascii</code>\u6216<code class=\"literal\">unicode</code>\u4e4b\u4e00\u3002\u5141\u8bb8\u4f7f\u7528\u552f\u4e00\u7f29\u5199\u3002\uff08\u8fd9\u610f\u5473\u7740\u4e00\u4e2a\u5b57\u6bcd\u5c31\u8db3\u591f\u4e86\u3002\uff09\u9ed8\u8ba4\u8bbe\u7f6e\u4e3a<code class=\"literal\">ascii</code>\u3002\u6b64\u9009\u9879\u4ec5\u5f71\u54cd<code class=\"literal\">aligned</code>\u548c<code class=\"literal\">wrapped</code>\u8f93\u51fa\u683c\u5f0f\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">ascii</code>\u6837\u5f0f\u4f7f\u7528\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u53f3\u8fb9\u7f18\u7684<code class=\"literal\">+</code>\u7b26\u53f7\u8868\u793a\u3002\u5f53<code class=\"literal\">wrapped</code>\u683c\u5f0f\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u628a\u6570\u636e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u4f1a\u5728\u7b2c\u4e00\u884c\u7684\u53f3\u8fb9\u7f18\u663e\u793a\u4e00\u4e2a\u70b9\uff08<code class=\"literal\">.</code>\uff09\uff0c\u5e76\u5728\u4e0b\u4e00\u884c\u7684\u5de6\u8fb9\u7f18\u518d\u6b21\u663e\u793a\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">old-ascii</code>\u6837\u5f0f\u4f7f\u7528\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\uff0c\u91c7\u7528<span class=\"productname\">PostgreSQL</span> 8.4 \u53ca\u66f4\u65e9\u7248\u672c\u7684\u683c\u5f0f\u6837\u5f0f\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u66ff\u4ee3\u5de6\u4fa7\u5217\u5206\u9694\u7b26\u7684<code class=\"literal\">:</code>\u7b26\u53f7\u8868\u793a\u3002\u5f53\u6570\u636e\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u5219\u7528<code class=\"literal\">;</code>\u7b26\u53f7\u66ff\u4ee3\u5de6\u4fa7\u5217\u5206\u9694\u7b26\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">unicode</code>\u6837\u5f0f\u4f7f\u7528 Unicode \u6846\u7ebf\u7ed8\u5236\u5b57\u7b26\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u53f3\u8fb9\u7f18\u7684\u56de\u8f66\u7b26\u53f7\u8868\u793a\u3002\u5f53\u6570\u636e\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u4f1a\u5728\u7b2c\u4e00\u884c\u7684\u53f3\u8fb9\u7f18\u663e\u793a\u7701\u7565\u53f7\u7b26\u53f7\uff0c\u5e76\u5728\u4e0b\u4e00\u884c\u7684\u5de6\u8fb9\u7f18\u518d\u6b21\u663e\u793a\u3002</p>\n<p lang=\"zh\">\u5f53<code class=\"literal\">border</code>\u8bbe\u7f6e\u5927\u4e8e\u96f6\u65f6\uff0c<code class=\"literal\">linestyle</code>\u9009\u9879\u8fd8\u51b3\u5b9a\u7528\u54ea\u4e9b\u5b57\u7b26\u7ed8\u5236\u8fb9\u6846\u7ebf\u3002\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\u5728\u4efb\u4f55\u73af\u5883\u4e2d\u90fd\u53ef\u7528\uff0c\u4f46\u5728\u652f\u6301 Unicode \u7684\u663e\u793a\u8bbe\u5907\u4e0a\uff0cUnicode \u5b57\u7b26\u66f4\u7f8e\u89c2\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">null</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u7528\u4e8e\u4ee3\u66ff\u7a7a\u503c\u6253\u5370\u7684\u5b57\u7b26\u4e32\u3002\u9ed8\u8ba4\u4e0d\u6253\u5370\u4efb\u4f55\u5185\u5bb9\uff0c\u8fd9\u5f88\u5bb9\u6613\u88ab\u8bef\u8ba4\u4e3a\u7a7a\u5b57\u7b26\u4e32\u3002\u4f8b\u5982\uff0c\u4f60\u53ef\u80fd\u66f4\u559c\u6b22\u4f7f\u7528<code class=\"literal\">\\pset null '(null)'</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">numericlocale</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u4f7f\u7528\u533a\u57df\u8bbe\u7f6e\u7279\u5b9a\u7684\u5b57\u7b26\u6765\u5206\u9694\u5c0f\u6570\u70b9\u5de6\u4fa7\u7684\u6570\u5b57\u7ec4\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5e38\u89c4\u6570\u5b57\u8f93\u51fa\u548c\u533a\u57df\u8bbe\u7f6e\u7279\u5b9a\u7684\u6570\u5b57\u8f93\u51fa\u4e4b\u95f4\u5207\u6362\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">pager</code></span></dt>\n<dd>\n<p lang=\"zh\">\u63a7\u5236\u67e5\u8be2\u548c<span class=\"application\">psql</span>\u5e2e\u52a9\u8f93\u51fa\u662f\u5426\u4f7f\u7528\u5206\u9875\u5668\u7a0b\u5e8f\u3002\u5982\u679c\u8bbe\u7f6e\u4e86\u73af\u5883\u53d8\u91cf<code class=\"envar\">PSQL_PAGER</code>\u6216<code class=\"envar\">PAGER</code>\uff0c\u8f93\u51fa\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u9012\u7ed9\u6307\u5b9a\u7684\u7a0b\u5e8f\u3002\u5426\u5219\uff0c\u4f7f\u7528\u4e0e\u5e73\u53f0\u6709\u5173\u7684\u9ed8\u8ba4\u7a0b\u5e8f\uff08\u5982<code class=\"filename\">more</code>\uff09\u3002</p>\n<p lang=\"zh\">\u5f53 pager \u4e3a off \u65f6\uff0c\u4e0d\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\uff1b\u4e3a on \u65f6\uff0c\u5728\u9002\u5f53\u60c5\u51b5\u4e0b\u4f7f\u7528\uff0c\u5373\u8f93\u51fa\u76ee\u6807\u662f\u7ec8\u7aef\u4e14\u5185\u5bb9\u65e0\u6cd5\u5728\u5c4f\u5e55\u5185\u663e\u793a\u5b8c\u3002\u8bbe\u4e3a always \u65f6\uff0c\u6240\u6709\u7ec8\u7aef\u8f93\u51fa\u5747\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\uff0c\u65e0\u8bba\u662f\u5426\u80fd\u5728\u5c4f\u5e55\u5185\u663e\u793a\u5b8c\u3002\u4e0d\u5e26\u503c\u7684 \\pset pager \u4f1a\u5207\u6362\u5206\u9875\u7684\u5f00\u5173\u72b6\u6001\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">pager_min_lines</code></span></dt>\n<dd>\n<p lang=\"zh\">\u82e5 pager_min_lines \u5927\u4e8e\u5c4f\u5e55\u9875\u9ad8\uff0c\u53ea\u6709\u8f93\u51fa\u884c\u6570\u8fbe\u5230\u8be5\u503c\u65f6\u624d\u8c03\u7528\u5206\u9875\u7a0b\u5e8f\u3002\u9ed8\u8ba4\u503c\u4e3a 0\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">recordsep</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u8bb0\u5f55\uff08\u884c\uff09\u5206\u9694\u7b26\u3002\u9ed8\u8ba4\u4e3a\u6362\u884c\u7b26\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">recordsep_zero</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u8bbe\u7f6e\u4e3a\u96f6\u5b57\u8282\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">tableattr</code>\uff08\u6216 <code class=\"literal\">T</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\u5728<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u4e2d\uff0c\u8fd9\u6307\u5b9a\u8981\u653e\u5728<code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u5c5e\u6027\uff0c\u4f8b\u5982<code class=\"literal\">cellpadding</code>\u6216<code class=\"literal\">bgcolor</code>\u3002\u8bf7\u6ce8\u610f\uff0c\u4f60\u53ef\u80fd\u4e0d\u9700\u8981\u5728\u8fd9\u91cc\u6307\u5b9a<code class=\"literal\">border</code>\uff0c\u56e0\u4e3a<code class=\"literal\">\\pset border</code>\u5df2\u7ecf\u8d1f\u8d23\u5904\u7406\u5b83\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u8868\u683c\u5c5e\u6027\u3002</p>\n<p lang=\"zh\">\u5728<code class=\"literal\">latex-longtable</code>\u683c\u5f0f\u4e2d\uff0c\u8fd9\u63a7\u5236\u6bcf\u4e2a\u5305\u542b\u5de6\u5bf9\u9f50\u6570\u636e\u7c7b\u578b\u7684\u5217\u7684\u5bbd\u5ea6\u6bd4\u4f8b\u3002\u5b83\u4ee5\u7a7a\u767d\u5206\u9694\u7684\u503c\u5217\u8868\u6307\u5b9a\uff0c\u4f8b\u5982<code class=\"literal\">'0.2 0.2 0.6'</code>\u3002\u672a\u6307\u5b9a\u7684\u8f93\u51fa\u5217\u4f7f\u7528\u6700\u540e\u6307\u5b9a\u7684\u503c\u3002</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">title</code>\uff08\u6216 <code class=\"literal\">C</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u968f\u540e\u6253\u5370\u7684\u6240\u6709\u8868\u683c\u7684\u6807\u9898\u3002\u8fd9\u53ef\u4ee5\u4e3a\u8f93\u51fa\u63d0\u4f9b\u63cf\u8ff0\u6027\u6807\u7b7e\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u6807\u9898\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">tuples_only</code>\uff08\u6216 <code class=\"literal\">t</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u4ec5\u5143\u7ec4\u6a21\u5f0f\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5e38\u89c4\u8f93\u51fa\u548c\u4ec5\u5143\u7ec4\u8f93\u51fa\u4e4b\u95f4\u5207\u6362\u3002\u5e38\u89c4\u8f93\u51fa\u5305\u542b\u5217\u6807\u9898\u3001\u8868\u683c\u6807\u9898\u548c\u5404\u79cd\u9875\u811a\u7b49\u9644\u52a0\u4fe1\u606f\u3002\u5728\u4ec5\u5143\u7ec4\u6a21\u5f0f\u4e0b\uff0c\u53ea\u663e\u793a\u5b9e\u9645\u7684\u8868\u683c\u6570\u636e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">unicode_border_linestyle</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u8fb9\u6846\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">unicode_column_linestyle</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u5217\u5206\u9694\u7ebf\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">unicode_header_linestyle</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u8868\u5934\u5206\u9694\u7ebf\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8fd9\u4e9b\u4e0d\u540c\u683c\u5f0f\u7684\u5916\u89c2\u793a\u4f8b\u53ef\u53c2\u89c1<a class=\"xref\" href=\"/docs/11/app-psql.html#APP-PSQL-EXAMPLES\" title=\"\u793a\u4f8b\">\u793a\u4f8b</a>\u4e00\u8282\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u6709\u5404\u79cd\u5feb\u6377\u547d\u4ee4\u7528\u4e8e<code class=\"command\">\\pset</code>\u3002\u8bf7\u53c2\u89c1<code class=\"command\">\\a</code>\u3001<code class=\"command\">\\C</code>\u3001<code class=\"command\">\\f</code>\u3001<code class=\"command\">\\H</code>\u3001<code class=\"command\">\\t</code>\u3001<code class=\"command\">\\T</code>\u548c<code class=\"command\">\\x</code>\u3002</p>\n</div>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\q</code> \u6216 <code class=\"literal\">\\quit</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9000\u51fa<span class=\"application\">psql</span>\u7a0b\u5e8f\u3002\u5728\u811a\u672c\u6587\u4ef6\u4e2d\uff0c\u53ea\u4f1a\u7ec8\u6b62\u8be5\u811a\u672c\u7684\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\qecho <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u547d\u4ee4\u4e0e<code class=\"command\">\\echo</code>\u76f8\u540c\uff0c\u53ea\u662f\u8f93\u51fa\u4f1a\u5199\u5165\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u7684\u67e5\u8be2\u8f93\u51fa\u901a\u9053\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\r</code> \u6216 <code class=\"literal\">\\reset</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u91cd\u7f6e\uff08\u6e05\u7a7a\uff09\u67e5\u8be2\u7f13\u51b2\u533a\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\s [ <em class=\"replaceable\"><code>filename</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u5386\u53f2\u8bb0\u5f55\u5230<em class=\"replaceable\"><code>filename</code></em>\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5386\u53f2\u8bb0\u5f55\u5c06\u88ab\u5199\u5165\u6807\u51c6\u8f93\u51fa\uff08\u5982\u679c\u9002\u7528\uff0c\u5c06\u4f7f\u7528\u5206\u9875\u5668\uff09\u3002\u5982\u679c<span class=\"application\">psql</span>\u5728\u6784\u5efa\u65f6\u6ca1\u6709\u4f7f\u7528<span class=\"application\">Readline</span>\u652f\u6301\uff0c\u5219\u6b64\u547d\u4ee4\u4e0d\u53ef\u7528\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\set [ <em class=\"replaceable\"><code>name</code></em> [ <em class=\"replaceable\"><code>value</code></em> [ ... ] ] ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06<span class=\"application\">psql</span>\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u8bbe\u7f6e\u4e3a<em class=\"replaceable\"><code>value</code></em>\uff0c\u5982\u679c\u7ed9\u51fa\u591a\u4e2a\u503c\uff0c\u5219\u8bbe\u7f6e\u4e3a\u6240\u6709\u503c\u7684\u4e32\u63a5\u3002\u5982\u679c\u53ea\u7ed9\u51fa\u4e00\u4e2a\u53c2\u6570\uff0c\u5219\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\u503c\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u8bbe\u7f6e\uff0c\u8bf7\u4f7f\u7528<code class=\"command\">\\unset</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\"><code class=\"command\">\\set</code>\u6ca1\u6709\u4efb\u4f55\u53c2\u6570\u65f6\uff0c\u663e\u793a\u5f53\u524d\u8bbe\u7f6e\u7684\u6240\u6709<span class=\"application\">psql</span>\u53d8\u91cf\u7684\u540d\u79f0\u548c\u503c\u3002</p>\n<p lang=\"zh\">\u5408\u6cd5\u7684\u53d8\u91cf\u540d\u53ef\u4ee5\u5305\u542b\u5b57\u6bcd\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u3002\u8be6\u60c5\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/11/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002\u53d8\u91cf\u540d\u533a\u5206\u5927\u5c0f\u5199\u3002</p>\n<p lang=\"zh\">\u67d0\u4e9b\u53d8\u91cf\u662f\u7279\u6b8a\u7684\uff0c\u5b83\u4eec\u63a7\u5236<span class=\"application\">psql</span>\u7684\u884c\u4e3a\uff0c\u6216\u8005\u7531\u7cfb\u7edf\u81ea\u52a8\u8bbe\u7f6e\u4ee5\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u3002\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/11/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u4ecb\u7ecd\u4e86\u8fd9\u4e9b\u53d8\u91cf\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u4e0e<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4<a class=\"xref\" href=\"/docs/11/sql-set.html\" title=\"SET\"><span class=\"refentrytitle\">SET</span></a>\u65e0\u5173\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\setenv <em class=\"replaceable\"><code>name</code></em> [ <em class=\"replaceable\"><code>value</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u4e3a<em class=\"replaceable\"><code>value</code></em>\uff0c\u6216\u8005\u5982\u679c\u672a\u63d0\u4f9b<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3002\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\setenv PAGER less</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>\\setenv LESS -imx4F</code></strong>\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\sf[+] <em class=\"replaceable\"><code>function_description</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u663e\u793a\u6307\u5b9a\u51fd\u6570\u6216\u8fc7\u7a0b\u7684\u5b9a\u4e49\uff0c\u4ee5<code class=\"command\">CREATE OR REPLACE FUNCTION</code>\u6216 <code class=\"command\">CREATE OR REPLACE PROCEDURE</code>\u547d\u4ee4\u7684\u5f62\u5f0f\u5448\u73b0\u3002\u5b9a\u4e49\u5c06\u6253\u5370\u5230\u5f53\u524d\u67e5\u8be2\u8f93\u51fa\u901a\u9053\uff0c\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\">\u76ee\u6807\u51fd\u6570\u53ef\u4ec5\u7528\u540d\u79f0\u6307\u5b9a\uff0c\u4e5f\u53ef\u7528\u540d\u79f0\u548c\u53c2\u6570\u6307\u5b9a\uff0c\u4f8b\u5982 foo(integer, text)\u3002\u82e5\u6709\u591a\u4e2a\u540c\u540d\u51fd\u6570\uff0c\u5219\u5fc5\u987b\u63d0\u4f9b\u53c2\u6570\u7c7b\u578b\u3002</p>\n<p lang=\"zh\">\u5728\u547d\u4ee4\u540d\u540e\u6dfb\u52a0 +\uff0c\u4f1a\u4e3a\u8f93\u51fa\u884c\u7f16\u53f7\uff0c\u51fd\u6570\u4f53\u7b2c\u4e00\u884c\u4e3a\u7b2c 1 \u884c\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\sf</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\sv[+] <em class=\"replaceable\"><code>view_name</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u6307\u5b9a\u89c6\u56fe\u7684\u5b9a\u4e49\uff0c\u5e76\u4ee5<code class=\"command\">CREATE OR REPLACE VIEW</code>\u547d\u4ee4\u7684\u5f62\u5f0f\u663e\u793a\u3002\u5b9a\u4e49\u4f1a\u6253\u5370\u5230\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u7684\u5f53\u524d\u67e5\u8be2\u8f93\u51fa\u901a\u9053\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u547d\u4ee4\u540d\u79f0\u540e\u6dfb\u52a0<code class=\"literal\">+</code>\uff0c\u90a3\u4e48\u8f93\u51fa\u884c\u5c06\u4ece1\u5f00\u59cb\u7f16\u53f7\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\sv</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\t</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u8f93\u51fa\u4e2d\u7684\u5217\u540d\u6807\u9898\u548c\u884c\u6570\u9875\u811a\u7684\u663e\u793a\u72b6\u6001\u3002\u8fd9\u4e2a\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset tuples_only</code>\uff0c\u63d0\u4f9b\u5b83\u662f\u4e3a\u4e86\u4f7f\u7528\u65b9\u4fbf\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\T <em class=\"replaceable\"><code>table_options</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728<acronym class=\"acronym\">HTML</acronym>\u8f93\u51fa\u683c\u5f0f\u4e2d\u653e\u5728<code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u5c5e\u6027\u3002\u8fd9\u4e2a\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset tableattr <em class=\"replaceable\"><code>table_options</code></em></code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\timing [ <em class=\"replaceable\"><code>on</code></em> | <em class=\"replaceable\"><code>off</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5e26\u53c2\u6570\u65f6\uff0c\u5f00\u542f\u6216\u5173\u95ed\u6bcf\u6761 SQL \u8bed\u53e5\u6267\u884c\u8017\u65f6\u7684\u663e\u793a\u3002\u4e0d\u5e26\u53c2\u6570\u65f6\uff0c\u5207\u6362\u663e\u793a\u7684\u5f00\u5173\u72b6\u6001\u3002\u8017\u65f6\u4ee5\u6beb\u79d2\u663e\u793a\uff1b\u8d85\u8fc7 1 \u79d2\u7684\u65f6\u95f4\u95f4\u9694\u8fd8\u4f1a\u4ee5\u5206\u949f:\u79d2\u7684\u683c\u5f0f\u663e\u793a\uff0c\u5fc5\u8981\u65f6\u6dfb\u52a0\u5c0f\u65f6\u548c\u5929\u5b57\u6bb5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\unset <em class=\"replaceable\"><code>name</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u53d6\u6d88\u8bbe\u7f6e\uff08\u5220\u9664\uff09<span class=\"application\">psql</span>\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u3002</p>\n<p lang=\"zh\">\u5927\u591a\u6570\u63a7\u5236<span class=\"application\">psql</span>\u884c\u4e3a\u7684\u53d8\u91cf\u4e0d\u80fd\u53d6\u6d88\u8bbe\u7f6e\uff1b\u5bf9\u4e8e\u8fd9\u4e9b\u53d8\u91cf\uff0c<code class=\"literal\">\\unset</code>\u547d\u4ee4\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u5176\u8bbe\u7f6e\u4e3a\u9ed8\u8ba4\u503c\u3002\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/11/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\w</code> \u6216 <code class=\"literal\">\\write</code> <em class=\"replaceable\"><code>filename</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\w</code> \u6216 <code class=\"literal\">\\write</code> <code class=\"literal\">|</code><em class=\"replaceable\"><code>command</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u5199\u5165\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u9012\u7ed9 shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6539\u4e3a\u5199\u5165\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\uff0c\u5219\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u7684\u5185\u5bb9\u53ea\u4f1a\u539f\u6837\u4f20\u9012\u7ed9 shell\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\watch [ <em class=\"replaceable\"><code>seconds</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u91cd\u590d\u6267\u884c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\uff08\u5982\u540c <code class=\"literal\">\\g</code> \u4e00\u6837\uff09\uff0c\u76f4\u5230\u88ab\u4e2d\u65ad\u6216\u67e5\u8be2\u5931\u8d25\u3002\u4e24\u6b21\u6267\u884c\u4e4b\u95f4\u7b49\u5f85\u6307\u5b9a\u7684\u79d2\u6570\uff08\u9ed8\u8ba4 2 \u79d2\uff09\u3002\u6bcf\u6b21\u67e5\u8be2\u7ed3\u679c\u90fd\u4f1a\u5e26\u6709\u4e00\u4e2a\u5934\u90e8\uff0c\u5176\u4e2d\u5305\u542b <code class=\"literal\">\\pset title</code> \u5b57\u7b26\u4e32\uff08\u5982\u679c\u6709\uff09\u3001\u67e5\u8be2\u5f00\u59cb\u65f6\u7684\u65f6\u95f4\u4ee5\u53ca\u5ef6\u8fdf\u95f4\u9694\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\x [ <em class=\"replaceable\"><code>on</code></em> | <em class=\"replaceable\"><code>off</code></em> | <em class=\"replaceable\"><code>auto</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u6216\u5207\u6362\u6269\u5c55\u8868\u683c\u683c\u5f0f\u6a21\u5f0f\u3002\u5b83\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset expanded</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\z [ <a class=\"link\" href=\"https://pg.center/docs/11/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u53ca\u5176\u5173\u8054\u7684\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u3002</p>\n<p lang=\"zh\">\u8fd9\u662f<code class=\"command\">\\dp</code>\u7684\u522b\u540d\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u663e\u793a\u6743\u9650</span>\u201d</span>\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\! [ <em class=\"replaceable\"><code>command</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u5e26\u53c2\u6570\u65f6\uff0c\u8fdb\u5165\u4e00\u4e2a\u5b50 shell\uff1b\u5b50 shell \u9000\u51fa\u540e\uff0c<span class=\"application\">psql</span>\u6062\u590d\u8fd0\u884c\u3002\u5e26\u53c2\u6570\u65f6\uff0c\u6267\u884c shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\!</code>\u7684\u53c2\u6570\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u5185\u5bb9\u4f1a\u539f\u6837\u4f20\u7ed9 shell\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\? [ <em class=\"replaceable\"><code>topic</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5e2e\u52a9\u4fe1\u606f\u3002\u53ef\u9009\u7684<em class=\"replaceable\"><code>topic</code></em>\u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a<code class=\"literal\">commands</code>\uff09\u9009\u62e9\u8981\u89e3\u91ca\u7684<span class=\"application\">psql</span>\u7684\u54ea\u4e2a\u90e8\u5206\uff1a<code class=\"literal\">commands</code>\u63cf\u8ff0<span class=\"application\">psql</span>\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b<code class=\"literal\">options</code>\u63cf\u8ff0\u53ef\u4ee5\u4f20\u9012\u7ed9<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c<code class=\"literal\">variables</code>\u663e\u793a\u5173\u4e8e<span class=\"application\">psql</span>\u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\;</code></span></dt>\n<dd>\n<p lang=\"zh\">\u53cd\u659c\u7ebf\u52a0\u5206\u53f7\u5e76\u4e0d\u662f\u4e0e\u524d\u8ff0\u547d\u4ee4\u76f8\u540c\u7684\u5143\u547d\u4ee4\uff1b\u5b83\u53ea\u662f\u5c06\u4e00\u4e2a\u5206\u53f7\u6dfb\u52a0\u5230\u67e5\u8be2\u7f13\u51b2\u533a\uff0c\u800c\u4e0d\u8fdb\u884c\u4efb\u4f55\u8fdb\u4e00\u6b65\u5904\u7406\u3002</p>\n<p lang=\"zh\">\u901a\u5e38\uff0c<span class=\"application\">psql</span>\u4e00\u9047\u5230\u7ed3\u675f\u547d\u4ee4\u7684\u5206\u53f7\uff0c\u5c31\u4f1a\u5c06 SQL \u547d\u4ee4\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u5373\u4f7f\u5f53\u524d\u884c\u4ecd\u6709\u66f4\u591a\u8f93\u5165\u4e5f\u662f\u5982\u6b64\u3002\u4f8b\u5982\uff0c\u8f93\u5165</p>\n<pre class=\"programlisting\">select 1; select 2; select 3;\n</pre>\n<p lang=\"zh\">\u4f1a\u5c06\u8fd9\u4e09\u6761 SQL \u547d\u4ee4\u5206\u522b\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u6bcf\u6761\u547d\u4ee4\u7684\u7ed3\u679c\u4f1a\u5728\u7ee7\u7eed\u5904\u7406\u4e0b\u4e00\u6761\u547d\u4ee4\u4e4b\u524d\u663e\u793a\u3002\u4e0d\u8fc7\uff0c\u4ee5\u4ee5\u4e0b\u5f62\u5f0f\u8f93\u5165\u7684\u5206\u53f7\uff1a<code class=\"literal\">\\;</code>\uff0c\u4e0d\u4f1a\u89e6\u53d1\u547d\u4ee4\u5904\u7406\uff0c\u56e0\u6b64\u5b83\u524d\u540e\u7684\u547d\u4ee4\u5b9e\u9645\u4e0a\u4f1a\u5408\u5e76\u5230\u4e00\u4e2a\u8bf7\u6c42\u4e2d\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u3002\u4f8b\u5982\uff0c\u8f93\u5165</p>\n<pre class=\"programlisting\">select 1\\; select 2\\; select 3;\n</pre>\n<p lang=\"zh\">\u4f1a\u5728\u9047\u5230\u672a\u52a0\u53cd\u659c\u7ebf\u7684\u5206\u53f7\u65f6\uff0c\u5c06\u8fd9\u4e09\u6761 SQL \u547d\u4ee4\u4f5c\u4e3a\u4e00\u4e2a\u8bf7\u6c42\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u3002\u670d\u52a1\u5668\u4f1a\u5c06\u8fd9\u6837\u7684\u8bf7\u6c42\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff0c\u9664\u975e\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u663e\u5f0f\u7684<code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code>\u547d\u4ee4\uff0c\u5c06\u5176\u5212\u5206\u4e3a\u591a\u4e2a\u4e8b\u52a1\u3002\uff08\u6709\u5173\u670d\u52a1\u5668\u5982\u4f55\u5904\u7406\u591a\u67e5\u8be2\u5b57\u7b26\u4e32\u7684\u66f4\u591a\u7ec6\u8282\uff0c\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/11/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT\" title=\"53.2.2.1.\u00a0\u4e00\u4e2a\u7b80\u5355\u67e5\u8be2\u4e2d\u7684\u591a\u6761\u8bed\u53e5\">\u7b2c\u00a053.2.2.1\u00a0\u8282</a>\u3002\uff09<span class=\"application\">psql</span>\u5bf9\u6bcf\u4e2a\u8bf7\u6c42\u53ea\u6253\u5370\u6536\u5230\u7684\u6700\u540e\u4e00\u4e2a\u67e5\u8be2\u7ed3\u679c\uff1b\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u867d\u7136\u4e09\u6761<code class=\"command\">SELECT</code>\u547d\u4ee4\u786e\u5b9e\u90fd\u4f1a\u6267\u884c\uff0c\u4f46<span class=\"application\">psql</span>\u53ea\u6253\u5370<code class=\"literal\">3</code>\u3002</p>\n</dd>\n</dl>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-PATTERNS\">\n<h4 lang=\"zh\">\u6a21\u5f0f</h4>\n<p lang=\"zh\">\u5f88\u591a<code class=\"literal\">\\d</code>\u547d\u4ee4\u90fd\u53ef\u4ee5\u7528\u4e00\u4e2a<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\u6765\u6307\u5b9a\u8981\u88ab\u663e\u793a\u7684\u5bf9\u8c61\u540d\u79f0\u3002\u5728\u6700\u7b80\u5355\u7684\u60c5\u51b5\u4e0b\uff0c\u6a21\u5f0f\u6b63\u597d\u5c31\u662f\u8be5\u5bf9\u8c61\u7684\u51c6\u786e\u540d\u79f0\u3002\u5728\u6a21\u5f0f\u4e2d\u7684\u5b57\u7b26\u901a\u5e38\u4f1a\u88ab\u53d8\u6210\u5c0f\u5199\u5f62\u5f0f\uff08\u5c31\u50cf\u5728 SQL \u540d\u79f0\u4e2d\u90a3\u6837\uff09\uff0c\u4f8b\u5982<code class=\"literal\">\\dt FOO</code>\u5c06\u4f1a\u663e\u793a\u540d\u4e3a<code class=\"literal\">foo</code>\u7684\u8868\u3002\u5c31\u50cf\u5728 SQL \u540d\u79f0\u4e2d\u90a3\u6837\uff0c\u628a\u6a21\u5f0f\u653e\u5728\u53cc\u5f15\u53f7\u4e2d\u53ef\u4ee5\u963b\u6b62\u5b83\u88ab\u8f6c\u6362\u6210\u5c0f\u5199\u5f62\u5f0f\u3002\u5982\u679c\u9700\u8981\u5728\u4e00\u4e2a\u6a21\u5f0f\u4e2d\u5305\u62ec\u4e00\u4e2a\u771f\u6b63\u7684\u53cc\u5f15\u53f7\u5b57\u7b26\uff0c\u5219\u9700\u8981\u5728\u53cc\u5f15\u53f7\u5305\u56f4\u7684\u6587\u672c\u5185\u628a\u5b83\u5199\u6210\u4e24\u4e2a\u76f8\u90bb\u7684\u53cc\u5f15\u53f7\uff0c\u8fd9\u540c\u6837\u662f\u7b26\u5408 SQL \u52a0\u5f15\u53f7\u6807\u8bc6\u7b26\u7684\u89c4\u5219\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dt \"FOO\"\"BAR\"</code>\u5c06\u663e\u793a\u540d\u4e3a<code class=\"literal\">FOO\"BAR</code>\uff08\u4e0d\u662f<code class=\"literal\">foo\"bar</code>\uff09\u7684\u8868\u3002\u548c\u666e\u901a\u7684 SQL \u540d\u79f0\u89c4\u5219\u4e0d\u540c\uff0c\u4f60\u53ef\u4ee5\u53ea\u5728\u6a21\u5f0f\u7684\u4e00\u90e8\u5206\u5468\u56f4\u653e\u4e0a\u53cc\u5f15\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">\\dt FOO\"FOO\"BAR</code>\u5c06\u4f1a\u663e\u793a\u540d\u4e3a<code class=\"literal\">fooFOObar</code>\u7684\u8868\u3002</p>\n<p lang=\"zh\">\u53ea\u8981\u5b8c\u5168\u7701\u7565<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\uff0c<code class=\"literal\">\\d</code>\u547d\u4ee4\u5c31\u4f1a\u663e\u793a\u5f53\u524d\u6a21\u5f0f\u641c\u7d22\u8def\u5f84\u4e2d\u53ef\u89c1\u7684\u5168\u90e8\u5bf9\u8c61 \u2014 \u8fd9\u7b49\u4ef7\u4e8e\u7528<code class=\"literal\">*</code>\u4f5c\u4e3a\u6a21\u5f0f\uff08\u5982\u679c\u4e00\u4e2a\u5bf9\u8c61\u6240\u5728\u7684\u6a21\u5f0f\u4f4d\u4e8e\u641c\u7d22\u8def\u5f84\u4e2d\uff0c\u5e76\u4e14\u5728\u641c\u7d22\u8def\u5f84\u4e2d\u8be5\u6a21\u5f0f\u4e4b\u524d\u6ca1\u6709\u540c\u7c7b\u4e14\u540c\u540d\u7684\u5bf9\u8c61\uff0c\u5219\u8be5\u5bf9\u8c61\u5c31\u662f<em class=\"firstterm\">\u53ef\u89c1</em>\u7684\u3002\u8fd9\u8868\u793a\u53ef\u4ee5\u76f4\u63a5\u7528\u540d\u79f0\u5f15\u7528\u8be5\u5bf9\u8c61\uff0c\u800c\u4e0d\u9700\u8981\u7528\u6a21\u5f0f\u6765\u9650\u5b9a\uff09\u3002\u8981\u67e5\u770b\u6570\u636e\u5e93\u4e2d\u6240\u6709\u5bf9\u8c61\u800c\u4e0d\u8003\u8651\u5176\u53ef\u89c1\u6027\uff0c\u53ef\u4ee5\u628a<code class=\"literal\">*.*</code>\u7528\u4f5c\u6a21\u5f0f\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u653e\u5728\u4e00\u4e2a\u6a21\u5f0f\u4e2d\uff0c<code class=\"literal\">*</code>\u5c06\u5339\u914d\u4efb\u610f\u5b57\u7b26\u5e8f\u5217\uff08\u5305\u62ec\u7a7a\u5e8f\u5217\uff09\uff0c\u800c<code class=\"literal\">?</code>\u4f1a\u5339\u914d\u4efb\u610f\u7684\u5355\u4e2a\u5b57\u7b26\uff08\u8fd9\u79cd\u8bb0\u53f7\u65b9\u6cd5\u5c31\u50cf Unix shell \u7684\u6587\u4ef6\u540d\u6a21\u5f0f\u4e00\u6837\uff09\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dt int*</code>\u4f1a\u663e\u793a\u540d\u79f0\u4ee5<code class=\"literal\">int</code>\u5f00\u59cb\u7684\u8868\u3002\u4f46\u662f\u5982\u679c\u88ab\u653e\u5728\u53cc\u5f15\u53f7\u5185\uff0c<code class=\"literal\">*</code>\u548c<code class=\"literal\">?</code>\u5c31\u4f1a\u5931\u53bb\u8fd9\u4e9b\u7279\u6b8a\u542b\u4e49\u800c\u53d8\u6210\u666e\u901a\u7684\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u5305\u542b\u70b9\u53f7\uff08.\uff09\u7684\u6a21\u5f0f\u4f1a\u88ab\u89e3\u91ca\u4e3a\u6a21\u5f0f\u540d\u5339\u914d\u6a21\u5f0f\uff0c\u540e\u63a5\u5bf9\u8c61\u540d\u5339\u914d\u6a21\u5f0f\u3002\u4f8b\u5982\uff0c\\dt foo*.*bar* \u4f1a\u663e\u793a\u6240\u6709\u6a21\u5f0f\u540d\u4ee5 foo \u5f00\u5934\u3001\u8868\u540d\u5305\u542b bar \u7684\u8868\u3002\u6ca1\u6709\u70b9\u53f7\u65f6\uff0c\u53ea\u5339\u914d\u5f53\u524d\u6a21\u5f0f\u641c\u7d22\u8def\u5f84\u4e2d\u53ef\u89c1\u7684\u5bf9\u8c61\u3002\u540c\u6837\uff0c\u53cc\u5f15\u53f7\u5185\u7684\u70b9\u53f7\u4e0d\u5177\u6709\u7279\u6b8a\u542b\u4e49\uff0c\u6309\u5b57\u9762\u5339\u914d\u3002</p>\n<p lang=\"zh\">\u9ad8\u7ea7\u7528\u6237\u53ef\u4ee5\u4f7f\u7528\u5b57\u7b26\u7c7b\u7b49\u6b63\u5219\u8868\u8fbe\u5f0f\u8bb0\u6cd5\uff0c\u5982<code class=\"literal\">[0-9]</code>\u53ef\u4ee5\u5339\u914d\u4efb\u610f\u6570\u5b57\u3002\u6240\u6709\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u90fd\u6309\u7167<a class=\"xref\" href=\"/docs/11/functions-matching.html#FUNCTIONS-POSIX-REGEXP\" title=\"9.7.3.\u00a0POSIX\u6b63\u5219\u8868\u8fbe\u5f0f\">\u7b2c\u00a09.7.3\u00a0\u8282</a>\u6240\u8bf4\u7684\u5de5\u4f5c\uff0c\u4ee5\u4e0b\u5b57\u7b26\u9664\u5916\uff1a<code class=\"literal\">.</code>\u4f1a\u6309\u7167\u4e0a\u9762\u6240\u8bf4\u7684\u4f5c\u4e3a\u4e00\u79cd\u5206\u9694\u7b26\uff0c<code class=\"literal\">*</code>\u4f1a\u88ab\u7ffb\u8bd1\u6210\u6b63\u5219\u8868\u8fbe\u5f0f\u8bb0\u53f7<code class=\"literal\">.*</code>\uff0c<code class=\"literal\">?</code>\u4f1a\u88ab\u7ffb\u8bd1\u6210<code class=\"literal\">.</code>\uff0c\u800c<code class=\"literal\">$</code>\u5219\u6309\u5b57\u9762\u610f\u601d\u5339\u914d\u3002\u6839\u636e\u9700\u8981\uff0c\u53ef\u4ee5\u7528<code class=\"literal\">?</code>\u6a21\u62df<code class=\"literal\">.</code>\uff0c\u7528<code class=\"literal\">(<em class=\"replaceable\"><code>R</code></em>+|)</code>\u6a21\u62df<code class=\"literal\"><em class=\"replaceable\"><code>R</code></em>*</code>\uff0c\u6216\u7528<code class=\"literal\">(<em class=\"replaceable\"><code>R</code></em>|)</code>\u6a21\u62df<code class=\"literal\"><em class=\"replaceable\"><code>R</code></em>?</code>\u3002<code class=\"literal\">$</code>\u4e0d\u9700\u8981\u4f5c\u4e3a\u4e00\u4e2a\u6b63\u5219\u8868\u8fbe\u5f0f\u5b57\u7b26\uff0c\u56e0\u4e3a\u6a21\u5f0f\u5fc5\u987b\u5339\u914d\u6574\u4e2a\u540d\u79f0\uff0c\u800c\u4e0d\u662f\u50cf\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5e38\u89c4\u7528\u6cd5\u90a3\u6837\u89e3\u91ca\uff08\u6362\u53e5\u8bdd\u8bf4\uff0c<code class=\"literal\">$</code>\u4f1a\u88ab\u81ea\u52a8\u5730\u8ffd\u52a0\u5230\u6a21\u5f0f\u4e0a\uff09\u3002\u5982\u679c\u4e0d\u5e0c\u671b\u8be5\u6a21\u5f0f\u7684\u5339\u914d\u4f4d\u7f6e\u88ab\u56fa\u5b9a\uff0c\u53ef\u4ee5\u5728\u5f00\u5934\u6216\u8005\u7ed3\u5c3e\u5199\u4e0a<code class=\"literal\">*</code>\u3002\u6ce8\u610f\u5728\u53cc\u5f15\u53f7\u5185\uff0c\u6240\u6709\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u4f1a\u5931\u53bb\u5176\u7279\u6b8a\u542b\u4e49\u5e76\u4e14\u6309\u7167\u5176\u5b57\u9762\u610f\u601d\u8fdb\u884c\u5339\u914d\u3002\u8fd8\u6709\uff0c\u5728\u64cd\u4f5c\u7b26\u540d\u79f0\u6a21\u5f0f\u4e2d\uff08\u5373\u4f5c\u4e3a<code class=\"literal\">\\do</code>\u7684\u53c2\u6570\uff09\uff0c\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u4e5f\u6309\u7167\u5b57\u9762\u610f\u601d\u8fdb\u884c\u5339\u914d\u3002</p>\n</div>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.18.8.5\">\n<h3 lang=\"zh\">\u9ad8\u7ea7\u7279\u6027</h3>\n<div class=\"refsect3\" id=\"APP-PSQL-VARIABLES\">\n<h4 lang=\"zh\">\u53d8\u91cf</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u63d0\u4f9b\u4e86\u548c\u666e\u901a Unix \u547d\u4ee4 shell \u76f8\u4f3c\u7684\u53d8\u91cf\u66ff\u6362\u7279\u6027\u3002\u53d8\u91cf\u7b80\u5355\u6765\u8bf4\u5c31\u662f\u4e00\u5bf9\u540d\u79f0/\u503c\uff0c\u5176\u4e2d\u503c\u53ef\u4ee5\u662f\u4efb\u610f\u957f\u5ea6\u7684\u4efb\u610f\u5b57\u7b26\u4e32\u3002\u540d\u79f0\u5fc5\u987b\u7531\u5b57\u6bcd\uff08\u5305\u62ec\u975e\u62c9\u4e01\u5b57\u6bcd\uff09\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u6784\u6210\u3002</p>\n<p lang=\"zh\">\u8981\u8bbe\u7f6e\u4e00\u4e2a\u53d8\u91cf\uff0c\u53ef\u4ee5\u4f7f\u7528<span class=\"application\">psql</span>\u7684\u5143\u547d\u4ee4<code class=\"command\">\\set</code>\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo bar</code></strong>\n</pre>\n<p lang=\"zh\">\u4f1a\u5c06<code class=\"literal\">foo</code>\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">bar</code>\u3002\u8981\u68c0\u7d22\u8be5\u53d8\u91cf\u7684\u5185\u5bb9\uff0c\u53ef\u4ee5\u5728\u540d\u79f0\u524d\u653e\u4e00\u4e2a\u5192\u53f7\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\echo :foo</code></strong>\nbar\n</pre>\n<p lang=\"zh\">\u8fd9\u5728\u5e38\u89c4 SQL \u547d\u4ee4\u548c\u5143\u547d\u4ee4\u4e2d\u5747\u6709\u6548\uff0c\u4e0b\u6587\u7684<a class=\"xref\" href=\"/docs/11/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL \u63d2\u503c\"><acronym class=\"acronym\">SQL</acronym> \u63d2\u503c</a>\u4e2d\u6709\u66f4\u591a\u7ec6\u8282\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u8c03\u7528<code class=\"command\">\\set</code>\u65f6\u6ca1\u6709\u7b2c\u4e8c\u4e2a\u53c2\u6570\uff0c\u8be5\u53d8\u91cf\u4f1a\u88ab\u8bbe\u7f6e\u4e3a\u4e00\u4e2a\u7a7a\u5b57\u7b26\u4e32\u503c\u3002\u8981\u53d6\u6d88\u8bbe\u7f6e\uff08\u5373\u5220\u9664\uff09\u4e00\u4e2a\u53d8\u91cf\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4<code class=\"command\">\\unset</code>\u3002\u8981\u663e\u793a\u6240\u6709\u53d8\u91cf\u7684\u503c\uff0c\u5728\u8c03\u7528<code class=\"command\">\\set</code>\u65f6\u4e0d\u5e26\u4efb\u4f55\u53c2\u6570\u5373\u53ef\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\"><code class=\"command\">\\set</code>\u7684\u53c2\u6570\u670d\u4ece\u4e0e\u5176\u4ed6\u547d\u4ee4\u76f8\u540c\u7684\u66ff\u6362\u89c4\u5219\u3002\u56e0\u6b64\u53ef\u4ee5\u6784\u9020\u6709\u8da3\u7684\u5f15\u7528\uff0c\u4f8b\u5982<code class=\"literal\">\\set :foo 'something'</code>\u4ee5\u53ca\u5206\u522b\u5f97\u5230<span class=\"productname\">Perl</span>\u6216\u8005<span class=\"productname\"><acronym class=\"acronym\">PHP</acronym></span>\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u8f6f\u94fe\u63a5</span>\u201d</span>\u6216\u8005<span class=\"quote\">\u201c<span class=\"quote\">\u53ef\u53d8\u53d8\u91cf</span>\u201d</span>\u3002\u4e0d\u5e78\u7684\u662f\uff08\u6216\u8005\u5e78\u8fd0\u7684\u662f\uff1f\uff09\uff0c\u8fd9\u4e9b\u6784\u9020\u51fa\u6765\u7684\u4e1c\u897f\u5e76\u6ca1\u6709\u4ec0\u4e48\u7528\u5904\u3002\u5728\u53e6\u4e00\u65b9\u9762\uff0c<code class=\"literal\">\\set bar :foo</code>\u662f\u4e00\u79cd\u5f88\u597d\u7684\u62f7\u8d1d\u53d8\u91cf\u7684\u65b9\u6cd5\u3002</p>\n</div>\n<p lang=\"zh\">\u6709\u4e00\u4e9b\u53d8\u91cf\u4f1a\u88ab<span class=\"application\">psql</span>\u7279\u6b8a\u5bf9\u5f85\u3002\u5b83\u4eec\u8868\u793a\u7279\u5b9a\u7684\u9009\u9879\u8bbe\u7f6e\uff0c\u8fd0\u884c\u65f6\u8fd9\u7c7b\u9009\u9879\u8bbe\u7f6e\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539\u8be5\u53d8\u91cf\u7684\u503c\u6765\u6539\u53d8\uff0c\u6216\u8005\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u5b83\u4eec\u8868\u793a<span class=\"application\">psql</span>\u7684\u53ef\u66f4\u6539\u7684\u72b6\u6001\u3002\u6309\u7167\u60ef\u4f8b\uff0c\u6240\u6709\u88ab\u7279\u6b8a\u5bf9\u5f85\u7684\u53d8\u91cf\u7684\u540d\u79f0\u7531\u5168\u90e8\u5927\u5199\u5f62\u5f0f\u7684 ASCII \u5b57\u6bcd\uff08\u8fd8\u6709\u53ef\u80fd\u662f\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\uff09\u7ec4\u6210\u3002\u4e3a\u4e86\u786e\u4fdd\u672a\u6765\u6700\u5927\u7684\u517c\u5bb9\u6027\uff0c\u6700\u597d\u907f\u514d\u628a\u8fd9\u7c7b\u53d8\u91cf\u540d\u7528\u4e8e\u81ea\u5df1\u7684\u76ee\u7684\u3002</p>\n<p lang=\"zh\">\u63a7\u5236<span class=\"application\">psql</span>\u884c\u4e3a\u7684\u53d8\u91cf\u901a\u5e38\u4e0d\u80fd\u88ab\u53d6\u6d88\u8bbe\u7f6e\u6216\u8005\u8bbe\u7f6e\u4e3a\u65e0\u6548\u503c\u3002\u5141\u8bb8<code class=\"literal\">\\unset</code>\u547d\u4ee4\uff0c\u4f46\u5b83\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u5b83\u7684\u9ed8\u8ba4\u503c\u3002\u6ca1\u6709\u7b2c\u4e8c\u53c2\u6570\u7684<code class=\"literal\">\\set</code>\u547d\u4ee4\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\uff08\u5bf9\u4e8e\u63a5\u53d7\u8be5\u503c\u7684\u63a7\u5236\u53d8\u91cf\uff09\uff0c\u5bf9\u4e0d\u63a5\u53d7\u8be5\u503c\u7684\u53d8\u91cf\u5219\u4f1a\u62d2\u7edd\u8fd9\u4e2a\u547d\u4ee4\u3002\u6b64\u5916\uff0c\u63a5\u53d7\u503c<code class=\"literal\">on</code>\u548c<code class=\"literal\">off</code>\u7684\u63a7\u5236\u53d8\u91cf\u4e5f\u80fd\u63a5\u53d7\u5176\u4ed6\u5e38\u89c1\u7684\u5e03\u5c14\u503c\u62fc\u5199\u65b9\u5f0f\uff0c\u4f8b\u5982<code class=\"literal\">true</code>\u548c<code class=\"literal\">false</code>\u3002</p>\n<p lang=\"zh\">\u88ab\u7279\u6b8a\u5bf9\u5f85\u7684\u53d8\u91cf\u662f\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"varname\">AUTOCOMMIT</code> </span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\uff08\u9ed8\u8ba4\uff09\u65f6\uff0c\u6bcf\u4e00\u4e2a SQL \u547d\u4ee4\u5728\u6210\u529f\u5b8c\u6210\u65f6\u4f1a\u88ab\u81ea\u52a8\u63d0\u4ea4\u3002\u5728\u8fd9\u79cd\u6a21\u5f0f\u4e2d\u8981\u63a8\u8fdf\u63d0\u4ea4\uff0c\u5fc5\u987b\u8f93\u5165\u4e00\u4e2a<code class=\"command\">BEGIN</code>\u6216\u8005<code class=\"command\">START TRANSACTION</code> SQL \u547d\u4ee4\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">off</code>\u6216\u8005\u88ab\u53d6\u6d88\u8bbe\u7f6e\u65f6\uff0c\u5728\u663e\u5f0f\u53d1\u51fa<code class=\"command\">COMMIT</code>\u6216\u8005<code class=\"command\">END</code>\u4e4b\u524d\uff0cSQL \u547d\u4ee4\u4e0d\u4f1a\u88ab\u63d0\u4ea4\u3002\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u4f1a\u4e3a\u4f60\u53d1\u51fa\u4e00\u4e2a\u9690\u5f0f\u7684<code class=\"command\">BEGIN</code>\uff0c\u8fd9\u4f1a\u53d1\u751f\u5728\u4efb\u4f55\u4e0d\u5728\u4e00\u4e2a\u4e8b\u52a1\u5757\u4e2d\u4e14\u672c\u8eab\u65e2\u4e0d\u662f<code class=\"command\">BEGIN</code>\u53ca\u5176\u4ed6\u4e8b\u52a1\u63a7\u5236\u547d\u4ee4\u4e14\u4e0d\u662f\u65e0\u6cd5\u5728\u4e8b\u52a1\u5757\u4e2d\u6267\u884c\u7684\u547d\u4ee4\uff08\u4f8b\u5982<code class=\"command\">VACUUM</code>\uff09\u4e4b\u524d\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u4e2d\uff0c\u5fc5\u987b\u901a\u8fc7<code class=\"command\">ABORT</code>\u6216\u8005<code class=\"command\">ROLLBACK</code>\u663e\u5f0f\u5730\u653e\u5f03\u4efb\u4f55\u5931\u8d25\u7684\u4e8b\u52a1\u3002\u8fd8\u8981\u8bb0\u4f4f\uff0c\u5982\u679c\u9000\u51fa\u4f1a\u8bdd\u65f6\u6ca1\u6709\u63d0\u4ea4\uff0c\u5219\u6240\u6709\u7684\u5de5\u4f5c\u90fd\u4f1a\u4e22\u5931\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u81ea\u52a8\u63d0\u4ea4\u6253\u5f00\u6a21\u5f0f\u662f<span class=\"productname\">PostgreSQL</span>\u7684\u4f20\u7edf\u884c\u4e3a\uff0c\u4f46\u662f\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u66f4\u63a5\u8fd1\u4e8e SQL \u7684\u89c4\u8303\u3002\u5982\u679c\u66f4\u559c\u6b22\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\uff0c\u53ef\u4ee5\u5728\u7cfb\u7edf\u7ea7\u7684<code class=\"filename\">psqlrc</code>\u6587\u4ef6\u6216\u8005\u4e2a\u4eba\u7684<code class=\"filename\">~/.psqlrc</code>\u6587\u4ef6\u4e2d\u8bbe\u7f6e\u5b83\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">COMP_KEYWORD_CASE</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u786e\u5b9a\u5728\u8865\u5168\u4e00\u4e2a SQL \u5173\u952e\u8bcd\u65f6\u8981\u4f7f\u7528\u7684\u5927\u5c0f\u5199\u5f62\u5f0f\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">lower</code>\u6216\u8005<code class=\"literal\">upper</code>\uff0c\u8865\u5168\u540e\u7684\u8bcd\u5c06\u5206\u522b\u662f\u5c0f\u5199\u6216\u8005\u5927\u5199\u5f62\u5f0f\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">preserve-lower</code>\u6216\u8005<code class=\"literal\">preserve-upper</code>\uff08\u9ed8\u8ba4\uff09\uff0c\u8865\u5168\u540e\u7684\u8bcd\u5c06\u4f1a\u4fdd\u6301\u8be5\u8bcd\u5df2\u8f93\u5165\u90e8\u5206\u7684\u5927\u5c0f\u5199\u5f62\u5f0f\uff0c\u4f46\u662f\u5982\u679c\u88ab\u8865\u5168\u7684\u8bcd\u8fd8\u6ca1\u6709\u88ab\u8f93\u5165\uff0c\u5219\u5b83\u4f1a\u88ab\u5206\u522b\u8865\u5168\u6210\u5c0f\u5199\u6216\u8005\u5927\u5199\u5f62\u5f0f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">DBNAME</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u5df2\u8fde\u63a5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u662f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ECHO</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">all</code>\uff0c\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u4f1a\u5728\u8bfb\u5165\u65f6\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u8bfb\u53d6\u7684\u884c\uff09\u3002\u8981\u5728\u7a0b\u5e8f\u5f00\u59cb\u65f6\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\uff0c\u53ef\u4ee5\u4f7f\u7528\u5f00\u5173<code class=\"option\">-a</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">queries</code>\uff0c<span class=\"application\">psql</span>\u4f1a\u5728\u53d1\u9001\u6bcf\u4e2a\u67e5\u8be2\u7ed9\u670d\u52a1\u5668\u65f6\u5c06\u5b83\u4eec\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\u3002\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\u7684\u5f00\u5173\u662f<code class=\"option\">-e</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">errors</code>\uff0c\u90a3\u4e48\u53ea\u6709\u5931\u8d25\u7684\u67e5\u8be2\u4f1a\u88ab\u663e\u793a\u5728\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u4e0a\u3002\u8fd9\u79cd\u884c\u4e3a\u7684\u5f00\u5173\u662f<code class=\"option\">-b</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">none</code>\uff08\u9ed8\u8ba4\u503c\uff09\u5219\u4e0d\u4f1a\u663e\u793a\u4efb\u4f55\u67e5\u8be2\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ECHO_HIDDEN</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u4e14\u4e00\u4e2a\u53cd\u659c\u7ebf\u547d\u4ee4\u67e5\u8be2\u6570\u636e\u5e93\u65f6\uff0c\u76f8\u5e94\u7684\u67e5\u8be2\u4f1a\u88ab\u5148\u663e\u793a\u3002\u8fd9\u79cd\u7279\u6027\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u5b66\u4e60<span class=\"productname\">PostgreSQL</span>\u7684\u5185\u90e8\u5e76\u4e14\u5728\u81ea\u5df1\u7684\u7a0b\u5e8f\u4e2d\u63d0\u4f9b\u7c7b\u4f3c\u7684\u529f\u80fd\uff08\u8981\u5728\u7a0b\u5e8f\u5f00\u59cb\u65f6\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\uff0c\u53ef\u4ee5\u4f7f\u7528\u5f00\u5173<code class=\"option\">-E</code>\uff09\u3002\u5982\u679c\u628a\u8fd9\u4e2a\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">noexec</code>\uff0c\u5219\u5bf9\u5e94\u7684\u67e5\u8be2\u53ea\u4f1a\u88ab\u663e\u793a\u800c\u5e76\u4e0d\u771f\u6b63\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u6267\u884c\u3002\u9ed8\u8ba4\u503c\u662f<code class=\"literal\">off</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ENCODING</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u7684\u5ba2\u6237\u7aef\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u6bcf\u4e00\u6b21\u4f60\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\uff09\u65f6\u4ee5\u53ca\u5f53\u4f60\u7528<code class=\"literal\">\\encoding</code>\u66f4\u6539\u7f16\u7801\u65f6\uff0c\u8fd9\u4e2a\u53d8\u91cf\u90fd\u4f1a\u88ab\u8bbe\u7f6e\uff0c\u4f46\u5b83\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ERROR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u4e0a\u4e00\u4e2aSQL\u67e5\u8be2\u5931\u8d25\u5219\u4e3a<code class=\"literal\">true</code>\uff0c\u5982\u679c\u6210\u529f\u5219\u662f<code class=\"literal\">false</code>\u3002\u53e6\u89c1<code class=\"varname\">SQLSTATE</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">FETCH_COUNT</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a\u4e00\u4e2a\u5927\u4e8e\u96f6\u7684\u6574\u6570\u503c\uff0c<code class=\"command\">SELECT</code>\u67e5\u8be2\u7684\u7ed3\u679c\u4f1a\u4ee5\u4e00\u7ec4\u4e00\u7ec4\u7684\u65b9\u5f0f\u53d6\u51fa\u5e76\u4e14\u663e\u793a\uff08\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u7684\u90a3\u6837\u628a\u6574\u4e2a\u7ed3\u679c\u96c6\u62ff\u5230\u4ee5\u540e\u518d\u663e\u793a\uff09\uff0c\u6bcf\u7ec4\u5305\u542b\u7684\u884c\u6570\u7b49\u4e8e\u8be5\u6574\u6570\u503c\u3002\u56e0\u6b64\uff0c\u8fd9\u79cd\u65b9\u5f0f\u53ea\u4f1a\u4f7f\u7528\u6709\u9650\u7684\u5185\u5b58\u91cf\uff0c\u800c\u4e0d\u7ba1\u6574\u4e2a\u7ed3\u679c\u96c6\u7684\u5927\u5c0f\u3002\u5728\u542f\u7528\u8fd9\u4e2a\u7279\u6027\u65f6\uff0c\u901a\u5e38\u4f1a\u4f7f\u7528 100 \u5230 1000 \u7684\u8bbe\u7f6e\u3002\u8bb0\u4f4f\u5728\u4f7f\u7528\u8fd9\u79cd\u7279\u6027\u65f6\uff0c\u4e00\u4e2a\u67e5\u8be2\u53ef\u80fd\u4f1a\u5728\u5df2\u7ecf\u663e\u793a\u4e86\u4e00\u4e9b\u884c\u4e4b\u540e\u5931\u8d25\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5c3d\u7ba1\u53ef\u4ee5\u628a\u8fd9\u79cd\u7279\u6027\u7528\u4e8e\u4efb\u4f55\u7684\u8f93\u51fa\u683c\u5f0f\uff0c\u4f46\u662f\u9ed8\u8ba4\u7684<code class=\"literal\">aligned</code>\u683c\u5f0f\u770b\u8d77\u6765\u4f1a\u6bd4\u8f83\u7cdf\u7cd5\uff0c\u56e0\u4e3a\u6bcf\u4e00\u7ec4\u7684<code class=\"varname\">FETCH_COUNT</code>\u884c\u5c06\u88ab\u5355\u72ec\u683c\u5f0f\u5316\uff0c\u8fd9\u5c31\u4f1a\u5bfc\u81f4\u4e0d\u540c\u7684\u884c\u7ec4\u7684\u5217\u5bbd\u4e0d\u540c\u3002\u5176\u4ed6\u7684\u8f93\u51fa\u683c\u5f0f\u4f1a\u66f4\u597d\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">HISTCONTROL</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">ignorespace</code>\uff0c\u5219\u4ee5\u4e00\u4e2a\u7a7a\u683c\u5f00\u59cb\u7684\u884c\u4e0d\u4f1a\u88ab\u653e\u5165\u5230\u5386\u53f2\u5217\u8868\u4e2d\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">ignoredups</code>\uff0c\u5219\u4e0e\u4e0a\u4e00\u6761\u5386\u53f2\u8bb0\u5f55\u76f8\u540c\u7684\u884c\u4e0d\u4f1a\u88ab\u653e\u5165\u3002\u503c<code class=\"literal\">ignoreboth</code>\u7ec4\u5408\u4e86\u4e0a\u8ff0\u4e24\u79cd\u503c\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">none</code>\uff08\u9ed8\u8ba4\u503c\uff09\uff0c\u6240\u6709\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e2d\u88ab\u8bfb\u5165\u7684\u884c\u90fd\u4f1a\u4fdd\u5b58\u5728\u5386\u53f2\u5217\u8868\u4e2d\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">HISTFILE</code></span></dt>\n<dd>\n<p lang=\"zh\">\u7528\u4e8e\u5b58\u50a8\u5386\u53f2\u8bb0\u5f55\u5217\u8868\u7684\u6587\u4ef6\u540d\u3002\u5982\u679c\u672a\u8bbe\u7f6e\uff0c\u5219\u4ece\u73af\u5883\u53d8\u91cf <code class=\"envar\">PSQL_HISTORY</code> \u4e2d\u83b7\u53d6\u6587\u4ef6\u540d\u3002\u5982\u679c\u8be5\u73af\u5883\u53d8\u91cf\u4e5f\u672a\u8bbe\u7f6e\uff0c\u5219\u9ed8\u8ba4\u4f7f\u7528 <code class=\"filename\">~/.psql_history</code>\uff0c\u5728 Windows \u4e0a\u5219\u4f7f\u7528 <code class=\"filename\">%APPDATA%\\postgresql\\psql_history</code>\u3002\u4f8b\u5982\uff0c\u5c06\u4ee5\u4e0b\u5185\u5bb9\uff1a</p>\n<pre class=\"programlisting\">\\set HISTFILE ~/.psql_history- :DBNAME\n</pre>\n<p lang=\"zh\">\u653e\u5165 <code class=\"filename\">~/.psqlrc</code> \u4f1a\u4f7f <span class=\"application\">psql</span> \u4e3a\u6bcf\u4e2a\u6570\u636e\u5e93\u7ef4\u62a4\u5355\u72ec\u7684\u5386\u53f2\u8bb0\u5f55\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">HISTSIZE</code></span></dt>\n<dd>\n<p lang=\"zh\">\u547d\u4ee4\u5386\u53f2\u4e2d\u6700\u591a\u4fdd\u5b58\u7684\u547d\u4ee4\u6570\uff08\u9ed8\u8ba4 500\uff09\u3002\u8bbe\u4e3a\u8d1f\u503c\u65f6\uff0c\u4e0d\u8bbe\u4e0a\u9650\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">HOST</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e3b\u673a\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u4e5f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">IGNOREEOF</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8bbe\u4e3a 1 \u6216\u66f4\u5c0f\u7684\u503c\uff0c\u5411 psql \u4ea4\u4e92\u4f1a\u8bdd\u53d1\u9001 EOF \u5b57\u7b26\uff08\u901a\u5e38\u4e3a Control + D\uff09\u5c31\u4f1a\u7ec8\u6b62\u5e94\u7528\u3002\u5982\u679c\u8bbe\u4e3a\u66f4\u5927\u7684\u6570\u503c\uff0c\u5219\u5fc5\u987b\u8fde\u7eed\u8f93\u5165\u76f8\u5e94\u6b21\u6570\u7684 EOF \u5b57\u7b26\u624d\u4f1a\u7ec8\u6b62\u4ea4\u4e92\u4f1a\u8bdd\u3002\u5982\u679c\u53d8\u91cf\u8bbe\u4e3a\u975e\u6570\u503c\uff0c\u4f1a\u88ab\u89e3\u91ca\u4e3a 10\u3002\u9ed8\u8ba4\u503c\u4e3a 0\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">LASTOID</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u540e\u88ab\u5f71\u54cd\u7684 OID \u7684\u503c\uff0c\u8fd9\u53ef\u80fd\u4f1a\u7531<code class=\"command\">INSERT</code>\u6216\u8005<code class=\"command\">\\lo_import</code>\u547d\u4ee4\u8fd4\u56de\u3002\u8fd9\u4e2a\u53d8\u91cf\u53ea\u4fdd\u8bc1\u5728\u4e0b\u4e00\u4e2a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u7684\u7ed3\u679c\u88ab\u663e\u793a\u5b8c\u4e4b\u524d\u6709\u6548\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">LAST_ERROR_MESSAGE</code><br/></span><span class=\"term\"><code class=\"varname\">LAST_ERROR_SQLSTATE</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d<span class=\"application\">psql</span>\u4f1a\u8bdd\u4e2d\u6700\u8fd1\u4e00\u4e2a\u5931\u8d25\u67e5\u8be2\u7684\u4e3b\u9519\u8bef\u6d88\u606f\u548c\u76f8\u5173\u7684SQLSTATE\u4ee3\u7801\uff0c\u5982\u679c\u5728\u5f53\u524d\u4f1a\u8bdd\u4e2d\u6ca1\u6709\u53d1\u751f\u9519\u8bef\uff0c\u5219\u662f\u4e00\u4e2a\u7a7a\u5b57\u7b26\u4e32\u548c<code class=\"literal\">00000</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ON_ERROR_ROLLBACK</code> </span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u65f6\uff0c\u5982\u679c\u4e8b\u52a1\u5757\u4e2d\u7684\u4e00\u4e2a\u8bed\u53e5\u4ea7\u751f\u4e00\u4e2a\u9519\u8bef\uff0c\u8be5\u9519\u8bef\u4f1a\u88ab\u5ffd\u7565\u5e76\u4e14\u8be5\u4e8b\u52a1\u4f1a\u7ee7\u7eed\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">interactive</code>\u65f6\uff0c\u53ea\u5728\u4ea4\u4e92\u5f0f\u4f1a\u8bdd\u4e2d\u5ffd\u7565\u8fd9\u7c7b\u9519\u8bef\uff0c\u800c\u8bfb\u53d6\u811a\u672c\u6587\u4ef6\u65f6\u5219\u4e0d\u4f1a\u5ffd\u7565\u9519\u8bef\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">off</code>\uff08\u9ed8\u8ba4\u503c\uff09\u65f6\uff0c\u4e8b\u52a1\u5757\u4e2d\u4ea7\u751f\u9519\u8bef\u7684\u4e00\u4e2a\u8bed\u53e5\u4f1a\u4e2d\u6b62\u6574\u4e2a\u4e8b\u52a1\u3002\u9519\u8bef\u56de\u6eda\u6a21\u5f0f\u7684\u5de5\u4f5c\u539f\u7406\u662f\u5728\u4e8b\u52a1\u5757\u7684\u6bcf\u4e2a\u547d\u4ee4\u4e4b\u524d\u90fd\u4e3a\u4f60\u53d1\u51fa\u4e00\u4e2a\u9690\u5f0f\u7684<code class=\"command\">SAVEPOINT</code>\uff0c\u7136\u540e\u5728\u8be5\u547d\u4ee4\u5931\u8d25\u65f6\u56de\u6eda\u5230\u8be5\u4fdd\u5b58\u70b9\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ON_ERROR_STOP</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u51fa\u9519\u540e\u4ecd\u4f1a\u7ee7\u7eed\u5904\u7406\u547d\u4ee4\u3002\u5c06\u6b64\u53d8\u91cf\u8bbe\u4e3a on \u540e\uff0c\u5904\u7406\u4f1a\u7acb\u5373\u505c\u6b62\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\uff0cpsql \u4f1a\u8fd4\u56de\u547d\u4ee4\u63d0\u793a\u7b26\uff1b\u5426\u5219\uff0cpsql \u4f1a\u9000\u51fa\u5e76\u8fd4\u56de\u9519\u8bef\u7801 3\uff0c\u4ee5\u533a\u522b\u4e8e\u9519\u8bef\u7801 1 \u6240\u8868\u793a\u7684\u81f4\u547d\u9519\u8bef\u3002\u65e0\u8bba\u54ea\u79cd\u60c5\u51b5\uff0c\u5f53\u524d\u6b63\u5728\u8fd0\u884c\u7684\u6240\u6709\u811a\u672c\uff08\u5982\u679c\u5b58\u5728\u9876\u5c42\u811a\u672c\uff0c\u5219\u5305\u62ec\u8be5\u811a\u672c\u53ca\u5176\u8c03\u7528\u7684\u5176\u4ed6\u811a\u672c\uff09\u90fd\u4f1a\u7acb\u5373\u7ec8\u6b62\u3002\u5982\u679c\u9876\u5c42\u547d\u4ee4\u5b57\u7b26\u4e32\u5305\u542b\u591a\u6761 SQL \u547d\u4ee4\uff0c\u5219\u4f1a\u5728\u5f53\u524d\u547d\u4ee4\u5904\u505c\u6b62\u5904\u7406\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">PORT</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u7aef\u53e3\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u4e5f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">PROMPT1</code><br/></span><span class=\"term\"><code class=\"varname\">PROMPT2</code><br/></span><span class=\"term\"><code class=\"varname\">PROMPT3</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e9b\u53d8\u91cf\u6307\u5b9a<span class=\"application\">psql</span>\u53d1\u51fa\u7684\u63d0\u793a\u7b26\u7684\u6a21\u6837\u3002\u89c1\u4e0b\u6587\u7684<a class=\"xref\" href=\"/docs/11/app-psql.html#APP-PSQL-PROMPTING\" title=\"\u63d0\u793a\u7b26\">\u63d0\u793a\u7b26</a>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">QUIET</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u8fd9\u4e2a\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-q</code>\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\u53ef\u80fd\u7528\u5904\u4e0d\u5927\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ROW_COUNT</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6700\u8fd1\u4e00\u6761 SQL \u67e5\u8be2\u8fd4\u56de\u6216\u5f71\u54cd\u7684\u884c\u6570\uff1b\u5982\u679c\u67e5\u8be2\u5931\u8d25\u6216\u6ca1\u6709\u62a5\u544a\u884c\u6570\uff0c\u5219\u4e3a 0\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">SERVER_VERSION_NAME</code><br/></span><span class=\"term\"><code class=\"varname\">SERVER_VERSION_NUM</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b57\u7b26\u4e32\u5f62\u5f0f\u7684\u670d\u52a1\u5668\u7248\u672c\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">9.6.2</code>\u3001<code class=\"literal\">10.1</code>\u6216\u8005<code class=\"literal\">11beta1</code>\uff0c\u4ee5\u53ca\u6570\u5b57\u5f62\u5f0f\u7684\u670d\u52a1\u5668\u7248\u672c\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">90602</code>\u6216\u8005<code class=\"literal\">100001</code>\u3002\u6bcf\u6b21\u4f60\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\uff09\u65f6\uff0c\u8fd9\u4e9b\u90fd\u4f1a\u88ab\u8bbe\u7f6e\uff0c\u4f46\u53ef\u4ee5\u88ab\u6539\u53d8\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">SHOW_CONTEXT</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u53d8\u91cf\u53ef\u4ee5\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">never</code>\u3001<code class=\"literal\">errors</code>\u6216\u8005<code class=\"literal\">always</code>\u6765\u63a7\u5236\u662f\u5426\u5728\u6765\u81ea\u670d\u52a1\u5668\u7684\u6d88\u606f\u4e2d\u663e\u793a<code class=\"literal\">CONTEXT</code>\u5b57\u6bb5\u3002\u9ed8\u8ba4\u662f<code class=\"literal\">errors</code>\uff08\u8868\u793a\u5728\u9519\u8bef\u6d88\u606f\u4e2d\u663e\u793a\u4e0a\u4e0b\u6587\uff0c\u4f46\u5728\u901a\u77e5\u548c\u8b66\u544a\u6d88\u606f\u4e2d\u4e0d\u663e\u793a\uff09\u3002\u5f53<code class=\"varname\">VERBOSITY</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">terse</code>\u65f6\uff0c\u8fd9\u4e2a\u8bbe\u7f6e\u65e0\u6548\uff08\u53e6\u89c1<code class=\"command\">\\errverbose</code>\uff0c\u5b83\u53ef\u4ee5\u7528\u6765\u5f97\u5230\u521a\u9047\u5230\u7684\u9519\u8bef\u7684\u8be6\u7ec6\u4fe1\u606f\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">SINGLELINE</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u8fd9\u4e2a\u53d8\u91cf\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-S</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">SINGLESTEP</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u8fd9\u4e2a\u53d8\u91cf\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-s</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">SQLSTATE</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0e\u4e0a\u4e00\u4e2aSQL\u67e5\u8be2\u7684\u5931\u8d25\u76f8\u5173\u7684\u9519\u8bef\u4ee3\u7801\uff08\u89c1<a class=\"xref\" href=\"/docs/11/errcodes-appendix.html\" title=\"\u9644\u5f55\u00a0A.\u00a0PostgreSQL\u9519\u8bef\u4ee3\u7801\">\u9644\u5f55\u00a0A</a>\uff09\uff0c\u5982\u679c\u4e0a\u4e00\u4e2a\u67e5\u8be2\u6210\u529f\u5219\u4e3a<code class=\"literal\">00000</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">USER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7528\u6237\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u662f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">VERBOSITY</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u53d8\u91cf\u53ef\u4ee5\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">default</code>\u3001<code class=\"literal\">verbose</code>\u6216\u8005<code class=\"literal\">terse</code>\u6765\u63a7\u5236\u9519\u8bef\u62a5\u544a\u7684\u8be6\u7ec6\u7a0b\u5ea6\uff08\u53e6\u89c1<code class=\"command\">\\errverbose</code>\uff0c\u5728\u60f3\u5f97\u5230\u521a\u9047\u5230\u7684\u9519\u8bef\u7684\u8be6\u7ec6\u4fe1\u606f\u65f6\u4f7f\u7528\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">VERSION</code><br/></span><span class=\"term\"><code class=\"varname\">VERSION_NAME</code><br/></span><span class=\"term\"><code class=\"varname\">VERSION_NUM</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e9b\u53d8\u91cf\u5728\u7a0b\u5e8f\u542f\u52a8\u65f6\u88ab\u8bbe\u7f6e\u4ee5\u53cd\u6620<span class=\"application\">psql</span>\u7684\u7248\u672c\uff0c\u5206\u522b\u662f\u4e00\u4e2a\u8be6\u7ec6\u7684\u5b57\u7b26\u4e32\u3001\u4e00\u4e2a\u77ed\u5b57\u7b26\u4e32\uff08\u4f8b\u5982<code class=\"literal\">9.6.2</code>\u3001<code class=\"literal\">10.1</code>\u6216\u8005<code class=\"literal\">11beta1</code>\uff09\u4ee5\u53ca\u4e00\u4e2a\u6570\u5b57\uff08\u4f8b\u5982<code class=\"literal\">90602</code>\u6216\u8005<code class=\"literal\">100001</code>\uff09\u3002\u5b83\u4eec\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-INTERPOLATION\">\n<h4 lang=\"zh\"><acronym class=\"acronym\">SQL</acronym> \u63d2\u503c</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u53d8\u91cf\u7684\u4e00\u4e2a\u5173\u952e\u7279\u6027\u662f\u53ef\u4ee5\u628a\u5b83\u4eec\u66ff\u6362\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u63d2\u503c</span>\u201d</span>\uff09\u5230\u5e38\u89c4<acronym class=\"acronym\">SQL</acronym>\u8bed\u53e5\u4e2d\uff0c\u4e5f\u53ef\u4ee5\u628a\u5b83\u4eec\u66ff\u6362\u5230\u5143\u547d\u4ee4\u7684\u53c2\u6570\u4e2d\u3002\u6b64\u5916\uff0c<span class=\"application\">psql</span>\u8fd8\u63d0\u4f9b\u4e86\u529f\u80fd\u6765\u786e\u4fdd\u88ab\u7528\u4f5c SQL \u5b57\u9762\u91cf\u548c\u6807\u8bc6\u7b26\u7684\u53d8\u91cf\u503c\u4f1a\u88ab\u6b63\u786e\u5730\u52a0\u5f15\u53f7\u3002\u4e0d\u52a0\u5f15\u53f7\u5730\u63d2\u503c\u4e00\u4e2a\u503c\u7684\u8bed\u6cd5\u662f\u5728\u53d8\u91cf\u540d\u524d\u9762\u52a0\u4e0a\u4e00\u4e2a\u5192\u53f7\uff08<code class=\"literal\">:</code>\uff09\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo 'my_table'</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM :foo;</code></strong>\n</pre>\n<p lang=\"zh\">\u5c06\u67e5\u8be2\u8868<code class=\"literal\">my_table</code>\u3002\u6ce8\u610f\u8fd9\u53ef\u80fd\u4f1a\u4e0d\u5b89\u5168\uff1a\u8be5\u53d8\u91cf\u7684\u503c\u4f1a\u88ab\u6309\u5b57\u9762\u62f7\u8d1d\uff0c\u56e0\u6b64\u5b83\u53ef\u80fd\u5305\u542b\u4e0d\u5e73\u8861\u7684\u5f15\u53f7\u751a\u81f3\u53cd\u659c\u7ebf\u547d\u4ee4\u3002\u5fc5\u987b\u786e\u4fdd\u628a\u5b83\u653e\u5728\u90a3\u91cc\u662f\u6709\u610f\u4e49\u7684\u3002</p>\n<p lang=\"zh\">\u5f53\u4e00\u4e2a\u503c\u8981\u7528\u4f5c SQL \u5b57\u9762\u91cf\u6216\u6807\u8bc6\u7b26\u65f6\uff0c\u6700\u5b89\u5168\u7684\u505a\u6cd5\u662f\u4e3a\u5b83\u52a0\u4e0a\u5f15\u53f7\u3002\u8981\u5c06\u53d8\u91cf\u503c\u4f5c\u4e3a SQL \u5b57\u9762\u91cf\u52a0\u5f15\u53f7\uff0c\u5e94\u5199\u4e00\u4e2a\u5192\u53f7\uff0c\u540e\u9762\u8ddf\u7528\u5355\u5f15\u53f7\u62ec\u8d77\u6765\u7684\u53d8\u91cf\u540d\u3002\u8981\u5c06\u53d8\u91cf\u503c\u4f5c\u4e3a SQL \u6807\u8bc6\u7b26\u52a0\u5f15\u53f7\uff0c\u5219\u5728\u5192\u53f7\u540e\u9762\u7528\u53cc\u5f15\u53f7\u62ec\u8d77\u53d8\u91cf\u540d\u3002\u8fd9\u4e9b\u5199\u6cd5\u80fd\u6b63\u786e\u5904\u7406\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165\u7684\u5f15\u53f7\u548c\u5176\u4ed6\u7279\u6b8a\u5b57\u7b26\u3002\u524d\u9762\u7684\u793a\u4f8b\u53ef\u7528\u4ee5\u4e0b\u66f4\u5b89\u5168\u7684\u5199\u6cd5\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo 'my_table'</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM :\"foo\";</code></strong>\n</pre>\n<p lang=\"zh\">\u5728\u52a0\u5f15\u53f7\u7684<acronym class=\"acronym\">SQL</acronym>\u5b57\u9762\u91cf\u548c\u6807\u8bc6\u7b26\u5185\u90e8\uff0c\u4e0d\u4f1a\u6267\u884c\u53d8\u91cf\u63d2\u503c\u3002\u56e0\u6b64\uff0c<code class=\"literal\">':foo'</code>\u8fd9\u6837\u7684\u5199\u6cd5\u4e0d\u80fd\u6839\u636e\u53d8\u91cf\u503c\u751f\u6210\u52a0\u5f15\u53f7\u7684\u5b57\u9762\u91cf\uff08\u5373\u4f7f\u80fd\u591f\u751f\u6548\uff0c\u4e5f\u4e0d\u5b89\u5168\uff0c\u56e0\u4e3a\u5b83\u65e0\u6cd5\u6b63\u786e\u5904\u7406\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165\u7684\u5f15\u53f7\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8fd9\u79cd\u673a\u5236\u7684\u4e00\u4e2a\u793a\u4f8b\u662f\u628a\u4e00\u4e2a\u6587\u4ef6\u7684\u5185\u5bb9\u62f7\u8d1d\u5230\u4e00\u4e2a\u8868\u5217\u4e2d\u3002\u9996\u5148\u628a\u8be5\u6587\u4ef6\u8f7d\u5165\u5230\u4e00\u4e2a\u53d8\u91cf\uff0c\u7136\u540e\u628a\u8be5\u53d8\u91cf\u7684\u503c\u4f5c\u4e3a\u4e00\u4e2a\u52a0\u5f15\u53f7\u7684\u5b57\u7b26\u4e32\u8fdb\u884c\u63d2\u503c\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set content `cat my_file.txt`</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>INSERT INTO my_table VALUES (:'content');</code></strong>\n</pre>\n<p lang=\"zh\">\uff08\u6ce8\u610f\u5982\u679c<code class=\"filename\">my_file.txt</code>\u5305\u542b NUL \u5b57\u8282\uff0c\u8fd9\u6837\u4e5f\u4e0d\u884c\u3002<span class=\"application\">psql</span>\u4e0d\u652f\u6301\u5728\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165 NUL \u5b57\u8282\uff09\u3002</p>\n<p lang=\"zh\">\u56e0\u4e3a\u5192\u53f7\u53ef\u4ee5\u5408\u6cd5\u5730\u51fa\u73b0\u5728 SQL \u547d\u4ee4\u4e2d\uff0c\u4e00\u6b21\u660e\u663e\u7684\u63d2\u503c\u5c1d\u8bd5\uff08\u5373<code class=\"literal\">:name</code>\u3001<code class=\"literal\">:'name'</code>\u6216\u8005<code class=\"literal\">:\"name\"</code>\uff09\u4e0d\u4f1a\u88ab\u66ff\u6362\uff0c\u9664\u975e\u6240\u6307\u7684\u53d8\u91cf\u5f53\u524d\u5df2\u8bbe\u7f6e\u3002\u5728\u4efb\u4f55\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u7528\u4e00\u4e2a\u53cd\u659c\u7ebf\u5bf9\u5192\u53f7\u8fdb\u884c\u8f6c\u4e49\u4ee5\u907f\u514d\u5b83\u88ab\u66ff\u6362\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">:{?<em class=\"replaceable\"><code>name</code></em>}</code>\u7279\u6b8a\u8bed\u6cd5\u4f1a\u6839\u636e\u8be5\u53d8\u91cf\u662f\u5426\u5b58\u5728\u8fd4\u56de TRUE \u6216 FALSE\uff0c\u56e0\u6b64\u603b\u662f\u4f1a\u88ab\u66ff\u6362\uff0c\u9664\u975e\u5192\u53f7\u88ab\u53cd\u659c\u7ebf\u8f6c\u4e49\u3002</p>\n<p lang=\"zh\">\u53d8\u91cf\u7684\u5192\u53f7\u8bed\u6cd5\u5bf9\u5d4c\u5165\u5f0f\u67e5\u8be2\u8bed\u8a00\uff08\u4f8b\u5982<span class=\"application\">ECPG</span>\uff09\u6765\u8bf4\u662f\u6807\u51c6\u7684<acronym class=\"acronym\">SQL</acronym>\u3002\u7528\u4e8e\u6570\u7ec4\u5207\u7247\u548c\u7c7b\u578b\u8f6c\u6362\u7684\u5192\u53f7\u8bed\u6cd5\u662f<span class=\"productname\">PostgreSQL</span>\u6269\u5c55\uff0c\u5b83\u6709\u65f6\u53ef\u80fd\u4f1a\u4e0e\u6807\u51c6\u7528\u6cd5\u51b2\u7a81\u3002\u628a\u4e00\u4e2a\u53d8\u91cf\u503c\u8f6c\u4e49\u6210 SQL \u5b57\u9762\u91cf\u6216\u8005\u6807\u8bc6\u7b26\u7684\u5192\u53f7\u52a0\u5f15\u53f7\u8bed\u6cd5\u662f\u4e00\u79cd<span class=\"application\">psql</span>\u6269\u5c55\u3002</p>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-PROMPTING\">\n<h4 lang=\"zh\">\u63d0\u793a\u7b26</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u53d1\u51fa\u7684\u63d0\u793a\u7b26\u53ef\u4ee5\u6309\u4f60\u7684\u559c\u597d\u8fdb\u884c\u5b9a\u5236\u3002<code class=\"varname\">PROMPT1</code>\u3001<code class=\"varname\">PROMPT2</code> \u548c <code class=\"varname\">PROMPT3</code> \u8fd9\u4e09\u4e2a\u53d8\u91cf\u5305\u542b\u63cf\u8ff0\u63d0\u793a\u7b26\u5916\u89c2\u7684\u5b57\u7b26\u4e32\u548c\u7279\u6b8a\u8f6c\u4e49\u5e8f\u5217\u3002\u63d0\u793a\u7b26 1 \u662f <span class=\"application\">psql</span> \u8bf7\u6c42\u65b0\u547d\u4ee4\u65f6\u53d1\u51fa\u7684\u5e38\u89c4\u63d0\u793a\u7b26\u3002\u63d0\u793a\u7b26 2 \u4f1a\u5728\u5f55\u5165\u547d\u4ee4\u671f\u95f4\u8fd8\u9700\u8981\u66f4\u591a\u8f93\u5165\u65f6\u53d1\u51fa\uff0c\u4f8b\u5982\u547d\u4ee4\u5c1a\u672a\u4ee5\u5206\u53f7\u7ed3\u675f\uff0c\u6216\u8005\u5f15\u53f7\u5c1a\u672a\u95ed\u5408\u65f6\u3002\u5728\u6267\u884c <acronym class=\"acronym\">SQL</acronym> <code class=\"command\">COPY FROM STDIN</code> \u547d\u4ee4\u5e76\u9700\u8981\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4e00\u884c\u503c\u65f6\uff0c\u4f1a\u53d1\u51fa\u63d0\u793a\u7b26 3\u3002</p>\n<p lang=\"zh\">\u6240\u9009\u63d0\u793a\u7b26\u53d8\u91cf\u7684\u503c\u4f1a\u539f\u6837\u6253\u5370\uff0c\u9664\u975e\u9047\u5230\u767e\u5206\u53f7\uff08<code class=\"literal\">%</code>\uff09\u3002\u6b64\u65f6\u4f1a\u6839\u636e\u4e0b\u4e00\u4e2a\u5b57\u7b26\u66ff\u6362\u4e3a\u5176\u4ed6\u6587\u672c\u3002\u5df2\u5b9a\u4e49\u7684\u66ff\u6362\u9879\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">%M</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5b8c\u6574\u4e3b\u673a\u540d\uff08\u542b\u57df\u540d\uff09\uff1b\u5982\u679c\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\uff0c\u5219\u4e3a<code class=\"literal\">[local]</code>\uff1b\u5982\u679c Unix \u57df\u5957\u63a5\u5b57\u4e0d\u5728\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u9ed8\u8ba4\u4f4d\u7f6e\uff0c\u5219\u4e3a<code class=\"literal\">[local:<em class=\"replaceable\"><code>/dir/name</code></em>]</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%m</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\uff0c\u5728\u7b2c\u4e00\u4e2a\u70b9\u53f7\u5904\u622a\u65ad\uff1b\u5982\u679c\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\uff0c\u5219\u4e3a<code class=\"literal\">[local]</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%&gt;</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u76d1\u542c\u7684\u7aef\u53e3\u53f7\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%n</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u4f1a\u8bdd\u7528\u6237\u540d\u3002\uff08\u5728\u6570\u636e\u5e93\u4f1a\u8bdd\u671f\u95f4\uff0c<code class=\"command\">SET SESSION AUTHORIZATION</code>\u547d\u4ee4\u53ef\u80fd\u6539\u53d8\u8be5\u503c\u7684\u6269\u5c55\u7ed3\u679c\u3002\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%/</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%~</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7c7b\u4f3c <code class=\"literal\">%/</code>\uff0c\u4f46\u5982\u679c\u8be5\u6570\u636e\u5e93\u662f\u4f60\u7684\u9ed8\u8ba4\u6570\u636e\u5e93\uff0c\u5219\u8f93\u51fa <code class=\"literal\">~</code>\uff08\u6ce2\u6d6a\u53f7\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%#</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u4f1a\u8bdd\u7528\u6237\u662f\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\uff0c\u5219\u4e3a<code class=\"literal\">#</code>\uff0c\u5426\u5219\u4e3a<code class=\"literal\">&gt;</code>\u3002\uff08\u5728\u6570\u636e\u5e93\u4f1a\u8bdd\u671f\u95f4\uff0c<code class=\"command\">SET SESSION AUTHORIZATION</code>\u547d\u4ee4\u53ef\u80fd\u6539\u53d8\u8be5\u503c\u7684\u6269\u5c55\u7ed3\u679c\u3002\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%p</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u6240\u8fde\u63a5\u540e\u7aef\u7684\u8fdb\u7a0b ID\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%R</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u63d0\u793a\u7b26 1 \u4e2d\uff0c\u901a\u5e38\u663e\u793a =\uff1b\u4f46\u5982\u679c\u4f1a\u8bdd\u5904\u4e8e\u6761\u4ef6\u5757\u4e2d\u672a\u6fc0\u6d3b\u7684\u5206\u652f\uff0c\u5219\u663e\u793a @\uff1b\u5982\u679c\u5904\u4e8e\u5355\u884c\u6a21\u5f0f\uff0c\u5219\u663e\u793a ^\uff1b\u5982\u679c\u4f1a\u8bdd\u5df2\u65ad\u5f00\u6570\u636e\u5e93\u8fde\u63a5\uff08\u4f8b\u5982 \\connect \u5931\u8d25\u65f6\uff09\uff0c\u5219\u663e\u793a !\u3002\u5728\u63d0\u793a\u7b26 2 \u4e2d\uff0c%R \u4f1a\u66ff\u6362\u4e3a\u8868\u793a psql \u7b49\u5f85\u66f4\u591a\u8f93\u5165\u539f\u56e0\u7684\u5b57\u7b26\uff1a\u547d\u4ee4\u5c1a\u672a\u7ed3\u675f\u65f6\u4e3a -\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684 /* ... */ \u6ce8\u91ca\u65f6\u4e3a *\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u5e26\u5f15\u53f7\u5b57\u7b26\u4e32\u65f6\u4e3a\u5355\u5f15\u53f7\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u5e26\u5f15\u53f7\u6807\u8bc6\u7b26\u65f6\u4e3a\u53cc\u5f15\u53f7\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u7f8e\u5143\u5f15\u7528\u5b57\u7b26\u4e32\u65f6\u4e3a\u7f8e\u5143\u7b26\u53f7\uff1b\u5b58\u5728\u672a\u5339\u914d\u7684\u5de6\u62ec\u53f7\u65f6\u4e3a (\u3002\u5728\u63d0\u793a\u7b26 3 \u4e2d\uff0c%R \u4e0d\u4ea7\u751f\u4efb\u4f55\u5185\u5bb9\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%x</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u72b6\u6001\uff1a\u5982\u679c\u5f53\u524d\u4e0d\u5728\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff1b\u5982\u679c\u5904\u4e8e\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a <code class=\"literal\">*</code>\uff1b\u5982\u679c\u5904\u4e8e\u5931\u8d25\u7684\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a <code class=\"literal\">!</code>\uff1b\u5982\u679c\u4e8b\u52a1\u72b6\u6001\u4e0d\u786e\u5b9a\uff08\u4f8b\u5982\u56e0\u4e3a\u5f53\u524d\u6ca1\u6709\u8fde\u63a5\uff09\uff0c\u5219\u4e3a <code class=\"literal\">?</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%l</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8bed\u53e5\u4e2d\u7684\u884c\u53f7\uff0c\u4ece <code class=\"literal\">1</code> \u5f00\u59cb\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%</code><em class=\"replaceable\"><code>digits</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u66ff\u6362\u4e3a\u6307\u5b9a\u516b\u8fdb\u5236\u4ee3\u7801\u5bf9\u5e94\u7684\u5b57\u7b26\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%:</code><em class=\"replaceable\"><code>name</code></em><code class=\"literal\">:</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><span class=\"application\">psql</span> \u53d8\u91cf <em class=\"replaceable\"><code>name</code></em> \u7684\u503c\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/11/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%`</code><em class=\"replaceable\"><code>command</code></em><code class=\"literal\">`</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><em class=\"replaceable\"><code>command</code></em> \u7684\u8f93\u51fa\uff0c\u7c7b\u4f3c\u666e\u901a\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u53cd\u5f15\u53f7</span>\u201d</span>\u66ff\u6362\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%[</code> ... <code class=\"literal\">%]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u63d0\u793a\u7b26\u4e2d\u53ef\u4ee5\u5305\u542b\u7ec8\u7aef\u63a7\u5236\u5b57\u7b26\uff0c\u4f8b\u5982\u6539\u53d8\u63d0\u793a\u6587\u672c\u7684\u989c\u8272\u3001\u80cc\u666f\u6216\u6837\u5f0f\uff0c\u6216\u8005\u6539\u53d8\u7ec8\u7aef\u7a97\u53e3\u6807\u9898\u3002\u4e3a\u4e86\u8ba9 <span class=\"application\">Readline</span> \u7684\u884c\u7f16\u8f91\u529f\u80fd\u6b63\u5e38\u5de5\u4f5c\uff0c\u8fd9\u4e9b\u4e0d\u53ef\u6253\u5370\u7684\u63a7\u5236\u5b57\u7b26\u5fc5\u987b\u7528 <code class=\"literal\">%[</code> \u548c <code class=\"literal\">%]</code> \u5305\u56f4\u8d77\u6765\uff0c\u4ee5\u6807\u8bb0\u4e3a\u4e0d\u53ef\u89c1\u5b57\u7b26\u3002\u63d0\u793a\u7b26\u4e2d\u53ef\u4ee5\u51fa\u73b0\u591a\u7ec4\u8fd9\u6837\u7684\u6807\u8bb0\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; \\set PROMPT1 '%[%033[1;33;40m%]%n@%/%R%[%033[0m%]%# '\n</pre>\n<p lang=\"zh\">\u5176\u6548\u679c\u662f\u5728\u517c\u5bb9 VT100 \u4e14\u652f\u6301\u989c\u8272\u7684\u7ec8\u7aef\u4e0a\uff0c\u751f\u6210\u4e00\u4e2a\u7c97\u4f53\uff08<code class=\"literal\">1;</code>\uff09\u7684\u9ed1\u5e95\u9ec4\u5b57\u63d0\u793a\u7b26\uff08<code class=\"literal\">33;40</code>\uff09\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8981\u5728\u63d0\u793a\u7b26\u4e2d\u63d2\u5165\u767e\u5206\u53f7\uff0c\u8bf7\u5199 %%\u3002\u63d0\u793a\u7b26 1 \u548c 2 \u7684\u9ed8\u8ba4\u503c\u4e3a '%/%R%# '\uff0c\u63d0\u793a\u7b26 3 \u7684\u9ed8\u8ba4\u503c\u4e3a '&gt;&gt; '\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">tcsh</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</div>\n<div class=\"refsect3\" id=\"id-1.9.4.18.8.5.5\">\n<h4 lang=\"zh\">\u547d\u4ee4\u884c\u7f16\u8f91</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u652f\u6301 <span class=\"application\">Readline</span> \u5e93\uff0c\u4fbf\u4e8e\u7f16\u8f91\u548c\u68c0\u7d22\u8f93\u5165\u884c\u3002\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\u4f1a\u5728 <span class=\"application\">psql</span> \u9000\u51fa\u65f6\u81ea\u52a8\u4fdd\u5b58\uff0c\u5e76\u5728 <span class=\"application\">psql</span> \u542f\u52a8\u65f6\u91cd\u65b0\u8f7d\u5165\u3002\u4e5f\u652f\u6301 Tab \u8865\u5168\uff0c\u4e0d\u8fc7\u5176\u8865\u5168\u903b\u8f91\u5e76\u4e0d\u58f0\u79f0\u81ea\u5df1\u662f <acronym class=\"acronym\">SQL</acronym> \u89e3\u6790\u5668\u3002Tab \u8865\u5168\u751f\u6210\u7684\u67e5\u8be2\u8fd8\u53ef\u80fd\u5e72\u6270\u5176\u4ed6 SQL \u547d\u4ee4\uff0c\u4f8b\u5982 <code class=\"literal\">SET TRANSACTION ISOLATION LEVEL</code>\u3002\u5982\u679c\u51fa\u4e8e\u67d0\u79cd\u539f\u56e0\u4f60\u4e0d\u559c\u6b22 Tab \u8865\u5168\uff0c\u53ef\u4ee5\u5c06\u4ee5\u4e0b\u5185\u5bb9\u653e\u5165\u4e3b\u76ee\u5f55\u4e0b\u540d\u4e3a <code class=\"filename\">.inputrc</code> \u7684\u6587\u4ef6\u4e2d\uff0c\u5c06\u5176\u5173\u95ed\uff1a</p>\n<pre class=\"programlisting\">$if psql\nset disable-completion on\n$endif\n</pre>\n<p lang=\"zh\">\uff08\u8fd9\u4e0d\u662f <span class=\"application\">psql</span> \u7684\u529f\u80fd\uff0c\u800c\u662f <span class=\"application\">Readline</span> \u7684\u529f\u80fd\u3002\u66f4\u591a\u7ec6\u8282\u8bf7\u9605\u8bfb\u5176\u6587\u6863\u3002\uff09</p>\n</div>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PSQL-ENVIRONMENT\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">COLUMNS</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c<code class=\"literal\">\\pset columns</code>\u4e3a\u96f6\uff0c\u8fd9\u4e2a\u73af\u5883\u53d8\u91cf\u63a7\u5236\u7528\u4e8e<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u5bbd\u5ea6\u4ee5\u53ca\u7528\u6765\u786e\u5b9a\u662f\u5426\u8f93\u51fa\u9700\u8981\u7528\u5230\u5206\u9875\u5668\u6216\u8005\u5207\u6362\u5230\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e2d\u7684\u5782\u76f4\u683c\u5f0f\u7684\u5bbd\u5ea6\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PGDATABASE</code><br/></span><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\uff08\u89c1<a class=\"xref\" href=\"/docs/11/libpq-envars.html\" title=\"34.14.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a034.14\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PSQL_EDITOR</code><br/></span><span class=\"term\"><code class=\"envar\">EDITOR</code><br/></span><span class=\"term\"><code class=\"envar\">VISUAL</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"command\">\\e</code>\u3001<code class=\"command\">\\ef</code>\u4ee5\u53ca<code class=\"command\">\\ev</code>\u547d\u4ee4\u6240\u4f7f\u7528\u7684\u7f16\u8f91\u5668\u3002\u4f1a\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u68c0\u67e5\u8fd9\u4e9b\u53d8\u91cf\uff0c\u7b2c\u4e00\u4e2a\u88ab\u8bbe\u7f6e\u7684\u5c06\u88ab\u4f7f\u7528\u3002\u5982\u679c\u90fd\u6ca1\u6709\u88ab\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u662f\u4f7f\u7528Unix\u7cfb\u7edf\u4e0a\u7684<code class=\"filename\">vi</code>\u6216\u8005Windows\u7cfb\u7edf\u4e0a\u7684<code class=\"filename\">notepad.exe</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PSQL_EDITOR_LINENUMBER_ARG</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f53 <code class=\"command\">\\e</code>\u3001<code class=\"command\">\\ef</code> \u6216 <code class=\"command\">\\ev</code> \u5e26\u6709\u884c\u53f7\u53c2\u6570\u4f7f\u7528\u65f6\uff0c\u6b64\u53d8\u91cf\u6307\u5b9a\u5c06\u8d77\u59cb\u884c\u53f7\u4f20\u7ed9\u7528\u6237\u7f16\u8f91\u5668\u65f6\u6240\u7528\u7684\u547d\u4ee4\u884c\u53c2\u6570\u3002\u5bf9\u4e8e <span class=\"productname\">Emacs</span> \u6216 <span class=\"productname\">vi</span> \u4e4b\u7c7b\u7684\u7f16\u8f91\u5668\uff0c\u8fd9\u4e2a\u53c2\u6570\u662f\u4e00\u4e2a\u52a0\u53f7\u3002\u5982\u679c\u9009\u9879\u540d\u548c\u884c\u53f7\u4e4b\u95f4\u9700\u8981\u7a7a\u683c\uff0c\u8bf7\u5728\u53d8\u91cf\u503c\u4e2d\u5305\u542b\u672b\u5c3e\u7a7a\u683c\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">PSQL_EDITOR_LINENUMBER_ARG='+'\nPSQL_EDITOR_LINENUMBER_ARG='--line '\n</pre>\n<p lang=\"zh\">\u5728 Unix \u7cfb\u7edf\u4e0a\u9ed8\u8ba4\u662f<code class=\"literal\">+</code>\uff08\u5bf9\u5e94\u4e8e\u9ed8\u8ba4\u7f16\u8f91\u5668<code class=\"filename\">vi</code>\uff0c\u4e14\u5bf9\u5f88\u591a\u5176\u4ed6\u5e38\u89c1\u7f16\u8f91\u5668\u53ef\u7528\uff09\u3002\u5728 Windows \u7cfb\u7edf\u4e0a\u6ca1\u6709\u9ed8\u8ba4\u503c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PSQL_HISTORY</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u547d\u4ee4\u5386\u53f2\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08<code class=\"literal\">~</code>\uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PSQL_PAGER</code><br/></span><span class=\"term\"><code class=\"envar\">PAGER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u67e5\u8be2\u7ed3\u679c\u65e0\u6cd5\u5728\u5c4f\u5e55\u4e0a\u663e\u793a\u5b8c\u6574\uff0c\u5b83\u4eec\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6b64\u547d\u4ee4\u3002\u5178\u578b\u7684\u503c\u662f<code class=\"literal\">more</code>\u6216<code class=\"literal\">less</code>\u3002\u53ef\u4ee5\u901a\u8fc7\u5c06<code class=\"envar\">PSQL_PAGER</code>\u6216<code class=\"envar\">PAGER</code>\u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u6216\u901a\u8fc7\u8c03\u6574<code class=\"command\">\\pset</code>\u547d\u4ee4\u7684\u4e0e\u5206\u9875\u76f8\u5173\u7684\u9009\u9879\u6765\u7981\u7528\u5206\u9875\u5668\u3002\u8fd9\u4e9b\u53d8\u91cf\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u8fdb\u884c\u68c0\u67e5\uff1b\u4f7f\u7528\u6309\u8be5\u987a\u5e8f\u627e\u5230\u7684\u7b2c\u4e00\u4e2a\u5df2\u8bbe\u7f6e\u7684\u53d8\u91cf\u3002\u5982\u679c\u5b83\u4eec\u90fd\u6ca1\u6709\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5728\u5927\u591a\u6570\u5e73\u53f0\u4e0a\u4f7f\u7528<code class=\"literal\">more</code>\uff0c\u4f46\u5728Cygwin\u4e0a\u4f7f\u7528<code class=\"literal\">less</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PSQLRC</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7528\u6237\u7684<code class=\"filename\">.psqlrc</code>\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08<code class=\"literal\">~</code>\uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">SHELL</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u88ab<code class=\"command\">\\!</code>\u547d\u4ee4\u6267\u884c\u7684\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">TMPDIR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b58\u50a8\u4e34\u65f6\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u662f<code class=\"filename\">/tmp</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6 <span class=\"productname\">PostgreSQL</span> \u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528 <span class=\"application\">libpq</span> \u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/11/libpq-envars.html\" title=\"34.14.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a034.14\u00a0\u8282</a>\uff09\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.18.10\">\n<h2 lang=\"zh\">\u6587\u4ef6</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt lang=\"zh\"><span class=\"term\"><code class=\"filename\">psqlrc</code> \u548c <code class=\"filename\">~/.psqlrc</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u6ca1\u6709<code class=\"option\">-X</code>\u9009\u9879\uff0c\u5728\u8fde\u63a5\u5230\u6570\u636e\u5e93\u540e\u4f46\u5728\u63a5\u6536\u6b63\u5e38\u7684\u547d\u4ee4\u4e4b\u524d\uff0c<span class=\"application\">psql</span>\u4f1a\u5c1d\u8bd5\u4f9d\u6b21\u4ece\u7cfb\u7edf\u7ea7\u7684\u542f\u52a8\u6587\u4ef6\uff08<code class=\"filename\">psqlrc</code>\uff09\u548c\u7528\u6237\u7684\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\uff08<code class=\"filename\">~/.psqlrc</code>\uff09\u4e2d\u8bfb\u53d6\u5e76\u4e14\u6267\u884c\u547d\u4ee4\u3002\u8fd9\u4e9b\u6587\u4ef6\u53ef\u4ee5\u88ab\u7528\u6765\u8bbe\u7f6e\u5ba2\u6237\u7aef\u6216\u8005\u670d\u52a1\u5668\uff0c\u901a\u5e38\u662f\u4e00\u4e9b<code class=\"command\">\\set</code>\u548c<code class=\"command\">SET</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u7cfb\u7edf\u8303\u56f4\u7684\u542f\u52a8\u6587\u4ef6\u540d\u4e3a <code class=\"filename\">psqlrc</code>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4f1a\u5728\u5b89\u88c5\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u7cfb\u7edf\u914d\u7f6e</span>\u201d</span>\u76ee\u5f55\u4e2d\u67e5\u627e\u5b83\uff0c\u6700\u53ef\u9760\u7684\u8bc6\u522b\u65b9\u5f0f\u662f\u8fd0\u884c <code class=\"literal\">pg_config --sysconfdir</code>\u3002\u901a\u5e38\u8fd9\u4e2a\u76ee\u5f55\u662f\u76f8\u5bf9\u4e8e\u5305\u542b <span class=\"productname\">PostgreSQL</span> \u53ef\u6267\u884c\u6587\u4ef6\u7684\u76ee\u5f55\u7684 <code class=\"filename\">../etc/</code>\u3002\u4e5f\u53ef\u4ee5\u901a\u8fc7 <code class=\"envar\">PGSYSCONFDIR</code> \u73af\u5883\u53d8\u91cf\u663e\u5f0f\u6307\u5b9a\u67e5\u627e\u76ee\u5f55\u3002</p>\n<p lang=\"zh\">\u7528\u6237\u7684\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\u540d\u4e3a<code class=\"filename\">.psqlrc</code>\uff0c\u5e76\u4e14\u5728\u8c03\u7528\u7528\u6237\u7684\u4e3b\u76ee\u5f55\u4e2d\u5bfb\u627e\u3002Windows \u6ca1\u6709\u4e3b\u76ee\u5f55\u8fd9\u4e00\u6982\u5ff5\uff0c\u5728 Windows \u4e0a\uff0c\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\u7684\u540d\u79f0\u4e3a<code class=\"filename\">%APPDATA%\\postgresql\\psqlrc.conf</code>\u3002\u5728\u4efb\u4f55\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e<code class=\"envar\">PSQLRC</code>\u73af\u5883\u53d8\u91cf\u6765\u8986\u76d6\u6b64\u9ed8\u8ba4\u6587\u4ef6\u8def\u5f84\u3002</p>\n<p lang=\"zh\">\u7cfb\u7edf\u8303\u56f4\u7684\u542f\u52a8\u6587\u4ef6\u548c\u7528\u6237\u4e2a\u4eba\u7684\u542f\u52a8\u6587\u4ef6\u90fd\u53ef\u4ee5\u901a\u8fc7\u5728\u6587\u4ef6\u540d\u540e\u9644\u52a0\u8fde\u5b57\u7b26\u548c<span class=\"productname\">PostgreSQL</span>\u7684\u5927\u7248\u672c\u6216\u5c0f\u7248\u672c\u53f7\u6765\u4f7f\u5176\u4e0e<span class=\"application\">psql</span>\u7248\u672c\u76f8\u5173\uff0c\u4f8b\u5982<code class=\"filename\">~/.psqlrc-9.2</code>\u6216<code class=\"filename\">~/.psqlrc-9.2.5</code>\u3002\u6700\u5177\u4f53\u7248\u672c\u5339\u914d\u7684\u6587\u4ef6\u5c06\u4f18\u5148\u8bfb\u53d6\uff0c\u800c\u4e0d\u662f\u975e\u7279\u5b9a\u7248\u672c\u7684\u6587\u4ef6\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"filename\">.psql_history</code></span></dt>\n<dd>\n<p lang=\"zh\">\u547d\u4ee4\u884c\u5386\u53f2\u88ab\u5b58\u50a8\u5728\u6587\u4ef6<code class=\"filename\">~/.psql_history</code>\u4e2d\uff0c\u6216\u8005\u662f Windows \u7684\u6587\u4ef6<code class=\"filename\">%APPDATA%\\postgresql\\psql_history</code>\u4e2d\u3002</p>\n<p lang=\"zh\">\u5386\u53f2\u6587\u4ef6\u7684\u4f4d\u7f6e\u53ef\u4ee5\u901a\u8fc7<code class=\"varname\">HISTFILE</code> <span class=\"application\">psql</span>\u53d8\u91cf\u6216\u8005<code class=\"envar\">PSQL_HISTORY</code>\u73af\u5883\u53d8\u91cf\u663e\u5f0f\u8bbe\u7f6e\u3002</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.18.11\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">psql</span>\u6700\u9002\u5408\u4e0e\u76f8\u540c\u6216\u8f83\u65e7\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\u914d\u5408\u4f7f\u7528\u3002\u5982\u679c\u670d\u52a1\u5668\u7684\u7248\u672c\u6bd4<span class=\"application\">psql</span>\u672c\u8eab\u66f4\u65b0\uff0c\u53cd\u659c\u7ebf\u547d\u4ee4\u7279\u522b\u5bb9\u6613\u5931\u8d25\u3002\u7136\u800c\uff0c<code class=\"literal\">\\d</code>\u7cfb\u5217\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u5e94\u8be5\u53ef\u4ee5\u5728\u6700\u4f4e\u81f3 7.4 \u7248\u672c\u7684\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\uff0c\u4f46\u4e0d\u4e00\u5b9a\u9002\u7528\u4e8e\u6bd4<span class=\"application\">psql</span>\u672c\u8eab\u66f4\u65b0\u7684\u670d\u52a1\u5668\u3002\u8fd0\u884cSQL\u547d\u4ee4\u548c\u663e\u793a\u67e5\u8be2\u7ed3\u679c\u7684\u4e00\u822c\u529f\u80fd\u4e5f\u5e94\u8be5\u53ef\u4ee5\u5728\u66f4\u65b0\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\uff0c\u4f46\u4e0d\u80fd\u4fdd\u8bc1\u5728\u6240\u6709\u60c5\u51b5\u4e0b\u90fd\u80fd\u5b9e\u73b0\u3002</p>\n<p>\u5982\u679c\u4f60\u60f3\u7528<span class=\"application\">psql</span>\u8fde\u63a5\u5230\u591a\u4e2a\u5177\u6709\u4e0d\u540c\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\uff0c\u63a8\u8350\u4f7f\u7528\u6700\u65b0\u7248\u672c\u7684<span class=\"application\">psql</span>\u3002\u6216\u8005\uff0c\u4f60\u53ef\u4ee5\u4e3a\u6bcf\u4e00\u4e2a\u5927\u7248\u672c\u4fdd\u7559\u4e00\u4efd<span class=\"application\">psql</span>\u62f7\u8d1d\uff0c\u5e76\u4e14\u9488\u5bf9\u76f8\u5e94\u7684\u670d\u52a1\u5668\u4f7f\u7528\u5339\u914d\u7684\u7248\u672c\u3002\u4f46\u5b9e\u9645\u4e0a\uff0c\u8fd9\u79cd\u989d\u5916\u7684\u9ebb\u70e6\u662f\u4e0d\u5fc5\u8981\u7684\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5728 <span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\uff0c<code class=\"option\">-c</code> \u9009\u9879\u610f\u5473\u7740 <code class=\"option\">-X</code>\uff08<code class=\"option\">--no-psqlrc</code>\uff09\uff1b\u73b0\u5728\u5df2\u7ecf\u4e0d\u662f\u8fd9\u6837\u4e86\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5728<span class=\"productname\">PostgreSQL</span> 8.4 \u4e4b\u524d\uff0c<span class=\"application\">psql</span>\u5141\u8bb8\u4e00\u4e2a\u5355\u5b57\u6bcd\u53cd\u659c\u7ebf\u547d\u4ee4\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u76f4\u63a5\u5199\u5728\u8be5\u547d\u4ee4\u540e\u9762\uff0c\u4e2d\u95f4\u4e0d\u9700\u8981\u7a7a\u767d\u3002\u73b0\u5728\u5219\u8981\u6c42\u7528\u7a7a\u767d\u5206\u9694\u3002</p>\n</li>\n</ul>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.18.12\">\n<h2 lang=\"zh\">\u7ed9 Windows \u7528\u6237\u7684\u6ce8\u89e3</h2>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u662f\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u63a7\u5236\u53f0\u5e94\u7528</span>\u201d</span>\u3002\u7531\u4e8e Windows \u7684\u63a7\u5236\u53f0\u7a97\u53e3\u4f7f\u7528\u7684\u662f\u4e00\u79cd\u548c\u7cfb\u7edf\u4e2d\u5176\u4ed6\u5e94\u7528\u4e0d\u540c\u7684\u7f16\u7801\uff0c\u5728<span class=\"application\">psql</span>\u4e2d\u4f7f\u7528 8 \u4f4d\u5b57\u7b26\u65f6\u8981\u7279\u522b\u6ce8\u610f\u3002\u5982\u679c<span class=\"application\">psql</span>\u68c0\u6d4b\u5230\u4e00\u4e2a\u6709\u95ee\u9898\u7684\u63a7\u5236\u53f0\u4ee3\u7801\u9875\uff0c\u5b83\u5c06\u4f1a\u5728\u542f\u52a8\u65f6\u8b66\u544a\u4f60\u3002\u8981\u66f4\u6539\u63a7\u5236\u53f0\u4ee3\u7801\u9875\uff0c\u6709\u4e24\u4ef6\u4e8b\u662f\u5fc5\u8981\u7684\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u8f93\u5165<strong class=\"userinput\"><code>cmd.exe /c chcp 1252</code></strong>\u53ef\u4ee5\u8bbe\u7f6e\u4ee3\u7801\u9875\uff081252 \u662f\u9002\u7528\u4e8e\u5fb7\u8bed\u7684\u4e00\u4e2a\u4ee3\u7801\u9875\uff0c\u8bf7\u5728\u8fd9\u91cc\u66ff\u6362\u6210\u4f60\u7684\u503c\uff09\u3002\u5982\u679c\u6b63\u5728\u4f7f\u7528 Cygwin\uff0c\u53ef\u4ee5\u628a\u8fd9\u4e2a\u547d\u4ee4\u653e\u5728<code class=\"filename\">/etc/profile</code>\u4e2d\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u628a\u63a7\u5236\u53f0\u5b57\u4f53\u8bbe\u7f6e\u4e3a<code class=\"literal\">Lucida Console</code>\uff0c\u56e0\u4e3a\u6805\u683c\u5b57\u4f53\u65e0\u6cd5\u4e0e ANSI \u4ee3\u7801\u9875\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</li>\n</ul>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PSQL-EXAMPLES\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u7b2c\u4e00\u4e2a\u793a\u4f8b\u5c55\u793a\u4e86\u5982\u4f55\u628a\u4e00\u6761\u547d\u4ee4\u5206\u6563\u5230\u591a\u884c\u8f93\u5165\u4e2d\u3002\u6ce8\u610f\u63d0\u793a\u7b26\u7684\u53d8\u5316\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>CREATE TABLE my_table (</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code> first integer not null default 0,</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code> second text)</code></strong>\ntestdb-&gt; <strong class=\"userinput\"><code>;</code></strong>\nCREATE TABLE\n</pre>\n<p lang=\"zh\">\u73b0\u5728\u518d\u6765\u770b\u4e00\u4e0b\u8fd9\u4e2a\u8868\u7684\u5b9a\u4e49\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\d my_table</code></strong>\n              Table \"public.my_table\"\n Column |  Type   | Collation | Nullable | Default\n--------+---------+-----------+----------+---------\n first  | integer |           | not null | 0\n second | text    |           |          | \n</pre>\n<p lang=\"zh\">\u73b0\u5728\u6211\u4eec\u628a\u63d0\u793a\u7b26\u6539\u6210\u66f4\u6709\u8da3\u7684\u5f62\u5f0f\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set PROMPT1 '%n@%m %~%R%# '</code></strong>\npeter@localhost testdb=&gt;\n</pre>\n<p lang=\"zh\">\u5047\u8bbe\u4f60\u5df2\u7ecf\u5411\u8868\u4e2d\u586b\u5165\u6570\u636e\uff0c\u5e76\u60f3\u770b\u4e00\u770b\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; SELECT * FROM my_table;\n first | second\n-------+--------\n     1 | one\n     2 | two\n     3 | three\n     4 | four\n(4 rows)\n\n</pre>\n<p lang=\"zh\">\u4f60\u53ef\u4ee5\u4f7f\u7528 <code class=\"command\">\\pset</code> \u547d\u4ee4\u4ee5\u4e0d\u540c\u65b9\u5f0f\u663e\u793a\u8868\u683c\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 2</code></strong>\nBorder style is 2.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\n+-------+--------+\n| first | second |\n+-------+--------+\n|     1 | one    |\n|     2 | two    |\n|     3 | three  |\n|     4 | four   |\n+-------+--------+\n(4 rows)\n\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 0</code></strong>\nBorder style is 0.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\nfirst second\n----- ------\n    1 one\n    2 two\n    3 three\n    4 four\n(4 rows)\n\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 1</code></strong>\nBorder style is 1.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset format unaligned</code></strong>\nOutput format is unaligned.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset fieldsep \",\"</code></strong>\nField separator is \",\".\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset tuples_only</code></strong>\nShowing only tuples.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT second, first FROM my_table;</code></strong>\none,1\ntwo,2\nthree,3\nfour,4\n</pre>\n<p lang=\"zh\">\u6216\u8005\u4f7f\u7528\u77ed\u547d\u4ee4\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\a \\t \\x</code></strong>\nOutput format is aligned.\nTuples only is off.\nExpanded display is on.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\n-[ RECORD 1 ]-\nfirst  | 1\nsecond | one\n-[ RECORD 2 ]-\nfirst  | 2\nsecond | two\n-[ RECORD 3 ]-\nfirst  | 3\nsecond | three\n-[ RECORD 4 ]-\nfirst  | 4\nsecond | four\n</pre>\n<p lang=\"zh\">\u5728\u9002\u5408\u7684\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u4f7f\u7528 <code class=\"command\">\\crosstabview</code> \u547d\u4ee4\u5c06\u67e5\u8be2\u7ed3\u679c\u663e\u793a\u4e3a\u4ea4\u53c9\u8868\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>SELECT first, second, first &gt; 2 AS gt2 FROM my_table;</code></strong>\n first | second | gt2 \n-------+--------+-----\n     1 | one    | f\n     2 | two    | f\n     3 | three  | t\n     4 | four   | t\n(4 rows)\n\ntestdb=&gt; <strong class=\"userinput\"><code>\\crosstabview first second</code></strong>\n first | one | two | three | four \n-------+-----+-----+-------+------\n     1 | f   |     |       | \n     2 |     | f   |       | \n     3 |     |     | t     | \n     4 |     |     |       | t\n(4 rows)\n</pre>\n<p lang=\"zh\">\u7b2c\u4e8c\u4e2a\u793a\u4f8b\u5c55\u793a\u4e86\u4e00\u4e2a\u4e58\u6cd5\u8868\uff0c\u5176\u4e2d\u884c\u6309\u6570\u5b57\u5012\u5e8f\u6392\u5217\uff0c\u800c\u5217\u6309\u72ec\u7acb\u7684\u5347\u5e8f\u6570\u5b57\u6392\u5217\u3002</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>SELECT t1.first as \"A\", t2.first+100 AS \"B\", t1.first*(t2.first+100) as \"AxB\",</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code>row_number() over(order by t2.first) AS ord</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code>FROM my_table t1 CROSS JOIN my_table t2 ORDER BY 1 DESC</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code>\\crosstabview \"A\" \"B\" \"AxB\" ord</code></strong>\n A | 101 | 102 | 103 | 104 \n---+-----+-----+-----+-----\n 4 | 404 | 408 | 412 | 416\n 3 | 303 | 306 | 309 | 312\n 2 | 202 | 204 | 206 | 208\n 1 | 101 | 102 | 103 | 104\n(4 rows)\n</pre>\n</div>\n</div></div>", "manual_path": "app-psql.html", "localization": {"status": "complete", "sources": [{"url": "/docs/11/app-psql.html", "method": "same-major semantic node", "sha256": "01339254dd1dc30d095af846d0b6a7c01f96338187a6fbb8cf45290d5941196b", "language": "zh", "matched_nodes": ["#APP-PSQL/div[10]/div[1]/ul[0]/li[0]", "#APP-PSQL/div[10]/div[1]/ul[0]/li[1]", "#APP-PSQL/div[10]/div[1]/ul[0]/li[2]", "#APP-PSQL/div[10]/h2[0]", "#APP-PSQL/div[11]/div[2]/ul[0]/li[0]", "#APP-PSQL/div[11]/div[2]/ul[0]/li[1]", "#APP-PSQL/div[11]/h2[0]", "#APP-PSQL/div[11]/p[1]", "#APP-PSQL/div[12]/p[11]", "#APP-PSQL/div[12]/p[13]", "#APP-PSQL/div[12]/p[15]", "#APP-PSQL/div[12]/p[1]", "#APP-PSQL/div[12]/p[3]", "#APP-PSQL/div[12]/p[5]", "#APP-PSQL/div[12]/p[7]", "#APP-PSQL/div[12]/p[9]", "#APP-PSQL/div[2]/p[1]", "#APP-PSQL/div[3]/h2[0]", "#APP-PSQL/div[4]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[11]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[13]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[15]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[15]/p[2]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[19]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[21]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[23]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[23]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[25]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[27]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[29]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[33]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[35]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[37]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[39]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[3]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[41]/div[1]/h3[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[41]/div[1]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[41]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[45]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[47]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[49]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[51]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[53]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[53]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[55]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[55]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[57]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[59]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[5]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[61]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[63]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[65]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[65]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[67]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[3]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[5]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[6]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[7]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[9]", "#APP-PSQL/div[6]/h2[0]", "#APP-PSQL/div[6]/p[1]", "#APP-PSQL/div[7]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[1]/p[1]", "#APP-PSQL/div[7]/div[1]/p[2]", "#APP-PSQL/div[7]/div[1]/p[5]", "#APP-PSQL/div[7]/div[1]/p[6]", "#APP-PSQL/div[7]/div[1]/p[7]", "#APP-PSQL/div[7]/div[2]/h3[0]", "#APP-PSQL/div[7]/div[2]/p[1]", "#APP-PSQL/div[7]/div[2]/p[3]", "#APP-PSQL/div[7]/div[2]/p[4]", "#APP-PSQL/div[7]/div[2]/p[5]", "#APP-PSQL/div[7]/div[2]/p[6]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[101]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[103]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[103]/p[0]/a[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[103]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[103]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[103]/p[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[105]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[107]/div[2]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[107]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[107]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[109]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[111]/div[2]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[111]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[111]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[113]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[113]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[113]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[113]/p[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[113]/p[6]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[115]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[117]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[119]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]/div[5]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[121]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[121]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[121]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[123]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[125]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[127]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[127]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[127]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[129]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[131]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[3]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[3]/dl[0]/dd[13]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[3]/dl[0]/dd[13]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[3]/dl[0]/dd[13]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[3]/dl[0]/dd[13]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[3]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[3]/dl[0]/dd[15]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[3]/dl[0]/dd[15]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[3]/dl[0]/dd[15]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[3]/dl[0]/dd[15]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[3]/dl[0]/dd[17]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[3]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[3]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[3]/dl[0]/dd[21]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[3]/dl[0]/dd[25]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[3]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[3]/dl[0]/dd[29]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[3]/dl[0]/dd[29]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[3]/dl[0]/dd[31]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[3]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[3]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[3]/dl[0]/dd[37]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[3]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[3]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[3]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[3]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[3]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[3]/dl[0]/dt[28]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[3]/dl[0]/dt[30]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[3]/dl[0]/dt[32]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[3]/dl[0]/dt[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/div[5]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/p[4]/a[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[139]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[141]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[143]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[149]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[149]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[153]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[157]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[159]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[159]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[15]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[15]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[161]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[163]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[165]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[167]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[167]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[169]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[169]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[171]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[173]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[173]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[173]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[173]/p[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[0]/a[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[21]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[23]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[25]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[29]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[29]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[29]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[31]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[33]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[33]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[37]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[41]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[41]/div[1]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[41]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[43]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[45]/div[1]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[45]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[47]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[49]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[51]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[53]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[55]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[57]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[59]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[61]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[63]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[65]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[67]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[67]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[69]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[69]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[71]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[73]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[75]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[77]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[79]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[7]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[7]/div[1]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[7]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[81]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[83]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[83]/div[3]/p[1]/a[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[83]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[83]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[83]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[85]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[85]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[85]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[87]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[87]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[87]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[87]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[89]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[91]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[93]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[93]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[93]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[93]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[95]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[97]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[97]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[97]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[99]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[99]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[106]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[108]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[110]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[114]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[116]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[126]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[128]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[136]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[140]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[160]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[82]", "#APP-PSQL/div[7]/div[3]/div[11]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/p[6]", "#APP-PSQL/div[7]/div[3]/h3[0]", "#APP-PSQL/div[7]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/p[2]", "#APP-PSQL/div[7]/div[3]/p[3]", "#APP-PSQL/div[7]/div[3]/p[4]", "#APP-PSQL/div[7]/div[3]/p[4]/a[2]", "#APP-PSQL/div[7]/div[3]/p[5]", "#APP-PSQL/div[7]/div[3]/p[7]", "#APP-PSQL/div[7]/div[3]/p[8]", "#APP-PSQL/div[7]/div[3]/p[9]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[15]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[17]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[19]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[19]/p[2]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/div[2]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[23]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[29]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[31]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[37]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[37]/p[0]/a[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[43]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[45]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[47]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[49]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[51]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[53]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[55]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[57]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[4]/div[1]/div[8]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/p[10]", "#APP-PSQL/div[7]/div[4]/div[1]/p[11]", "#APP-PSQL/div[7]/div[4]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/p[2]", "#APP-PSQL/div[7]/div[4]/div[1]/p[4]", "#APP-PSQL/div[7]/div[4]/div[1]/p[6]", "#APP-PSQL/div[7]/div[4]/div[1]/p[7]", "#APP-PSQL/div[7]/div[4]/div[1]/p[9]", "#APP-PSQL/div[7]/div[4]/div[2]/p[10]", "#APP-PSQL/div[7]/div[4]/div[2]/p[11]", "#APP-PSQL/div[7]/div[4]/div[2]/p[12]", "#APP-PSQL/div[7]/div[4]/div[2]/p[1]", "#APP-PSQL/div[7]/div[4]/div[2]/p[3]", "#APP-PSQL/div[7]/div[4]/div[2]/p[4]", "#APP-PSQL/div[7]/div[4]/div[2]/p[6]", "#APP-PSQL/div[7]/div[4]/div[2]/p[7]", "#APP-PSQL/div[7]/div[4]/div[2]/p[9]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[15]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[21]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[23]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[25]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[29]/p[0]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[29]/p[2]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[4]/div[3]/div[5]/p[1]", "#APP-PSQL/div[7]/div[4]/div[3]/p[1]", "#APP-PSQL/div[7]/div[4]/div[3]/p[2]", "#APP-PSQL/div[7]/div[4]/div[4]/h4[0]", "#APP-PSQL/div[7]/div[4]/div[4]/p[1]", "#APP-PSQL/div[7]/div[4]/div[4]/p[3]", "#APP-PSQL/div[7]/div[4]/h3[0]", "#APP-PSQL/div[7]/h2[0]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[11]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[13]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[15]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[17]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[1]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[3]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[5]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[7]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[7]/p[0]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[7]/p[2]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]", "#APP-PSQL/div[8]/p[2]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[0]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[1]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[2]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[3]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[3]/p[0]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[3]/p[1]", "#APP-PSQL/div[9]/div[1]/dl[0]/dt[0]", "#APP-PSQL/div[9]/h2[0]"]}, {"url": "/docs/11/indexes-index-only-scans.html", "method": "same-major semantic node", "sha256": "0a406a6e086e54ce46c3b74f89893b67b2dbd5789d94285cd68b4edaff5a1d15", "language": "zh", "matched_nodes": ["#INDEXES-INDEX-ONLY-SCANS/p[24]/span[2]"]}], "language": "zh", "original_text": {"/versions/11/description/0": "psql \u2014 PostgreSQL interactive terminal", "/versions/11/facts/0/label": "Documented executable", "/versions/11/facts/1/label": "Executable version", "/versions/11/facts/2/label": "Reference inventory", "/versions/11/facts/2/value": "Client applications", "/versions/11/facts/3/label": "Option definition groups", "/versions/11/tables/0/title": "Documented options", "/versions/11/tables/1/title": "Environment variables", "/versions/11/related/0/label": "psql meta-commands", "/versions/11/related/1/label": "libpq connection parameters", "/versions/11/tables/0/rows/0/summary": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all .", "/versions/11/tables/0/rows/1/summary": "Switches to unaligned output mode. (The default output mode is otherwise aligned.) This is equivalent to \\pset format unaligned .", "/versions/11/tables/0/rows/2/summary": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors .", "/versions/11/tables/0/rows/3/summary": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence.", "/versions/11/tables/0/rows/4/summary": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "/versions/11/tables/0/rows/5/summary": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries .", "/versions/11/tables/0/rows/6/summary": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on .", "/versions/11/tables/0/rows/7/summary": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i .", "/versions/11/tables/0/rows/8/summary": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f .", "/versions/11/tables/0/rows/9/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket.", "/versions/11/tables/0/columns/0/label": "Option and arguments", "/versions/11/tables/0/columns/1/label": "Description", "/versions/11/tables/0/rows/10/summary": "Turn on HTML tabular output. This is equivalent to \\pset format html or the \\H command.", "/versions/11/tables/0/rows/11/summary": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list .", "/versions/11/tables/0/rows/12/summary": "Write all query output into file filename , in addition to the normal output destination.", "/versions/11/tables/0/rows/13/summary": "Do not use Readline for line editing and do not use the command history. This can be useful to turn off tab expansion when cutting and pasting.", "/versions/11/tables/0/rows/14/summary": "Put all query output into file filename . This is equivalent to the command \\o .", "/versions/11/tables/0/rows/15/summary": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432.", "/versions/11/tables/0/rows/16/summary": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex .", "/versions/11/tables/0/rows/17/summary": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on .", "/versions/11/tables/0/rows/18/summary": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep .", "/versions/11/tables/0/rows/19/summary": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts.", "/versions/11/tables/0/rows/20/summary": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does.", "/versions/11/tables/0/rows/21/summary": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only .", "/versions/11/tables/0/rows/22/summary": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details.", "/versions/11/tables/0/rows/23/summary": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)", "/versions/11/tables/0/rows/24/summary": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later.", "/versions/11/tables/0/rows/25/summary": "Print the psql version and exit.", "/versions/11/tables/0/rows/26/summary": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/11/tables/0/rows/27/summary": "Force psql to prompt for a password before connecting to a database, even if the password will not be used.", "/versions/11/tables/0/rows/28/summary": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded .", "/versions/11/tables/0/rows/29/summary": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file).", "/versions/11/tables/0/rows/30/summary": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero .", "/versions/11/tables/0/rows/31/summary": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero .", "/versions/11/tables/0/rows/32/summary": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. This ensures that either all the commands complete successfully, or no changes are applied.", "/versions/11/tables/0/rows/33/summary": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables.", "/versions/11/tables/1/columns/0/label": "Variable", "/versions/11/tables/1/columns/1/label": "Meaning", "/versions/11/tables/1/rows/0/description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode.", "/versions/11/tables/1/rows/1/description": "Default connection parameters (see Section 34.14 ).", "/versions/11/tables/1/rows/2/description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems.", "/versions/11/tables/1/rows/3/description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems.", "/versions/11/tables/1/rows/4/description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed.", "/versions/11/tables/1/rows/5/description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use more on most platforms, but less on Cygwin.", "/versions/11/tables/1/rows/6/description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed.", "/versions/11/tables/1/rows/7/description": "Command executed by the \\! command.", "/versions/11/tables/1/rows/8/description": "Directory for storing temporary files. The default is /tmp ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "b2e449390ae43456067955e1a3e4fd2c1e07dec87e0cd970e3e7a787352420f6"}, "comparison_data": {"options": [{"names": ["-a", "--echo-all"], "signature": "-a --echo-all", "description": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all ."}, {"names": ["-A", "--no-align"], "signature": "-A --no-align", "description": "Switches to unaligned output mode. (The default output mode is otherwise aligned.) This is equivalent to \\pset format unaligned ."}, {"names": ["-b", "--echo-errors"], "signature": "-b --echo-errors", "description": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors ."}, {"names": ["-c command", "--command= command"], "signature": "-c command --command= command", "description": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. command must be either a command string that is completely parsable by the server (i.e., it contains no psql -specific features), or a single backslash command. Thus you cannot mix SQL and psql meta-commands within a -c option. To achieve that, you could use repeated -c options or pipe the string into psql , for example: psql -c '\\x' -c 'SELECT * FROM foo;' or echo '\\x \\\\ SELECT * FROM foo;' | psql ( \\\\ is the separator meta-command.) Each SQL command string passed to -c is sent to the server as a single request. Because of this, the server executes it as a single transaction even if the string contains multiple SQL commands, unless there are explicit BEGIN / COMMIT commands included in the string to divide it into multiple transactions. (See Section 53.2.2.1 for more details about how the server handles multi-query strings.) Also, psql only prints the result of the last SQL command in the string. This is different from the behavior when the same string is read from a file or fed to psql 's standard input, because then psql sends each SQL command separately. Because of this behavior, putting more than one SQL command in a single -c string often has unexpected results. It's better to use repeated -c commands or feed multiple commands to psql 's standard input, either using echo as illustrated above, or via a shell here-document, for example: psql <<EOF \\x SELECT * FROM foo; EOF"}, {"names": ["-d dbname", "--dbname= dbname"], "signature": "-d dbname --dbname= dbname", "description": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--echo-queries"], "signature": "-e --echo-queries", "description": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries ."}, {"names": ["-E", "--echo-hidden"], "signature": "-E --echo-hidden", "description": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on ."}, {"names": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i . If filename is - (hyphen), then standard input is read until an EOF indication or \\q meta-command. This can be used to intersperse interactive input with input from files. Note however that Readline is not used in this case (much as if -n had been specified). Using this option is subtly different from writing psql < filename . In general, both will do what you expect, but using -f enables some nice features such as error messages with line numbers. There is also a slight chance that using this option will reduce the start-up overhead. On the other hand, the variant using the shell's input redirection is (in theory) guaranteed to yield exactly the same output you would have received had you entered everything by hand."}, {"names": ["-F separator", "--field-separator= separator"], "signature": "-F separator --field-separator= separator", "description": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f ."}, {"names": ["-h hostname", "--host= hostname"], "signature": "-h hostname --host= hostname", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket."}, {"names": ["-H", "--html"], "signature": "-H --html", "description": "Turn on HTML tabular output. This is equivalent to \\pset format html or the \\H command."}, {"names": ["-l", "--list"], "signature": "-l --list", "description": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list . When this option is used, psql will connect to the database postgres , unless a different database is named on the command line (option -d or non-option argument, possibly via a service entry, but not via an environment variable)."}, {"names": ["-L filename", "--log-file= filename"], "signature": "-L filename --log-file= filename", "description": "Write all query output into file filename , in addition to the normal output destination."}, {"names": ["-n", "--no-readline"], "signature": "-n --no-readline", "description": "Do not use Readline for line editing and do not use the command history. This can be useful to turn off tab expansion when cutting and pasting."}, {"names": ["-o filename", "--output= filename"], "signature": "-o filename --output= filename", "description": "Put all query output into file filename . This is equivalent to the command \\o ."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432."}, {"names": ["-P assignment", "--pset= assignment"], "signature": "-P assignment --pset= assignment", "description": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex ."}, {"names": ["-q", "--quiet"], "signature": "-q --quiet", "description": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on ."}, {"names": ["-R separator", "--record-separator= separator"], "signature": "-R separator --record-separator= separator", "description": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep ."}, {"names": ["-s", "--single-step"], "signature": "-s --single-step", "description": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts."}, {"names": ["-S", "--single-line"], "signature": "-S --single-line", "description": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does. Note This mode is provided for those who insist on it, but you are not necessarily encouraged to use it. In particular, if you mix SQL and meta-commands on a line the order of execution might not always be clear to the inexperienced user."}, {"names": ["-t", "--tuples-only"], "signature": "-t --tuples-only", "description": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only ."}, {"names": ["-T table_options", "--table-attr= table_options"], "signature": "-T table_options --table-attr= table_options", "description": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)"}, {"names": ["-v assignment", "--set= assignment", "--variable= assignment"], "signature": "-v assignment --set= assignment --variable= assignment", "description": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the psql version and exit."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Force psql to prompt for a password before connecting to a database, even if the password will not be used. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, psql will prompt for a password in any case. However, psql will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-x", "--expanded"], "signature": "-x --expanded", "description": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded ."}, {"names": ["-X,", "--no-psqlrc"], "signature": "-X, --no-psqlrc", "description": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file)."}, {"names": ["-z", "--field-separator-zero"], "signature": "-z --field-separator-zero", "description": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero ."}, {"names": ["-0", "--record-separator-zero"], "signature": "-0 --record-separator-zero", "description": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero ."}, {"names": ["-1", "--single-transaction"], "signature": "-1 --single-transaction", "description": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. This ensures that either all the commands complete successfully, or no changes are applied. If the commands themselves contain BEGIN , COMMIT , or ROLLBACK , this option will not have the desired effects. Also, if an individual command cannot be executed inside a transaction block, specifying this option will cause the whole transaction to fail."}, {"names": ["-?", "--help[= topic ]"], "signature": "-? --help[= topic ]", "description": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables."}], "synopsis": ["psql [ option ...] [ dbname [ username ]]"], "environment": [{"name": "COLUMNS", "description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode."}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters (see Section 34.14 )."}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems."}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems."}, {"name": "PSQL_HISTORY", "description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed."}, {"name": "PSQL_PAGER PAGER", "description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use more on most platforms, but less on Cygwin."}, {"name": "PSQLRC", "description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed."}, {"name": "SHELL", "description": "Command executed by the \\! command."}, {"name": "TMPDIR", "description": "Directory for storing temporary files. The default is /tmp ."}]}, "comparison_hash": "bd8d2a218c6c76b7a7ee6d0b4d0f64243b2c5aca5359b0953f340089033cf303", "manual_language": "zh"}, "12": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "psql"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "12.22"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "35"}], "tables": [{"key": "options", "rows": [{"summary": "\u5728\u8bfb\u5165\u65f6\u5c06\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u884c\u8bfb\u53d6\uff09\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a all \u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-a --echo-all"}}, {"summary": "\u5207\u6362\u5230\u975e\u5bf9\u9f50\u8f93\u51fa\u6a21\u5f0f\uff08\u9ed8\u8ba4\u8f93\u51fa\u6a21\u5f0f\u662f aligned \uff09\u3002\u8fd9\u7b49\u6548\u4e8e \\pset format unaligned \u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-A --no-align"}}, {"summary": "\u628a\u5931\u8d25\u7684 SQL \u547d\u4ee4\u6253\u5370\u5230\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a errors \u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-b --echo-errors"}}, {"summary": "\u6307\u5b9a psql \u6267\u884c\u4e00\u4e2a\u7ed9\u5b9a\u7684\u547d\u4ee4\u5b57\u7b26\u4e32 command \u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u591a\u6b21\u5e76\u4e14\u4ee5\u4efb\u4f55\u987a\u5e8f\u4e0e -f \u9009\u9879\u7ec4\u5408\u5728\u4e00\u8d77\u3002\u5f53 -c \u6216\u8005 -f \u88ab\u6307\u5b9a\u65f6\uff0c psql \u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709 -c \u548c -f \u9009\u9879\u540e\u7ec8\u6b62\u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-c command --command= command"}}, {"summary": "\u5207\u6362\u5230 CSV \uff08\u9017\u53f7\u5206\u9694\u503c\uff09\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u76f8\u5f53\u4e8e \\pset format csv \u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "--csv"}}, {"summary": "\u6307\u5b9a\u8981\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002\u8fd9\u7b49\u6548\u4e8e\u6307\u5b9a dbname \u4e3a\u547d\u4ee4\u884c\u4e0a\u7684\u7b2c\u4e00\u4e2a\u975e\u9009\u9879\u53c2\u6570\u3002 dbname \u53ef\u4ee5\u662f \u8fde\u63a5\u5b57\u7b26\u4e32 \u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u5c06\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-d dbname --dbname= dbname"}}, {"summary": "\u4e5f\u628a\u53d1\u9001\u5230\u670d\u52a1\u5668\u7684\u6240\u6709 SQL \u547d\u4ee4\u590d\u5236\u5230\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a queries \u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-e --echo-queries"}}, {"summary": "\u56de\u663e \\d \u4ee5\u53ca\u5176\u4ed6\u53cd\u659c\u7ebf\u547d\u4ee4\u751f\u6210\u7684\u5b9e\u9645\u67e5\u8be2\u3002\u53ef\u4ee5\u7528\u5b83\u6765\u5b66\u4e60 psql \u7684\u5185\u90e8\u64cd\u4f5c\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO_HIDDEN \u8bbe\u7f6e\u4e3a on \u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-E --echo-hidden"}}, {"summary": "\u4ece\u6587\u4ef6 filename \u800c\u4e0d\u662f\u6807\u51c6\u8f93\u5165\u4e2d\u8bfb\u53d6\u547d\u4ee4\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u6307\u5b9a\uff0c\u4e5f\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u4e0e -c \u9009\u9879\u7ec4\u5408\u4f7f\u7528\u3002\u5f53\u6307\u5b9a\u4e86 -c \u6216 -f \u65f6\uff0c psql \u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709 -c \u548c -f \u9009\u9879\u540e\u7ec8\u6b62\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u7b49\u4ef7\u4e8e\u5143\u547d\u4ee4 \\i \u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-f filename --file= filename"}}, {"summary": "\u4f7f\u7528 separator \u4f5c\u4e3a\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e \\pset fieldsep \u6216\u8005 \\f \u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-F separator --field-separator= separator"}}, {"summary": "\u6307\u5b9a\u8fd0\u884c\u670d\u52a1\u5668\u7684\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u6240\u5728\u7684\u76ee\u5f55\u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-h hostname --host= hostname"}}, {"summary": "\u5207\u6362\u5230 HTML \u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e \\pset format html \u6216\u8005 \\H \u547d\u4ee4\u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-H --html"}}, {"summary": "\u5217\u51fa\u6240\u6709\u53ef\u7528\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u9000\u51fa\u3002\u5176\u4ed6\u975e\u8fde\u63a5\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002\u8fd9\u4e0e\u5143\u547d\u4ee4 \\list \u7c7b\u4f3c\u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-l --list"}}, {"summary": "\u9664\u4e86\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u5199\u5230\u666e\u901a\u8f93\u51fa\u76ee\u6807\u4e4b\u5916\uff0c\u8fd8\u5199\u5230\u6587\u4ef6 filename \u4e2d\u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-L filename --log-file= filename"}}, {"summary": "\u4e0d\u8981\u4f7f\u7528 Readline \u8fdb\u884c\u884c\u7f16\u8f91\uff0c\u4e5f\u4e0d\u8981\u4f7f\u7528\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\u3002\u8fd9\u6709\u52a9\u4e8e\u5728\u526a\u5207\u548c\u7c98\u8d34\u65f6\u5173\u95edTAB \u8865\u5168\u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-n --no-readline"}}, {"summary": "\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u653e\u5230\u6587\u4ef6 filename \u4e2d\u3002\u8fd9\u7b49\u6548\u4e8e\u547d\u4ee4 \\o \u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-o filename --output= filename"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u7684\u6587\u4ef6\u540d\u540e\u7f00\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u7684\u503c\uff1b\u672a\u8bbe\u7f6e\u65f6\uff0c\u4f7f\u7528\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u7aef\u53e3\uff0c\u901a\u5e38\u4e3a 5432\u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-p port --port= port"}}, {"summary": "\u4ee5 \\pset \u7684\u5f62\u5f0f\u6307\u5b9a\u6253\u5370\u9009\u9879\u3002\u6ce8\u610f\uff0c\u8fd9\u91cc\u4f60\u5fc5\u987b\u7528\u4e00\u4e2a\u7b49\u53f7\u800c\u4e0d\u662f\u7a7a\u683c\u6765\u5206\u9694\u540d\u79f0\u548c\u503c\u3002\u4f8b\u5982\uff0c\u8981\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a LaTeX \uff0c\u5e94\u8be5\u5199\u6210 -P format=latex \u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-P assignment --pset= assignment"}}, {"summary": "\u6307\u5b9a psql \u5e94\u8be5\u5b89\u9759\u5730\u5de5\u4f5c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4f1a\u6253\u5370\u51fa\u6b22\u8fce\u6d88\u606f\u548c\u5404\u79cd\u63d0\u793a\u4fe1\u606f\u3002\u5982\u679c\u4f7f\u7528\u4e86\u8fd9\u4e2a\u9009\u9879\uff0c\u4ee5\u4e0a\u90a3\u4e9b\u5c31\u90fd\u4e0d\u4f1a\u8f93\u51fa\u3002\u5728\u4f7f\u7528 -c \u9009\u9879\u65f6\uff0c\u914d\u5408\u8fd9\u4e2a\u9009\u9879\u5f88\u6709\u7528\u3002\u8fd9\u7b49\u6548\u4e8e\u8bbe\u7f6e\u53d8\u91cf QUIET \u4e3a on \u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-q --quiet"}}, {"summary": "\u628a separator \u7528\u4f5c\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e \\pset recordsep \u547d\u4ee4\u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-R separator --record-separator= separator"}}, {"summary": "\u8fd0\u884c\u5728\u5355\u6b65\u6a21\u5f0f\u4e2d\u3002\u8fd9\u610f\u5473\u7740\u5728\u6bcf\u4e2a\u547d\u4ee4\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u4e4b\u524d\u90fd\u4f1a\u63d0\u793a\u7528\u6237\uff0c\u5e76\u5141\u8bb8\u53d6\u6d88\u6267\u884c\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u8c03\u8bd5\u811a\u672c\u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-s --single-step"}}, {"summary": "\u8fd0\u884c\u5728\u5355\u884c\u6a21\u5f0f\u4e2d\uff0c\u5176\u4e2d\u6362\u884c\u7b26\u4f1a\u7ec8\u6b62\u4e00\u4e2a SQL \u547d\u4ee4\uff0c\u5c31\u50cf\u5206\u53f7\u7684\u4f5c\u7528\u4e00\u6837\u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-S --single-line"}}, {"summary": "\u5173\u95ed\u6253\u5370\u5217\u540d\u548c\u7ed3\u679c\u884c\u8ba1\u6570\u9875\u811a\u7b49\u3002\u8fd9\u7b49\u6548\u4e8e \\t \u6216\u8005 \\pset tuples_only \u547d\u4ee4\u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-t --tuples-only"}}, {"summary": "\u6307\u5b9a\u8981\u653e\u5728 HTML table \u6807\u7b7e\u5185\u7684\u9009\u9879\u3002\u8be6\u89c1 \\pset tableattr \u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-T table_options --table-attr= table_options"}}, {"summary": "\u4f5c\u4e3a\u7528\u6237 username \u800c\u4e0d\u662f\u9ed8\u8ba4\u7528\u6237\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff08\u5f53\u7136\uff0c\u4f60\u5fc5\u987b\u5177\u6709\u8fd9\u6837\u505a\u7684\u6743\u9650\uff09\u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-U username --username= username"}}, {"summary": "\u6267\u884c\u4e00\u6b21\u53d8\u91cf\u8d4b\u503c\uff0c\u548c \\set \u5143\u547d\u4ee4\u76f8\u4f3c\u3002\u6ce8\u610f\u4f60\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u7528\u7b49\u53f7\u5206\u9694\u540d\u5b57\u548c\u503c\uff08\u5982\u679c\u6709\uff09\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u7684\u8bbe\u7f6e\uff0c\u53bb\u6389\u7b49\u53f7\u5c31\u884c\u3002\u8981\u628a\u4e00\u4e2a\u53d8\u91cf\u8bbe\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u4f7f\u7528\u7b49\u53f7\u4f46\u662f\u53bb\u6389\u503c\u3002\u8fd9\u4e9b\u8d4b\u503c\u5728\u547d\u4ee4\u884c\u5904\u7406\u671f\u95f4\u88ab\u5b8c\u6210\uff0c\u56e0\u6b64\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u7684\u53d8\u91cf\u5c06\u5728\u7a0d\u540e\u88ab\u8986\u76d6\u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-v assignment --set= assignment --variable= assignment"}}, {"summary": "\u6253\u5370 psql \u7248\u672c\u5e76\u4e14\u9000\u51fa\u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-V --version"}}, {"summary": "\u6c38\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982 .pgpass \u6587\u4ef6\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u8fd9\u4e2a\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4efb\u52a1\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u65f6\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 psql \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\uff0c\u5373\u4f7f\u8be5\u5bc6\u7801\u5b9e\u9645\u4e0a\u4e0d\u4f1a\u88ab\u4f7f\u7528\u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-W --password"}}, {"summary": "\u6253\u5f00\u6269\u5c55\u8868\u683c\u5f0f\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e \\x \u6216\u8005 \\pset expanded \u547d\u4ee4\u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-x --expanded"}}, {"summary": "\u4e0d\u8bfb\u53d6\u542f\u52a8\u6587\u4ef6\uff08\u65e2\u4e0d\u8bfb\u53d6\u7cfb\u7edf\u8303\u56f4\u7684 psqlrc \u6587\u4ef6\uff0c\u4e5f\u4e0d\u8bfb\u53d6\u7528\u6237\u7684 ~/.psqlrc \u6587\u4ef6\uff09\u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-X --no-psqlrc"}}, {"summary": "\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u8fd9\u7b49\u6548\u4e8e \\pset fieldsep_zero \u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-z --field-separator-zero"}}, {"summary": "\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u4f8b\u5982\uff0c\u8fd9\u6709\u52a9\u4e8e\u4e0e xargs -0 \u914d\u5408\u4f7f\u7528\u3002\u8fd9\u7b49\u6548\u4e8e \\pset recordsep_zero \u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-0 --record-separator-zero"}}, {"summary": "\u8fd9\u4e2a\u9009\u9879\u53ea\u80fd\u4e0e\u4e00\u4e2a\u6216\u591a\u4e2a -c \u548c/\u6216 -f \u9009\u9879\u7ed3\u5408\u4f7f\u7528\u3002\u5b83\u4f1a\u5bfc\u81f4 psql \u5728\u7b2c\u4e00\u4e2a\u8fd9\u6837\u7684\u9009\u9879\u4e4b\u524d\u53d1\u51fa\u4e00\u4e2a BEGIN \u547d\u4ee4\uff0c\u5e76\u5728\u6700\u540e\u4e00\u4e2a\u9009\u9879\u4e4b\u540e\u53d1\u51fa\u4e00\u4e2a COMMIT \u547d\u4ee4\uff0c\u4ece\u800c\u5c06\u6240\u6709\u547d\u4ee4\u5305\u88c5\u6210\u4e00\u4e2a\u5355\u72ec\u7684\u4e8b\u52a1\u3002\u8fd9\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-1 --single-transaction"}}, {"summary": "\u663e\u793a\u6709\u5173 psql \u7684\u5e2e\u52a9\u5e76\u4e14\u9000\u51fa\u3002\u53ef\u9009\u7684 topic \u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a options \uff09\u9009\u62e9\u8981\u89e3\u91ca psql \u7684\u54ea\u4e00\u90e8\u5206\uff1a commands \u63cf\u8ff0 psql \u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b options \u63cf\u8ff0\u53ef\u4ee5\u88ab\u4f20\u9012\u7ed9 psql \u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c variables \u5219\u663e\u793a\u6709\u5173 psql \u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002", "signature": {"url": "/docs/12/app-psql.html", "text": "-? --help[= topic ]"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "COLUMNS", "description": "\u5982\u679c \\pset columns \u4e3a\u96f6\uff0c\u8fd9\u4e2a\u73af\u5883\u53d8\u91cf\u63a7\u5236\u7528\u4e8e wrapped \u683c\u5f0f\u7684\u5bbd\u5ea6\u4ee5\u53ca\u7528\u6765\u786e\u5b9a\u662f\u5426\u8f93\u51fa\u9700\u8981\u7528\u5230\u5206\u9875\u5668\u6216\u8005\u5207\u6362\u5230\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e2d\u7684\u5782\u76f4\u683c\u5f0f\u7684\u5bbd\u5ea6\u3002"}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\uff08\u89c1 \u7b2c 33.14 \u8282 \uff09\u3002"}, {"name": "PG_COLOR", "description": "\u89c4\u5b9a\u5728\u8bca\u65ad\u6d88\u606f\u4e2d\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u80fd\u7684\u503c\u4e3a always \u3001 auto \u3001 never \u3002"}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "\\e \u3001 \\ef \u4ee5\u53ca \\ev \u547d\u4ee4\u6240\u4f7f\u7528\u7684\u7f16\u8f91\u5668\u3002\u4f1a\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u68c0\u67e5\u8fd9\u4e9b\u53d8\u91cf\uff0c\u7b2c\u4e00\u4e2a\u88ab\u8bbe\u7f6e\u7684\u5c06\u88ab\u4f7f\u7528\u3002\u5982\u679c\u90fd\u6ca1\u6709\u88ab\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u662f\u4f7f\u7528Unix\u7cfb\u7edf\u4e0a\u7684 vi \u6216\u8005Windows\u7cfb\u7edf\u4e0a\u7684 notepad.exe \u3002"}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "\u5f53 \\e \u3001 \\ef \u6216 \\ev \u5e26\u6709\u884c\u53f7\u53c2\u6570\u4f7f\u7528\u65f6\uff0c\u6b64\u53d8\u91cf\u6307\u5b9a\u5c06\u8d77\u59cb\u884c\u53f7\u4f20\u7ed9\u7528\u6237\u7f16\u8f91\u5668\u65f6\u6240\u7528\u7684\u547d\u4ee4\u884c\u53c2\u6570\u3002\u5bf9\u4e8e Emacs \u6216 vi \u4e4b\u7c7b\u7684\u7f16\u8f91\u5668\uff0c\u8fd9\u4e2a\u53c2\u6570\u662f\u4e00\u4e2a\u52a0\u53f7\u3002\u5982\u679c\u9009\u9879\u540d\u548c\u884c\u53f7\u4e4b\u95f4\u9700\u8981\u7a7a\u683c\uff0c\u8bf7\u5728\u53d8\u91cf\u503c\u4e2d\u5305\u542b\u672b\u5c3e\u7a7a\u683c\u3002\u4f8b\u5982\uff1a PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' \u5728 Unix \u7cfb\u7edf\u4e0a\u9ed8\u8ba4\u662f + \uff08\u5bf9\u5e94\u4e8e\u9ed8\u8ba4\u7f16\u8f91\u5668 vi \uff0c\u4e14\u5bf9\u5f88\u591a\u5176\u4ed6\u5e38\u89c1\u7f16\u8f91\u5668\u53ef\u7528\uff09\u3002\u5728 Windows \u7cfb\u7edf\u4e0a\u6ca1\u6709\u9ed8\u8ba4\u503c\u3002"}, {"name": "PSQL_HISTORY", "description": "\u547d\u4ee4\u5386\u53f2\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08 ~ \uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002"}, {"name": "PSQL_PAGER PAGER", "description": "\u5982\u679c\u67e5\u8be2\u7ed3\u679c\u65e0\u6cd5\u5728\u5c4f\u5e55\u4e0a\u663e\u793a\u5b8c\u6574\uff0c\u5b83\u4eec\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6b64\u547d\u4ee4\u3002\u5178\u578b\u7684\u503c\u662f more \u6216 less \u3002\u53ef\u4ee5\u901a\u8fc7\u5c06 PSQL_PAGER \u6216 PAGER \u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u6216\u901a\u8fc7\u8c03\u6574 \\pset \u547d\u4ee4\u7684\u4e0e\u5206\u9875\u76f8\u5173\u7684\u9009\u9879\u6765\u7981\u7528\u5206\u9875\u5668\u3002\u8fd9\u4e9b\u53d8\u91cf\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u8fdb\u884c\u68c0\u67e5\uff1b\u4f7f\u7528\u6309\u8be5\u987a\u5e8f\u627e\u5230\u7684\u7b2c\u4e00\u4e2a\u5df2\u8bbe\u7f6e\u7684\u53d8\u91cf\u3002\u5982\u679c\u5b83\u4eec\u90fd\u6ca1\u6709\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5728\u5927\u591a\u6570\u5e73\u53f0\u4e0a\u4f7f\u7528 more \uff0c\u4f46\u5728Cygwin\u4e0a\u4f7f\u7528 less \u3002"}, {"name": "PSQLRC", "description": "\u7528\u6237\u7684 .psqlrc \u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08 ~ \uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002"}, {"name": "SHELL", "description": "\u88ab \\! \u547d\u4ee4\u6267\u884c\u7684\u547d\u4ee4\u3002"}, {"name": "TMPDIR", "description": "\u5b58\u50a8\u4e34\u65f6\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u662f /tmp \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-a", "--echo-all"], "summary": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all .", "signature": "-a --echo-all", "source_url": "/docs/12/app-psql.html", "description": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all ."}, {"names": ["-A", "--no-align"], "summary": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned .", "signature": "-A --no-align", "source_url": "/docs/12/app-psql.html", "description": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned ."}, {"names": ["-b", "--echo-errors"], "summary": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors .", "signature": "-b --echo-errors", "source_url": "/docs/12/app-psql.html", "description": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors ."}, {"names": ["-c command", "--command= command"], "summary": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence.", "signature": "-c command --command= command", "source_url": "/docs/12/app-psql.html", "description": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. command must be either a command string that is completely parsable by the server (i.e., it contains no psql -specific features), or a single backslash command. Thus you cannot mix SQL and psql meta-commands within a -c option. To achieve that, you could use repeated -c options or pipe the string into psql , for example: psql -c '\\x' -c 'SELECT * FROM foo;' or echo '\\x \\\\ SELECT * FROM foo;' | psql ( \\\\ is the separator meta-command.) Each SQL command string passed to -c is sent to the server as a single request. Because of this, the server executes it as a single transaction even if the string contains multiple SQL commands, unless there are explicit BEGIN / COMMIT commands included in the string to divide it into multiple transactions. (See Section 52.2.2.1 for more details about how the server handles multi-query strings.) Also, psql only prints the result of the last SQL command in the string. This is different from the behavior when the same string is read from a file or fed to psql 's standard input, because then psql sends each SQL command separately. Because of this behavior, putting more than one SQL command in a single -c string often has unexpected results. It's better to use repeated -c commands or feed multiple commands to psql 's standard input, either using echo as illustrated above, or via a shell here-document, for example: psql <<EOF \\x SELECT * FROM foo; EOF"}, {"names": ["--csv"], "summary": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv .", "signature": "--csv", "source_url": "/docs/12/app-psql.html", "description": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv ."}, {"names": ["-d dbname", "--dbname= dbname"], "summary": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "signature": "-d dbname --dbname= dbname", "source_url": "/docs/12/app-psql.html", "description": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--echo-queries"], "summary": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries .", "signature": "-e --echo-queries", "source_url": "/docs/12/app-psql.html", "description": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries ."}, {"names": ["-E", "--echo-hidden"], "summary": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on .", "signature": "-E --echo-hidden", "source_url": "/docs/12/app-psql.html", "description": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on ."}, {"names": ["-f filename", "--file= filename"], "summary": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i .", "signature": "-f filename --file= filename", "source_url": "/docs/12/app-psql.html", "description": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i . If filename is - (hyphen), then standard input is read until an EOF indication or \\q meta-command. This can be used to intersperse interactive input with input from files. Note however that Readline is not used in this case (much as if -n had been specified). Using this option is subtly different from writing psql < filename . In general, both will do what you expect, but using -f enables some nice features such as error messages with line numbers. There is also a slight chance that using this option will reduce the start-up overhead. On the other hand, the variant using the shell's input redirection is (in theory) guaranteed to yield exactly the same output you would have received had you entered everything by hand."}, {"names": ["-F separator", "--field-separator= separator"], "summary": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f .", "signature": "-F separator --field-separator= separator", "source_url": "/docs/12/app-psql.html", "description": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f ."}, {"names": ["-h hostname", "--host= hostname"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket.", "signature": "-h hostname --host= hostname", "source_url": "/docs/12/app-psql.html", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket."}, {"names": ["-H", "--html"], "summary": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command.", "signature": "-H --html", "source_url": "/docs/12/app-psql.html", "description": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command."}, {"names": ["-l", "--list"], "summary": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list .", "signature": "-l --list", "source_url": "/docs/12/app-psql.html", "description": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list . When this option is used, psql will connect to the database postgres , unless a different database is named on the command line (option -d or non-option argument, possibly via a service entry, but not via an environment variable)."}, {"names": ["-L filename", "--log-file= filename"], "summary": "Write all query output into file filename , in addition to the normal output destination.", "signature": "-L filename --log-file= filename", "source_url": "/docs/12/app-psql.html", "description": "Write all query output into file filename , in addition to the normal output destination."}, {"names": ["-n", "--no-readline"], "summary": "Do not use Readline for line editing and do not use the command history. This can be useful to turn off tab expansion when cutting and pasting.", "signature": "-n --no-readline", "source_url": "/docs/12/app-psql.html", "description": "Do not use Readline for line editing and do not use the command history. This can be useful to turn off tab expansion when cutting and pasting."}, {"names": ["-o filename", "--output= filename"], "summary": "Put all query output into file filename . This is equivalent to the command \\o .", "signature": "-o filename --output= filename", "source_url": "/docs/12/app-psql.html", "description": "Put all query output into file filename . This is equivalent to the command \\o ."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432.", "signature": "-p port --port= port", "source_url": "/docs/12/app-psql.html", "description": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432."}, {"names": ["-P assignment", "--pset= assignment"], "summary": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex .", "signature": "-P assignment --pset= assignment", "source_url": "/docs/12/app-psql.html", "description": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex ."}, {"names": ["-q", "--quiet"], "summary": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on .", "signature": "-q --quiet", "source_url": "/docs/12/app-psql.html", "description": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on ."}, {"names": ["-R separator", "--record-separator= separator"], "summary": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep .", "signature": "-R separator --record-separator= separator", "source_url": "/docs/12/app-psql.html", "description": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep ."}, {"names": ["-s", "--single-step"], "summary": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts.", "signature": "-s --single-step", "source_url": "/docs/12/app-psql.html", "description": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts."}, {"names": ["-S", "--single-line"], "summary": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does.", "signature": "-S --single-line", "source_url": "/docs/12/app-psql.html", "description": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does. Note This mode is provided for those who insist on it, but you are not necessarily encouraged to use it. In particular, if you mix SQL and meta-commands on a line the order of execution might not always be clear to the inexperienced user."}, {"names": ["-t", "--tuples-only"], "summary": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only .", "signature": "-t --tuples-only", "source_url": "/docs/12/app-psql.html", "description": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only ."}, {"names": ["-T table_options", "--table-attr= table_options"], "summary": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details.", "signature": "-T table_options --table-attr= table_options", "source_url": "/docs/12/app-psql.html", "description": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details."}, {"names": ["-U username", "--username= username"], "summary": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)", "signature": "-U username --username= username", "source_url": "/docs/12/app-psql.html", "description": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)"}, {"names": ["-v assignment", "--set= assignment", "--variable= assignment"], "summary": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later.", "signature": "-v assignment --set= assignment --variable= assignment", "source_url": "/docs/12/app-psql.html", "description": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later."}, {"names": ["-V", "--version"], "summary": "Print the psql version and exit.", "signature": "-V --version", "source_url": "/docs/12/app-psql.html", "description": "Print the psql version and exit."}, {"names": ["-w", "--no-password"], "summary": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/12/app-psql.html", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-W", "--password"], "summary": "Force psql to prompt for a password before connecting to a database, even if the password will not be used.", "signature": "-W --password", "source_url": "/docs/12/app-psql.html", "description": "Force psql to prompt for a password before connecting to a database, even if the password will not be used. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, psql will prompt for a password in any case. However, psql will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-x", "--expanded"], "summary": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded .", "signature": "-x --expanded", "source_url": "/docs/12/app-psql.html", "description": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded ."}, {"names": ["-X", "--no-psqlrc"], "summary": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file).", "signature": "-X --no-psqlrc", "source_url": "/docs/12/app-psql.html", "description": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file)."}, {"names": ["-z", "--field-separator-zero"], "summary": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero .", "signature": "-z --field-separator-zero", "source_url": "/docs/12/app-psql.html", "description": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero ."}, {"names": ["-0", "--record-separator-zero"], "summary": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero .", "signature": "-0 --record-separator-zero", "source_url": "/docs/12/app-psql.html", "description": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero ."}, {"names": ["-1", "--single-transaction"], "summary": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. This ensures that either all the commands complete successfully, or no changes are applied.", "signature": "-1 --single-transaction", "source_url": "/docs/12/app-psql.html", "description": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. This ensures that either all the commands complete successfully, or no changes are applied. If the commands themselves contain BEGIN , COMMIT , or ROLLBACK , this option will not have the desired effects. Also, if an individual command cannot be executed inside a transaction block, specifying this option will cause the whole transaction to fail."}, {"names": ["-?", "--help[= topic ]"], "summary": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables.", "signature": "-? --help[= topic ]", "source_url": "/docs/12/app-psql.html", "description": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables."}], "related": [{"url": "/wiki/psql/?v=12", "label": "psql \u5143\u547d\u4ee4"}, {"url": "/wiki/conn/?v=12", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v12.22/postgresql-12.22.tar.bz2", "label": "12.22", "major": "12", "channel": "historical", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/12/postgresql-12-A4.pdf", "bytes": 13424351, "pages": 2803, "sha256": "7422cf53fd1939e7a3d2925231a88b0330e468afa5393627cac0ff86158a0621", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/12/postgresql-12-US.pdf", "bytes": 13322565, "pages": 2958, "sha256": "51f3b04e72907fc38512685946223452ea65f84419c60c66241dfa3396035e77", "built_at": "2026-09-26"}}, "tree": "12", "index": "index.html", "major": "12", "pages": 1131, "release": "12.22", "source_url": "https://ftp.postgresql.org/pub/source/v12.22/postgresql-12.22.tar.bz2", "svg_assets": 2, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "8df3c0474782589d3c6f374b5133b1bd14d168086edbc13c6e72e67dd4527a3b"}, "revision": "7a827e97cbfacd7febff75f34443e2043e40723de5b6d8c9d81a9430b65a37e4", "evidence_kind": "English manual and source declarations", "source_sha256": "8df3c0474782589d3c6f374b5133b1bd14d168086edbc13c6e72e67dd4527a3b"}, "sources": [{"url": "https://pg.center/docs/12/app-psql.html", "file": "app-psql.html", "label": "12.22 English manual \u00b7 app-psql.html", "anchor": "", "sha256": "a5cec5a456a98610e98d1f1959d96ce57c8413bb392f0f5d6720fc561bb63627", "language": "en", "original_url": "/docs/12/app-psql.html"}, {"url": "https://pg.center/docs/12/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "089624dd131f52eea682b304f87a1acb03392ee7bcf78b000699c9b17c7ca22d", "language": "en", "original_url": "/docs/12/reference-client.html"}], "sections": [], "synopsis": ["psql [ option ...] [ dbname [ username ]]"], "signature": "psql [ option ...] [ dbname [ username ]]", "description": ["psql \u2014 PostgreSQL \u7684\u4ea4\u4e92\u5f0f\u7ec8\u7aef"], "environment": [{"name": "COLUMNS", "description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode."}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters (see Section 33.14 )."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems."}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems."}, {"name": "PSQL_HISTORY", "description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed."}, {"name": "PSQL_PAGER PAGER", "description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use more on most platforms, but less on Cygwin."}, {"name": "PSQLRC", "description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed."}, {"name": "SHELL", "description": "Command executed by the \\! command."}, {"name": "TMPDIR", "description": "Directory for storing temporary files. The default is /tmp ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PSQL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></h2>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u2014 <span class=\"productname\">PostgreSQL</span>\u7684\u4ea4\u4e92\u5f0f\u7ec8\u7aef</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.18.4.1\"><code class=\"command\">psql</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em> [<em class=\"replaceable\"><code>username</code></em>]]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.18.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u662f<span class=\"productname\">PostgreSQL</span>\u7684\u4e00\u4e2a\u57fa\u4e8e\u7ec8\u7aef\u7684\u524d\u7aef\u3002\u5b83\u4f7f\u4f60\u80fd\u591f\u4ea4\u4e92\u5f0f\u5730\u8f93\u5165\u67e5\u8be2\uff0c\u5c06\u5176\u53d1\u9001\u7ed9<span class=\"productname\">PostgreSQL</span>\uff0c\u5e76\u67e5\u770b\u67e5\u8be2\u7ed3\u679c\u3002\u4e5f\u53ef\u4ee5\u4ece\u6587\u4ef6\u6216\u547d\u4ee4\u884c\u53c2\u6570\u63d0\u4f9b\u8f93\u5165\u3002\u6b64\u5916\uff0c<span class=\"application\">psql</span>\u8fd8\u63d0\u4f9b\u4e86\u82e5\u5e72\u5143\u547d\u4ee4\u548c\u591a\u79cd\u7c7b\u4f3c shell \u7684\u7279\u6027\uff0c\u4ee5\u4fbf\u4e8e\u7f16\u5199\u811a\u672c\u548c\u81ea\u52a8\u5316\u6267\u884c\u5404\u79cd\u4efb\u52a1\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-PSQL-3\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-a</code><br/></span><span class=\"term\"><code class=\"option\">--echo-all</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8bfb\u5165\u65f6\u5c06\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u884c\u8bfb\u53d6\uff09\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a <code class=\"literal\">all</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-A</code><br/></span><span class=\"term\"><code class=\"option\">--no-align</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230\u975e\u5bf9\u9f50\u8f93\u51fa\u6a21\u5f0f\uff08\u9ed8\u8ba4\u8f93\u51fa\u6a21\u5f0f\u662f<code class=\"literal\">aligned</code>\uff09\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset format unaligned</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-b</code><br/></span><span class=\"term\"><code class=\"option\">--echo-errors</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u5931\u8d25\u7684 SQL \u547d\u4ee4\u6253\u5370\u5230\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">errors</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>command</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--command=<em class=\"replaceable\"><code>command</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a<span class=\"application\">psql</span>\u6267\u884c\u4e00\u4e2a\u7ed9\u5b9a\u7684\u547d\u4ee4\u5b57\u7b26\u4e32<em class=\"replaceable\"><code>command</code></em>\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u591a\u6b21\u5e76\u4e14\u4ee5\u4efb\u4f55\u987a\u5e8f\u4e0e<code class=\"option\">-f</code>\u9009\u9879\u7ec4\u5408\u5728\u4e00\u8d77\u3002\u5f53<code class=\"option\">-c</code>\u6216\u8005<code class=\"option\">-f</code>\u88ab\u6307\u5b9a\u65f6\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709<code class=\"option\">-c</code>\u548c<code class=\"option\">-f</code>\u9009\u9879\u540e\u7ec8\u6b62\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>command</code></em>\u5fc5\u987b\u662f\u4e00\u4e2a\u670d\u52a1\u5668\u5b8c\u5168\u53ef\u89e3\u6790\u7684\u547d\u4ee4\u5b57\u7b26\u4e32\uff08\u5373\u4e0d\u5305\u542b<span class=\"application\">psql</span>\u4e13\u6709\u7684\u7279\u6027\uff09\u6216\u8005\u5355\u4e2a\u53cd\u659c\u7ebf\u547d\u4ee4\u3002\u56e0\u6b64\u4e0d\u80fd\u5728\u4e00\u4e2a<code class=\"option\">-c</code>\u9009\u9879\u4e2d\u6df7\u5408<acronym class=\"acronym\">SQL</acronym>\u548c<span class=\"application\">psql</span>\u5143\u547d\u4ee4\u3002\u8981\u90a3\u6837\u505a\uff0c\u53ef\u4ee5\u4f7f\u7528\u591a\u4e2a<code class=\"option\">-c</code>\u9009\u9879\u6216\u8005\u628a\u5b57\u7b26\u4e32\u7528\u7ba1\u9053\u8f93\u9001\u5230<span class=\"application\">psql</span>\u4e2d\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">psql -c '\\x' -c 'SELECT * FROM foo;'\n</pre>\n<p lang=\"zh\">\u6216\u8005</p>\n<pre class=\"programlisting\">echo '\\x \\\\ SELECT * FROM foo;' | psql\n</pre>\n<p lang=\"zh\">\uff08<code class=\"literal\">\\\\</code>\u662f\u5206\u9694\u7b26\u5143\u547d\u4ee4\uff09\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u5b57\u7b26\u4e32\u4f20\u9012\u7ed9<code class=\"option\">-c</code>\u90fd\u4f5c\u4e3a\u4e00\u4e2a\u5355\u72ec\u7684\u8bf7\u6c42\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u56e0\u6b64\uff0c\u5373\u4f7f\u5b57\u7b26\u4e32\u5305\u542b\u591a\u4e2a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\uff0c\u670d\u52a1\u5668\u4e5f\u4f1a\u5c06\u5176\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff0c\u9664\u975e\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u663e\u5f0f\u7684<code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code>\u547d\u4ee4\u5c06\u5176\u5206\u6210\u591a\u4e2a\u4e8b\u52a1\u3002\uff08\u6709\u5173\u670d\u52a1\u5668\u5982\u4f55\u5904\u7406\u591a\u67e5\u8be2\u5b57\u7b26\u4e32\u7684\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/12/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT\" title=\"52.2.2.1.\u00a0\u4e00\u4e2a\u7b80\u5355\u67e5\u8be2\u4e2d\u7684\u591a\u6761\u8bed\u53e5\">\u7b2c\u00a052.2.2.1\u00a0\u8282</a>\u3002\uff09\u6b64\u5916\uff0c<span class=\"application\">psql</span>\u53ea\u6253\u5370\u5b57\u7b26\u4e32\u4e2d\u6700\u540e\u4e00\u6761<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u7684\u7ed3\u679c\u3002\u8fd9\u4e0e\u4ece\u6587\u4ef6\u8bfb\u53d6\u540c\u4e00\u5b57\u7b26\u4e32\u6216\u5c06\u5176\u9001\u5165<span class=\"application\">psql</span>\u6807\u51c6\u8f93\u5165\u65f6\u7684\u884c\u4e3a\u4e0d\u540c\uff0c\u56e0\u4e3a\u5728\u8fd9\u4e9b\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">psql</span>\u4f1a\u5206\u522b\u53d1\u9001\u6bcf\u6761<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u7531\u4e8e\u8fd9\u79cd\u884c\u4e3a\uff0c\u5728\u5355\u4e2a <code class=\"option\">-c</code> \u5b57\u7b26\u4e32\u4e2d\u653e\u5165\u591a\u6761 SQL \u547d\u4ee4\u5e38\u5e38\u4f1a\u4ea7\u751f\u610f\u5916\u7ed3\u679c\u3002\u6700\u597d\u91cd\u590d\u4f7f\u7528 <code class=\"option\">-c</code> \u547d\u4ee4\uff0c\u6216\u5c06\u591a\u6761\u547d\u4ee4\u9001\u5165 <span class=\"application\">psql</span> \u7684\u6807\u51c6\u8f93\u5165\uff0c\u53ef\u4ee5\u50cf\u4e0a\u9762\u6240\u793a\u4f7f\u7528 <span class=\"application\">echo</span>\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528 shell \u7684 here-document\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">psql &lt;&lt;EOF\n\\x\nSELECT * FROM foo;\nEOF\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--csv</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230<acronym class=\"acronym\">CSV</acronym>\uff08\u9017\u53f7\u5206\u9694\u503c\uff09\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u76f8\u5f53\u4e8e<code class=\"command\">\\pset format csv</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>dbname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>dbname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002\u8fd9\u7b49\u6548\u4e8e\u6307\u5b9a<em class=\"replaceable\"><code>dbname</code></em>\u4e3a\u547d\u4ee4\u884c\u4e0a\u7684\u7b2c\u4e00\u4e2a\u975e\u9009\u9879\u53c2\u6570\u3002<em class=\"replaceable\"><code>dbname</code></em> \u53ef\u4ee5\u662f<a class=\"link\" href=\"/docs/12/libpq.html#LIBPQ-CONNSTRING\" title=\"33.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u5c06\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-e</code><br/></span><span class=\"term\"><code class=\"option\">--echo-queries</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e5f\u628a\u53d1\u9001\u5230\u670d\u52a1\u5668\u7684\u6240\u6709 SQL \u547d\u4ee4\u590d\u5236\u5230\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">queries</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-E</code><br/></span><span class=\"term\"><code class=\"option\">--echo-hidden</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u56de\u663e<code class=\"command\">\\d</code>\u4ee5\u53ca\u5176\u4ed6\u53cd\u659c\u7ebf\u547d\u4ee4\u751f\u6210\u7684\u5b9e\u9645\u67e5\u8be2\u3002\u53ef\u4ee5\u7528\u5b83\u6765\u5b66\u4e60<span class=\"application\">psql</span>\u7684\u5185\u90e8\u64cd\u4f5c\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO_HIDDEN</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u800c\u4e0d\u662f\u6807\u51c6\u8f93\u5165\u4e2d\u8bfb\u53d6\u547d\u4ee4\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u6307\u5b9a\uff0c\u4e5f\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u4e0e<code class=\"option\">-c</code>\u9009\u9879\u7ec4\u5408\u4f7f\u7528\u3002\u5f53\u6307\u5b9a\u4e86<code class=\"option\">-c</code>\u6216<code class=\"option\">-f</code>\u65f6\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709<code class=\"option\">-c</code>\u548c<code class=\"option\">-f</code>\u9009\u9879\u540e\u7ec8\u6b62\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u7b49\u4ef7\u4e8e\u5143\u547d\u4ee4<code class=\"command\">\\i</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c<em class=\"replaceable\"><code>filename</code></em>\u662f<code class=\"literal\">-</code>\uff08\u8fde\u5b57\u7b26\uff09\uff0c\u5219\u4f1a\u8bfb\u53d6\u6807\u51c6\u8f93\u5165\uff0c\u76f4\u5230\u9047\u5230 <acronym class=\"acronym\">EOF</acronym> \u6307\u793a\u6216<code class=\"command\">\\q</code>\u5143\u547d\u4ee4\u3002\u8fd9\u53ef\u7528\u4e8e\u5c06\u4ea4\u4e92\u5f0f\u8f93\u5165\u4e0e\u6587\u4ef6\u8f93\u5165\u4ea4\u9519\u4f7f\u7528\u3002\u4e0d\u8fc7\u8bf7\u6ce8\u610f\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\u4e0d\u4f1a\u4f7f\u7528 <span class=\"application\">Readline</span>\uff08\u5f88\u50cf\u6307\u5b9a\u4e86<code class=\"option\">-n</code>\u65f6\u7684\u60c5\u51b5\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u4e0e\u5199\u6210<code class=\"literal\">psql &lt; <em class=\"replaceable\"><code>filename</code></em></code>\u6709\u7ec6\u5fae\u5dee\u522b\u3002\u901a\u5e38\u4e24\u79cd\u5f62\u5f0f\u90fd\u4f1a\u5f97\u5230\u4f60\u671f\u671b\u7684\u7ed3\u679c\uff0c\u4f46\u4f7f\u7528<code class=\"literal\">-f</code>\u53ef\u4ee5\u542f\u7528\u4e00\u4e9b\u6709\u7528\u7684\u7279\u6027\uff0c\u4f8b\u5982\u5e26\u884c\u53f7\u7684\u9519\u8bef\u6d88\u606f\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u4e5f\u8fd8\u6709\u4e00\u70b9\u673a\u4f1a\u964d\u4f4e\u542f\u52a8\u5f00\u9500\u3002\u53e6\u4e00\u65b9\u9762\uff0c\u4f7f\u7528 shell \u8f93\u5165\u91cd\u5b9a\u5411\u7684\u5f62\u5f0f\u5728\u7406\u8bba\u4e0a\u80fd\u4fdd\u8bc1\u5f97\u5230\u4e0e\u4f60\u624b\u5de5\u9010\u884c\u8f93\u5165\u65f6\u5b8c\u5168\u76f8\u540c\u7684\u8f93\u51fa\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>separator</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--field-separator=<em class=\"replaceable\"><code>separator</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f7f\u7528<em class=\"replaceable\"><code>separator</code></em>\u4f5c\u4e3a\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset fieldsep</code>\u6216\u8005<code class=\"command\">\\f</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>hostname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>hostname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8fd0\u884c\u670d\u52a1\u5668\u7684\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u6240\u5728\u7684\u76ee\u5f55\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-H</code><br/></span><span class=\"term\"><code class=\"option\">--html</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230<acronym class=\"acronym\">HTML</acronym>\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset format html</code>\u6216\u8005<code class=\"command\">\\H</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--list</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u6240\u6709\u53ef\u7528\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u9000\u51fa\u3002\u5176\u4ed6\u975e\u8fde\u63a5\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002\u8fd9\u4e0e\u5143\u547d\u4ee4<code class=\"command\">\\list</code>\u7c7b\u4f3c\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8be5\u9009\u9879\u65f6\uff0c<span class=\"application\">psql</span>\u5c06\u8fde\u63a5\u5230\u6570\u636e\u5e93<code class=\"literal\">postgres</code>\uff0c\u9664\u975e\u547d\u4ee4\u884c\u4e0a\u6307\u5b9a\u4e86\u5176\u4ed6\u6570\u636e\u5e93\uff08\u901a\u8fc7<code class=\"option\">-d</code>\u9009\u9879\u6216\u975e\u9009\u9879\u53c2\u6570\uff0c\u4e5f\u53ef\u80fd\u901a\u8fc7\u670d\u52a1\u9879\uff0c\u4f46\u4e0d\u80fd\u901a\u8fc7\u73af\u5883\u53d8\u91cf\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--log-file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9664\u4e86\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u5199\u5230\u666e\u901a\u8f93\u51fa\u76ee\u6807\u4e4b\u5916\uff0c\u8fd8\u5199\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-readline</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8981\u4f7f\u7528<span class=\"application\">Readline</span>\u8fdb\u884c\u884c\u7f16\u8f91\uff0c\u4e5f\u4e0d\u8981\u4f7f\u7528\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\u3002\u8fd9\u6709\u52a9\u4e8e\u5728\u526a\u5207\u548c\u7c98\u8d34\u65f6\u5173\u95edTAB \u8865\u5168\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-o <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--output=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u653e\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u3002\u8fd9\u7b49\u6548\u4e8e\u547d\u4ee4<code class=\"command\">\\o</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u7684\u6587\u4ef6\u540d\u540e\u7f00\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u7684\u503c\uff1b\u672a\u8bbe\u7f6e\u65f6\uff0c\u4f7f\u7528\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u7aef\u53e3\uff0c\u901a\u5e38\u4e3a 5432\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P <em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--pset=<em class=\"replaceable\"><code>assignment</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ee5<code class=\"command\">\\pset</code>\u7684\u5f62\u5f0f\u6307\u5b9a\u6253\u5370\u9009\u9879\u3002\u6ce8\u610f\uff0c\u8fd9\u91cc\u4f60\u5fc5\u987b\u7528\u4e00\u4e2a\u7b49\u53f7\u800c\u4e0d\u662f\u7a7a\u683c\u6765\u5206\u9694\u540d\u79f0\u548c\u503c\u3002\u4f8b\u5982\uff0c\u8981\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a<span class=\"application\">LaTeX</span>\uff0c\u5e94\u8be5\u5199\u6210<code class=\"literal\">-P format=latex</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-q</code><br/></span><span class=\"term\"><code class=\"option\">--quiet</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a<span class=\"application\">psql</span>\u5e94\u8be5\u5b89\u9759\u5730\u5de5\u4f5c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4f1a\u6253\u5370\u51fa\u6b22\u8fce\u6d88\u606f\u548c\u5404\u79cd\u63d0\u793a\u4fe1\u606f\u3002\u5982\u679c\u4f7f\u7528\u4e86\u8fd9\u4e2a\u9009\u9879\uff0c\u4ee5\u4e0a\u90a3\u4e9b\u5c31\u90fd\u4e0d\u4f1a\u8f93\u51fa\u3002\u5728\u4f7f\u7528<code class=\"option\">-c</code>\u9009\u9879\u65f6\uff0c\u914d\u5408\u8fd9\u4e2a\u9009\u9879\u5f88\u6709\u7528\u3002\u8fd9\u7b49\u6548\u4e8e\u8bbe\u7f6e\u53d8\u91cf<code class=\"varname\">QUIET</code>\u4e3a<code class=\"literal\">on</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R <em class=\"replaceable\"><code>separator</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--record-separator=<em class=\"replaceable\"><code>separator</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a<em class=\"replaceable\"><code>separator</code></em>\u7528\u4f5c\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset recordsep</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code><br/></span><span class=\"term\"><code class=\"option\">--single-step</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5728\u5355\u6b65\u6a21\u5f0f\u4e2d\u3002\u8fd9\u610f\u5473\u7740\u5728\u6bcf\u4e2a\u547d\u4ee4\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u4e4b\u524d\u90fd\u4f1a\u63d0\u793a\u7528\u6237\uff0c\u5e76\u5141\u8bb8\u53d6\u6d88\u6267\u884c\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u8c03\u8bd5\u811a\u672c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S</code><br/></span><span class=\"term\"><code class=\"option\">--single-line</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd0\u884c\u5728\u5355\u884c\u6a21\u5f0f\u4e2d\uff0c\u5176\u4e2d\u6362\u884c\u7b26\u4f1a\u7ec8\u6b62\u4e00\u4e2a SQL \u547d\u4ee4\uff0c\u5c31\u50cf\u5206\u53f7\u7684\u4f5c\u7528\u4e00\u6837\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u79cd\u6a21\u5f0f\u662f\u4e3a\u575a\u6301\u4f7f\u7528\u5b83\u7684\u7528\u6237\u63d0\u4f9b\u7684\uff0c\u4f46\u5e76\u4e0d\u4e00\u5b9a\u503c\u5f97\u63a8\u8350\u3002\u7279\u522b\u662f\uff0c\u5982\u679c\u5728\u4e00\u884c\u4e2d\u6df7\u5408\u4e86<acronym class=\"acronym\">SQL</acronym>\u548c\u5143\u547d\u4ee4\uff0c\u5bf9\u4e8e\u6ca1\u6709\u7ecf\u9a8c\u7684\u7528\u6237\u6765\u8bf4\uff0c\u5b83\u4eec\u7684\u6267\u884c\u987a\u5e8f\u672a\u5fc5\u603b\u662f\u6e05\u695a\u7684\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t</code><br/></span><span class=\"term\"><code class=\"option\">--tuples-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5173\u95ed\u6253\u5370\u5217\u540d\u548c\u7ed3\u679c\u884c\u8ba1\u6570\u9875\u811a\u7b49\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\t</code>\u6216\u8005<code class=\"command\">\\pset tuples_only</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>table_options</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--table-attr=<em class=\"replaceable\"><code>table_options</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u653e\u5728<acronym class=\"acronym\">HTML</acronym> <code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u9009\u9879\u3002\u8be6\u89c1<code class=\"command\">\\pset tableattr</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f5c\u4e3a\u7528\u6237<em class=\"replaceable\"><code>username</code></em>\u800c\u4e0d\u662f\u9ed8\u8ba4\u7528\u6237\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff08\u5f53\u7136\uff0c\u4f60\u5fc5\u987b\u5177\u6709\u8fd9\u6837\u505a\u7684\u6743\u9650\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v <em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--set=<em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--variable=<em class=\"replaceable\"><code>assignment</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6267\u884c\u4e00\u6b21\u53d8\u91cf\u8d4b\u503c\uff0c\u548c<code class=\"command\">\\set</code>\u5143\u547d\u4ee4\u76f8\u4f3c\u3002\u6ce8\u610f\u4f60\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u7528\u7b49\u53f7\u5206\u9694\u540d\u5b57\u548c\u503c\uff08\u5982\u679c\u6709\uff09\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u7684\u8bbe\u7f6e\uff0c\u53bb\u6389\u7b49\u53f7\u5c31\u884c\u3002\u8981\u628a\u4e00\u4e2a\u53d8\u91cf\u8bbe\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u4f7f\u7528\u7b49\u53f7\u4f46\u662f\u53bb\u6389\u503c\u3002\u8fd9\u4e9b\u8d4b\u503c\u5728\u547d\u4ee4\u884c\u5904\u7406\u671f\u95f4\u88ab\u5b8c\u6210\uff0c\u56e0\u6b64\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u7684\u53d8\u91cf\u5c06\u5728\u7a0d\u540e\u88ab\u8986\u76d6\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">psql</span>\u7248\u672c\u5e76\u4e14\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6c38\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u8fd9\u4e2a\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4efb\u52a1\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u65f6\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u6574\u4e2a\u4f1a\u8bdd\u671f\u95f4\u90fd\u4f1a\u4fdd\u6301\u751f\u6548\uff0c\u56e0\u6b64\u5b83\u4e0d\u4ec5\u5f71\u54cd\u521d\u59cb\u8fde\u63a5\u5c1d\u8bd5\uff0c\u4e5f\u4f1a\u5f71\u54cd\u5143\u547d\u4ee4<code class=\"command\">\\connect</code>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236<span class=\"application\">psql</span>\u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\uff0c\u5373\u4f7f\u8be5\u5bc6\u7801\u5b9e\u9645\u4e0a\u4e0d\u4f1a\u88ab\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff0c\u5219<span class=\"application\">psql</span>\u65e0\u8bba\u5982\u4f55\u90fd\u4f1a\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">psql</span>\u9700\u8981\u5148\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\uff0c\u624d\u80fd\u77e5\u9053\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u663e\u5f0f\u6307\u5b9a<code class=\"option\">-W</code>\u503c\u5f97\u7528\u6765\u907f\u514d\u8fd9\u6b21\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u6574\u4e2a\u4f1a\u8bdd\u671f\u95f4\u90fd\u4f1a\u4fdd\u6301\u751f\u6548\uff0c\u56e0\u6b64\u5b83\u4e0d\u4ec5\u5f71\u54cd\u521d\u59cb\u8fde\u63a5\u5c1d\u8bd5\uff0c\u4e5f\u4f1a\u5f71\u54cd\u5143\u547d\u4ee4<code class=\"command\">\\connect</code>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x</code><br/></span><span class=\"term\"><code class=\"option\">--expanded</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5f00\u6269\u5c55\u8868\u683c\u5f0f\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\x</code>\u6216\u8005<code class=\"command\">\\pset expanded</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-X</code><br/></span><span class=\"term\"><code class=\"option\">--no-psqlrc</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8bfb\u53d6\u542f\u52a8\u6587\u4ef6\uff08\u65e2\u4e0d\u8bfb\u53d6\u7cfb\u7edf\u8303\u56f4\u7684<code class=\"filename\">psqlrc</code>\u6587\u4ef6\uff0c\u4e5f\u4e0d\u8bfb\u53d6\u7528\u6237\u7684<code class=\"filename\">~/.psqlrc</code>\u6587\u4ef6\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-z</code><br/></span><span class=\"term\"><code class=\"option\">--field-separator-zero</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset fieldsep_zero</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-0</code><br/></span><span class=\"term\"><code class=\"option\">--record-separator-zero</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u4f8b\u5982\uff0c\u8fd9\u6709\u52a9\u4e8e\u4e0e<code class=\"literal\">xargs -0</code>\u914d\u5408\u4f7f\u7528\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset recordsep_zero</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-1</code><br/></span><span class=\"term\"><code class=\"option\">--single-transaction</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u9009\u9879\u53ea\u80fd\u4e0e\u4e00\u4e2a\u6216\u591a\u4e2a<code class=\"option\">-c</code>\u548c/\u6216<code class=\"option\">-f</code>\u9009\u9879\u7ed3\u5408\u4f7f\u7528\u3002\u5b83\u4f1a\u5bfc\u81f4<span class=\"application\">psql</span>\u5728\u7b2c\u4e00\u4e2a\u8fd9\u6837\u7684\u9009\u9879\u4e4b\u524d\u53d1\u51fa\u4e00\u4e2a<code class=\"command\">BEGIN</code>\u547d\u4ee4\uff0c\u5e76\u5728\u6700\u540e\u4e00\u4e2a\u9009\u9879\u4e4b\u540e\u53d1\u51fa\u4e00\u4e2a<code class=\"command\">COMMIT</code>\u547d\u4ee4\uff0c\u4ece\u800c\u5c06\u6240\u6709\u547d\u4ee4\u5305\u88c5\u6210\u4e00\u4e2a\u5355\u72ec\u7684\u4e8b\u52a1\u3002\u8fd9\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u547d\u4ee4\u672c\u8eab\u5305\u542b<code class=\"command\">BEGIN</code>\u3001<code class=\"command\">COMMIT</code>\u6216<code class=\"command\">ROLLBACK</code>\uff0c\u8fd9\u4e2a\u9009\u9879\u5c31\u4e0d\u4f1a\u4ea7\u751f\u671f\u671b\u7684\u6548\u679c\u3002\u53e6\u5916\uff0c\u5982\u679c\u67d0\u4e2a\u5355\u72ec\u547d\u4ee4\u4e0d\u80fd\u5728\u4e8b\u52a1\u5757\u4e2d\u6267\u884c\uff0c\u6307\u5b9a\u8fd9\u4e2a\u9009\u9879\u5c06\u5bfc\u81f4\u6574\u4e2a\u4e8b\u52a1\u5931\u8d25\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help[=<em class=\"replaceable\"><code>topic</code></em>]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u6709\u5173<span class=\"application\">psql</span>\u7684\u5e2e\u52a9\u5e76\u4e14\u9000\u51fa\u3002\u53ef\u9009\u7684<em class=\"replaceable\"><code>topic</code></em>\u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a<code class=\"literal\">options</code>\uff09\u9009\u62e9\u8981\u89e3\u91ca<span class=\"application\">psql</span>\u7684\u54ea\u4e00\u90e8\u5206\uff1a<code class=\"literal\">commands</code>\u63cf\u8ff0<span class=\"application\">psql</span>\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b<code class=\"literal\">options</code>\u63cf\u8ff0\u53ef\u4ee5\u88ab\u4f20\u9012\u7ed9<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c<code class=\"literal\">variables</code>\u5219\u663e\u793a\u6709\u5173<span class=\"application\">psql</span>\u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.18.7\">\n<h2 lang=\"zh\">\u9000\u51fa\u72b6\u6001</h2>\n<p lang=\"zh\">\u5982\u679c<span class=\"application\">psql</span>\u6b63\u5e38\u7ed3\u675f\uff0c\u5b83\u4f1a\u5411 shell \u8fd4\u56de 0\uff1b\u5982\u679c\u5b83\u81ea\u8eab\u53d1\u751f\u81f4\u547d\u9519\u8bef\uff08\u4f8b\u5982\u5185\u5b58\u8017\u5c3d\u3001\u627e\u4e0d\u5230\u6587\u4ef6\uff09\uff0c\u5219\u8fd4\u56de 1\uff1b\u5982\u679c\u5230\u670d\u52a1\u5668\u7684\u8fde\u63a5\u53d1\u751f\u6545\u969c\u4e14\u8be5\u4f1a\u8bdd\u4e0d\u662f\u4ea4\u4e92\u5f0f\u7684\uff0c\u5219\u8fd4\u56de 2\uff1b\u5982\u679c\u811a\u672c\u4e2d\u53d1\u751f\u9519\u8bef\u4e14\u53d8\u91cf<code class=\"varname\">ON_ERROR_STOP</code>\u5df2\u8bbe\u7f6e\uff0c\u5219\u8fd4\u56de 3\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.18.8\">\n<h2 lang=\"zh\">\u7528\u6cd5</h2>\n<div class=\"refsect2\" id=\"R2-APP-PSQL-CONNECTING\">\n<h3 lang=\"zh\">\u8fde\u63a5\u5230\u6570\u636e\u5e93</h3>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u662f\u5e38\u89c4\u7684 <span class=\"productname\">PostgreSQL</span> \u5ba2\u6237\u7aef\u5e94\u7528\u7a0b\u5e8f\u3002\u8981\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff0c\u4f60\u9700\u8981\u77e5\u9053\u76ee\u6807\u6570\u636e\u5e93\u540d\u79f0\u3001\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u548c\u7aef\u53e3\u53f7\uff0c\u4ee5\u53ca\u8981\u4ee5\u54ea\u4e2a\u6570\u636e\u5e93\u7528\u6237\u540d\u8fde\u63a5\u3002<span class=\"application\">psql</span> \u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u9009\u9879 <code class=\"option\">-d</code>\u3001<code class=\"option\">-h</code>\u3001<code class=\"option\">-p</code> \u548c <code class=\"option\">-U</code> \u5206\u522b\u6307\u5b9a\u8fd9\u4e9b\u53c2\u6570\u3002\u5982\u679c\u9047\u5230\u4e00\u4e2a\u4e0d\u5c5e\u4e8e\u4efb\u4f55\u9009\u9879\u7684\u53c2\u6570\uff0c\u5b83\u5c06\u88ab\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u540d\uff08\u5982\u679c\u6570\u636e\u5e93\u540d\u5df2\u7ecf\u7ed9\u51fa\uff0c\u5219\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u7528\u6237\u540d\uff09\u3002\u5e76\u975e\u6240\u6709\u8fd9\u4e9b\u9009\u9879\u90fd\u662f\u5fc5\u9700\u7684\uff1b\u5b83\u4eec\u90fd\u6709\u6709\u7528\u7684\u9ed8\u8ba4\u503c\u3002\u5982\u679c\u7701\u7565\u4e3b\u673a\u540d\uff0c<span class=\"application\">psql</span> \u5c06\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u5230\u672c\u5730\u4e3b\u673a\u4e0a\u7684\u670d\u52a1\u5668\uff0c\u800c\u5728\u6ca1\u6709 Unix \u57df\u5957\u63a5\u5b57\u7684\u673a\u5668\u4e0a\u5219\u901a\u8fc7 TCP/IP \u8fde\u63a5\u5230 <code class=\"literal\">localhost</code>\u3002\u9ed8\u8ba4\u7aef\u53e3\u53f7\u5728\u7f16\u8bd1\u65f6\u786e\u5b9a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u670d\u52a1\u5668\u4f7f\u7528\u76f8\u540c\u7684\u9ed8\u8ba4\u503c\uff0c\u56e0\u6b64\u5728\u5927\u591a\u6570\u60c5\u51b5\u4e0b\u4e0d\u5fc5\u6307\u5b9a\u7aef\u53e3\u3002\u9ed8\u8ba4\u7528\u6237\u540d\u662f\u4f60\u7684\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\uff0c\u9ed8\u8ba4\u6570\u636e\u5e93\u540d\u4e5f\u662f\u5982\u6b64\u3002\u8bf7\u6ce8\u610f\uff0c\u4f60\u4e0d\u80fd\u968f\u610f\u4ee5\u4efb\u610f\u6570\u636e\u5e93\u7528\u6237\u540d\u8fde\u63a5\u5230\u4efb\u610f\u6570\u636e\u5e93\u3002\u6570\u636e\u5e93\u7ba1\u7406\u5458\u5e94\u5f53\u5df2\u7ecf\u544a\u77e5\u4f60\u62e5\u6709\u7684\u8bbf\u95ee\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5f53\u9ed8\u8ba4\u503c\u4e0d\u5b8c\u5168\u5408\u9002\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7\u628a\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGDATABASE</code>\u3001<code class=\"envar\">PGHOST</code>\u3001<code class=\"envar\">PGPORT</code>\u548c<code class=\"envar\">PGUSER</code>\u8bbe\u7f6e\u4e3a\u9002\u5f53\u7684\u503c\u6765\u5c11\u6572\u4e00\u4e9b\u952e\u76d8\uff08\u989d\u5916\u7684\u73af\u5883\u53d8\u91cf\u89c1<a class=\"xref\" href=\"/docs/12/libpq-envars.html\" title=\"33.14.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a033.14\u00a0\u8282</a>\uff09\u3002\u53e6\u5916\uff0c\u51c6\u5907\u4e00\u4e2a<code class=\"filename\">~/.pgpass</code>\u6587\u4ef6\u4e5f\u5f88\u65b9\u4fbf\uff0c\u8fd9\u6837\u5c31\u4e0d\u5fc5\u7ecf\u5e38\u624b\u5de5\u8f93\u5165\u5bc6\u7801\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/12/libpq-pgpass.html\" title=\"33.15.\u00a0\u5bc6\u7801\u6587\u4ef6\">\u7b2c\u00a033.15\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u53e6\u4e00\u79cd\u6307\u5b9a\u8fde\u63a5\u53c2\u6570\u7684\u65b9\u6cd5\u662f\u4f7f\u7528 conninfo \u5b57\u7b26\u4e32\u6216 URI \u6765\u4ee3\u66ff\u6570\u636e\u5e93\u540d\u3002\u6b64\u673a\u5236\u5141\u8bb8\u5bf9\u8fde\u63a5\u8fdb\u884c\u975e\u5e38\u5e7f\u6cdb\u7684\u63a7\u5236\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">$ <strong class=\"userinput\"><code>psql \"service=myservice sslmode=require\"</code></strong>\n$ <strong class=\"userinput\"><code>psql postgresql://dbmaster:5433/mydb?sslmode=require</code></strong>\n</pre>\n<p lang=\"zh\">\u7528\u8fd9\u79cd\u65b9\u5f0f\uff0c\u4f60\u4e5f\u53ef\u4ee5\u628a<acronym class=\"acronym\">LDAP</acronym>\u7528\u4e8e<a class=\"xref\" href=\"/docs/12/libpq-ldap.html\" title=\"33.17.\u00a0\u8fde\u63a5\u53c2\u6570\u7684 LDAP \u67e5\u627e\">\u7b2c\u00a033.17\u00a0\u8282</a>\u4e2d\u63cf\u8ff0\u7684\u8fde\u63a5\u53c2\u6570\u67e5\u627e\u3002\u53ef\u7528\u8fde\u63a5\u9009\u9879\u7684\u66f4\u591a\u4fe1\u606f\u8bf7\u89c1<a class=\"xref\" href=\"/docs/12/libpq.html#LIBPQ-PARAMKEYWORDS\" title=\"33.1.2.\u00a0\u53c2\u6570\u5173\u952e\u8bcd\">\u7b2c\u00a033.1.2\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7531\u4e8e\u4efb\u4f55\u539f\u56e0\uff08\u4f8b\u5982\u6743\u9650\u4e0d\u8db3\u3001\u670d\u52a1\u5668\u6ca1\u6709\u5728\u76ee\u6807\u4e3b\u673a\u4e0a\u8fd0\u884c\u7b49\uff09\u5bfc\u81f4\u8fde\u63a5\u65e0\u6cd5\u5efa\u7acb\uff0c<span class=\"application\">psql</span>\u5c06\u8fd4\u56de\u4e00\u4e2a\u9519\u8bef\u5e76\u4e14\u7ec8\u6b62\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6807\u51c6\u8f93\u5165\u548c\u6807\u51c6\u8f93\u51fa\u90fd\u662f\u7ec8\u7aef\uff0c\u90a3\u4e48<span class=\"application\">psql</span>\u4f1a\u628a\u5ba2\u6237\u7aef\u7f16\u7801\u8bbe\u7f6e\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">auto</span>\u201d</span>\uff0c\u4ece\u533a\u57df\u8bbe\u7f6e\u4e2d\u68c0\u6d4b\u5408\u9002\u7684\u5ba2\u6237\u7aef\u7f16\u7801\uff08\u5728 Unix \u7cfb\u7edf\u4e0a\u662f<code class=\"envar\">LC_CTYPE</code>\u73af\u5883\u53d8\u91cf\uff09\u3002\u5982\u679c\u7ed3\u679c\u4e0d\u7b26\u5408\u9884\u671f\uff0c\u53ef\u4ee5\u4f7f\u7528\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGCLIENTENCODING</code>\u8986\u76d6\u5ba2\u6237\u7aef\u7f16\u7801\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"R2-APP-PSQL-4\">\n<h3 lang=\"zh\">\u8f93\u5165 SQL \u547d\u4ee4</h3>\n<p lang=\"zh\">\u5728\u6b63\u5e38\u64cd\u4f5c\u65f6\uff0c<span class=\"application\">psql</span>\u4f1a\u63d0\u4f9b\u4e00\u4e2a\u63d0\u793a\u7b26\uff0c\u8be5\u63d0\u793a\u7b26\u662f<span class=\"application\">psql</span>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u540d\u79f0\u540e\u9762\u8ddf\u4e0a\u5b57\u7b26\u4e32<code class=\"literal\">=&gt;</code>\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">$ <strong class=\"userinput\"><code>psql testdb</code></strong>\npsql (12.22)\nType \"help\" for help.\n\ntestdb=&gt;\n</pre>\n<p lang=\"zh\">\u5728\u63d0\u793a\u7b26\u4e0b\uff0c\u7528\u6237\u53ef\u4ee5\u8f93\u5165<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u3002\u901a\u5e38\uff0c\u5f53\u9047\u5230\u8868\u793a\u547d\u4ee4\u7ed3\u675f\u7684\u5206\u53f7\u65f6\uff0c\u8f93\u5165\u7684\u5185\u5bb9\u5c31\u4f1a\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u3002\u884c\u7ed3\u675f\u5e76\u4e0d\u4f1a\u7ec8\u6b62\u4e00\u6761\u547d\u4ee4\uff0c\u56e0\u6b64\u4e3a\u4e86\u63d0\u9ad8\u6e05\u6670\u5ea6\uff0c\u547d\u4ee4\u53ef\u4ee5\u5206\u5e03\u5728\u591a\u884c\u4e0a\u3002\u5982\u679c\u547d\u4ee4\u88ab\u53d1\u9001\u5e76\u6210\u529f\u6267\u884c\uff0c\u5176\u7ed3\u679c\u5c31\u4f1a\u663e\u793a\u5728\u5c4f\u5e55\u4e0a\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u53d7\u4fe1\u4efb\u7684\u7528\u6237\u80fd\u591f\u8bbf\u95ee\u5c1a\u672a\u91c7\u7528<a class=\"link\" href=\"/docs/12/ddl-schemas.html#DDL-SCHEMAS-PATTERNS\" title=\"5.9.6.\u00a0\u4f7f\u7528\u65b9\u5f0f\">\u6a21\u5f0f\u7684\u5b89\u5168\u4f7f\u7528\u65b9\u5f0f</a>\u7684\u6570\u636e\u5e93\uff0c\u8bf7\u5728\u4f1a\u8bdd\u5f00\u59cb\u65f6\u4ece<code class=\"varname\">search_path</code>\u4e2d\u79fb\u9664\u6240\u6709\u516c\u4f17\u53ef\u5199\u7684\u6a21\u5f0f\u3002\u53ef\u4ee5\u5728\u8fde\u63a5\u5b57\u7b26\u4e32\u4e2d\u52a0\u5165<code class=\"literal\">options=-csearch_path=</code>\uff0c\u6216\u8005\u5728\u6267\u884c\u5176\u4ed6 SQL \u547d\u4ee4\u4e4b\u524d\u53d1\u51fa<code class=\"literal\">SELECT pg_catalog.set_config('search_path', '', false)</code>\u3002\u8fd9\u79cd\u8003\u8651\u5e76\u975e<span class=\"application\">psql</span>\u7279\u6709\uff1b\u5b83\u9002\u7528\u4e8e\u4efb\u4f55\u6267\u884c\u4efb\u610f SQL \u547d\u4ee4\u7684\u63a5\u53e3\u3002</p>\n<p lang=\"zh\">\u6bcf\u5f53\u6267\u884c\u547d\u4ee4\u65f6\uff0c<span class=\"application\">psql</span>\u4e5f\u4f1a\u8f6e\u8be2\u7531<a class=\"xref\" href=\"/docs/12/sql-listen.html\" title=\"LISTEN\"><span class=\"refentrytitle\">LISTEN</span></a>\u548c<a class=\"xref\" href=\"/docs/12/sql-notify.html\" title=\"NOTIFY\"><span class=\"refentrytitle\">NOTIFY</span></a>\u751f\u6210\u7684\u5f02\u6b65\u901a\u77e5\u4e8b\u4ef6\u3002</p>\n<p lang=\"zh\">\u867d\u7136 C \u98ce\u683c\u7684\u5757\u6ce8\u91ca\u4f1a\u88ab\u4f20\u7ed9\u670d\u52a1\u5668\u5904\u7406\u5e76\u79fb\u9664\uff0c\u4f46 SQL \u6807\u51c6\u6ce8\u91ca\u4f1a\u7531<span class=\"application\">psql</span>\u81ea\u884c\u79fb\u9664\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"APP-PSQL-META-COMMANDS\">\n<h3 lang=\"zh\">\u5143\u547d\u4ee4</h3>\n<p lang=\"zh\">\u4f60\u8f93\u5165\u5230<span class=\"application\">psql</span>\u4e2d\u7684\u4efb\u4f55\u4ee5\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u5f00\u59cb\u7684\u4e1c\u897f\u90fd\u662f\u4e00\u4e2a<span class=\"application\">psql</span>\u5143\u547d\u4ee4\uff0c\u5b83\u4eec\u7531<span class=\"application\">psql</span>\u81ea\u884c\u5904\u7406\u3002\u8fd9\u4e9b\u547d\u4ee4\u8ba9<span class=\"application\">psql</span>\u5bf9\u7ba1\u7406\u548c\u7f16\u5199\u811a\u672c\u66f4\u6709\u7528\u3002\u5143\u547d\u4ee4\u5e38\u5e38\u88ab\u79f0\u4f5c\u659c\u7ebf\u6216\u8005\u53cd\u659c\u7ebf\u547d\u4ee4\u3002</p>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u547d\u4ee4\u7684\u683c\u5f0f\u662f\u7528\u53cd\u659c\u7ebf\u540e\u9762\u76f4\u63a5\u8ddf\u4e0a\u4e00\u4e2a\u547d\u4ee4\u52a8\u8bcd\uff0c\u7136\u540e\u662f\u4e00\u4e9b\u53c2\u6570\u3002\u53c2\u6570\u4e0e\u547d\u4ee4\u52a8\u8bcd\u548c\u5176\u4ed6\u53c2\u6570\u4e4b\u95f4\u7528\u4efb\u610f\u591a\u4e2a\u7a7a\u767d\u5b57\u7b26\u5206\u9694\u5f00\u3002</p>\n<p lang=\"zh\">\u8981\u5728\u53c2\u6570\u4e2d\u5305\u542b\u7a7a\u767d\uff0c\u53ef\u4ee5\u7528\u5355\u5f15\u53f7\u5c06\u5b83\u62ec\u8d77\u6765\u3002\u8981\u5728\u53c2\u6570\u4e2d\u5305\u542b\u4e00\u4e2a\u5355\u5f15\u53f7\uff0c\u53ef\u4ee5\u5728\u5355\u5f15\u53f7\u6587\u672c\u5185\u5199\u4e24\u4e2a\u5355\u5f15\u53f7\u3002\u5355\u5f15\u53f7\u4e2d\u7684\u5185\u5bb9\u8fd8\u4f1a\u63a5\u53d7\u7c7b\u4f3c C \u8bed\u8a00\u7684\u66ff\u6362\uff1a<code class=\"literal\">\\n</code>\uff08\u6362\u884c\uff09\u3001<code class=\"literal\">\\t</code>\uff08\u5236\u8868\u7b26\uff09\u3001<code class=\"literal\">\\b</code>\uff08\u9000\u683c\uff09\u3001<code class=\"literal\">\\r</code>\uff08\u56de\u8f66\uff09\u3001<code class=\"literal\">\\f</code>\uff08\u6362\u9875\uff09\u3001<code class=\"literal\">\\</code><em class=\"replaceable\"><code>digits</code></em>\uff08\u516b\u8fdb\u5236\uff09\u4ee5\u53ca<code class=\"literal\">\\x</code><em class=\"replaceable\"><code>digits</code></em>\uff08\u5341\u516d\u8fdb\u5236\uff09\u3002\u5728\u5355\u5f15\u53f7\u6587\u672c\u5185\uff0c\u53cd\u659c\u7ebf\u51fa\u73b0\u5728\u4efb\u4f55\u5176\u4ed6\u5b57\u7b26\u524d\u9762\u65f6\uff0c\u53ea\u662f\u5bf9\u8be5\u5355\u4e2a\u5b57\u7b26\u8fdb\u884c\u8f6c\u4e49\uff0c\u4e0d\u8bba\u5b83\u662f\u4ec0\u4e48\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u53c2\u6570\u4e2d\u51fa\u73b0\u4e00\u4e2a\u672a\u52a0\u5f15\u53f7\u7684\u5192\u53f7\uff08<code class=\"literal\">:</code>\uff09\uff0c\u540e\u9762\u7d27\u8ddf\u4e00\u4e2a<span class=\"application\">psql</span>\u53d8\u91cf\u540d\uff0c\u5b83\u5c31\u4f1a\u88ab\u8be5\u53d8\u91cf\u7684\u503c\u66ff\u6362\uff0c\u5982\u4e0b\u9762<a class=\"xref\" href=\"/docs/12/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL \u63d2\u503c\"><acronym class=\"acronym\">SQL</acronym> \u63d2\u503c</a>\u6240\u8ff0\u3002\u5176\u4e2d\u4ecb\u7ecd\u7684<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u548c<code class=\"literal\">:\"<em class=\"replaceable\"><code>variable_name</code></em>\"</code>\u5f62\u5f0f\u4e5f\u540c\u6837\u9002\u7528\u3002<code class=\"literal\">:{?<em class=\"replaceable\"><code>variable_name</code></em>}</code>\u8bed\u6cd5\u5141\u8bb8\u6d4b\u8bd5\u53d8\u91cf\u662f\u5426\u5df2\u5b9a\u4e49\uff1b\u5b83\u4f1a\u88ab TRUE \u6216 FALSE \u66ff\u6362\u3002\u7528\u53cd\u659c\u7ebf\u8f6c\u4e49\u8be5\u5192\u53f7\u53ef\u4ee5\u9632\u6b62\u66ff\u6362\u53d1\u751f\u3002</p>\n<p lang=\"zh\">\u5728\u53c2\u6570\u4e2d\uff0c\u7528\u53cd\u5f15\u53f7\uff08<code class=\"literal\">`</code>\uff09\u5305\u56f4\u7684\u6587\u672c\u4f1a\u88ab\u89c6\u4e3a\u4f20\u7ed9 shell \u7684\u547d\u4ee4\u884c\u3002\u8be5\u547d\u4ee4\u7684\u8f93\u51fa\uff08\u53bb\u6389\u672b\u5c3e\u7684\u6362\u884c\u7b26\uff09\u4f1a\u66ff\u6362\u53cd\u5f15\u53f7\u4e2d\u7684\u6587\u672c\u3002\u5728\u53cd\u5f15\u53f7\u5305\u56f4\u7684\u6587\u672c\u5185\u90e8\uff0c\u4e0d\u4f1a\u8fdb\u884c\u7279\u6b8a\u7684\u5f15\u53f7\u5904\u7406\u6216\u5176\u4ed6\u5904\u7406\uff0c\u4f46\u51fa\u73b0<code class=\"literal\">:<em class=\"replaceable\"><code>variable_name</code></em></code>\u65f6\uff0c\u5982\u679c<em class=\"replaceable\"><code>variable_name</code></em>\u662f<span class=\"application\">psql</span>\u53d8\u91cf\u540d\uff0c\u5c31\u4f1a\u88ab\u66ff\u6362\u4e3a\u8be5\u53d8\u91cf\u7684\u503c\u3002\u6b64\u5916\uff0c<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u4e5f\u4f1a\u88ab\u66ff\u6362\u4e3a\u8be5\u53d8\u91cf\u7684\u503c\uff0c\u5e76\u4f1a\u9002\u5f53\u5730\u52a0\u4e0a\u5f15\u53f7\uff0c\u4f7f\u5176\u6210\u4e3a\u5355\u4e2a shell \u547d\u4ee4\u53c2\u6570\u3002\uff08\u540e\u4e00\u79cd\u5f62\u5f0f\u51e0\u4e4e\u603b\u662f\u66f4\u53ef\u53d6\uff0c\u9664\u975e\u4f60\u975e\u5e38\u786e\u5b9a\u53d8\u91cf\u4e2d\u5305\u542b\u4ec0\u4e48\u3002\uff09\u7531\u4e8e\u65e0\u6cd5\u4fdd\u8bc1\u5728\u6240\u6709\u5e73\u53f0\u4e0a\u90fd\u80fd\u5bf9\u56de\u8f66\u548c\u6362\u884c\u5b57\u7b26\u5b89\u5168\u5730\u52a0\u5f15\u53f7\uff0c\u5f53\u53d8\u91cf\u503c\u4e2d\u51fa\u73b0\u8fd9\u7c7b\u5b57\u7b26\u65f6\uff0c<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u5f62\u5f0f\u4f1a\u6253\u5370\u9519\u8bef\u6d88\u606f\uff0c\u5e76\u4e14\u4e0d\u4f1a\u66ff\u6362\u53d8\u91cf\u503c\u3002</p>\n<p lang=\"zh\">\u4e00\u4e9b\u547d\u4ee4\u63a5\u53d7 SQL \u6807\u8bc6\u7b26\uff08\u4f8b\u5982\u8868\u540d\uff09\u4f5c\u4e3a\u53c2\u6570\u3002\u8fd9\u4e9b\u53c2\u6570\u9075\u5faa SQL \u8bed\u6cd5\u89c4\u5219\uff1a\u672a\u52a0\u5f15\u53f7\u7684\u5b57\u6bcd\u4f1a\u5f3a\u5236\u8f6c\u6362\u4e3a\u5c0f\u5199\uff0c\u800c\u53cc\u5f15\u53f7\uff08\"\uff09\u4f1a\u4fdd\u62a4\u5b57\u6bcd\u4e0d\u88ab\u8f6c\u6362\u5927\u5c0f\u5199\uff0c\u5e76\u5141\u8bb8\u6807\u8bc6\u7b26\u5305\u542b\u7a7a\u767d\u5b57\u7b26\u3002\u5728\u53cc\u5f15\u53f7\u5185\u90e8\uff0c\u8fde\u7eed\u4e24\u4e2a\u53cc\u5f15\u53f7\u4f1a\u5728\u6700\u7ec8\u540d\u79f0\u4e2d\u53d8\u4e3a\u4e00\u4e2a\u53cc\u5f15\u53f7\u3002\u4f8b\u5982\uff0cFOO\"BAR\"BAZ \u4f1a\u88ab\u89e3\u91ca\u4e3a fooBARbaz\uff0c\u800c \"A weird\"\" name\" \u4f1a\u53d8\u4e3a A weird\" name\u3002</p>\n<p lang=\"zh\">\u53c2\u6570\u89e3\u6790\u4f1a\u5728\u884c\u5c3e\u6216\u9047\u5230\u53e6\u4e00\u4e2a\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u65f6\u505c\u6b62\u3002\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u4f1a\u88ab\u89c6\u4e3a\u65b0\u5143\u547d\u4ee4\u7684\u5f00\u59cb\u3002\u7279\u6b8a\u5e8f\u5217<code class=\"literal\">\\\\</code>\uff08\u4e24\u4e2a\u53cd\u659c\u7ebf\uff09\u8868\u793a\u53c2\u6570\u7ed3\u675f\uff0c\u5e76\u7ee7\u7eed\u89e3\u6790<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\uff08\u5982\u679c\u8fd8\u6709\uff09\u3002\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u548c<span class=\"application\">psql</span>\u547d\u4ee4\u53ef\u4ee5\u81ea\u7531\u5730\u6df7\u5408\u5728\u540c\u4e00\u884c\u4e2d\u3002\u4f46\u65e0\u8bba\u5982\u4f55\uff0c\u5143\u547d\u4ee4\u7684\u53c2\u6570\u90fd\u4e0d\u80fd\u5ef6\u7eed\u5230\u4e0b\u4e00\u884c\u3002</p>\n<p lang=\"zh\">\u8bb8\u591a\u5143\u547d\u4ee4\u4f5c\u7528\u4e8e<em class=\"firstterm\">\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a</em>\u3002\u8fd9\u53ea\u662f\u4e00\u4e2a\u4fdd\u5b58\u5df2\u8f93\u5165\u4f46\u5c1a\u672a\u53d1\u9001\u5230\u670d\u52a1\u5668\u6267\u884c\u7684 SQL \u547d\u4ee4\u6587\u672c\u7684\u7f13\u51b2\u533a\u3002\u5176\u4e2d\u65e2\u5305\u62ec\u5148\u524d\u8f93\u5165\u7684\u884c\uff0c\u4e5f\u5305\u62ec\u540c\u4e00\u884c\u4e0a\u4f4d\u4e8e\u5143\u547d\u4ee4\u4e4b\u524d\u7684\u6587\u672c\u3002</p>\n<p lang=\"zh\">\u5b9a\u4e49\u4e86\u4ee5\u4e0b\u5143\u547d\u4ee4\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">\\a</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u5f53\u524d\u8868\u683c\u8f93\u51fa\u683c\u5f0f\u662f\u975e\u5bf9\u9f50\uff0c\u5219\u5207\u6362\u4e3a\u5bf9\u9f50\uff1b\u5426\u5219\u5207\u6362\u4e3a\u975e\u5bf9\u9f50\u3002\u4fdd\u7559\u6b64\u547d\u4ee4\u662f\u4e3a\u4e86\u5411\u540e\u517c\u5bb9\u3002\u66f4\u901a\u7528\u7684\u89e3\u51b3\u65b9\u6848\u8bf7\u53c2\u89c1<code class=\"command\">\\pset</code>\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\c</code> \u6216 <code class=\"literal\">\\connect [ -reuse-previous=<em class=\"replaceable\"><code>on|off</code></em> ] [ <em class=\"replaceable\"><code>dbname</code></em> [ <em class=\"replaceable\"><code>username</code></em> ] [ <em class=\"replaceable\"><code>host</code></em> ] [ <em class=\"replaceable\"><code>port</code></em> ] | <em class=\"replaceable\"><code>conninfo</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5efa\u7acb\u5230<span class=\"productname\">PostgreSQL</span>\u670d\u52a1\u5668\u7684\u65b0\u8fde\u63a5\u3002\u8fde\u63a5\u53c2\u6570\u65e2\u53ef\u4ee5\u4f7f\u7528\u6309\u4f4d\u7f6e\u6307\u5b9a\u7684\u8bed\u6cd5\uff08\u6570\u636e\u5e93\u540d\u3001\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\u4e2d\u7684\u4e00\u4e2a\u6216\u591a\u4e2a\uff09\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528<em class=\"replaceable\"><code>conninfo</code></em>\u8fde\u63a5\u5b57\u7b26\u4e32\uff0c\u8be6\u89c1<a class=\"xref\" href=\"/docs/12/libpq.html#LIBPQ-CONNSTRING\" title=\"33.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u7b2c\u00a033.1.1\u00a0\u8282</a>\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa\u53c2\u6570\uff0c\u5219\u4f7f\u7528\u4e0e\u4e4b\u524d\u76f8\u540c\u7684\u53c2\u6570\u5efa\u7acb\u65b0\u8fde\u63a5\u3002</p>\n<p lang=\"zh\">\u5c06<em class=\"replaceable\"><code>dbname</code></em>\u3001<em class=\"replaceable\"><code>username</code></em>\u3001<em class=\"replaceable\"><code>host</code></em>\u6216<em class=\"replaceable\"><code>port</code></em>\u4e2d\u7684\u4efb\u4f55\u4e00\u4e2a\u6307\u5b9a\u4e3a<code class=\"literal\">-</code>\uff0c\u90fd\u7b49\u4ef7\u4e8e\u7701\u7565\u8be5\u53c2\u6570\u3002</p>\n<p lang=\"zh\">\u65b0\u8fde\u63a5\u53ef\u4ee5\u91cd\u7528\u524d\u4e00\u4e2a\u8fde\u63a5\u7684\u8fde\u63a5\u53c2\u6570\uff1b\u4e0d\u4ec5\u5305\u62ec\u6570\u636e\u5e93\u540d\u79f0\u3001\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\uff0c\u8fd8\u5305\u62ec\u5176\u4ed6\u8bbe\u7f6e\uff0c\u5982<em class=\"replaceable\"><code>sslmode</code></em>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53c2\u6570\u5728\u4f4d\u7f6e\u8bed\u6cd5\u4e2d\u88ab\u91cd\u7528\uff0c\u4f46\u5728\u7ed9\u5b9a<em class=\"replaceable\"><code>conninfo</code></em>\u5b57\u7b26\u4e32\u65f6\u4e0d\u4f1a\u88ab\u91cd\u7528\u3002\u4f20\u9012<code class=\"literal\">-reuse-previous=on</code>\u6216<code class=\"literal\">-reuse-previous=off</code>\u4f5c\u4e3a\u7b2c\u4e00\u4e2a\u53c2\u6570\u5c06\u8986\u76d6\u8be5\u9ed8\u8ba4\u8bbe\u7f6e\u3002\u5982\u679c\u53c2\u6570\u88ab\u91cd\u7528\uff0c\u5219\u4efb\u4f55\u672a\u660e\u786e\u6307\u5b9a\u4e3a\u4f4d\u7f6e\u53c2\u6570\u6216\u5728<em class=\"replaceable\"><code>conninfo</code></em>\u5b57\u7b26\u4e32\u4e2d\u7684\u53c2\u6570\u5c06\u4ece\u73b0\u6709\u8fde\u63a5\u7684\u53c2\u6570\u4e2d\u83b7\u53d6\u3002\u4e00\u4e2a\u4f8b\u5916\u662f\uff0c\u5982\u679c\u4f7f\u7528\u4f4d\u7f6e\u8bed\u6cd5\u66f4\u6539<em class=\"replaceable\"><code>host</code></em>\u8bbe\u7f6e\uff0c\u4f7f\u5176\u4e0d\u540c\u4e8e\u5148\u524d\u7684\u503c\uff0c\u5219\u73b0\u6709\u8fde\u63a5\u53c2\u6570\u4e2d\u5b58\u5728\u7684\u4efb\u4f55<em class=\"replaceable\"><code>hostaddr</code></em>\u8bbe\u7f6e\u5c06\u88ab\u5220\u9664\u3002\u6b64\u5916\uff0c\u4ec5\u5f53\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\u8bbe\u7f6e\u672a\u66f4\u6539\u65f6\uff0c\u624d\u4f1a\u91cd\u7528\u73b0\u6709\u8fde\u63a5\u4f7f\u7528\u7684\u4efb\u4f55\u5bc6\u7801\u3002\u5f53\u547d\u4ee4\u65e2\u4e0d\u6307\u5b9a\u4e5f\u4e0d\u91cd\u7528\u7279\u5b9a\u53c2\u6570\u65f6\uff0c\u5c06\u4f7f\u7528<span class=\"application\">libpq</span>\u7684\u9ed8\u8ba4\u503c\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6210\u529f\u5efa\u7acb\u4e86\u65b0\u8fde\u63a5\uff0c\u5219\u5173\u95ed\u5148\u524d\u7684\u8fde\u63a5\u3002\u5982\u679c\u8fde\u63a5\u5c1d\u8bd5\u5931\u8d25\uff08\u7528\u6237\u540d\u9519\u8bef\u3001\u8bbf\u95ee\u88ab\u62d2\u7edd\u7b49\uff09\uff0c\u5f53<span class=\"application\">psql</span>\u5904\u4e8e\u4ea4\u4e92\u6a21\u5f0f\u65f6\uff0c\u4f1a\u4fdd\u7559\u5148\u524d\u7684\u8fde\u63a5\u3002\u4f46\u5728\u6267\u884c\u975e\u4ea4\u4e92\u5f0f\u811a\u672c\u65f6\uff0c\u4f1a\u7acb\u5373\u62a5\u9519\u5e76\u505c\u6b62\u5904\u7406\u3002\u8fd9\u4e00\u533a\u522b\u4e00\u65b9\u9762\u4f7f\u7528\u6237\u80fd\u591f\u65b9\u4fbf\u5730\u5e94\u5bf9\u8f93\u5165\u9519\u8bef\uff0c\u53e6\u4e00\u65b9\u9762\u4e5f\u4f5c\u4e3a\u5b89\u5168\u673a\u5236\uff0c\u9632\u6b62\u811a\u672c\u610f\u5916\u5730\u4f5c\u7528\u4e8e\u9519\u8bef\u7684\u6570\u636e\u5e93\u3002</p>\n<p lang=\"zh\">\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">=&gt; \\c mydb myuser host.dom 6432\n=&gt; \\c service=foo\n=&gt; \\c \"host=localhost port=5432 dbname=mydb connect_timeout=10 sslmode=disable\"\n=&gt; \\c -reuse-previous=on sslmode=require    -- changes only sslmode\n=&gt; \\c postgresql://tom@localhost/mydb?application_name=myapp\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\C [ <em class=\"replaceable\"><code>title</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u4f5c\u4e3a\u67e5\u8be2\u7ed3\u679c\u6253\u5370\u7684\u8868\u7684\u6807\u9898\uff0c\u6216\u53d6\u6d88\u6b64\u7c7b\u6807\u9898\u3002\u8be5\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset title <em class=\"replaceable\"><code>title</code></em></code>\u3002\uff08\u6b64\u547d\u4ee4\u7684\u540d\u79f0\u6e90\u81ea<span class=\"quote\">\u201c<span class=\"quote\">caption</span>\u201d</span>\uff0c\u56e0\u4e3a\u5b83\u8fc7\u53bb\u53ea\u7528\u4e8e\u8bbe\u7f6e<acronym class=\"acronym\">HTML</acronym>\u8868\u7684\u6807\u9898\u3002\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\cd [ <em class=\"replaceable\"><code>directory</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u66f4\u6539\u4e3a<em class=\"replaceable\"><code>directory</code></em>\u3002\u5982\u679c\u6ca1\u6709\u53c2\u6570\uff0c\u5219\u5207\u6362\u5230\u5f53\u524d\u7528\u6237\u7684\u4e3b\u76ee\u5f55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8981\u6253\u5370\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\uff0c\u8bf7\u4f7f\u7528<code class=\"literal\">\\! pwd</code>\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\conninfo</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa\u5f53\u524d\u6570\u636e\u5e93\u8fde\u63a5\u7684\u4fe1\u606f\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMANDS-COPY\"><span class=\"term\"><code class=\"literal\">\\copy { <em class=\"replaceable\"><code>table</code></em> [ ( <em class=\"replaceable\"><code>column_list</code></em> ) ] } <code class=\"literal\">from</code> { <em class=\"replaceable\"><code>'filename'</code></em> | program <em class=\"replaceable\"><code>'command'</code></em> | stdin | pstdin } [ [ with ] ( <em class=\"replaceable\"><code>option</code></em> [, ...] ) ] [ where <em class=\"replaceable\"><code>condition</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\copy { <em class=\"replaceable\"><code>table</code></em> [ ( <em class=\"replaceable\"><code>column_list</code></em> ) ] | ( <em class=\"replaceable\"><code>query</code></em> ) } <code class=\"literal\">to</code> { <em class=\"replaceable\"><code>'filename'</code></em> | program <em class=\"replaceable\"><code>'command'</code></em> | stdout | pstdout } [ [ with ] ( <em class=\"replaceable\"><code>option</code></em> [, ...] ) ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6267\u884c\u524d\u7aef\uff08\u5ba2\u6237\u7aef\uff09\u590d\u5236\u3002\u8be5\u64cd\u4f5c\u4f1a\u8fd0\u884c\u4e00\u4e2a<acronym class=\"acronym\">SQL</acronym> <a class=\"xref\" href=\"/docs/12/sql-copy.html\" title=\"COPY\"><span class=\"refentrytitle\">COPY</span></a>\u547d\u4ee4\uff0c\u4f46\u5e76\u4e0d\u662f\u7531\u670d\u52a1\u5668\u8bfb\u53d6\u6216\u5199\u5165\u6307\u5b9a\u6587\u4ef6\uff0c\u800c\u662f\u7531<span class=\"application\">psql</span>\u8bfb\u53d6\u6216\u5199\u5165\u6587\u4ef6\uff0c\u5e76\u5728\u670d\u52a1\u5668\u4e0e\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e4b\u95f4\u8f6c\u9001\u6570\u636e\u3002\u8fd9\u610f\u5473\u7740\u6587\u4ef6\u53ef\u8bbf\u95ee\u6027\u548c\u6743\u9650\u53d6\u51b3\u4e8e\u672c\u5730\u7528\u6237\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\uff0c\u4e5f\u4e0d\u9700\u8981 SQL \u8d85\u7ea7\u7528\u6237\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5f53\u6307\u5b9a<code class=\"literal\">program</code>\u65f6\uff0c<em class=\"replaceable\"><code>command</code></em> \u7531<span class=\"application\">psql</span>\u6267\u884c\uff0c\u4f20\u7ed9<em class=\"replaceable\"><code>command</code></em>\u7684\u6570\u636e\u6216\u4ece\u5176\u4e2d\u8bfb\u51fa\u7684\u6570\u636e\u90fd\u4f1a\u5728\u670d\u52a1\u5668\u4e0e\u5ba2\u6237\u7aef\u4e4b\u95f4\u8f6c\u9001\u3002\u518d\u6b21\u5f3a\u8c03\uff0c\u6267\u884c\u6743\u9650\u5c5e\u4e8e\u672c\u5730\u7528\u6237\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\uff0c\u4e5f\u4e0d\u9700\u8981 SQL \u8d85\u7ea7\u7528\u6237\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e \\copy ... from stdin\uff0c\u4ece\u53d1\u51fa\u547d\u4ee4\u7684\u540c\u4e00\u8f93\u5165\u6e90\u8bfb\u53d6\u6570\u636e\u884c\uff0c\u76f4\u5230\u8bfb\u53d6\u5230 \\.\u6216\u8f93\u5165\u6d41\u5230\u8fbe EOF\u3002\u8fd9\u9002\u5408\u5728 SQL \u811a\u672c\u4e2d\u5185\u8054\u586b\u5145\u8868\u3002\u5bf9\u4e8e \\copy ... to stdout\uff0c\u8f93\u51fa\u53d1\u5f80\u4e0e psql \u547d\u4ee4\u8f93\u51fa\u76f8\u540c\u7684\u4f4d\u7f6e\uff0c\u4e14\u4e0d\u6253\u5370 COPY count \u547d\u4ee4\u72b6\u6001\uff0c\u4ee5\u514d\u4e0e\u6570\u636e\u884c\u6df7\u6dc6\u3002\u82e5\u8981\u59cb\u7ec8\u8bfb\u5199 psql \u7684\u6807\u51c6\u8f93\u5165\u6216\u8f93\u51fa\uff0c\u800c\u4e0d\u53d7\u5f53\u524d\u547d\u4ee4\u6765\u6e90\u6216 \\o \u9009\u9879\u5f71\u54cd\uff0c\u8bf7\u4f7f\u7528 from pstdin \u6216 to pstdout\u3002</p>\n<p lang=\"zh\">\u8be5\u547d\u4ee4\u7684\u8bed\u6cd5\u4e0e<acronym class=\"acronym\">SQL</acronym> <a class=\"xref\" href=\"/docs/12/sql-copy.html\" title=\"COPY\"><span class=\"refentrytitle\">COPY</span></a>\u547d\u4ee4\u7c7b\u4f3c\u3002\u9664\u6570\u636e\u6e90\u6216\u76ee\u6807\u4e4b\u5916\uff0c\u5176\u4ed6\u6240\u6709\u9009\u9879\u90fd\u4e0e<a class=\"xref\" href=\"/docs/12/sql-copy.html\" title=\"COPY\"><span class=\"refentrytitle\">COPY</span></a>\u4e2d\u7684\u6307\u5b9a\u76f8\u540c\u3002\u56e0\u6b64\uff0c\u7279\u6b8a\u7684\u89e3\u6790\u89c4\u5219\u9002\u7528\u4e8e<code class=\"command\">\\copy</code>\u5143\u547d\u4ee4\u3002\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u5269\u4f59\u884c\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\copy</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u6267\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u53e6\u4e00\u79cd\u83b7\u5f97\u4e0e<code class=\"literal\">\\copy ... to</code>\u76f8\u540c\u7ed3\u679c\u7684\u65b9\u6cd5\u662f\u4f7f\u7528<acronym class=\"acronym\">SQL</acronym> <code class=\"literal\">COPY ... TO STDOUT</code>\u547d\u4ee4\uff0c\u5e76\u4ee5<code class=\"literal\">\\g <em class=\"replaceable\"><code>filename</code></em></code> \u6216<code class=\"literal\">\\g |<em class=\"replaceable\"><code>program</code></em></code>\u7ed3\u675f\u3002\u4e0e<code class=\"literal\">\\copy</code>\u4e0d\u540c\uff0c\u8fd9\u79cd\u65b9\u6cd5\u5141\u8bb8\u547d\u4ee4\u8de8\u8d8a\u591a\u884c\uff1b\u6b64\u5916\uff0c\u53ef\u4ee5\u4f7f\u7528\u53d8\u91cf\u63d2\u503c\u548c\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</div>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8fd9\u4e9b\u64cd\u4f5c\u4e0d\u5982\u4ee5\u6587\u4ef6\u6216\u7a0b\u5e8f\u4f5c\u4e3a\u6570\u636e\u6e90\u6216\u76ee\u6807\u7684<acronym class=\"acronym\">SQL</acronym> <code class=\"command\">COPY</code>\u547d\u4ee4\u9ad8\u6548\uff0c\u56e0\u4e3a\u6240\u6709\u6570\u636e\u90fd\u5fc5\u987b\u901a\u8fc7\u5ba2\u6237\u7aef/\u670d\u52a1\u5668\u8fde\u63a5\u4f20\u8f93\u3002\u5bf9\u4e8e\u5927\u91cf\u6570\u636e\uff0c\u4f7f\u7528<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u53ef\u80fd\u66f4\u5408\u9002\u3002\u53e6\u5916\uff0c\u7531\u4e8e\u91c7\u7528\u8fd9\u79cd\u6570\u636e\u8f6c\u9001\u65b9\u5f0f\uff0c<acronym class=\"acronym\">CSV</acronym>\u6a21\u5f0f\u4e0b\u7684<code class=\"literal\">\\copy ... from</code>\u4f1a\u9519\u8bef\u5730\u628a\u5355\u72ec\u5360\u636e\u4e00\u884c\u7684<code class=\"literal\">\\.</code>\u6570\u636e\u503c\u5f53\u4f5c\u8f93\u5165\u7ed3\u675f\u6807\u8bb0\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\copyright</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"productname\">PostgreSQL</span>\u7684\u7248\u6743\u548c\u5206\u53d1\u6761\u6b3e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMANDS-CROSSTABVIEW\"><span class=\"term\"><code class=\"literal\">\\crosstabview [ <em class=\"replaceable\"><code>colV</code></em> [ <em class=\"replaceable\"><code>colH</code></em> [ <em class=\"replaceable\"><code>colD</code></em> [ <em class=\"replaceable\"><code>sortcolH</code></em> ] ] ] ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6267\u884c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\uff08\u4e0e<code class=\"literal\">\\g</code>\u7c7b\u4f3c\uff09\uff0c\u5e76\u4ee5\u4ea4\u53c9\u8868\u7f51\u683c\u663e\u793a\u7ed3\u679c\u3002\u67e5\u8be2\u5fc5\u987b\u8fd4\u56de\u81f3\u5c11\u4e09\u5217\u3002\u7531<em class=\"replaceable\"><code>colV</code></em>\u6807\u8bc6\u7684\u8f93\u51fa\u5217\u6210\u4e3a\u7eb5\u5411\u8868\u5934\uff0c\u7531<em class=\"replaceable\"><code>colH</code></em>\u6807\u8bc6\u7684\u8f93\u51fa\u5217\u6210\u4e3a\u6a2a\u5411\u8868\u5934\u3002<em class=\"replaceable\"><code>colD</code></em>\u6807\u8bc6\u8981\u5728\u7f51\u683c\u4e2d\u663e\u793a\u7684\u8f93\u51fa\u5217\u3002<em class=\"replaceable\"><code>sortcolH</code></em>\u6807\u8bc6\u6a2a\u5411\u8868\u5934\u7684\u53ef\u9009\u6392\u5e8f\u5217\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a\u5217\u6307\u5b9a\u9879\u53ef\u4ee5\u662f\u4ece 1 \u5f00\u59cb\u7684\u5217\u53f7\uff0c\u4e5f\u53ef\u4ee5\u662f\u5217\u540d\uff1b\u5217\u540d\u9075\u5faa\u5e38\u89c4 SQL \u5927\u5c0f\u5199\u6298\u53e0\u548c\u5f15\u53f7\u89c4\u5219\u3002\u7701\u7565\u65f6\uff0ccolV \u9ed8\u8ba4\u4e3a\u7b2c 1 \u5217\uff0ccolH \u9ed8\u8ba4\u4e3a\u7b2c 2 \u5217\u3002colH \u5fc5\u987b\u4e0e colV \u4e0d\u540c\u3002\u82e5\u4e0d\u6307\u5b9a colD\uff0c\u67e5\u8be2\u7ed3\u679c\u5fc5\u987b\u6070\u6709\u4e09\u5217\uff0c\u65e2\u975e colV \u4e5f\u975e colH \u7684\u90a3\u4e00\u5217\u4f5c\u4e3a colD\u3002</p>\n<p lang=\"zh\">\u7eb5\u5411\u8868\u5934\u663e\u793a\u4e3a\u6700\u5de6\u5217\uff0c\u5305\u542b<em class=\"replaceable\"><code>colV</code></em>\u5217\u4e2d\u7684\u503c\uff0c\u5176\u987a\u5e8f\u4e0e\u67e5\u8be2\u7ed3\u679c\u4e2d\u76f8\u540c\uff0c\u4f46\u4f1a\u79fb\u9664\u91cd\u590d\u503c\u3002</p>\n<p lang=\"zh\">\u6a2a\u5411\u8868\u5934\u663e\u793a\u4e3a\u7b2c\u4e00\u884c\uff0c\u5305\u542b<em class=\"replaceable\"><code>colH</code></em>\u5217\u4e2d\u7684\u503c\uff0c\u5e76\u79fb\u9664\u91cd\u590d\u503c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4eec\u6309\u67e5\u8be2\u7ed3\u679c\u4e2d\u7684\u76f8\u540c\u987a\u5e8f\u663e\u793a\u3002\u4f46\u5982\u679c\u7ed9\u51fa\u4e86\u53ef\u9009\u7684<em class=\"replaceable\"><code>sortcolH</code></em>\u53c2\u6570\uff0c\u5b83\u6240\u6807\u8bc6\u7684\u5217\u7684\u503c\u5fc5\u987b\u662f\u6574\u6570\uff0c\u800c<em class=\"replaceable\"><code>colH</code></em>\u4e2d\u7684\u503c\u4f1a\u6309\u7167\u5bf9\u5e94\u7684<em class=\"replaceable\"><code>sortcolH</code></em>\u503c\u6392\u5e8f\u540e\u663e\u793a\u5728\u6a2a\u5411\u8868\u5934\u4e2d\u3002</p>\n<p lang=\"zh\">\u4ea4\u53c9\u8868\u4e2d\uff0c\u5bf9\u4e8e colH \u7684\u6bcf\u4e2a\u4e0d\u540c\u503c x \u548c colV \u7684\u6bcf\u4e2a\u4e0d\u540c\u503c y\uff0c\u4ea4\u70b9 (x,y) \u7684\u5355\u5143\u683c\u4fdd\u5b58\u67e5\u8be2\u7ed3\u679c\u4e2d colH=x \u4e14 colV=y \u90a3\u4e00\u884c\u7684 colD \u503c\u3002\u6ca1\u6709\u5339\u914d\u884c\u65f6\u5355\u5143\u683c\u4e3a\u7a7a\uff1b\u5b58\u5728\u591a\u884c\u65f6\u4f1a\u62a5\u9519\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\d[S+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5bf9\u4e8e\u6bcf\u4e2a\u5339\u914d<em class=\"replaceable\"><code>pattern</code></em>\u7684\u5173\u7cfb\uff08\u8868\u3001\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u7d22\u5f15\u3001\u5e8f\u5217\u6216\u5916\u90e8\u8868\uff09\u6216\u590d\u5408\u7c7b\u578b\uff0c\u663e\u793a\u6240\u6709\u5217\u53ca\u5176\u7c7b\u578b\u3001\u8868\u7a7a\u95f4\uff08\u5982\u679c\u4e0d\u662f\u9ed8\u8ba4\u8868\u7a7a\u95f4\uff09\uff0c\u4ee5\u53ca<code class=\"literal\">NOT NULL</code>\u6216\u9ed8\u8ba4\u503c\u7b49\u7279\u6b8a\u5c5e\u6027\u3002\u8fd8\u4f1a\u663e\u793a\u5173\u8054\u7684\u7d22\u5f15\u3001\u7ea6\u675f\u3001\u89c4\u5219\u548c\u89e6\u53d1\u5668\u3002\u5bf9\u4e8e\u5916\u90e8\u8868\uff0c\u8fd8\u4f1a\u663e\u793a\u5173\u8054\u7684\u5916\u90e8\u670d\u52a1\u5668\u3002\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u5339\u914d\u6a21\u5f0f</span>\u201d</span>\u7684\u5b9a\u4e49\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"\u6a21\u5f0f\">\u6a21\u5f0f</a>\u3002\uff09</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u67d0\u4e9b\u5173\u7cfb\u7c7b\u578b\uff0c<code class=\"literal\">\\d</code>\u4f1a\u4e3a\u6bcf\u5217\u663e\u793a\u9644\u52a0\u4fe1\u606f\uff1a\u5e8f\u5217\u7684\u5217\u503c\u3001\u7d22\u5f15\u7684\u7d22\u5f15\u8868\u8fbe\u5f0f\uff0c\u4ee5\u53ca\u5916\u90e8\u8868\u7684\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u9009\u9879\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">\\d+</code>\u5f62\u5f0f\u7684\u547d\u4ee4\u4e0e\u4e4b\u76f8\u540c\uff0c\u4f46\u4f1a\u663e\u793a\u66f4\u591a\u4fe1\u606f\uff1a\u8868\u5404\u5217\u5173\u8054\u7684\u6ce8\u91ca\u3001\u8868\u4e2d\u662f\u5426\u5b58\u5728 OID\u3001\u89c6\u56fe\u5b9a\u4e49\uff08\u5982\u679c\u5173\u7cfb\u662f\u89c6\u56fe\uff09\uff0c\u4ee5\u53ca\u975e\u9ed8\u8ba4\u7684<a class=\"link\" href=\"/docs/12/sql-altertable.html#SQL-CREATETABLE-REPLICA-IDENTITY\">\u590d\u5236\u6807\u8bc6</a>\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528<code class=\"command\">\\d</code>\u800c\u6ca1\u6709<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\uff0c\u5b83\u7b49\u540c\u4e8e<code class=\"command\">\\dtvmsE</code>\uff0c\u5b83\u5c06\u663e\u793a\u6240\u6709\u53ef\u89c1\u7684\u8868\u3001\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u7684\u5217\u8868\u3002\u8fd9\u7eaf\u7cb9\u662f\u4e00\u79cd\u4fbf\u5229\u63aa\u65bd\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\da[S] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u805a\u5408\u51fd\u6570\uff0c\u4ee5\u53ca\u5b83\u4eec\u7684\u8fd4\u56de\u7c7b\u578b\u548c\u6240\u4f5c\u7528\u7684\u6570\u636e\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u805a\u5408\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dA[+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8bbf\u95ee\u65b9\u6cd5\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bbf\u95ee\u65b9\u6cd5\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u8bbf\u95ee\u65b9\u6cd5\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u7684\u5904\u7406\u5668\u51fd\u6570\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\db[+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8868\u7a7a\u95f4\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8868\u7a7a\u95f4\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u8868\u7a7a\u95f4\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u9009\u9879\u3001\u78c1\u76d8\u5927\u5c0f\u3001\u6743\u9650\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dc[S+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5b57\u7b26\u96c6\u7f16\u7801\u4e4b\u95f4\u7684\u8f6c\u6362\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8f6c\u6362\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dC[+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u7c7b\u578b\u8f6c\u6362\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u6e90\u7c7b\u578b\u6216\u76ee\u6807\u7c7b\u578b\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u7c7b\u578b\u8f6c\u6362\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u5217\u51fa\u6bcf\u4e2a\u5bf9\u8c61\u5173\u8054\u7684\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dd[S] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u663e\u793a\u7c7b\u578b\u4e3a<code class=\"literal\">constraint</code>\u3001<code class=\"literal\">operator class</code>\u3001<code class=\"literal\">operator family</code>\u3001<code class=\"literal\">rule</code>\u548c<code class=\"literal\">trigger</code>\u7684\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002\u5176\u4ed6\u6240\u6709\u6ce8\u91ca\u90fd\u53ef\u4ee5\u901a\u8fc7\u76f8\u5e94\u5bf9\u8c61\u7c7b\u578b\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u67e5\u770b\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">\\dd</code>\u663e\u793a\u5339\u914d<em class=\"replaceable\"><code>pattern</code></em>\u7684\u5bf9\u8c61\u7684\u63cf\u8ff0\uff1b\u5982\u679c\u6ca1\u6709\u7ed9\u51fa\u53c2\u6570\uff0c\u5219\u663e\u793a\u9002\u5f53\u7c7b\u578b\u7684\u53ef\u89c1\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002\u4f46\u65e0\u8bba\u54ea\u79cd\u60c5\u51b5\uff0c\u90fd\u53ea\u5217\u51fa\u6709\u63cf\u8ff0\u7684\u5bf9\u8c61\u3002\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528<a class=\"xref\" href=\"/docs/12/sql-comment.html\" title=\"COMMENT\"><span class=\"refentrytitle\">COMMENT</span></a> <acronym class=\"acronym\">SQL</acronym> \u547d\u4ee4\u521b\u5efa\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dD[S+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u57df\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u57df\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u6743\u9650\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\ddp [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u9ed8\u8ba4\u8bbf\u95ee\u6743\u9650\u8bbe\u7f6e\u3002\u5bf9\u4e8e\u9ed8\u8ba4\u6743\u9650\u8bbe\u7f6e\u5df2\u504f\u79bb\u5185\u7f6e\u9ed8\u8ba4\u503c\u7684\u6bcf\u4e2a\u89d2\u8272\uff08\u4ee5\u53ca\u6a21\u5f0f\uff0c\u5982\u679c\u9002\u7528\uff09\uff0c\u90fd\u4f1a\u663e\u793a\u4e00\u4e2a\u6761\u76ee\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u89d2\u8272\u540d\u6216\u6a21\u5f0f\u540d\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6761\u76ee\u3002</p>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/12/sql-alterdefaultprivileges.html\" title=\"ALTER DEFAULT PRIVILEGES\"><span class=\"refentrytitle\">ALTER DEFAULT PRIVILEGES</span></a>\u547d\u4ee4\u7528\u4e8e\u8bbe\u7f6e\u9ed8\u8ba4\u8bbf\u95ee\u6743\u9650\u3002\u6743\u9650\u663e\u793a\u7684\u542b\u4e49\u5728<a class=\"xref\" href=\"/docs/12/ddl-priv.html\" title=\"5.7.\u00a0\u6743\u9650\">\u7b2c\u00a05.7\u00a0\u8282</a>\u4e2d\u6709\u89e3\u91ca\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dE[S+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\di[S+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dm[S+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\ds[S+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dt[S+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dv[S+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd9\u7ec4\u547d\u4ee4\u4e2d\uff0c\u5b57\u6bcd<code class=\"literal\">E</code>\u3001<code class=\"literal\">i</code>\u3001<code class=\"literal\">m</code>\u3001<code class=\"literal\">s</code>\u3001<code class=\"literal\">t</code>\u548c<code class=\"literal\">v</code>\u5206\u522b\u4ee3\u8868\u5916\u90e8\u8868\u3001\u7d22\u5f15\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u3001\u8868\u548c\u89c6\u56fe\u3002\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u6307\u5b9a\u8fd9\u4e9b\u5b57\u6bcd\u4e2d\u7684\u4efb\u610f\u4e00\u4e2a\u6216\u5168\u90e8\uff0c\u4ee5\u83b7\u53d6\u76f8\u5e94\u7c7b\u578b\u7684\u5bf9\u8c61\u5217\u8868\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dit</code>\u5217\u51fa\u7d22\u5f15\u548c\u8868\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u5217\u51fa\u6bcf\u4e2a\u5bf9\u8c61\u7684\u78c1\u76d8\u4e0a\u7684\u7269\u7406\u5927\u5c0f\u4ee5\u53ca\u5173\u8054\u7684\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u5bf9\u8c61\u3002\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\des[+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u670d\u52a1\u5668\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external servers</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u670d\u52a1\u5668\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\des+</code>\u5f62\u5f0f\uff0c\u5219\u663e\u793a\u6bcf\u4e2a\u670d\u52a1\u5668\u7684\u5b8c\u6574\u8bf4\u660e\uff0c\u5305\u62ec\u670d\u52a1\u5668\u7684\u8bbf\u95ee\u6743\u9650\u3001\u7c7b\u578b\u3001\u7248\u672c\u3001\u9009\u9879\u548c\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\det[+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u8868\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external tables</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u8868\u540d\u6216\u6a21\u5f0f\u540d\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6761\u76ee\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\det+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u901a\u7528\u9009\u9879\u548c\u5916\u90e8\u8868\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\deu[+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u7528\u6237\u6620\u5c04\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external users</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u7528\u6237\u540d\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6620\u5c04\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\deu+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u6620\u5c04\u7684\u9644\u52a0\u4fe1\u606f\u3002</p>\n<div class=\"caution\">\n<h3 class=\"title\" lang=\"zh\">\u5c0f\u5fc3</h3>\n<p lang=\"zh\"><code class=\"literal\">\\deu+</code>\u8fd8\u53ef\u80fd\u663e\u793a\u8fdc\u7a0b\u7528\u6237\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u56e0\u6b64\u5e94\u6ce8\u610f\u4e0d\u8981\u6cc4\u9732\u5b83\u4eec\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dew[+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external wrappers</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dew+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u7684\u8bbf\u95ee\u6743\u9650\u3001\u9009\u9879\u548c\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\df[anptwS+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u51fd\u6570\u53ca\u5176\u7ed3\u679c\u6570\u636e\u7c7b\u578b\u3001\u53c2\u6570\u6570\u636e\u7c7b\u578b\u548c\u51fd\u6570\u7c7b\u578b\u3002\u51fd\u6570\u7c7b\u578b\u5206\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">agg</span>\u201d</span>\uff08\u805a\u5408\uff09\u3001<span class=\"quote\">\u201c<span class=\"quote\">normal</span>\u201d</span>\u3001<span class=\"quote\">\u201c<span class=\"quote\">procedure</span>\u201d</span>\u3001<span class=\"quote\">\u201c<span class=\"quote\">trigger</span>\u201d</span>\u6216<span class=\"quote\">\u201c<span class=\"quote\">window</span>\u201d</span>\u3002\u8981\u4ec5\u663e\u793a\u7279\u5b9a\u7c7b\u578b\u7684\u51fd\u6570\uff0c\u53ef\u5728\u547d\u4ee4\u4e2d\u6dfb\u52a0\u5bf9\u5e94\u7684\u5b57\u6bcd<code class=\"literal\">a</code>\u3001<code class=\"literal\">n</code>\u3001<code class=\"literal\">p</code>\u3001<code class=\"literal\">t</code>\u6216<code class=\"literal\">w</code>\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u51fd\u6570\u3002\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\df+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u51fd\u6570\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u6613\u53d8\u6027\u3001\u5e76\u884c\u5b89\u5168\u6027\u3001\u62e5\u6709\u8005\u3001\u5b89\u5168\u5206\u7c7b\u3001\u8bbf\u95ee\u6743\u9650\u3001\u8bed\u8a00\u3001\u6e90\u4ee3\u7801\u548c\u63cf\u8ff0\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8981\u67e5\u627e\u63a5\u53d7\u7279\u5b9a\u6570\u636e\u7c7b\u578b\u53c2\u6570\u6216\u8fd4\u56de\u7279\u5b9a\u6570\u636e\u7c7b\u578b\u503c\u7684\u51fd\u6570\uff0c\u8bf7\u4f7f\u7528\u5206\u9875\u5668\u7684\u641c\u7d22\u529f\u80fd\u6d4f\u89c8<code class=\"literal\">\\df</code>\u8f93\u51fa\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dF[+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u914d\u7f6e\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u914d\u7f6e\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dF+</code>\u5f62\u5f0f\uff0c\u5219\u663e\u793a\u6bcf\u4e2a\u914d\u7f6e\u7684\u5b8c\u6574\u8bf4\u660e\uff0c\u5305\u62ec\u5e95\u5c42\u5168\u6587\u68c0\u7d22\u89e3\u6790\u5668\u548c\u6bcf\u79cd\u89e3\u6790\u5668\u8bcd\u5143\u7c7b\u578b\u7684\u8bcd\u5178\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dFd[+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u8bcd\u5178\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bcd\u5178\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dFd+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u9009\u4e2d\u8bcd\u5178\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5e95\u5c42\u5168\u6587\u68c0\u7d22\u6a21\u677f\u548c\u9009\u9879\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dFp[+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u89e3\u6790\u5668\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u89e3\u6790\u5668\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dFp+</code>\u5f62\u5f0f\uff0c\u5219\u663e\u793a\u6bcf\u4e2a\u89e3\u6790\u5668\u7684\u5b8c\u6574\u8bf4\u660e\uff0c\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u548c\u53ef\u8bc6\u522b\u7684\u8bcd\u5143\u7c7b\u578b\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dFt[+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u6a21\u677f\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6a21\u677f\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dFt+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u6a21\u677f\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dg[S+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u5e93\u89d2\u8272\u3002\uff08\u7531\u4e8e<span class=\"quote\">\u201c<span class=\"quote\">\u7528\u6237</span>\u201d</span>\u548c<span class=\"quote\">\u201c<span class=\"quote\">\u7ec4</span>\u201d</span>\u7684\u6982\u5ff5\u5df2\u7ecf\u7edf\u4e00\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">\u89d2\u8272</span>\u201d</span>\uff0c\u6b64\u547d\u4ee4\u73b0\u5728\u7b49\u4ef7\u4e8e<code class=\"literal\">\\du</code>\u3002\uff09\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u89d2\u8272\uff1b\u63d0\u4f9b<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u89d2\u8272\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u89d2\u8272\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dg+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u89d2\u8272\u7684\u9644\u52a0\u4fe1\u606f\uff1b\u76ee\u524d\u4f1a\u589e\u52a0\u6bcf\u4e2a\u89d2\u8272\u7684\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dl</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u662f<code class=\"command\">\\lo_list</code>\u7684\u522b\u540d\uff0c\u7528\u4e8e\u663e\u793a\u5927\u5bf9\u8c61\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dL[S+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8fc7\u7a0b\u8bed\u8a00\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bed\u8a00\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u8bed\u8a00\uff1b\u63d0\u4f9b <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u79cd\u8bed\u8a00\u90fd\u4f1a\u8fde\u540c\u5176\u8c03\u7528\u5904\u7406\u5668\u3001\u9a8c\u8bc1\u5668\u3001\u8bbf\u95ee\u6743\u9650\u4ee5\u53ca\u5b83\u662f\u5426\u4e3a\u7cfb\u7edf\u5bf9\u8c61\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dn[S+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6a21\u5f0f\uff08\u547d\u540d\u7a7a\u95f4\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6a21\u5f0f\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u6743\u9650\u548c\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\do[S+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u64cd\u4f5c\u7b26\u53ca\u5176\u64cd\u4f5c\u6570\u7c7b\u578b\u548c\u7ed3\u679c\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u64cd\u4f5c\u7b26\u3002\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u76ee\u524d\u53ea\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dO[S+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6392\u5e8f\u89c4\u5219\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6392\u5e8f\u89c4\u5219\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u6392\u5e8f\u89c4\u5219\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u4e00\u8d77\u5217\u51fa\u3002\u8bf7\u6ce8\u610f\uff0c\u53ea\u4f1a\u663e\u793a\u4e0e\u5f53\u524d\u6570\u636e\u5e93\u7f16\u7801\u517c\u5bb9\u7684\u6392\u5e8f\u89c4\u5219\uff0c\u56e0\u6b64\u5728\u540c\u4e00\u5b89\u88c5\u4e2d\u7684\u4e0d\u540c\u6570\u636e\u5e93\u91cc\u7ed3\u679c\u53ef\u80fd\u4e0d\u540c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dp [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u53ca\u5176\u5173\u8054\u7684\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u3002</p>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/12/sql-grant.html\" title=\"GRANT\"><span class=\"refentrytitle\">GRANT</span></a>\u548c<a class=\"xref\" href=\"/docs/12/sql-revoke.html\" title=\"REVOKE\"><span class=\"refentrytitle\">REVOKE</span></a>\u547d\u4ee4\u7528\u4e8e\u8bbe\u7f6e\u8bbf\u95ee\u6743\u9650\u3002\u6743\u9650\u663e\u793a\u7684\u542b\u4e49\u5728<a class=\"xref\" href=\"/docs/12/ddl-priv.html\" title=\"5.7.\u00a0\u6743\u9650\">\u7b2c\u00a05.7\u00a0\u8282</a>\u4e2d\u6709\u89e3\u91ca\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dP[itn+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5206\u533a\u5173\u7cfb\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6761\u76ee\u3002\u53ef\u4ee5\u5728\u547d\u4ee4\u540e\u9644\u52a0\u4fee\u9970\u7b26<code class=\"literal\">t</code>\uff08\u8868\uff09\u548c<code class=\"literal\">i</code>\uff08\u7d22\u5f15\uff09\uff0c\u7b5b\u9009\u8981\u5217\u51fa\u7684\u5173\u7cfb\u7c7b\u578b\u3002\u9ed8\u8ba4\u4f1a\u5217\u51fa\u5206\u533a\u8868\u548c\u5206\u533a\u7d22\u5f15\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528\u4e86\u4fee\u9970\u7b26<code class=\"literal\">n</code>\uff08<span class=\"quote\">\u201c<span class=\"quote\">nested</span>\u201d</span>\uff09\uff0c\u6216\u6307\u5b9a\u4e86\u6a21\u5f0f\uff0c\u5219\u4f1a\u5305\u542b\u975e\u6839\u5206\u533a\u5173\u7cfb\uff0c\u5e76\u663e\u793a\u4e00\u5217\uff0c\u5217\u51fa\u6bcf\u4e2a\u5206\u533a\u5173\u7cfb\u7684\u7236\u5173\u7cfb\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u5173\u7cfb\u7684\u5404\u4e2a\u5206\u533a\u7684\u5927\u5c0f\u4e4b\u548c\uff0c\u4ee5\u53ca\u8be5\u5173\u7cfb\u7684\u63cf\u8ff0\u3002\u5982\u679c\u5c06<code class=\"literal\">n</code>\u4e0e<code class=\"literal\">+</code>\u7ed3\u5408\u4f7f\u7528\uff0c\u5219\u663e\u793a\u4e24\u4e2a\u5927\u5c0f\uff1a\u4e00\u4e2a\u662f\u76f4\u63a5\u9644\u52a0\u7684\u53f6\u5b50\u5206\u533a\u7684\u603b\u5927\u5c0f\uff0c\u53e6\u4e00\u4e2a\u662f\u6240\u6709\u5206\u533a\u7684\u603b\u5927\u5c0f\uff0c\u5305\u62ec\u95f4\u63a5\u9644\u52a0\u7684\u5b50\u5206\u533a\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\drds [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>role-pattern</code></em></a> [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>database-pattern</code></em></a> ] ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5df2\u5b9a\u4e49\u7684\u914d\u7f6e\u8bbe\u7f6e\u3002\u8fd9\u4e9b\u8bbe\u7f6e\u53ef\u4ee5\u7279\u5b9a\u4e8e\u89d2\u8272\u3001\u7279\u5b9a\u4e8e\u6570\u636e\u5e93\uff0c\u6216\u540c\u65f6\u7279\u5b9a\u4e8e\u4e24\u8005\u3002<em class=\"replaceable\"><code>role-pattern</code></em>\u548c<em class=\"replaceable\"><code>database-pattern</code></em>\u5206\u522b\u7528\u4e8e\u9009\u62e9\u8981\u5217\u51fa\u7684\u89d2\u8272\u548c\u6570\u636e\u5e93\u3002\u7701\u7565\u67d0\u4e2a\u6a21\u5f0f\u53c2\u6570\u6216\u5c06\u5176\u6307\u5b9a\u4e3a<code class=\"literal\">*</code>\u65f6\uff0c\u4e0d\u4f1a\u6309\u8be5\u53c2\u6570\u7b5b\u9009\uff0c\u8fd8\u4f1a\u5206\u522b\u5305\u542b\u4e0d\u7279\u5b9a\u4e8e\u89d2\u8272\u6216\u4e0d\u7279\u5b9a\u4e8e\u6570\u636e\u5e93\u7684\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/12/sql-alterrole.html\" title=\"ALTER ROLE\"><span class=\"refentrytitle\">ALTER ROLE</span></a>\u548c<a class=\"xref\" href=\"/docs/12/sql-alterdatabase.html\" title=\"ALTER DATABASE\"><span class=\"refentrytitle\">ALTER DATABASE</span></a>\u547d\u4ee4\u7528\u4e8e\u5b9a\u4e49\u89d2\u8272\u4e13\u5c5e\u548c\u6570\u636e\u5e93\u4e13\u5c5e\u7684\u914d\u7f6e\u8bbe\u7f6e\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dRp[+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u590d\u5236\u53d1\u5e03\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u53d1\u5e03\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u663e\u793a\u4e0e\u6bcf\u4e2a\u53d1\u5e03\u5173\u8054\u7684\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dRs[+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u903b\u8f91\u590d\u5236\u8ba2\u9605\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8ba2\u9605\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u8ba2\u9605\u7684\u5176\u4ed6\u5c5e\u6027\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dT[S+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u7c7b\u578b\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u7c7b\u578b\u90fd\u4f1a\u8fde\u540c\u5176\u5185\u90e8\u540d\u79f0\u3001\u5927\u5c0f\u4ee5\u53ca\u76f8\u5173\u6743\u9650\u4e00\u8d77\u5217\u51fa\uff1b\u5bf9\u4e8e <code class=\"type\">enum</code> \u7c7b\u578b\uff0c\u8fd8\u4f1a\u663e\u793a\u5176\u5141\u8bb8\u503c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\du[S+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u5e93\u89d2\u8272\u3002\uff08\u7531\u4e8e<span class=\"quote\">\u201c<span class=\"quote\">\u7528\u6237</span>\u201d</span>\u548c<span class=\"quote\">\u201c<span class=\"quote\">\u7ec4</span>\u201d</span>\u7684\u6982\u5ff5\u5df2\u7ecf\u7edf\u4e00\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">\u89d2\u8272</span>\u201d</span>\uff0c\u6b64\u547d\u4ee4\u73b0\u5728\u7b49\u4ef7\u4e8e<code class=\"literal\">\\dg</code>\u3002\uff09\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u89d2\u8272\uff1b\u63d0\u4f9b<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u89d2\u8272\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u89d2\u8272\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\du+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u89d2\u8272\u7684\u9644\u52a0\u4fe1\u606f\uff1b\u76ee\u524d\u4f1a\u589e\u52a0\u6bcf\u4e2a\u89d2\u8272\u7684\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dx[+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5df2\u5b89\u88c5\u7684\u6269\u5c55\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6269\u5c55\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dx+</code>\u5f62\u5f0f\uff0c\u5219\u5217\u51fa\u5c5e\u4e8e\u6bcf\u4e2a\u5339\u914d\u6269\u5c55\u7684\u6240\u6709\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dy[+] [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u4e8b\u4ef6\u89e6\u53d1\u5668\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u4e8b\u4ef6\u89e6\u53d1\u5668\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\e</code> \u6216 <code class=\"literal\">\\edit</code> <code class=\"literal\">[ <span class=\"optional\"><em class=\"replaceable\"><code>filename</code></em></span> ] [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5219\u7f16\u8f91\u8be5\u6587\u4ef6\uff1b\u7f16\u8f91\u5668\u9000\u51fa\u540e\uff0c\u5c06\u6587\u4ef6\u5185\u5bb9\u590d\u5236\u5230\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u3002\u5982\u679c\u672a\u7ed9\u51fa<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5219\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u590d\u5236\u5230\u4e34\u65f6\u6587\u4ef6\uff0c\u518d\u4ee5\u76f8\u540c\u65b9\u5f0f\u7f16\u8f91\u3002\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u5c06\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u590d\u5236\u5230\u4e34\u65f6\u6587\u4ef6\uff0c\u5e76\u4ee5\u76f8\u540c\u65b9\u5f0f\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u968f\u540e\uff0c\u6309\u7167<span class=\"application\">psql</span>\u7684\u6b63\u5e38\u89c4\u5219\u91cd\u65b0\u89e3\u6790\u67e5\u8be2\u7f13\u51b2\u533a\u7684\u65b0\u5185\u5bb9\uff0c\u5c06\u6574\u4e2a\u7f13\u51b2\u533a\u89c6\u4e3a\u4e00\u884c\u3002\u4efb\u4f55\u5b8c\u6574\u7684\u67e5\u8be2\u90fd\u4f1a\u7acb\u5373\u6267\u884c\uff1b\u4e5f\u5c31\u662f\u8bf4\uff0c\u5982\u679c\u67e5\u8be2\u7f13\u51b2\u533a\u5305\u542b\u5206\u53f7\u6216\u4ee5\u5206\u53f7\u7ed3\u675f\uff0c\u5c31\u4f1a\u6267\u884c\u5230\u8be5\u4f4d\u7f6e\u4e3a\u6b62\u7684\u6240\u6709\u5185\u5bb9\u3002\u5269\u4f59\u5185\u5bb9\u4f1a\u5728\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u7b49\u5f85\uff1b\u952e\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u952e\u5165<code class=\"literal\">\\r</code>\u6e05\u7a7a\u67e5\u8be2\u7f13\u51b2\u533a\u4ee5\u53d6\u6d88\u5b83\u3002\u5c06\u7f13\u51b2\u533a\u89c6\u4e3a\u4e00\u884c\u4e3b\u8981\u5f71\u54cd\u5143\u547d\u4ee4\uff1a\u7f13\u51b2\u533a\u4e2d\u4f4d\u4e8e\u5143\u547d\u4ee4\u4e4b\u540e\u7684\u6240\u6709\u5185\u5bb9\u90fd\u4f1a\u88ab\u89c6\u4e3a\u8be5\u5143\u547d\u4ee4\u7684\u53c2\u6570\uff0c\u5373\u4f7f\u5b83\u4eec\u8de8\u8d8a\u591a\u884c\u4e5f\u662f\u5982\u6b64\u3002\uff08\u56e0\u6b64\uff0c\u4e0d\u80fd\u7528\u8fd9\u79cd\u65b9\u5f0f\u7f16\u5199\u4f7f\u7528\u5143\u547d\u4ee4\u7684\u811a\u672c\u3002\u5e94\u4f7f\u7528<code class=\"command\">\\i</code>\u6765\u5904\u7406\u8fd9\u7c7b\u811a\u672c\u3002\uff09</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u4f1a\u5c06\u5149\u6807\u5b9a\u4f4d\u5230\u6587\u4ef6\u6216\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u7684\u6307\u5b9a\u884c\u3002\u8bf7\u6ce8\u610f\uff0c\u5982\u679c\u53ea\u7ed9\u51fa\u4e00\u4e2a\u5168\u7531\u6570\u5b57\u7ec4\u6210\u7684\u53c2\u6570\uff0c<span class=\"application\">psql</span>\u4f1a\u5047\u5b9a\u5b83\u662f\u884c\u53f7\uff0c\u800c\u4e0d\u662f\u6587\u4ef6\u540d\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u6709\u5173\u5982\u4f55\u914d\u7f6e\u548c\u5b9a\u5236\u7f16\u8f91\u5668\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/12/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"\u73af\u5883\">\u73af\u5883</a>\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\echo <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u53c2\u6570\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff0c\u53c2\u6570\u4e4b\u95f4\u7528\u4e00\u4e2a\u7a7a\u683c\u5206\u9694\uff0c\u672b\u5c3e\u8ddf\u968f\u6362\u884c\u7b26\u3002\u8fd9\u53ef\u7528\u4e8e\u5728\u811a\u672c\u8f93\u51fa\u4e2d\u63d2\u5165\u4fe1\u606f\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>\\echo `date`</code></strong>\nTue Oct 26 21:40:57 CEST 1999\n</pre>\n<p lang=\"zh\">\u5982\u679c\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f\u672a\u52a0\u5f15\u53f7\u7684<code class=\"literal\">-n</code>\uff0c\u5219\u4e0d\u8f93\u51fa\u672b\u5c3e\u7684\u6362\u884c\u7b26\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528<code class=\"command\">\\o</code>\u547d\u4ee4\u91cd\u5b9a\u5411\u67e5\u8be2\u8f93\u51fa\uff0c\u53ef\u80fd\u4f1a\u60f3\u7528<code class=\"command\">\\qecho</code>\u4ee3\u66ff\u8fd9\u4e2a\u547d\u4ee4\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\ef [ <span class=\"optional\"><em class=\"replaceable\"><code>function_description</code></em> [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</span> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u7f16\u8f91\u6307\u5b9a\u51fd\u6570\u6216\u8fc7\u7a0b\u7684\u5b9a\u4e49\uff0c\u5f62\u5f0f\u4e3a<code class=\"command\">CREATE OR REPLACE FUNCTION</code>\u6216 <code class=\"command\">CREATE OR REPLACE PROCEDURE</code>\u547d\u4ee4\u3002\u7f16\u8f91\u65b9\u5f0f\u4e0e<code class=\"literal\">\\edit</code>\u76f8\u540c\u3002\u7f16\u8f91\u5668\u9000\u51fa\u540e\uff0c\u66f4\u65b0\u540e\u7684\u547d\u4ee4\u4f1a\u5728\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u7b49\u5f85\uff1b\u952e\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u7528<code class=\"literal\">\\r</code>\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u76ee\u6807\u51fd\u6570\u53ef\u4ec5\u7528\u540d\u79f0\u6307\u5b9a\uff0c\u4e5f\u53ef\u7528\u540d\u79f0\u548c\u53c2\u6570\u6307\u5b9a\uff0c\u4f8b\u5982 foo(integer, text)\u3002\u82e5\u6709\u591a\u4e2a\u540c\u540d\u51fd\u6570\uff0c\u5219\u5fc5\u987b\u63d0\u4f9b\u53c2\u6570\u7c7b\u578b\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u51fd\u6570\uff0c\u5219\u4f1a\u5448\u73b0\u4e00\u4e2a\u7a7a\u7684<code class=\"command\">CREATE FUNCTION</code>\u6a21\u677f\u4f9b\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u4f1a\u5c06\u5149\u6807\u5b9a\u4f4d\u5230\u51fd\u6570\u4f53\u4e2d\u7684\u6307\u5b9a\u884c\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u51fd\u6570\u4f53\u901a\u5e38\u5e76\u4e0d\u4ece\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u5f00\u59cb\u3002\uff09</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\ef</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u6709\u5173\u5982\u4f55\u914d\u7f6e\u548c\u5b9a\u5236\u7f16\u8f91\u5668\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/12/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"\u73af\u5883\">\u73af\u5883</a>\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\encoding [ <em class=\"replaceable\"><code>encoding</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5ba2\u6237\u7aef\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u6ca1\u6709\u53c2\u6570\u65f6\uff0c\u6b64\u547d\u4ee4\u663e\u793a\u5f53\u524d\u7f16\u7801\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\errverbose</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ee5\u6700\u5927\u7684\u8be6\u7ec6\u7a0b\u5ea6\u91cd\u590d\u6700\u8fd1\u7684\u670d\u52a1\u5668\u9519\u8bef\u6d88\u606f\uff0c\u5c31\u597d\u50cf<code class=\"varname\">VERBOSITY</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">verbose</code>\uff0c<code class=\"varname\">SHOW_CONTEXT</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">always</code>\u4e00\u6837\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\ev [ <span class=\"optional\"><em class=\"replaceable\"><code>view_name</code></em> [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</span> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u7f16\u8f91\u6307\u5b9a\u89c6\u56fe\u7684\u5b9a\u4e49\uff0c\u5f62\u5f0f\u4e3a<code class=\"command\">CREATE OR REPLACE VIEW</code>\u547d\u4ee4\u3002\u7f16\u8f91\u65b9\u5f0f\u4e0e<code class=\"literal\">\\edit</code>\u76f8\u540c\u3002\u7f16\u8f91\u5668\u9000\u51fa\u540e\uff0c\u66f4\u65b0\u540e\u7684\u547d\u4ee4\u4f1a\u5728\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u7b49\u5f85\uff1b\u8f93\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u7528<code class=\"literal\">\\r</code>\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u89c6\u56fe\uff0c\u5219\u4f1a\u5448\u73b0\u4e00\u4e2a\u7a7a\u7684<code class=\"command\">CREATE VIEW</code>\u6a21\u677f\u4f9b\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u4f1a\u5c06\u5149\u6807\u5b9a\u4f4d\u5230\u89c6\u56fe\u5b9a\u4e49\u4e2d\u7684\u6307\u5b9a\u884c\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\ev</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\f [ <em class=\"replaceable\"><code>string</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u67e5\u8be2\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u9ed8\u8ba4\u503c\u662f\u7ad6\u7ebf\uff08<code class=\"literal\">|</code>\uff09\u3002\u5b83\u7b49\u540c\u4e8e<code class=\"command\">\\pset fieldsep</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\g [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\g [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u6267\u884c\u3002\u5982\u679c\u7ed9\u51fa\u53c2\u6570\uff0c\u67e5\u8be2\u8f93\u51fa\u4f1a\u5199\u5165\u6307\u5b9a\u6587\u4ef6\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u9012\u7ed9\u7ed9\u5b9a\u7684 shell \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u6309\u901a\u5e38\u65b9\u5f0f\u663e\u793a\u3002\u53ea\u6709\u67e5\u8be2\u6210\u529f\u8fd4\u56de\u96f6\u4e2a\u6216\u66f4\u591a\u5143\u7ec4\u65f6\uff0c\u624d\u4f1a\u5411\u6587\u4ef6\u6216\u547d\u4ee4\u5199\u5165\u5185\u5bb9\uff1b\u5982\u679c\u67e5\u8be2\u5931\u8d25\u6216 SQL \u547d\u4ee4\u4e0d\u8fd4\u56de\u6570\u636e\uff0c\u5219\u4e0d\u4f1a\u5199\u5165\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u5c06\u88ab\u91cd\u65b0\u6267\u884c\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u6ca1\u6709\u4efb\u4f55\u53c2\u6570\u7684<code class=\"literal\">\\g</code>\u57fa\u672c\u4e0a\u7b49\u540c\u4e8e\u4e00\u4e2a\u5206\u53f7\u3002\u5e26\u6709\u53c2\u6570\u7684<code class=\"literal\">\\g</code>\u63d0\u4f9b\u4e86\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u4e00\u6b21\u6027</span>\u201d</span>\u66ff\u4ee3<code class=\"command\">\\o</code>\u547d\u4ee4\u7684\u9009\u62e9\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\uff0c\u5219\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u7684\u5185\u5bb9\u53ea\u4f1a\u539f\u6837\u4f20\u9012\u7ed9 shell\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\gdesc</code></span></dt>\n<dd>\n<p lang=\"zh\">\u663e\u793a\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u67e5\u8be2\u7ed3\u679c\u7684\u63cf\u8ff0\uff08\u5373\u5217\u540d\u548c\u6570\u636e\u7c7b\u578b\uff09\u3002\u67e5\u8be2\u5e76\u4e0d\u4f1a\u5b9e\u9645\u6267\u884c\uff1b\u4e0d\u8fc7\uff0c\u5982\u679c\u5176\u4e2d\u5b58\u5728\u8bed\u6cd5\u9519\u8bef\uff0c\u4f1a\u6309\u901a\u5e38\u7684\u65b9\u5f0f\u62a5\u544a\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6539\u4e3a\u63cf\u8ff0\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\gexec</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u7136\u540e\u628a\u67e5\u8be2\u8f93\u51fa\uff08\u5982\u679c\u6709\uff09\u7684\u6bcf\u4e00\u884c\u7684\u6bcf\u4e00\u5217\u89c6\u4e3a\u8981\u6267\u884c\u7684 SQL \u8bed\u53e5\u3002\u4f8b\u5982\uff0c\u4e0b\u9762\u4e3a\u6bcf\u4e00\u5217\u521b\u5efa\u4e00\u4e2a\u7d22\u5f15\uff0c\u76ee\u6807\u8868\u662f <code class=\"structname\">my_table</code>\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT format('create index on my_table(%I)', attname)</code></strong>\n-&gt; <strong class=\"userinput\"><code>FROM pg_attribute</code></strong>\n-&gt; <strong class=\"userinput\"><code>WHERE attrelid = 'my_table'::regclass AND attnum &gt; 0</code></strong>\n-&gt; <strong class=\"userinput\"><code>ORDER BY attnum</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gexec</code></strong>\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\n</pre>\n<p lang=\"zh\">\u751f\u6210\u7684\u67e5\u8be2\u6309\u8fd4\u56de\u884c\u7684\u987a\u5e8f\u6267\u884c\uff1b\u540c\u4e00\u884c\u6709\u591a\u5217\u65f6\u4ece\u5de6\u5230\u53f3\u6267\u884c\uff0c\u5ffd\u7565 NULL \u5b57\u6bb5\u3002\u67e5\u8be2\u539f\u6837\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u56e0\u6b64\u4e0d\u80fd\u662f psql \u5143\u547d\u4ee4\uff0c\u4e5f\u4e0d\u80fd\u5305\u542b psql \u53d8\u91cf\u5f15\u7528\u3002\u9664\u975e\u8bbe\u7f6e ON_ERROR_STOP\uff0c\u67d0\u6761\u67e5\u8be2\u5931\u8d25\u540e\u4ecd\u7ee7\u7eed\u6267\u884c\u5176\u4f59\u67e5\u8be2\u3002\u6bcf\u6761\u67e5\u8be2\u5747\u9075\u5faa ECHO \u8bbe\u7f6e\uff08\u4f7f\u7528 \\gexec \u65f6\uff0c\u901a\u5e38\u5efa\u8bae\u5c06 ECHO \u8bbe\u4e3a all \u6216 queries\uff09\uff0c\u67e5\u8be2\u65e5\u5fd7\u3001\u5355\u6b65\u6a21\u5f0f\u3001\u8ba1\u65f6\u7b49\u6267\u884c\u529f\u80fd\u4e5f\u5206\u522b\u5e94\u7528\u4e8e\u6bcf\u6761\u751f\u6210\u7684\u67e5\u8be2\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\gset [ <em class=\"replaceable\"><code>prefix</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u5e76\u5c06\u67e5\u8be2\u8f93\u51fa\u5b58\u5165 <span class=\"application\">psql</span> \u53d8\u91cf\uff08\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/12/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\uff09\u3002\u8981\u6267\u884c\u7684\u67e5\u8be2\u5fc5\u987b\u6070\u597d\u8fd4\u56de\u4e00\u884c\u3002\u8be5\u884c\u7684\u6bcf\u4e00\u5217\u5206\u522b\u5b58\u5165\u4e00\u4e2a\u53d8\u91cf\uff0c\u53d8\u91cf\u540d\u4e0e\u5217\u540d\u76f8\u540c\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT 'hello' AS var1, 10 AS var2</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gset</code></strong>\n=&gt; <strong class=\"userinput\"><code>\\echo :var1 :var2</code></strong>\nhello 10\n</pre>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>prefix</code></em>\uff0c\u5219\u4f1a\u5c06\u8be5\u5b57\u7b26\u4e32\u52a0\u5230\u67e5\u8be2\u7684\u5217\u540d\u524d\u9762\uff0c\u4ee5\u6784\u6210\u8981\u4f7f\u7528\u7684\u53d8\u91cf\u540d\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT 'hello' AS var1, 10 AS var2</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gset result_</code></strong>\n=&gt; <strong class=\"userinput\"><code>\\echo :result_var1 :result_var2</code></strong>\nhello 10\n</pre>\n<p lang=\"zh\">\u5982\u679c\u67d0\u4e00\u5217\u7684\u7ed3\u679c\u4e3a NULL\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u5bf9\u5e94\u7684\u53d8\u91cf\uff0c\u800c\u4e0d\u662f\u8bbe\u7f6e\u5b83\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u67e5\u8be2\u5931\u8d25\u6216\u6ca1\u6709\u6070\u597d\u8fd4\u56de\u4e00\u884c\uff0c\u5219\u4e0d\u4f1a\u66f4\u6539\u4efb\u4f55\u53d8\u91cf\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\gx [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\gx [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"literal\">\\gx</code>\u7b49\u4ef7\u4e8e<code class=\"literal\">\\g</code>\uff0c\u4f46\u4f1a\u5bf9\u5f53\u524d\u67e5\u8be2\u5f3a\u5236\u4f7f\u7528\u6269\u5c55\u8f93\u51fa\u6a21\u5f0f\u3002\u53c2\u89c1<code class=\"literal\">\\x</code>\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\h</code> \u6216 <code class=\"literal\">\\help</code> <code class=\"literal\">[ <em class=\"replaceable\"><code>command</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u7ed9\u51fa\u6307\u5b9a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u7684\u8bed\u6cd5\u5e2e\u52a9\u3002\u5982\u679c\u672a\u6307\u5b9a<em class=\"replaceable\"><code>command</code></em>\uff0c\u5219<span class=\"application\">psql</span>\u5c06\u5217\u51fa\u6240\u6709\u53ef\u7528\u8bed\u6cd5\u5e2e\u52a9\u7684\u547d\u4ee4\u3002\u5982\u679c<em class=\"replaceable\"><code>command</code></em>\u662f\u661f\u53f7\uff08<code class=\"literal\">*</code>\uff09\uff0c\u5219\u663e\u793a\u6240\u6709<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u7684\u8bed\u6cd5\u5e2e\u52a9\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\help</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u4e3a\u4e86\u7b80\u5316\u8f93\u5165\uff0c\u7531\u591a\u4e2a\u5355\u8bcd\u7ec4\u6210\u7684\u547d\u4ee4\u4e0d\u9700\u8981\u52a0\u5f15\u53f7\u3002\u56e0\u6b64\uff0c\u53ef\u4ee5\u76f4\u63a5\u8f93\u5165<strong class=\"userinput\"><code>\\help alter table</code></strong>\u3002</p>\n</div>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\H</code> \u6216 <code class=\"literal\">\\html</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5f00<acronym class=\"acronym\">HTML</acronym>\u67e5\u8be2\u8f93\u51fa\u683c\u5f0f\u3002\u5982\u679c<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u5df2\u7ecf\u6253\u5f00\uff0c\u5219\u5207\u6362\u56de\u9ed8\u8ba4\u7684\u5bf9\u9f50\u6587\u672c\u683c\u5f0f\u3002\u6b64\u547d\u4ee4\u662f\u4e3a\u517c\u5bb9\u6027\u548c\u4fbf\u5229\u6027\u800c\u4fdd\u7559\u7684\uff1b\u8bbe\u7f6e\u5176\u4ed6\u8f93\u51fa\u9009\u9879\u7684\u65b9\u6cd5\u89c1<code class=\"command\">\\pset</code>\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\i</code> \u6216 <code class=\"literal\">\\include</code> <em class=\"replaceable\"><code>filename</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u8bfb\u53d6\u8f93\u5165\uff0c\u5e76\u50cf\u5728\u952e\u76d8\u4e0a\u8f93\u5165\u4e00\u6837\u6267\u884c\u5b83\u3002</p>\n<p lang=\"zh\">\u5982\u679c<em class=\"replaceable\"><code>filename</code></em>\u662f<code class=\"literal\">-</code>\uff08\u8fde\u5b57\u7b26\uff09\uff0c\u5219\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\uff0c\u76f4\u5230\u9047\u5230 EOF \u6307\u793a\u6216<code class=\"command\">\\q</code>\u5143\u547d\u4ee4\u3002\u8fd9\u53ef\u7528\u4e8e\u5c06\u4ea4\u4e92\u5f0f\u8f93\u5165\u4e0e\u6587\u4ef6\u8f93\u5165\u4ea4\u9519\u4f7f\u7528\u3002\u8bf7\u6ce8\u610f\uff0c\u53ea\u6709\u5728\u6700\u5916\u5c42\u542f\u7528\u4e86 Readline\uff0c\u6b64\u5904\u624d\u4f1a\u4f7f\u7528 Readline \u529f\u80fd\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5982\u679c\u60f3\u5728\u5c4f\u5e55\u4e0a\u770b\u5230\u88ab\u8bfb\u5165\u7684\u5404\u884c\uff0c\u8bf7\u5c06\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">all</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"PSQL-METACOMMAND-IF\"><span class=\"term\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\elif</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\else</code><br/></span><span class=\"term\"><code class=\"literal\">\\endif</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u7ec4\u547d\u4ee4\u5b9e\u73b0\u4e86\u53ef\u5d4c\u5957\u7684\u6761\u4ef6\u5757\u3002\u6761\u4ef6\u5757\u5fc5\u987b\u4ee5<code class=\"command\">\\if</code>\u5f00\u59cb\uff0c\u4ee5<code class=\"command\">\\endif</code>\u7ed3\u675f\u3002\u4e2d\u95f4\u53ef\u4ee5\u5305\u542b\u4efb\u610f\u6570\u91cf\u7684<code class=\"command\">\\elif</code>\u5b50\u53e5\uff0c\u540e\u9762\u8fd8\u53ef\u4ee5\u9009\u62e9\u8ddf\u968f\u4e00\u4e2a<code class=\"command\">\\else</code>\u5b50\u53e5\u3002\u666e\u901a\u67e5\u8be2\u548c\u5176\u4ed6\u7c7b\u578b\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u53ef\u4ee5\uff08\u901a\u5e38\u4e5f\u4f1a\uff09\u51fa\u73b0\u5728\u6784\u6210\u6761\u4ef6\u5757\u7684\u547d\u4ee4\u4e4b\u95f4\u3002</p>\n<p lang=\"zh\">\\if \u548c \\elif \u8bfb\u53d6\u53c2\u6570\u5e76\u5c06\u5176\u4f5c\u4e3a\u5e03\u5c14\u8868\u8fbe\u5f0f\u6c42\u503c\u3002\u7ed3\u679c\u4e3a\u771f\u65f6\u7ee7\u7eed\u6b63\u5e38\u5904\u7406\uff0c\u5426\u5219\u8df3\u8fc7\u540e\u7eed\u884c\uff0c\u76f4\u5230\u9047\u5230\u5339\u914d\u7684 \\elif\u3001\\else \u6216 \\endif\u3002\u67d0\u4e2a \\if \u6216 \\elif \u6761\u4ef6\u6210\u7acb\u540e\uff0c\u540c\u4e00\u5757\u4e2d\u540e\u7eed \\elif \u7684\u53c2\u6570\u4e0d\u518d\u6c42\u503c\uff0c\u76f4\u63a5\u89c6\u4e3a\u5047\u3002\u53ea\u6709\u4e4b\u524d\u5339\u914d\u7684 \\if \u548c \\elif \u5747\u672a\u6210\u7acb\uff0c\u624d\u5904\u7406 \\else \u540e\u7684\u884c\u3002</p>\n<p lang=\"zh\">\u4e0e\u5176\u4ed6\u53cd\u659c\u6760\u547d\u4ee4\u53c2\u6570\u4e00\u6837\uff0c\\if \u6216 \\elif \u7684\u8868\u8fbe\u5f0f\u53c2\u6570\u5148\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u548c\u53cd\u5f15\u53f7\u5c55\u5f00\uff0c\u7136\u540e\u50cf\u5f00\u5173\u9009\u9879\u53d8\u91cf\u4e00\u6837\u6c42\u503c\u3002\u6709\u6548\u503c\u4e3a true\u3001false\u30011\u30010\u3001on\u3001off\u3001yes\u3001no \u7684\u4efb\u610f\u65e0\u6b67\u4e49\u3001\u4e0d\u533a\u5206\u5927\u5c0f\u5199\u7684\u5339\u914d\u3002\u4f8b\u5982 t\u3001T \u548c tR \u90fd\u4f1a\u89c6\u4e3a\u771f\u3002</p>\n<p lang=\"zh\">\u4e0d\u80fd\u6b63\u786e\u6c42\u503c\u4e3a\u771f\u6216\u5047\u7684\u8868\u8fbe\u5f0f\u4f1a\u4ea7\u751f\u8b66\u544a\uff0c\u5e76\u88ab\u89c6\u4e3a\u5047\u3002</p>\n<p lang=\"zh\">\u88ab\u8df3\u8fc7\u7684\u884c\u4ecd\u4f1a\u6b63\u5e38\u89e3\u6790\uff0c\u4ee5\u8bc6\u522b\u67e5\u8be2\u548c\u53cd\u659c\u7ebf\u547d\u4ee4\uff0c\u4f46\u67e5\u8be2\u4e0d\u4f1a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u6761\u4ef6\u547d\u4ee4\uff08<code class=\"command\">\\if</code>\u3001<code class=\"command\">\\elif</code>\u3001<code class=\"command\">\\else</code>\u3001<code class=\"command\">\\endif</code>\uff09\u4ee5\u5916\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u4f1a\u88ab\u5ffd\u7565\u3002\u5bf9\u4e8e\u6761\u4ef6\u547d\u4ee4\uff0c\u53ea\u68c0\u67e5\u5d4c\u5957\u662f\u5426\u5408\u6cd5\u3002\u88ab\u8df3\u8fc7\u7684\u884c\u4e2d\u7684\u53d8\u91cf\u5f15\u7528\u4e0d\u4f1a\u5c55\u5f00\uff0c\u4e5f\u4e0d\u4f1a\u6267\u884c\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<p lang=\"zh\">\u540c\u4e00\u4e2a\u6761\u4ef6\u5757\u7684\u6240\u6709\u53cd\u659c\u7ebf\u547d\u4ee4\u5fc5\u987b\u51fa\u73b0\u5728\u540c\u4e00\u4e2a\u6e90\u6587\u4ef6\u4e2d\u3002\u5982\u679c\u4e3b\u8f93\u5165\u6587\u4ef6\u6216\u901a\u8fc7<code class=\"command\">\\include</code>\u5f15\u5165\u7684\u6587\u4ef6\u5230\u8fbe EOF \u65f6\uff0c\u4ecd\u6709\u672c\u5730<code class=\"command\">\\if</code>\u5757\u672a\u5173\u95ed\uff0c<span class=\"application\">psql</span>\u5c31\u4f1a\u62a5\u9519\u3002</p>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4e00\u4e2a\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">-- check for the existence of two separate records in the database and store\n-- the results in separate psql variables\nSELECT\n    EXISTS(SELECT 1 FROM customer WHERE customer_id = 123) as is_customer,\n    EXISTS(SELECT 1 FROM employee WHERE employee_id = 456) as is_employee\n\\gset\n\\if :is_customer\n    SELECT * FROM customer WHERE customer_id = 123;\n\\elif :is_employee\n    \\echo 'is not a customer but is an employee'\n    SELECT * FROM employee WHERE employee_id = 456;\n\\else\n    \\if yes\n        \\echo 'not a customer or employee'\n    \\else\n        \\echo 'this will never print'\n    \\endif\n\\endif\n</pre>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\ir</code> \u6216 <code class=\"literal\">\\include_relative</code> <em class=\"replaceable\"><code>filename</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"literal\">\\ir</code>\u547d\u4ee4\u4e0e<code class=\"literal\">\\i</code>\u76f8\u4f3c\uff0c\u4f46\u89e3\u6790\u76f8\u5bf9\u6587\u4ef6\u540d\u7684\u65b9\u5f0f\u4e0d\u540c\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\u6267\u884c\u65f6\uff0c\u8fd9\u4e24\u4e2a\u547d\u4ee4\u7684\u884c\u4e3a\u76f8\u540c\u3002\u4e0d\u8fc7\uff0c\u5728\u811a\u672c\u4e2d\u8c03\u7528\u65f6\uff0c<code class=\"literal\">\\ir</code>\u4f1a\u76f8\u5bf9\u4e8e\u811a\u672c\u6240\u5728\u7684\u76ee\u5f55\u6765\u89e3\u91ca\u6587\u4ef6\u540d\uff0c\u800c\u4e0d\u662f\u76f8\u5bf9\u4e8e\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\l[+]</code> \u6216 <code class=\"literal\">\\list[+] [ <a class=\"link\" href=\"/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"\u6a21\u5f0f\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u670d\u52a1\u5668\u4e2d\u7684\u6570\u636e\u5e93\uff0c\u5e76\u663e\u793a\u5176\u540d\u79f0\u3001\u62e5\u6709\u8005\u3001\u5b57\u7b26\u96c6\u7f16\u7801\u548c\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6570\u636e\u5e93\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u663e\u793a\u6570\u636e\u5e93\u5927\u5c0f\u3001\u9ed8\u8ba4\u8868\u7a7a\u95f4\u548c\u63cf\u8ff0\u3002\uff08\u5927\u5c0f\u4fe1\u606f\u53ea\u5bf9\u5f53\u524d\u7528\u6237\u80fd\u591f\u8fde\u63a5\u7684\u6570\u636e\u5e93\u53ef\u7528\u3002\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\lo_export <em class=\"replaceable\"><code>loid</code></em> <em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6570\u636e\u5e93\u4e2d\u8bfb\u53d6\u5177\u6709<acronym class=\"acronym\">OID</acronym><em class=\"replaceable\"><code>loid</code></em>\u7684\u5927\u5bf9\u8c61\uff0c\u5e76\u5c06\u5176\u5199\u5165<em class=\"replaceable\"><code>filename</code></em>\u3002\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e0e\u670d\u52a1\u5668\u51fd\u6570 <code class=\"function\">lo_export</code>\u7565\u6709\u4e0d\u540c\uff0c\u540e\u8005\u4f7f\u7528\u8fd0\u884c\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7528\u6237\u7684\u6743\u9650\uff0c\u5e76\u5728\u670d\u52a1\u5668\u7684\u6587\u4ef6\u7cfb\u7edf\u4e0a\u64cd\u4f5c\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u4f7f\u7528 \\lo_list \u67e5\u627e\u5927\u5bf9\u8c61\u7684 OID\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\lo_import <em class=\"replaceable\"><code>filename</code></em> [ <em class=\"replaceable\"><code>comment</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6587\u4ef6\u5b58\u50a8\u5230\u4e00\u4e2a<span class=\"productname\">PostgreSQL</span>\u5927\u5bf9\u8c61\u4e2d\u3002\u53ef\u9009\u5730\uff0c\u5b83\u5c06\u7ed9\u5b9a\u7684\u6ce8\u91ca\u4e0e\u5bf9\u8c61\u5173\u8054\u8d77\u6765\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">foo=&gt; <strong class=\"userinput\"><code>\\lo_import '/home/peter/pictures/photo.xcf' 'a picture of me'</code></strong>\nlo_import 152801\n</pre>\n<p lang=\"zh\">\u54cd\u5e94\u8868\u660e\u5927\u5bf9\u8c61\u83b7\u5f97\u4e86\u5bf9\u8c61 ID 152801\uff0c\u8fd9\u4e2a ID \u53ef\u4ee5\u7528\u6765\u5728\u5c06\u6765\u8bbf\u95ee\u65b0\u521b\u5efa\u7684\u5927\u5bf9\u8c61\u3002\u4e3a\u4fbf\u4e8e\u9605\u8bfb\uff0c\u5efa\u8bae\u59cb\u7ec8\u4e3a\u6bcf\u4e2a\u5bf9\u8c61\u5173\u8054\u4e00\u6761\u4fbf\u4e8e\u4eba\u9605\u8bfb\u7684\u6ce8\u91ca\u3002\u67e5\u770b OID \u548c\u6ce8\u91ca\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528<code class=\"command\">\\lo_list</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u6b64\u547d\u4ee4\u4e0e\u670d\u52a1\u5668\u7aef\u7684<code class=\"function\">lo_import</code>\u7565\u6709\u4e0d\u540c\uff0c\u56e0\u4e3a\u5b83\u4f5c\u4e3a\u672c\u5730\u7528\u6237\u5728\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e0a\u64cd\u4f5c\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\u7684\u7528\u6237\u548c\u6587\u4ef6\u7cfb\u7edf\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\lo_list</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5f53\u524d\u5b58\u50a8\u5728\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709<span class=\"productname\">PostgreSQL</span>\u5927\u5bf9\u8c61\uff0c\u4ee5\u53ca\u4e3a\u5b83\u4eec\u63d0\u4f9b\u7684\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\lo_unlink <em class=\"replaceable\"><code>loid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6570\u636e\u5e93\u4e2d\u5220\u9664<acronym class=\"acronym\">OID</acronym> \u4e3a <em class=\"replaceable\"><code>loid</code></em>\u7684\u5927\u5bf9\u8c61\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u4f7f\u7528 \\lo_list \u67e5\u627e\u5927\u5bf9\u8c61\u7684 OID\u3002</p>\n</div>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\o</code> \u6216 <code class=\"literal\">\\out [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\o</code> \u6216 <code class=\"literal\">\\out [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u540e\u7eed\u67e5\u8be2\u7ed3\u679c\u4fdd\u5b58\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9 shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002\u5982\u679c\u6ca1\u6709\u6307\u5b9a\u53c2\u6570\uff0c\u67e5\u8be2\u8f93\u51fa\u5c06\u6062\u590d\u4e3a\u6807\u51c6\u8f93\u51fa\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\uff0c\u5219\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u7684\u5185\u5bb9\u53ea\u4f1a\u539f\u6837\u4f20\u9012\u7ed9 shell\u3002</p>\n<p lang=\"zh\"><span class=\"quote\">\u201c<span class=\"quote\">\u67e5\u8be2\u7ed3\u679c</span>\u201d</span>\u5305\u62ec\u4ece\u6570\u636e\u5e93\u670d\u52a1\u5668\u83b7\u53d6\u7684\u6240\u6709\u8868\u683c\u3001\u547d\u4ee4\u54cd\u5e94\u548c\u901a\u77e5\uff0c\u4ee5\u53ca\u67e5\u8be2\u6570\u636e\u5e93\u7684\u5404\u79cd\u53cd\u659c\u6760\u547d\u4ee4\u7684\u8f93\u51fa\uff08\u4f8b\u5982<code class=\"command\">\\d</code>\uff09\uff1b\u4f46\u4e0d\u5305\u62ec\u9519\u8bef\u6d88\u606f\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8981\u5728\u67e5\u8be2\u7ed3\u679c\u4e4b\u95f4\u63d2\u5165\u6587\u672c\u8f93\u51fa\uff0c\u4f7f\u7528<code class=\"command\">\\qecho</code>\u3002</p>\n</div>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\p</code> \u6216 <code class=\"literal\">\\print</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\u3002\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6253\u5370\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\password [ <em class=\"replaceable\"><code>username</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u66f4\u6539\u6307\u5b9a\u7528\u6237\uff08\u9ed8\u8ba4\u4e3a\u5f53\u524d\u7528\u6237\uff09\u7684\u5bc6\u7801\u3002\u6b64\u547d\u4ee4\u63d0\u793a\u8f93\u5165\u65b0\u5bc6\u7801\uff0c\u5bf9\u5176\u8fdb\u884c\u52a0\u5bc6\uff0c\u5e76\u5c06\u5176\u4f5c\u4e3a<code class=\"command\">ALTER ROLE</code>\u547d\u4ee4\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u65b0\u5bc6\u7801\u4e0d\u4f1a\u4ee5\u660e\u6587\u5f62\u5f0f\u51fa\u73b0\u5728\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\u3001\u670d\u52a1\u5668\u65e5\u5fd7\u6216\u5176\u4ed6\u5730\u65b9\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\prompt [ <em class=\"replaceable\"><code>text</code></em> ] <em class=\"replaceable\"><code>name</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u63d0\u793a\u7528\u6237\u63d0\u4f9b\u6587\u672c\uff0c\u5c06\u5176\u8d4b\u503c\u7ed9\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u3002\u53ef\u4ee5\u6307\u5b9a\u4e00\u4e2a\u53ef\u9009\u7684\u63d0\u793a\u5b57\u7b26\u4e32<em class=\"replaceable\"><code>text</code></em>\u3002\uff08\u5bf9\u4e8e\u591a\u4e2a\u5355\u8bcd\u7684\u63d0\u793a\uff0c\u7528\u5355\u5f15\u53f7\u62ec\u8d77\u6587\u672c\u3002\uff09</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"literal\">\\prompt</code> \u4f7f\u7528\u7ec8\u7aef\u8fdb\u884c\u8f93\u5165\u548c\u8f93\u51fa\u3002\u7136\u800c\uff0c\u5982\u679c\u4f7f\u7528\u4e86 <code class=\"option\">-f</code> \u547d\u4ee4\u884c\u5f00\u5173\uff0c<code class=\"literal\">\\prompt</code> \u5c06\u4f7f\u7528\u6807\u51c6\u8f93\u5165\u548c\u6807\u51c6\u8f93\u51fa\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\pset [ <em class=\"replaceable\"><code>option</code></em> [ <em class=\"replaceable\"><code>value</code></em> ] ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u8bbe\u7f6e\u5f71\u54cd\u67e5\u8be2\u7ed3\u679c\u8868\u8f93\u51fa\u7684\u9009\u9879\u3002<em class=\"replaceable\"><code>option</code></em>\u6307\u5b9a\u8981\u8bbe\u7f6e\u54ea\u4e2a\u9009\u9879\u3002<em class=\"replaceable\"><code>value</code></em>\u7684\u542b\u4e49\u53d6\u51b3\u4e8e\u6240\u9009\u7684\u9009\u9879\u3002\u5bf9\u4e8e\u67d0\u4e9b\u9009\u9879\uff0c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\u4f1a\u5207\u6362\u6216\u53d6\u6d88\u8bbe\u7f6e\u8be5\u9009\u9879\uff0c\u5177\u4f53\u89c1\u5404\u9009\u9879\u7684\u8bf4\u660e\u3002\u5982\u679c\u6ca1\u6709\u63d0\u53ca\u8fd9\u7c7b\u884c\u4e3a\uff0c\u90a3\u4e48\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\u53ea\u4f1a\u663e\u793a\u5f53\u524d\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\">\u4e0d\u5e26\u4efb\u4f55\u53c2\u6570\u7684<code class=\"command\">\\pset</code>\u4f1a\u663e\u793a\u6240\u6709\u6253\u5370\u9009\u9879\u7684\u5f53\u524d\u72b6\u6001\u3002</p>\n<p lang=\"zh\">\u53ef\u8c03\u6574\u7684\u6253\u5370\u9009\u9879\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">border</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><em class=\"replaceable\"><code>value</code></em>\u5fc5\u987b\u662f\u6570\u5b57\u3002\u4e00\u822c\u6765\u8bf4\uff0c\u6570\u5b57\u8d8a\u5927\uff0c\u8868\u683c\u7684\u8fb9\u6846\u548c\u5206\u9694\u7ebf\u5c31\u8d8a\u591a\uff0c\u4f46\u7ec6\u8282\u53d6\u51b3\u4e8e\u5177\u4f53\u683c\u5f0f\u3002\u5728<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u4e2d\uff0c\u5b83\u4f1a\u76f4\u63a5\u8f6c\u6362\u4e3a<code class=\"literal\">border=...</code>\u5c5e\u6027\u3002\u5728\u5927\u591a\u6570\u5176\u4ed6\u683c\u5f0f\u4e2d\uff0c\u53ea\u6709\u503c 0\uff08\u65e0\u8fb9\u6846\uff09\u30011\uff08\u5185\u90e8\u5206\u9694\u7ebf\uff09\u548c 2\uff08\u8868\u683c\u5916\u6846\uff09\u6709\u610f\u4e49\uff0c\u5927\u4e8e 2 \u7684\u503c\u4f1a\u4e0e<code class=\"literal\">border = 2</code>\u4f5c\u76f8\u540c\u5904\u7406\u3002<code class=\"literal\">latex</code>\u548c<code class=\"literal\">latex-longtable</code>\u683c\u5f0f\u8fd8\u5141\u8bb8\u4f7f\u7528\u503c 3\uff0c\u4ee5\u5728\u6570\u636e\u884c\u4e4b\u95f4\u6dfb\u52a0\u5206\u9694\u7ebf\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><em>\u5217</em></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u76ee\u6807\u5bbd\u5ea6\uff0c\u540c\u65f6\u4e5f\u662f\u786e\u5b9a\u8f93\u51fa\u662f\u5426\u8db3\u591f\u5bbd\u4ee5\u9700\u8981\u5206\u9875\u5668\u6216\u5728\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e0b\u5207\u6362\u5230\u5782\u76f4\u663e\u793a\u7684\u5bbd\u5ea6\u9650\u5236\u3002\u96f6\uff08\u9ed8\u8ba4\u503c\uff09\u4f1a\u5bfc\u81f4\u76ee\u6807\u5bbd\u5ea6\u7531\u73af\u5883\u53d8\u91cf<code class=\"envar\">COLUMNS</code>\u63a7\u5236\uff0c\u6216\u8005\u5982\u679c\u672a\u8bbe\u7f6e <code class=\"envar\">COLUMNS</code>\u5219\u7531\u68c0\u6d4b\u5230\u7684\u5c4f\u5e55\u5bbd\u5ea6\u63a7\u5236\u3002\u53e6\u5916\uff0c\u5982\u679c<code class=\"literal\">columns</code>\u4e3a\u96f6\uff0c\u5219<code class=\"literal\">wrapped</code>\u683c\u5f0f\u4ec5\u5f71\u54cd\u5c4f\u5e55\u8f93\u51fa\u3002\u5982\u679c<code class=\"literal\">columns</code>\u4e3a\u975e\u96f6\uff0c\u5219\u6587\u4ef6\u548c\u7ba1\u9053\u8f93\u51fa\u4e5f\u4f1a\u6309\u8be5\u5bbd\u5ea6\u6298\u884c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">csv_fieldsep</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728<acronym class=\"acronym\">CSV</acronym>\u8f93\u51fa\u683c\u5f0f\u4e2d\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u5982\u679c\u5206\u9694\u7b26\u5b57\u7b26\u51fa\u73b0\u5728\u5b57\u6bb5\u7684\u503c\u4e2d\uff0c\u5219\u8be5\u5b57\u6bb5\u5c06\u6839\u636e\u6807\u51c6<acronym class=\"acronym\">CSV</acronym>\u89c4\u5219\u5728\u53cc\u5f15\u53f7\u5185\u8f93\u51fa\u3002\u9ed8\u8ba4\u503c\u662f\u9017\u53f7\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">expanded</code>\uff08\u6216 <code class=\"literal\">x</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff08\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u6269\u5c55\u6a21\u5f0f\uff09\uff0c\u6216\u8005\u662f<code class=\"literal\">auto</code>\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5f00\u542f\u548c\u5173\u95ed\u8bbe\u7f6e\u4e4b\u95f4\u5207\u6362\u3002\u542f\u7528\u6269\u5c55\u6a21\u5f0f\u65f6\uff0c\u67e5\u8be2\u7ed3\u679c\u4ee5\u4e24\u5217\u663e\u793a\uff0c\u5de6\u4fa7\u4e3a\u5217\u540d\uff0c\u53f3\u4fa7\u4e3a\u6570\u636e\u3002\u5982\u679c\u6570\u636e\u5728\u901a\u5e38\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u6a2a\u5411</span>\u201d</span>\u6a21\u5f0f\u4e0b\u65e0\u6cd5\u9002\u5e94\u5c4f\u5e55\uff0c\u8fd9\u79cd\u6a21\u5f0f\u5c31\u5f88\u6709\u7528\u3002\u5728\u81ea\u52a8\u8bbe\u7f6e\u4e0b\uff0c\u5f53\u67e5\u8be2\u8f93\u51fa\u5305\u542b\u591a\u5217\u4e14\u5bbd\u5ea6\u8d85\u8fc7\u5c4f\u5e55\u65f6\uff0c\u4f1a\u4f7f\u7528\u6269\u5c55\u6a21\u5f0f\uff1b\u5426\u5219\u4f7f\u7528\u5e38\u89c4\u6a21\u5f0f\u3002\u81ea\u52a8\u8bbe\u7f6e\u53ea\u5728\u5bf9\u9f50\u548c\u6298\u884c\u683c\u5f0f\u4e2d\u6709\u6548\u3002\u5728\u5176\u4ed6\u683c\u5f0f\u4e2d\uff0c\u5b83\u7684\u884c\u4e3a\u59cb\u7ec8\u4e0e\u5173\u95ed\u6269\u5c55\u6a21\u5f0f\u76f8\u540c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">fieldsep</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u6837\u53ef\u4ee5\u521b\u5efa\u4f8b\u5982\u5236\u8868\u7b26\u5206\u9694\u7684\u8f93\u51fa\uff0c\u8fd9\u53ef\u80fd\u66f4\u7b26\u5408\u5176\u4ed6\u7a0b\u5e8f\u7684\u9700\u8981\u3002\u8981\u5c06\u5236\u8868\u7b26\u8bbe\u7f6e\u4e3a\u5b57\u6bb5\u5206\u9694\u7b26\uff0c\u8bf7\u8f93\u5165<code class=\"literal\">\\pset fieldsep '\\t'</code>\u3002\u9ed8\u8ba4\u5b57\u6bb5\u5206\u9694\u7b26\u662f<code class=\"literal\">'|'</code>\uff08\u7ad6\u7ebf\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">fieldsep_zero</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u8bbe\u7f6e\u4e3a\u96f6\u5b57\u8282\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">footer</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u8868\u683c\u9875\u811a\uff08<code class=\"literal\">(<em class=\"replaceable\"><code>n</code></em> rows)</code>\u8ba1\u6570\uff09\u7684\u663e\u793a\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5207\u6362\u9875\u811a\u663e\u793a\u7684\u5f00\u5173\u72b6\u6001\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">format</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a<code class=\"literal\">aligned</code>\u3001<code class=\"literal\">asciidoc</code>\u3001<code class=\"literal\">csv</code>\u3001<code class=\"literal\">html</code>\u3001<code class=\"literal\">latex</code>\u3001<code class=\"literal\">latex-longtable</code>\u3001<code class=\"literal\">troff-ms</code>\u3001<code class=\"literal\">unaligned</code>\u6216<code class=\"literal\">wrapped</code>\u3002\u5141\u8bb8\u4f7f\u7528\u552f\u4e00\u7f29\u5199\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">aligned</code>\u683c\u5f0f\u662f\u6807\u51c6\u7684\u3001\u9002\u5408\u4eba\u9605\u8bfb\u4e14\u6392\u7248\u6574\u9f50\u7684\u6587\u672c\u8f93\u51fa\uff1b\u8fd9\u662f\u9ed8\u8ba4\u683c\u5f0f\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">unaligned</code>\u683c\u5f0f\u5c06\u4e00\u884c\u4e2d\u7684\u6240\u6709\u5217\u5199\u5728\u4e00\u884c\u4e0a\uff0c\u7531\u5f53\u524d\u6d3b\u52a8\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u5206\u9694\u3002\u8fd9\u5bf9\u4e8e\u521b\u5efa\u53ef\u80fd\u88ab\u5176\u4ed6\u7a0b\u5e8f\u8bfb\u53d6\u7684\u8f93\u51fa\u5f88\u6709\u7528\uff0c\u4f8b\u5982\uff0c\u5236\u8868\u7b26\u5206\u9694\u6216\u9017\u53f7\u5206\u9694\u683c\u5f0f\u3002\u7136\u800c\uff0c\u5982\u679c\u5b57\u6bb5\u5206\u9694\u7b26\u5b57\u7b26\u51fa\u73b0\u5728\u5217\u7684\u503c\u4e2d\uff0c\u5219\u4e0d\u4f1a\u88ab\u7279\u6b8a\u5904\u7406\uff1b\u56e0\u6b64\uff0c<acronym class=\"acronym\">CSV</acronym>\u683c\u5f0f\u53ef\u80fd\u66f4\u9002\u5408\u8fd9\u4e9b\u76ee\u7684\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">csv</code>\u683c\u5f0f<a class=\"indexterm\" id=\"id-1.9.4.18.8.4.10.1.69.2.3.1.8.2.4.2\" name=\"id-1.9.4.18.8.4.10.1.69.2.3.1.8.2.4.2\"></a>\u6309\u9017\u53f7\u5206\u9694\u7684\u5217\u503c\u8f93\u51fa\uff0c\u5e76\u5e94\u7528 <a class=\"ulink\" href=\"https://datatracker.ietf.org/doc/html/rfc4180\" target=\"_top\">RFC 4180</a> \u4e2d\u63cf\u8ff0\u7684\u52a0\u5f15\u53f7\u89c4\u5219\u3002\u6b64\u8f93\u51fa\u4e0e\u670d\u52a1\u5668\u7684CSV\u683c\u5f0f\u7684 <code class=\"command\">COPY</code>\u547d\u4ee4\u517c\u5bb9\u3002\u751f\u6210\u5305\u542b\u5217\u540d\u7684\u8868\u5934\u884c\uff0c\u9664\u975e <code class=\"literal\">tuples_only</code>\u53c2\u6570\u8bbe\u7f6e\u4e3a <code class=\"literal\">on</code>\u3002\u4e0d\u6253\u5370\u8868\u683c\u6807\u9898\u548c\u9875\u811a\u3002\u6bcf\u884c\u4ee5\u7cfb\u7edf\u76f8\u5173\u7684\u884c\u7ed3\u675f\u5b57\u7b26\u7ed3\u675f\uff0c\u5bf9\u4e8e\u7c7bUnix\u7cfb\u7edf\u901a\u5e38\u662f\u5355\u4e2a\u6362\u884c\u7b26\uff08<code class=\"literal\">\\n</code>\uff09\uff0c\u5bf9\u4e8eMicrosoft Windows\u5219\u662f\u56de\u8f66\u548c\u6362\u884c\u5e8f\u5217\uff08<code class=\"literal\">\\r\\n</code>\uff09\u3002\u53ef\u4ee5\u7528<code class=\"command\">\\pset csv_fieldsep</code>\u9009\u62e9\u9017\u53f7\u4ee5\u5916\u7684\u5b57\u6bb5\u5206\u9694\u5b57\u7b26\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">wrapped</code>\u683c\u5f0f\u4e0e<code class=\"literal\">aligned</code>\u76f8\u4f3c\uff0c\u4f46\u4f1a\u5c06\u8f83\u5bbd\u7684\u6570\u636e\u503c\u6298\u6210\u591a\u884c\uff0c\u4f7f\u8f93\u51fa\u9002\u5e94\u76ee\u6807\u5217\u5bbd\u3002\u76ee\u6807\u5bbd\u5ea6\u7684\u786e\u5b9a\u65b9\u5f0f\u89c1<code class=\"literal\">columns</code>\u9009\u9879\u7684\u8bf4\u660e\u3002\u8bf7\u6ce8\u610f\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u5c1d\u8bd5\u5bf9\u5217\u6807\u9898\u6298\u884c\uff1b\u56e0\u6b64\uff0c\u5982\u679c\u5217\u6807\u9898\u6240\u9700\u7684\u603b\u5bbd\u5ea6\u8d85\u8fc7\u76ee\u6807\u5bbd\u5ea6\uff0c<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u884c\u4e3a\u5c31\u4e0e<code class=\"literal\">aligned</code>\u76f8\u540c\u3002</p>\n<p lang=\"zh\">asciidoc\u3001html\u3001latex\u3001latex-longtable \u548c troff-ms \u683c\u5f0f\u8f93\u51fa\u7684\u662f\u53ef\u5d4c\u5165\u76f8\u5e94\u6807\u8bb0\u8bed\u8a00\u6587\u6863\u7684\u8868\u683c\uff0c\u5e76\u975e\u5b8c\u6574\u6587\u6863\u3002HTML \u53ef\u80fd\u4e0d\u8981\u6c42\u5b8c\u6574\u5c01\u88c5\uff0c\u4f46 LaTeX \u5fc5\u987b\u6709\u5b8c\u6574\u6587\u6863\u7ed3\u6784\u3002latex \u4f7f\u7528 LaTeX \u7684 tabular \u73af\u5883\uff1blatex-longtable \u9700\u8981 LaTeX \u7684 longtable \u548c booktabs \u5b8f\u5305\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">linestyle</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u8fb9\u6846\u7ebf\u7ed8\u5236\u6837\u5f0f\u4e3a<code class=\"literal\">ascii</code>\u3001<code class=\"literal\">old-ascii</code>\u6216<code class=\"literal\">unicode</code>\u4e4b\u4e00\u3002\u5141\u8bb8\u4f7f\u7528\u552f\u4e00\u7f29\u5199\u3002\uff08\u8fd9\u610f\u5473\u7740\u4e00\u4e2a\u5b57\u6bcd\u5c31\u8db3\u591f\u4e86\u3002\uff09\u9ed8\u8ba4\u8bbe\u7f6e\u4e3a<code class=\"literal\">ascii</code>\u3002\u6b64\u9009\u9879\u4ec5\u5f71\u54cd<code class=\"literal\">aligned</code>\u548c<code class=\"literal\">wrapped</code>\u8f93\u51fa\u683c\u5f0f\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">ascii</code>\u6837\u5f0f\u4f7f\u7528\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u53f3\u8fb9\u7f18\u7684<code class=\"literal\">+</code>\u7b26\u53f7\u8868\u793a\u3002\u5f53<code class=\"literal\">wrapped</code>\u683c\u5f0f\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u628a\u6570\u636e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u4f1a\u5728\u7b2c\u4e00\u884c\u7684\u53f3\u8fb9\u7f18\u663e\u793a\u4e00\u4e2a\u70b9\uff08<code class=\"literal\">.</code>\uff09\uff0c\u5e76\u5728\u4e0b\u4e00\u884c\u7684\u5de6\u8fb9\u7f18\u518d\u6b21\u663e\u793a\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">old-ascii</code>\u6837\u5f0f\u4f7f\u7528\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\uff0c\u91c7\u7528<span class=\"productname\">PostgreSQL</span> 8.4 \u53ca\u66f4\u65e9\u7248\u672c\u7684\u683c\u5f0f\u6837\u5f0f\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u66ff\u4ee3\u5de6\u4fa7\u5217\u5206\u9694\u7b26\u7684<code class=\"literal\">:</code>\u7b26\u53f7\u8868\u793a\u3002\u5f53\u6570\u636e\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u5219\u7528<code class=\"literal\">;</code>\u7b26\u53f7\u66ff\u4ee3\u5de6\u4fa7\u5217\u5206\u9694\u7b26\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">unicode</code>\u6837\u5f0f\u4f7f\u7528 Unicode \u6846\u7ebf\u7ed8\u5236\u5b57\u7b26\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u53f3\u8fb9\u7f18\u7684\u56de\u8f66\u7b26\u53f7\u8868\u793a\u3002\u5f53\u6570\u636e\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u4f1a\u5728\u7b2c\u4e00\u884c\u7684\u53f3\u8fb9\u7f18\u663e\u793a\u7701\u7565\u53f7\u7b26\u53f7\uff0c\u5e76\u5728\u4e0b\u4e00\u884c\u7684\u5de6\u8fb9\u7f18\u518d\u6b21\u663e\u793a\u3002</p>\n<p lang=\"zh\">\u5f53<code class=\"literal\">border</code>\u8bbe\u7f6e\u5927\u4e8e\u96f6\u65f6\uff0c<code class=\"literal\">linestyle</code>\u9009\u9879\u8fd8\u51b3\u5b9a\u7528\u54ea\u4e9b\u5b57\u7b26\u7ed8\u5236\u8fb9\u6846\u7ebf\u3002\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\u5728\u4efb\u4f55\u73af\u5883\u4e2d\u90fd\u53ef\u7528\uff0c\u4f46\u5728\u652f\u6301 Unicode \u7684\u663e\u793a\u8bbe\u5907\u4e0a\uff0cUnicode \u5b57\u7b26\u66f4\u7f8e\u89c2\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">null</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u7528\u4e8e\u4ee3\u66ff\u7a7a\u503c\u6253\u5370\u7684\u5b57\u7b26\u4e32\u3002\u9ed8\u8ba4\u4e0d\u6253\u5370\u4efb\u4f55\u5185\u5bb9\uff0c\u8fd9\u5f88\u5bb9\u6613\u88ab\u8bef\u8ba4\u4e3a\u7a7a\u5b57\u7b26\u4e32\u3002\u4f8b\u5982\uff0c\u4f60\u53ef\u80fd\u66f4\u559c\u6b22\u4f7f\u7528<code class=\"literal\">\\pset null '(null)'</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">numericlocale</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u4f7f\u7528\u533a\u57df\u8bbe\u7f6e\u7279\u5b9a\u7684\u5b57\u7b26\u6765\u5206\u9694\u5c0f\u6570\u70b9\u5de6\u4fa7\u7684\u6570\u5b57\u7ec4\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5e38\u89c4\u6570\u5b57\u8f93\u51fa\u548c\u533a\u57df\u8bbe\u7f6e\u7279\u5b9a\u7684\u6570\u5b57\u8f93\u51fa\u4e4b\u95f4\u5207\u6362\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">pager</code></span></dt>\n<dd>\n<p lang=\"zh\">\u63a7\u5236\u67e5\u8be2\u548c<span class=\"application\">psql</span>\u5e2e\u52a9\u8f93\u51fa\u662f\u5426\u4f7f\u7528\u5206\u9875\u5668\u7a0b\u5e8f\u3002\u5982\u679c\u8bbe\u7f6e\u4e86\u73af\u5883\u53d8\u91cf<code class=\"envar\">PSQL_PAGER</code>\u6216<code class=\"envar\">PAGER</code>\uff0c\u8f93\u51fa\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u9012\u7ed9\u6307\u5b9a\u7684\u7a0b\u5e8f\u3002\u5426\u5219\uff0c\u4f7f\u7528\u4e0e\u5e73\u53f0\u6709\u5173\u7684\u9ed8\u8ba4\u7a0b\u5e8f\uff08\u5982<code class=\"filename\">more</code>\uff09\u3002</p>\n<p lang=\"zh\">\u5f53 pager \u4e3a off \u65f6\uff0c\u4e0d\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\uff1b\u4e3a on \u65f6\uff0c\u5728\u9002\u5f53\u60c5\u51b5\u4e0b\u4f7f\u7528\uff0c\u5373\u8f93\u51fa\u76ee\u6807\u662f\u7ec8\u7aef\u4e14\u5185\u5bb9\u65e0\u6cd5\u5728\u5c4f\u5e55\u5185\u663e\u793a\u5b8c\u3002\u8bbe\u4e3a always \u65f6\uff0c\u6240\u6709\u7ec8\u7aef\u8f93\u51fa\u5747\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\uff0c\u65e0\u8bba\u662f\u5426\u80fd\u5728\u5c4f\u5e55\u5185\u663e\u793a\u5b8c\u3002\u4e0d\u5e26\u503c\u7684 \\pset pager \u4f1a\u5207\u6362\u5206\u9875\u7684\u5f00\u5173\u72b6\u6001\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">pager_min_lines</code></span></dt>\n<dd>\n<p lang=\"zh\">\u82e5 pager_min_lines \u5927\u4e8e\u5c4f\u5e55\u9875\u9ad8\uff0c\u53ea\u6709\u8f93\u51fa\u884c\u6570\u8fbe\u5230\u8be5\u503c\u65f6\u624d\u8c03\u7528\u5206\u9875\u7a0b\u5e8f\u3002\u9ed8\u8ba4\u503c\u4e3a 0\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">recordsep</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u8bb0\u5f55\uff08\u884c\uff09\u5206\u9694\u7b26\u3002\u9ed8\u8ba4\u4e3a\u6362\u884c\u7b26\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">recordsep_zero</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u8bbe\u7f6e\u4e3a\u96f6\u5b57\u8282\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">tableattr</code>\uff08\u6216 <code class=\"literal\">T</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\u5728<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u4e2d\uff0c\u8fd9\u6307\u5b9a\u8981\u653e\u5728<code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u5c5e\u6027\uff0c\u4f8b\u5982<code class=\"literal\">cellpadding</code>\u6216<code class=\"literal\">bgcolor</code>\u3002\u8bf7\u6ce8\u610f\uff0c\u4f60\u53ef\u80fd\u4e0d\u9700\u8981\u5728\u8fd9\u91cc\u6307\u5b9a<code class=\"literal\">border</code>\uff0c\u56e0\u4e3a<code class=\"literal\">\\pset border</code>\u5df2\u7ecf\u8d1f\u8d23\u5904\u7406\u5b83\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u8868\u683c\u5c5e\u6027\u3002</p>\n<p lang=\"zh\">\u5728<code class=\"literal\">latex-longtable</code>\u683c\u5f0f\u4e2d\uff0c\u8fd9\u63a7\u5236\u6bcf\u4e2a\u5305\u542b\u5de6\u5bf9\u9f50\u6570\u636e\u7c7b\u578b\u7684\u5217\u7684\u5bbd\u5ea6\u6bd4\u4f8b\u3002\u5b83\u4ee5\u7a7a\u767d\u5206\u9694\u7684\u503c\u5217\u8868\u6307\u5b9a\uff0c\u4f8b\u5982<code class=\"literal\">'0.2 0.2 0.6'</code>\u3002\u672a\u6307\u5b9a\u7684\u8f93\u51fa\u5217\u4f7f\u7528\u6700\u540e\u6307\u5b9a\u7684\u503c\u3002</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">title</code>\uff08\u6216 <code class=\"literal\">C</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u968f\u540e\u6253\u5370\u7684\u6240\u6709\u8868\u683c\u7684\u6807\u9898\u3002\u8fd9\u53ef\u4ee5\u4e3a\u8f93\u51fa\u63d0\u4f9b\u63cf\u8ff0\u6027\u6807\u7b7e\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u6807\u9898\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">tuples_only</code>\uff08\u6216 <code class=\"literal\">t</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u4ec5\u5143\u7ec4\u6a21\u5f0f\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5e38\u89c4\u8f93\u51fa\u548c\u4ec5\u5143\u7ec4\u8f93\u51fa\u4e4b\u95f4\u5207\u6362\u3002\u5e38\u89c4\u8f93\u51fa\u5305\u542b\u5217\u6807\u9898\u3001\u8868\u683c\u6807\u9898\u548c\u5404\u79cd\u9875\u811a\u7b49\u9644\u52a0\u4fe1\u606f\u3002\u5728\u4ec5\u5143\u7ec4\u6a21\u5f0f\u4e0b\uff0c\u53ea\u663e\u793a\u5b9e\u9645\u7684\u8868\u683c\u6570\u636e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">unicode_border_linestyle</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u8fb9\u6846\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">unicode_column_linestyle</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u5217\u5206\u9694\u7ebf\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">unicode_header_linestyle</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u8868\u5934\u5206\u9694\u7ebf\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8fd9\u4e9b\u4e0d\u540c\u683c\u5f0f\u7684\u5916\u89c2\u793a\u4f8b\u53ef\u53c2\u89c1<a class=\"xref\" href=\"/docs/12/app-psql.html#APP-PSQL-EXAMPLES\" title=\"\u793a\u4f8b\">\u793a\u4f8b</a>\u4e00\u8282\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u6709\u5404\u79cd\u5feb\u6377\u547d\u4ee4\u7528\u4e8e<code class=\"command\">\\pset</code>\u3002\u8bf7\u53c2\u89c1<code class=\"command\">\\a</code>\u3001<code class=\"command\">\\C</code>\u3001<code class=\"command\">\\f</code>\u3001<code class=\"command\">\\H</code>\u3001<code class=\"command\">\\t</code>\u3001<code class=\"command\">\\T</code>\u548c<code class=\"command\">\\x</code>\u3002</p>\n</div>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\q</code> \u6216 <code class=\"literal\">\\quit</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9000\u51fa<span class=\"application\">psql</span>\u7a0b\u5e8f\u3002\u5728\u811a\u672c\u6587\u4ef6\u4e2d\uff0c\u53ea\u4f1a\u7ec8\u6b62\u8be5\u811a\u672c\u7684\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\qecho <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u547d\u4ee4\u4e0e<code class=\"command\">\\echo</code>\u76f8\u540c\uff0c\u53ea\u662f\u8f93\u51fa\u4f1a\u5199\u5165\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u7684\u67e5\u8be2\u8f93\u51fa\u901a\u9053\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\r</code> \u6216 <code class=\"literal\">\\reset</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u91cd\u7f6e\uff08\u6e05\u7a7a\uff09\u67e5\u8be2\u7f13\u51b2\u533a\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\s [ <em class=\"replaceable\"><code>filename</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u5386\u53f2\u8bb0\u5f55\u5230<em class=\"replaceable\"><code>filename</code></em>\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5386\u53f2\u8bb0\u5f55\u5c06\u88ab\u5199\u5165\u6807\u51c6\u8f93\u51fa\uff08\u5982\u679c\u9002\u7528\uff0c\u5c06\u4f7f\u7528\u5206\u9875\u5668\uff09\u3002\u5982\u679c<span class=\"application\">psql</span>\u5728\u6784\u5efa\u65f6\u6ca1\u6709\u4f7f\u7528<span class=\"application\">Readline</span>\u652f\u6301\uff0c\u5219\u6b64\u547d\u4ee4\u4e0d\u53ef\u7528\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\set [ <em class=\"replaceable\"><code>name</code></em> [ <em class=\"replaceable\"><code>value</code></em> [ ... ] ] ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06<span class=\"application\">psql</span>\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u8bbe\u7f6e\u4e3a<em class=\"replaceable\"><code>value</code></em>\uff0c\u5982\u679c\u7ed9\u51fa\u591a\u4e2a\u503c\uff0c\u5219\u8bbe\u7f6e\u4e3a\u6240\u6709\u503c\u7684\u4e32\u63a5\u3002\u5982\u679c\u53ea\u7ed9\u51fa\u4e00\u4e2a\u53c2\u6570\uff0c\u5219\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\u503c\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u8bbe\u7f6e\uff0c\u8bf7\u4f7f\u7528<code class=\"command\">\\unset</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\"><code class=\"command\">\\set</code>\u6ca1\u6709\u4efb\u4f55\u53c2\u6570\u65f6\uff0c\u663e\u793a\u5f53\u524d\u8bbe\u7f6e\u7684\u6240\u6709<span class=\"application\">psql</span>\u53d8\u91cf\u7684\u540d\u79f0\u548c\u503c\u3002</p>\n<p lang=\"zh\">\u5408\u6cd5\u7684\u53d8\u91cf\u540d\u53ef\u4ee5\u5305\u542b\u5b57\u6bcd\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u3002\u8be6\u60c5\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/12/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002\u53d8\u91cf\u540d\u533a\u5206\u5927\u5c0f\u5199\u3002</p>\n<p lang=\"zh\">\u67d0\u4e9b\u53d8\u91cf\u662f\u7279\u6b8a\u7684\uff0c\u5b83\u4eec\u63a7\u5236<span class=\"application\">psql</span>\u7684\u884c\u4e3a\uff0c\u6216\u8005\u7531\u7cfb\u7edf\u81ea\u52a8\u8bbe\u7f6e\u4ee5\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u3002\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/12/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u4ecb\u7ecd\u4e86\u8fd9\u4e9b\u53d8\u91cf\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u4e0e<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4<a class=\"xref\" href=\"/docs/12/sql-set.html\" title=\"SET\"><span class=\"refentrytitle\">SET</span></a>\u65e0\u5173\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\setenv <em class=\"replaceable\"><code>name</code></em> [ <em class=\"replaceable\"><code>value</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u4e3a<em class=\"replaceable\"><code>value</code></em>\uff0c\u6216\u8005\u5982\u679c\u672a\u63d0\u4f9b<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3002\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\setenv PAGER less</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>\\setenv LESS -imx4F</code></strong>\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\sf[+] <em class=\"replaceable\"><code>function_description</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u663e\u793a\u6307\u5b9a\u51fd\u6570\u6216\u8fc7\u7a0b\u7684\u5b9a\u4e49\uff0c\u4ee5<code class=\"command\">CREATE OR REPLACE FUNCTION</code>\u6216 <code class=\"command\">CREATE OR REPLACE PROCEDURE</code>\u547d\u4ee4\u7684\u5f62\u5f0f\u5448\u73b0\u3002\u5b9a\u4e49\u5c06\u6253\u5370\u5230\u5f53\u524d\u67e5\u8be2\u8f93\u51fa\u901a\u9053\uff0c\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\">\u76ee\u6807\u51fd\u6570\u53ef\u4ec5\u7528\u540d\u79f0\u6307\u5b9a\uff0c\u4e5f\u53ef\u7528\u540d\u79f0\u548c\u53c2\u6570\u6307\u5b9a\uff0c\u4f8b\u5982 foo(integer, text)\u3002\u82e5\u6709\u591a\u4e2a\u540c\u540d\u51fd\u6570\uff0c\u5219\u5fc5\u987b\u63d0\u4f9b\u53c2\u6570\u7c7b\u578b\u3002</p>\n<p lang=\"zh\">\u5728\u547d\u4ee4\u540d\u540e\u6dfb\u52a0 +\uff0c\u4f1a\u4e3a\u8f93\u51fa\u884c\u7f16\u53f7\uff0c\u51fd\u6570\u4f53\u7b2c\u4e00\u884c\u4e3a\u7b2c 1 \u884c\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\sf</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\sv[+] <em class=\"replaceable\"><code>view_name</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u6307\u5b9a\u89c6\u56fe\u7684\u5b9a\u4e49\uff0c\u5e76\u4ee5<code class=\"command\">CREATE OR REPLACE VIEW</code>\u547d\u4ee4\u7684\u5f62\u5f0f\u663e\u793a\u3002\u5b9a\u4e49\u4f1a\u6253\u5370\u5230\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u7684\u5f53\u524d\u67e5\u8be2\u8f93\u51fa\u901a\u9053\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u547d\u4ee4\u540d\u79f0\u540e\u6dfb\u52a0<code class=\"literal\">+</code>\uff0c\u90a3\u4e48\u8f93\u51fa\u884c\u5c06\u4ece1\u5f00\u59cb\u7f16\u53f7\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\sv</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\t</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u8f93\u51fa\u4e2d\u7684\u5217\u540d\u6807\u9898\u548c\u884c\u6570\u9875\u811a\u7684\u663e\u793a\u72b6\u6001\u3002\u8fd9\u4e2a\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset tuples_only</code>\uff0c\u63d0\u4f9b\u5b83\u662f\u4e3a\u4e86\u4f7f\u7528\u65b9\u4fbf\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\T <em class=\"replaceable\"><code>table_options</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728<acronym class=\"acronym\">HTML</acronym>\u8f93\u51fa\u683c\u5f0f\u4e2d\u653e\u5728<code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u5c5e\u6027\u3002\u8fd9\u4e2a\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset tableattr <em class=\"replaceable\"><code>table_options</code></em></code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\timing [ <em class=\"replaceable\"><code>on</code></em> | <em class=\"replaceable\"><code>off</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5e26\u53c2\u6570\u65f6\uff0c\u5f00\u542f\u6216\u5173\u95ed\u6bcf\u6761 SQL \u8bed\u53e5\u6267\u884c\u8017\u65f6\u7684\u663e\u793a\u3002\u4e0d\u5e26\u53c2\u6570\u65f6\uff0c\u5207\u6362\u663e\u793a\u7684\u5f00\u5173\u72b6\u6001\u3002\u8017\u65f6\u4ee5\u6beb\u79d2\u663e\u793a\uff1b\u8d85\u8fc7 1 \u79d2\u7684\u65f6\u95f4\u95f4\u9694\u8fd8\u4f1a\u4ee5\u5206\u949f:\u79d2\u7684\u683c\u5f0f\u663e\u793a\uff0c\u5fc5\u8981\u65f6\u6dfb\u52a0\u5c0f\u65f6\u548c\u5929\u5b57\u6bb5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\unset <em class=\"replaceable\"><code>name</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u53d6\u6d88\u8bbe\u7f6e\uff08\u5220\u9664\uff09<span class=\"application\">psql</span>\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u3002</p>\n<p lang=\"zh\">\u5927\u591a\u6570\u63a7\u5236<span class=\"application\">psql</span>\u884c\u4e3a\u7684\u53d8\u91cf\u4e0d\u80fd\u53d6\u6d88\u8bbe\u7f6e\uff1b\u5bf9\u4e8e\u8fd9\u4e9b\u53d8\u91cf\uff0c<code class=\"literal\">\\unset</code>\u547d\u4ee4\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u5176\u8bbe\u7f6e\u4e3a\u9ed8\u8ba4\u503c\u3002\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/12/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\w</code> \u6216 <code class=\"literal\">\\write</code> <em class=\"replaceable\"><code>filename</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\w</code> \u6216 <code class=\"literal\">\\write</code> <code class=\"literal\">|</code><em class=\"replaceable\"><code>command</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u5199\u5165\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u9012\u7ed9 shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6539\u4e3a\u5199\u5165\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\uff0c\u5219\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u7684\u5185\u5bb9\u53ea\u4f1a\u539f\u6837\u4f20\u9012\u7ed9 shell\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\watch [ <em class=\"replaceable\"><code>seconds</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u91cd\u590d\u6267\u884c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\uff08\u5982\u540c <code class=\"literal\">\\g</code> \u4e00\u6837\uff09\uff0c\u76f4\u5230\u88ab\u4e2d\u65ad\u6216\u67e5\u8be2\u5931\u8d25\u3002\u4e24\u6b21\u6267\u884c\u4e4b\u95f4\u7b49\u5f85\u6307\u5b9a\u7684\u79d2\u6570\uff08\u9ed8\u8ba4 2 \u79d2\uff09\u3002\u6bcf\u6b21\u67e5\u8be2\u7ed3\u679c\u90fd\u4f1a\u5e26\u6709\u4e00\u4e2a\u5934\u90e8\uff0c\u5176\u4e2d\u5305\u542b <code class=\"literal\">\\pset title</code> \u5b57\u7b26\u4e32\uff08\u5982\u679c\u6709\uff09\u3001\u67e5\u8be2\u5f00\u59cb\u65f6\u7684\u65f6\u95f4\u4ee5\u53ca\u5ef6\u8fdf\u95f4\u9694\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\x [ <em class=\"replaceable\"><code>on</code></em> | <em class=\"replaceable\"><code>off</code></em> | <em class=\"replaceable\"><code>auto</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u6216\u5207\u6362\u6269\u5c55\u8868\u683c\u683c\u5f0f\u6a21\u5f0f\u3002\u5b83\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset expanded</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\z [ <a class=\"link\" href=\"https://pg.center/docs/12/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u53ca\u5176\u5173\u8054\u7684\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u3002</p>\n<p lang=\"zh\">\u8fd9\u662f<code class=\"command\">\\dp</code>\u7684\u522b\u540d\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u663e\u793a\u6743\u9650</span>\u201d</span>\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\! [ <em class=\"replaceable\"><code>command</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u5e26\u53c2\u6570\u65f6\uff0c\u8fdb\u5165\u4e00\u4e2a\u5b50 shell\uff1b\u5b50 shell \u9000\u51fa\u540e\uff0c<span class=\"application\">psql</span>\u6062\u590d\u8fd0\u884c\u3002\u5e26\u53c2\u6570\u65f6\uff0c\u6267\u884c shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\!</code>\u7684\u53c2\u6570\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u5185\u5bb9\u4f1a\u539f\u6837\u4f20\u7ed9 shell\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\? [ <em class=\"replaceable\"><code>topic</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5e2e\u52a9\u4fe1\u606f\u3002\u53ef\u9009\u7684<em class=\"replaceable\"><code>topic</code></em>\u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a<code class=\"literal\">commands</code>\uff09\u9009\u62e9\u8981\u89e3\u91ca\u7684<span class=\"application\">psql</span>\u7684\u54ea\u4e2a\u90e8\u5206\uff1a<code class=\"literal\">commands</code>\u63cf\u8ff0<span class=\"application\">psql</span>\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b<code class=\"literal\">options</code>\u63cf\u8ff0\u53ef\u4ee5\u4f20\u9012\u7ed9<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c<code class=\"literal\">variables</code>\u663e\u793a\u5173\u4e8e<span class=\"application\">psql</span>\u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\;</code></span></dt>\n<dd>\n<p lang=\"zh\">\u53cd\u659c\u7ebf\u52a0\u5206\u53f7\u5e76\u4e0d\u662f\u4e0e\u524d\u8ff0\u547d\u4ee4\u76f8\u540c\u7684\u5143\u547d\u4ee4\uff1b\u5b83\u53ea\u662f\u5c06\u4e00\u4e2a\u5206\u53f7\u6dfb\u52a0\u5230\u67e5\u8be2\u7f13\u51b2\u533a\uff0c\u800c\u4e0d\u8fdb\u884c\u4efb\u4f55\u8fdb\u4e00\u6b65\u5904\u7406\u3002</p>\n<p lang=\"zh\">\u901a\u5e38\uff0c<span class=\"application\">psql</span>\u4e00\u9047\u5230\u7ed3\u675f\u547d\u4ee4\u7684\u5206\u53f7\uff0c\u5c31\u4f1a\u5c06 SQL \u547d\u4ee4\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u5373\u4f7f\u5f53\u524d\u884c\u4ecd\u6709\u66f4\u591a\u8f93\u5165\u4e5f\u662f\u5982\u6b64\u3002\u4f8b\u5982\uff0c\u8f93\u5165</p>\n<pre class=\"programlisting\">select 1; select 2; select 3;\n</pre>\n<p lang=\"zh\">\u4f1a\u5c06\u8fd9\u4e09\u6761 SQL \u547d\u4ee4\u5206\u522b\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u6bcf\u6761\u547d\u4ee4\u7684\u7ed3\u679c\u4f1a\u5728\u7ee7\u7eed\u5904\u7406\u4e0b\u4e00\u6761\u547d\u4ee4\u4e4b\u524d\u663e\u793a\u3002\u4e0d\u8fc7\uff0c\u4ee5\u4ee5\u4e0b\u5f62\u5f0f\u8f93\u5165\u7684\u5206\u53f7\uff1a<code class=\"literal\">\\;</code>\uff0c\u4e0d\u4f1a\u89e6\u53d1\u547d\u4ee4\u5904\u7406\uff0c\u56e0\u6b64\u5b83\u524d\u540e\u7684\u547d\u4ee4\u5b9e\u9645\u4e0a\u4f1a\u5408\u5e76\u5230\u4e00\u4e2a\u8bf7\u6c42\u4e2d\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u3002\u4f8b\u5982\uff0c\u8f93\u5165</p>\n<pre class=\"programlisting\">select 1\\; select 2\\; select 3;\n</pre>\n<p lang=\"zh\">\u4f1a\u5728\u9047\u5230\u672a\u52a0\u53cd\u659c\u7ebf\u7684\u5206\u53f7\u65f6\uff0c\u5c06\u8fd9\u4e09\u6761 SQL \u547d\u4ee4\u4f5c\u4e3a\u4e00\u4e2a\u8bf7\u6c42\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u3002\u670d\u52a1\u5668\u4f1a\u5c06\u8fd9\u6837\u7684\u8bf7\u6c42\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff0c\u9664\u975e\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u663e\u5f0f\u7684<code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code>\u547d\u4ee4\uff0c\u5c06\u5176\u5212\u5206\u4e3a\u591a\u4e2a\u4e8b\u52a1\u3002\uff08\u6709\u5173\u670d\u52a1\u5668\u5982\u4f55\u5904\u7406\u591a\u67e5\u8be2\u5b57\u7b26\u4e32\u7684\u66f4\u591a\u7ec6\u8282\uff0c\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/12/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT\" title=\"52.2.2.1.\u00a0\u4e00\u4e2a\u7b80\u5355\u67e5\u8be2\u4e2d\u7684\u591a\u6761\u8bed\u53e5\">\u7b2c\u00a052.2.2.1\u00a0\u8282</a>\u3002\uff09<span class=\"application\">psql</span>\u5bf9\u6bcf\u4e2a\u8bf7\u6c42\u53ea\u6253\u5370\u6536\u5230\u7684\u6700\u540e\u4e00\u4e2a\u67e5\u8be2\u7ed3\u679c\uff1b\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u867d\u7136\u4e09\u6761<code class=\"command\">SELECT</code>\u547d\u4ee4\u786e\u5b9e\u90fd\u4f1a\u6267\u884c\uff0c\u4f46<span class=\"application\">psql</span>\u53ea\u6253\u5370<code class=\"literal\">3</code>\u3002</p>\n</dd>\n</dl>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-PATTERNS\">\n<h4 lang=\"zh\">\u6a21\u5f0f</h4>\n<p lang=\"zh\">\u5f88\u591a<code class=\"literal\">\\d</code>\u547d\u4ee4\u90fd\u53ef\u4ee5\u7528\u4e00\u4e2a<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\u6765\u6307\u5b9a\u8981\u88ab\u663e\u793a\u7684\u5bf9\u8c61\u540d\u79f0\u3002\u5728\u6700\u7b80\u5355\u7684\u60c5\u51b5\u4e0b\uff0c\u6a21\u5f0f\u6b63\u597d\u5c31\u662f\u8be5\u5bf9\u8c61\u7684\u51c6\u786e\u540d\u79f0\u3002\u5728\u6a21\u5f0f\u4e2d\u7684\u5b57\u7b26\u901a\u5e38\u4f1a\u88ab\u53d8\u6210\u5c0f\u5199\u5f62\u5f0f\uff08\u5c31\u50cf\u5728 SQL \u540d\u79f0\u4e2d\u90a3\u6837\uff09\uff0c\u4f8b\u5982<code class=\"literal\">\\dt FOO</code>\u5c06\u4f1a\u663e\u793a\u540d\u4e3a<code class=\"literal\">foo</code>\u7684\u8868\u3002\u5c31\u50cf\u5728 SQL \u540d\u79f0\u4e2d\u90a3\u6837\uff0c\u628a\u6a21\u5f0f\u653e\u5728\u53cc\u5f15\u53f7\u4e2d\u53ef\u4ee5\u963b\u6b62\u5b83\u88ab\u8f6c\u6362\u6210\u5c0f\u5199\u5f62\u5f0f\u3002\u5982\u679c\u9700\u8981\u5728\u4e00\u4e2a\u6a21\u5f0f\u4e2d\u5305\u62ec\u4e00\u4e2a\u771f\u6b63\u7684\u53cc\u5f15\u53f7\u5b57\u7b26\uff0c\u5219\u9700\u8981\u5728\u53cc\u5f15\u53f7\u5305\u56f4\u7684\u6587\u672c\u5185\u628a\u5b83\u5199\u6210\u4e24\u4e2a\u76f8\u90bb\u7684\u53cc\u5f15\u53f7\uff0c\u8fd9\u540c\u6837\u662f\u7b26\u5408 SQL \u52a0\u5f15\u53f7\u6807\u8bc6\u7b26\u7684\u89c4\u5219\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dt \"FOO\"\"BAR\"</code>\u5c06\u663e\u793a\u540d\u4e3a<code class=\"literal\">FOO\"BAR</code>\uff08\u4e0d\u662f<code class=\"literal\">foo\"bar</code>\uff09\u7684\u8868\u3002\u548c\u666e\u901a\u7684 SQL \u540d\u79f0\u89c4\u5219\u4e0d\u540c\uff0c\u4f60\u53ef\u4ee5\u53ea\u5728\u6a21\u5f0f\u7684\u4e00\u90e8\u5206\u5468\u56f4\u653e\u4e0a\u53cc\u5f15\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">\\dt FOO\"FOO\"BAR</code>\u5c06\u4f1a\u663e\u793a\u540d\u4e3a<code class=\"literal\">fooFOObar</code>\u7684\u8868\u3002</p>\n<p lang=\"zh\">\u53ea\u8981\u5b8c\u5168\u7701\u7565<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\uff0c<code class=\"literal\">\\d</code>\u547d\u4ee4\u5c31\u4f1a\u663e\u793a\u5f53\u524d\u6a21\u5f0f\u641c\u7d22\u8def\u5f84\u4e2d\u53ef\u89c1\u7684\u5168\u90e8\u5bf9\u8c61 \u2014 \u8fd9\u7b49\u4ef7\u4e8e\u7528<code class=\"literal\">*</code>\u4f5c\u4e3a\u6a21\u5f0f\uff08\u5982\u679c\u4e00\u4e2a\u5bf9\u8c61\u6240\u5728\u7684\u6a21\u5f0f\u4f4d\u4e8e\u641c\u7d22\u8def\u5f84\u4e2d\uff0c\u5e76\u4e14\u5728\u641c\u7d22\u8def\u5f84\u4e2d\u8be5\u6a21\u5f0f\u4e4b\u524d\u6ca1\u6709\u540c\u7c7b\u4e14\u540c\u540d\u7684\u5bf9\u8c61\uff0c\u5219\u8be5\u5bf9\u8c61\u5c31\u662f<em class=\"firstterm\">\u53ef\u89c1</em>\u7684\u3002\u8fd9\u8868\u793a\u53ef\u4ee5\u76f4\u63a5\u7528\u540d\u79f0\u5f15\u7528\u8be5\u5bf9\u8c61\uff0c\u800c\u4e0d\u9700\u8981\u7528\u6a21\u5f0f\u6765\u9650\u5b9a\uff09\u3002\u8981\u67e5\u770b\u6570\u636e\u5e93\u4e2d\u6240\u6709\u5bf9\u8c61\u800c\u4e0d\u8003\u8651\u5176\u53ef\u89c1\u6027\uff0c\u53ef\u4ee5\u628a<code class=\"literal\">*.*</code>\u7528\u4f5c\u6a21\u5f0f\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u653e\u5728\u4e00\u4e2a\u6a21\u5f0f\u4e2d\uff0c<code class=\"literal\">*</code>\u5c06\u5339\u914d\u4efb\u610f\u5b57\u7b26\u5e8f\u5217\uff08\u5305\u62ec\u7a7a\u5e8f\u5217\uff09\uff0c\u800c<code class=\"literal\">?</code>\u4f1a\u5339\u914d\u4efb\u610f\u7684\u5355\u4e2a\u5b57\u7b26\uff08\u8fd9\u79cd\u8bb0\u53f7\u65b9\u6cd5\u5c31\u50cf Unix shell \u7684\u6587\u4ef6\u540d\u6a21\u5f0f\u4e00\u6837\uff09\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dt int*</code>\u4f1a\u663e\u793a\u540d\u79f0\u4ee5<code class=\"literal\">int</code>\u5f00\u59cb\u7684\u8868\u3002\u4f46\u662f\u5982\u679c\u88ab\u653e\u5728\u53cc\u5f15\u53f7\u5185\uff0c<code class=\"literal\">*</code>\u548c<code class=\"literal\">?</code>\u5c31\u4f1a\u5931\u53bb\u8fd9\u4e9b\u7279\u6b8a\u542b\u4e49\u800c\u53d8\u6210\u666e\u901a\u7684\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u5305\u542b\u70b9\u53f7\uff08.\uff09\u7684\u6a21\u5f0f\u4f1a\u88ab\u89e3\u91ca\u4e3a\u6a21\u5f0f\u540d\u5339\u914d\u6a21\u5f0f\uff0c\u540e\u63a5\u5bf9\u8c61\u540d\u5339\u914d\u6a21\u5f0f\u3002\u4f8b\u5982\uff0c\\dt foo*.*bar* \u4f1a\u663e\u793a\u6240\u6709\u6a21\u5f0f\u540d\u4ee5 foo \u5f00\u5934\u3001\u8868\u540d\u5305\u542b bar \u7684\u8868\u3002\u6ca1\u6709\u70b9\u53f7\u65f6\uff0c\u53ea\u5339\u914d\u5f53\u524d\u6a21\u5f0f\u641c\u7d22\u8def\u5f84\u4e2d\u53ef\u89c1\u7684\u5bf9\u8c61\u3002\u540c\u6837\uff0c\u53cc\u5f15\u53f7\u5185\u7684\u70b9\u53f7\u4e0d\u5177\u6709\u7279\u6b8a\u542b\u4e49\uff0c\u6309\u5b57\u9762\u5339\u914d\u3002</p>\n<p lang=\"zh\">\u9ad8\u7ea7\u7528\u6237\u53ef\u4ee5\u4f7f\u7528\u5b57\u7b26\u7c7b\u7b49\u6b63\u5219\u8868\u8fbe\u5f0f\u8bb0\u6cd5\uff0c\u5982<code class=\"literal\">[0-9]</code>\u53ef\u4ee5\u5339\u914d\u4efb\u610f\u6570\u5b57\u3002\u6240\u6709\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u90fd\u6309\u7167<a class=\"xref\" href=\"/docs/12/functions-matching.html#FUNCTIONS-POSIX-REGEXP\" title=\"9.7.3.\u00a0POSIX\u6b63\u5219\u8868\u8fbe\u5f0f\">\u7b2c\u00a09.7.3\u00a0\u8282</a>\u6240\u8bf4\u7684\u5de5\u4f5c\uff0c\u4ee5\u4e0b\u5b57\u7b26\u9664\u5916\uff1a<code class=\"literal\">.</code>\u4f1a\u6309\u7167\u4e0a\u9762\u6240\u8bf4\u7684\u4f5c\u4e3a\u4e00\u79cd\u5206\u9694\u7b26\uff0c<code class=\"literal\">*</code>\u4f1a\u88ab\u7ffb\u8bd1\u6210\u6b63\u5219\u8868\u8fbe\u5f0f\u8bb0\u53f7<code class=\"literal\">.*</code>\uff0c<code class=\"literal\">?</code>\u4f1a\u88ab\u7ffb\u8bd1\u6210<code class=\"literal\">.</code>\uff0c\u800c<code class=\"literal\">$</code>\u5219\u6309\u5b57\u9762\u610f\u601d\u5339\u914d\u3002\u6839\u636e\u9700\u8981\uff0c\u53ef\u4ee5\u7528<code class=\"literal\">?</code>\u6a21\u62df<code class=\"literal\">.</code>\uff0c\u7528<code class=\"literal\">(<em class=\"replaceable\"><code>R</code></em>+|)</code>\u6a21\u62df<code class=\"literal\"><em class=\"replaceable\"><code>R</code></em>*</code>\uff0c\u6216\u7528<code class=\"literal\">(<em class=\"replaceable\"><code>R</code></em>|)</code>\u6a21\u62df<code class=\"literal\"><em class=\"replaceable\"><code>R</code></em>?</code>\u3002<code class=\"literal\">$</code>\u4e0d\u9700\u8981\u4f5c\u4e3a\u4e00\u4e2a\u6b63\u5219\u8868\u8fbe\u5f0f\u5b57\u7b26\uff0c\u56e0\u4e3a\u6a21\u5f0f\u5fc5\u987b\u5339\u914d\u6574\u4e2a\u540d\u79f0\uff0c\u800c\u4e0d\u662f\u50cf\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5e38\u89c4\u7528\u6cd5\u90a3\u6837\u89e3\u91ca\uff08\u6362\u53e5\u8bdd\u8bf4\uff0c<code class=\"literal\">$</code>\u4f1a\u88ab\u81ea\u52a8\u5730\u8ffd\u52a0\u5230\u6a21\u5f0f\u4e0a\uff09\u3002\u5982\u679c\u4e0d\u5e0c\u671b\u8be5\u6a21\u5f0f\u7684\u5339\u914d\u4f4d\u7f6e\u88ab\u56fa\u5b9a\uff0c\u53ef\u4ee5\u5728\u5f00\u5934\u6216\u8005\u7ed3\u5c3e\u5199\u4e0a<code class=\"literal\">*</code>\u3002\u6ce8\u610f\u5728\u53cc\u5f15\u53f7\u5185\uff0c\u6240\u6709\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u4f1a\u5931\u53bb\u5176\u7279\u6b8a\u542b\u4e49\u5e76\u4e14\u6309\u7167\u5176\u5b57\u9762\u610f\u601d\u8fdb\u884c\u5339\u914d\u3002\u8fd8\u6709\uff0c\u5728\u64cd\u4f5c\u7b26\u540d\u79f0\u6a21\u5f0f\u4e2d\uff08\u5373\u4f5c\u4e3a<code class=\"literal\">\\do</code>\u7684\u53c2\u6570\uff09\uff0c\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u4e5f\u6309\u7167\u5b57\u9762\u610f\u601d\u8fdb\u884c\u5339\u914d\u3002</p>\n</div>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.18.8.5\">\n<h3 lang=\"zh\">\u9ad8\u7ea7\u7279\u6027</h3>\n<div class=\"refsect3\" id=\"APP-PSQL-VARIABLES\">\n<h4 lang=\"zh\">\u53d8\u91cf</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u63d0\u4f9b\u4e86\u548c\u666e\u901a Unix \u547d\u4ee4 shell \u76f8\u4f3c\u7684\u53d8\u91cf\u66ff\u6362\u7279\u6027\u3002\u53d8\u91cf\u7b80\u5355\u6765\u8bf4\u5c31\u662f\u4e00\u5bf9\u540d\u79f0/\u503c\uff0c\u5176\u4e2d\u503c\u53ef\u4ee5\u662f\u4efb\u610f\u957f\u5ea6\u7684\u4efb\u610f\u5b57\u7b26\u4e32\u3002\u540d\u79f0\u5fc5\u987b\u7531\u5b57\u6bcd\uff08\u5305\u62ec\u975e\u62c9\u4e01\u5b57\u6bcd\uff09\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u6784\u6210\u3002</p>\n<p lang=\"zh\">\u8981\u8bbe\u7f6e\u4e00\u4e2a\u53d8\u91cf\uff0c\u53ef\u4ee5\u4f7f\u7528<span class=\"application\">psql</span>\u7684\u5143\u547d\u4ee4<code class=\"command\">\\set</code>\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo bar</code></strong>\n</pre>\n<p lang=\"zh\">\u4f1a\u5c06<code class=\"literal\">foo</code>\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">bar</code>\u3002\u8981\u68c0\u7d22\u8be5\u53d8\u91cf\u7684\u5185\u5bb9\uff0c\u53ef\u4ee5\u5728\u540d\u79f0\u524d\u653e\u4e00\u4e2a\u5192\u53f7\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\echo :foo</code></strong>\nbar\n</pre>\n<p lang=\"zh\">\u8fd9\u5728\u5e38\u89c4 SQL \u547d\u4ee4\u548c\u5143\u547d\u4ee4\u4e2d\u5747\u6709\u6548\uff0c\u4e0b\u6587\u7684<a class=\"xref\" href=\"/docs/12/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL \u63d2\u503c\"><acronym class=\"acronym\">SQL</acronym> \u63d2\u503c</a>\u4e2d\u6709\u66f4\u591a\u7ec6\u8282\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u8c03\u7528<code class=\"command\">\\set</code>\u65f6\u6ca1\u6709\u7b2c\u4e8c\u4e2a\u53c2\u6570\uff0c\u8be5\u53d8\u91cf\u4f1a\u88ab\u8bbe\u7f6e\u4e3a\u4e00\u4e2a\u7a7a\u5b57\u7b26\u4e32\u503c\u3002\u8981\u53d6\u6d88\u8bbe\u7f6e\uff08\u5373\u5220\u9664\uff09\u4e00\u4e2a\u53d8\u91cf\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4<code class=\"command\">\\unset</code>\u3002\u8981\u663e\u793a\u6240\u6709\u53d8\u91cf\u7684\u503c\uff0c\u5728\u8c03\u7528<code class=\"command\">\\set</code>\u65f6\u4e0d\u5e26\u4efb\u4f55\u53c2\u6570\u5373\u53ef\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\"><code class=\"command\">\\set</code>\u7684\u53c2\u6570\u670d\u4ece\u4e0e\u5176\u4ed6\u547d\u4ee4\u76f8\u540c\u7684\u66ff\u6362\u89c4\u5219\u3002\u56e0\u6b64\u53ef\u4ee5\u6784\u9020\u6709\u8da3\u7684\u5f15\u7528\uff0c\u4f8b\u5982<code class=\"literal\">\\set :foo 'something'</code>\u4ee5\u53ca\u5206\u522b\u5f97\u5230<span class=\"productname\">Perl</span>\u6216\u8005<span class=\"productname\"><acronym class=\"acronym\">PHP</acronym></span>\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u8f6f\u94fe\u63a5</span>\u201d</span>\u6216\u8005<span class=\"quote\">\u201c<span class=\"quote\">\u53ef\u53d8\u53d8\u91cf</span>\u201d</span>\u3002\u4e0d\u5e78\u7684\u662f\uff08\u6216\u8005\u5e78\u8fd0\u7684\u662f\uff1f\uff09\uff0c\u8fd9\u4e9b\u6784\u9020\u51fa\u6765\u7684\u4e1c\u897f\u5e76\u6ca1\u6709\u4ec0\u4e48\u7528\u5904\u3002\u5728\u53e6\u4e00\u65b9\u9762\uff0c<code class=\"literal\">\\set bar :foo</code>\u662f\u4e00\u79cd\u5f88\u597d\u7684\u62f7\u8d1d\u53d8\u91cf\u7684\u65b9\u6cd5\u3002</p>\n</div>\n<p lang=\"zh\">\u6709\u4e00\u4e9b\u53d8\u91cf\u4f1a\u88ab<span class=\"application\">psql</span>\u7279\u6b8a\u5bf9\u5f85\u3002\u5b83\u4eec\u8868\u793a\u7279\u5b9a\u7684\u9009\u9879\u8bbe\u7f6e\uff0c\u8fd0\u884c\u65f6\u8fd9\u7c7b\u9009\u9879\u8bbe\u7f6e\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539\u8be5\u53d8\u91cf\u7684\u503c\u6765\u6539\u53d8\uff0c\u6216\u8005\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u5b83\u4eec\u8868\u793a<span class=\"application\">psql</span>\u7684\u53ef\u66f4\u6539\u7684\u72b6\u6001\u3002\u6309\u7167\u60ef\u4f8b\uff0c\u6240\u6709\u88ab\u7279\u6b8a\u5bf9\u5f85\u7684\u53d8\u91cf\u7684\u540d\u79f0\u7531\u5168\u90e8\u5927\u5199\u5f62\u5f0f\u7684 ASCII \u5b57\u6bcd\uff08\u8fd8\u6709\u53ef\u80fd\u662f\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\uff09\u7ec4\u6210\u3002\u4e3a\u4e86\u786e\u4fdd\u672a\u6765\u6700\u5927\u7684\u517c\u5bb9\u6027\uff0c\u6700\u597d\u907f\u514d\u628a\u8fd9\u7c7b\u53d8\u91cf\u540d\u7528\u4e8e\u81ea\u5df1\u7684\u76ee\u7684\u3002</p>\n<p lang=\"zh\">\u63a7\u5236<span class=\"application\">psql</span>\u884c\u4e3a\u7684\u53d8\u91cf\u901a\u5e38\u4e0d\u80fd\u88ab\u53d6\u6d88\u8bbe\u7f6e\u6216\u8005\u8bbe\u7f6e\u4e3a\u65e0\u6548\u503c\u3002\u5141\u8bb8<code class=\"literal\">\\unset</code>\u547d\u4ee4\uff0c\u4f46\u5b83\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u5b83\u7684\u9ed8\u8ba4\u503c\u3002\u6ca1\u6709\u7b2c\u4e8c\u53c2\u6570\u7684<code class=\"literal\">\\set</code>\u547d\u4ee4\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\uff08\u5bf9\u4e8e\u63a5\u53d7\u8be5\u503c\u7684\u63a7\u5236\u53d8\u91cf\uff09\uff0c\u5bf9\u4e0d\u63a5\u53d7\u8be5\u503c\u7684\u53d8\u91cf\u5219\u4f1a\u62d2\u7edd\u8fd9\u4e2a\u547d\u4ee4\u3002\u6b64\u5916\uff0c\u63a5\u53d7\u503c<code class=\"literal\">on</code>\u548c<code class=\"literal\">off</code>\u7684\u63a7\u5236\u53d8\u91cf\u4e5f\u80fd\u63a5\u53d7\u5176\u4ed6\u5e38\u89c1\u7684\u5e03\u5c14\u503c\u62fc\u5199\u65b9\u5f0f\uff0c\u4f8b\u5982<code class=\"literal\">true</code>\u548c<code class=\"literal\">false</code>\u3002</p>\n<p lang=\"zh\">\u88ab\u7279\u6b8a\u5bf9\u5f85\u7684\u53d8\u91cf\u662f\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"varname\">AUTOCOMMIT</code> </span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\uff08\u9ed8\u8ba4\uff09\u65f6\uff0c\u6bcf\u4e00\u4e2a SQL \u547d\u4ee4\u5728\u6210\u529f\u5b8c\u6210\u65f6\u4f1a\u88ab\u81ea\u52a8\u63d0\u4ea4\u3002\u5728\u8fd9\u79cd\u6a21\u5f0f\u4e2d\u8981\u63a8\u8fdf\u63d0\u4ea4\uff0c\u5fc5\u987b\u8f93\u5165\u4e00\u4e2a<code class=\"command\">BEGIN</code>\u6216\u8005<code class=\"command\">START TRANSACTION</code> SQL \u547d\u4ee4\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">off</code>\u6216\u8005\u88ab\u53d6\u6d88\u8bbe\u7f6e\u65f6\uff0c\u5728\u663e\u5f0f\u53d1\u51fa<code class=\"command\">COMMIT</code>\u6216\u8005<code class=\"command\">END</code>\u4e4b\u524d\uff0cSQL \u547d\u4ee4\u4e0d\u4f1a\u88ab\u63d0\u4ea4\u3002\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u4f1a\u4e3a\u4f60\u53d1\u51fa\u4e00\u4e2a\u9690\u5f0f\u7684<code class=\"command\">BEGIN</code>\uff0c\u8fd9\u4f1a\u53d1\u751f\u5728\u4efb\u4f55\u4e0d\u5728\u4e00\u4e2a\u4e8b\u52a1\u5757\u4e2d\u4e14\u672c\u8eab\u65e2\u4e0d\u662f<code class=\"command\">BEGIN</code>\u53ca\u5176\u4ed6\u4e8b\u52a1\u63a7\u5236\u547d\u4ee4\u4e14\u4e0d\u662f\u65e0\u6cd5\u5728\u4e8b\u52a1\u5757\u4e2d\u6267\u884c\u7684\u547d\u4ee4\uff08\u4f8b\u5982<code class=\"command\">VACUUM</code>\uff09\u4e4b\u524d\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u4e2d\uff0c\u5fc5\u987b\u901a\u8fc7<code class=\"command\">ABORT</code>\u6216\u8005<code class=\"command\">ROLLBACK</code>\u663e\u5f0f\u5730\u653e\u5f03\u4efb\u4f55\u5931\u8d25\u7684\u4e8b\u52a1\u3002\u8fd8\u8981\u8bb0\u4f4f\uff0c\u5982\u679c\u9000\u51fa\u4f1a\u8bdd\u65f6\u6ca1\u6709\u63d0\u4ea4\uff0c\u5219\u6240\u6709\u7684\u5de5\u4f5c\u90fd\u4f1a\u4e22\u5931\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u81ea\u52a8\u63d0\u4ea4\u6253\u5f00\u6a21\u5f0f\u662f<span class=\"productname\">PostgreSQL</span>\u7684\u4f20\u7edf\u884c\u4e3a\uff0c\u4f46\u662f\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u66f4\u63a5\u8fd1\u4e8e SQL \u7684\u89c4\u8303\u3002\u5982\u679c\u66f4\u559c\u6b22\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\uff0c\u53ef\u4ee5\u5728\u7cfb\u7edf\u7ea7\u7684<code class=\"filename\">psqlrc</code>\u6587\u4ef6\u6216\u8005\u4e2a\u4eba\u7684<code class=\"filename\">~/.psqlrc</code>\u6587\u4ef6\u4e2d\u8bbe\u7f6e\u5b83\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">COMP_KEYWORD_CASE</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u786e\u5b9a\u5728\u8865\u5168\u4e00\u4e2a SQL \u5173\u952e\u8bcd\u65f6\u8981\u4f7f\u7528\u7684\u5927\u5c0f\u5199\u5f62\u5f0f\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">lower</code>\u6216\u8005<code class=\"literal\">upper</code>\uff0c\u8865\u5168\u540e\u7684\u8bcd\u5c06\u5206\u522b\u662f\u5c0f\u5199\u6216\u8005\u5927\u5199\u5f62\u5f0f\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">preserve-lower</code>\u6216\u8005<code class=\"literal\">preserve-upper</code>\uff08\u9ed8\u8ba4\uff09\uff0c\u8865\u5168\u540e\u7684\u8bcd\u5c06\u4f1a\u4fdd\u6301\u8be5\u8bcd\u5df2\u8f93\u5165\u90e8\u5206\u7684\u5927\u5c0f\u5199\u5f62\u5f0f\uff0c\u4f46\u662f\u5982\u679c\u88ab\u8865\u5168\u7684\u8bcd\u8fd8\u6ca1\u6709\u88ab\u8f93\u5165\uff0c\u5219\u5b83\u4f1a\u88ab\u5206\u522b\u8865\u5168\u6210\u5c0f\u5199\u6216\u8005\u5927\u5199\u5f62\u5f0f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">DBNAME</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u5df2\u8fde\u63a5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u662f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ECHO</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">all</code>\uff0c\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u4f1a\u5728\u8bfb\u5165\u65f6\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u8bfb\u53d6\u7684\u884c\uff09\u3002\u8981\u5728\u7a0b\u5e8f\u5f00\u59cb\u65f6\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\uff0c\u53ef\u4ee5\u4f7f\u7528\u5f00\u5173<code class=\"option\">-a</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">queries</code>\uff0c<span class=\"application\">psql</span>\u4f1a\u5728\u53d1\u9001\u6bcf\u4e2a\u67e5\u8be2\u7ed9\u670d\u52a1\u5668\u65f6\u5c06\u5b83\u4eec\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\u3002\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\u7684\u5f00\u5173\u662f<code class=\"option\">-e</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">errors</code>\uff0c\u90a3\u4e48\u53ea\u6709\u5931\u8d25\u7684\u67e5\u8be2\u4f1a\u88ab\u663e\u793a\u5728\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u4e0a\u3002\u8fd9\u79cd\u884c\u4e3a\u7684\u5f00\u5173\u662f<code class=\"option\">-b</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">none</code>\uff08\u9ed8\u8ba4\u503c\uff09\u5219\u4e0d\u4f1a\u663e\u793a\u4efb\u4f55\u67e5\u8be2\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ECHO_HIDDEN</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u4e14\u4e00\u4e2a\u53cd\u659c\u7ebf\u547d\u4ee4\u67e5\u8be2\u6570\u636e\u5e93\u65f6\uff0c\u76f8\u5e94\u7684\u67e5\u8be2\u4f1a\u88ab\u5148\u663e\u793a\u3002\u8fd9\u79cd\u7279\u6027\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u5b66\u4e60<span class=\"productname\">PostgreSQL</span>\u7684\u5185\u90e8\u5e76\u4e14\u5728\u81ea\u5df1\u7684\u7a0b\u5e8f\u4e2d\u63d0\u4f9b\u7c7b\u4f3c\u7684\u529f\u80fd\uff08\u8981\u5728\u7a0b\u5e8f\u5f00\u59cb\u65f6\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\uff0c\u53ef\u4ee5\u4f7f\u7528\u5f00\u5173<code class=\"option\">-E</code>\uff09\u3002\u5982\u679c\u628a\u8fd9\u4e2a\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">noexec</code>\uff0c\u5219\u5bf9\u5e94\u7684\u67e5\u8be2\u53ea\u4f1a\u88ab\u663e\u793a\u800c\u5e76\u4e0d\u771f\u6b63\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u6267\u884c\u3002\u9ed8\u8ba4\u503c\u662f<code class=\"literal\">off</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ENCODING</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u7684\u5ba2\u6237\u7aef\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u6bcf\u4e00\u6b21\u4f60\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\uff09\u65f6\u4ee5\u53ca\u5f53\u4f60\u7528<code class=\"literal\">\\encoding</code>\u66f4\u6539\u7f16\u7801\u65f6\uff0c\u8fd9\u4e2a\u53d8\u91cf\u90fd\u4f1a\u88ab\u8bbe\u7f6e\uff0c\u4f46\u5b83\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ERROR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u4e0a\u4e00\u4e2aSQL\u67e5\u8be2\u5931\u8d25\u5219\u4e3a<code class=\"literal\">true</code>\uff0c\u5982\u679c\u6210\u529f\u5219\u662f<code class=\"literal\">false</code>\u3002\u53e6\u89c1<code class=\"varname\">SQLSTATE</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">FETCH_COUNT</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a\u4e00\u4e2a\u5927\u4e8e\u96f6\u7684\u6574\u6570\u503c\uff0c<code class=\"command\">SELECT</code>\u67e5\u8be2\u7684\u7ed3\u679c\u4f1a\u4ee5\u4e00\u7ec4\u4e00\u7ec4\u7684\u65b9\u5f0f\u53d6\u51fa\u5e76\u4e14\u663e\u793a\uff08\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u7684\u90a3\u6837\u628a\u6574\u4e2a\u7ed3\u679c\u96c6\u62ff\u5230\u4ee5\u540e\u518d\u663e\u793a\uff09\uff0c\u6bcf\u7ec4\u5305\u542b\u7684\u884c\u6570\u7b49\u4e8e\u8be5\u6574\u6570\u503c\u3002\u56e0\u6b64\uff0c\u8fd9\u79cd\u65b9\u5f0f\u53ea\u4f1a\u4f7f\u7528\u6709\u9650\u7684\u5185\u5b58\u91cf\uff0c\u800c\u4e0d\u7ba1\u6574\u4e2a\u7ed3\u679c\u96c6\u7684\u5927\u5c0f\u3002\u5728\u542f\u7528\u8fd9\u4e2a\u7279\u6027\u65f6\uff0c\u901a\u5e38\u4f1a\u4f7f\u7528 100 \u5230 1000 \u7684\u8bbe\u7f6e\u3002\u8bb0\u4f4f\u5728\u4f7f\u7528\u8fd9\u79cd\u7279\u6027\u65f6\uff0c\u4e00\u4e2a\u67e5\u8be2\u53ef\u80fd\u4f1a\u5728\u5df2\u7ecf\u663e\u793a\u4e86\u4e00\u4e9b\u884c\u4e4b\u540e\u5931\u8d25\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5c3d\u7ba1\u53ef\u4ee5\u628a\u8fd9\u79cd\u7279\u6027\u7528\u4e8e\u4efb\u4f55\u7684\u8f93\u51fa\u683c\u5f0f\uff0c\u4f46\u662f\u9ed8\u8ba4\u7684<code class=\"literal\">aligned</code>\u683c\u5f0f\u770b\u8d77\u6765\u4f1a\u6bd4\u8f83\u7cdf\u7cd5\uff0c\u56e0\u4e3a\u6bcf\u4e00\u7ec4\u7684<code class=\"varname\">FETCH_COUNT</code>\u884c\u5c06\u88ab\u5355\u72ec\u683c\u5f0f\u5316\uff0c\u8fd9\u5c31\u4f1a\u5bfc\u81f4\u4e0d\u540c\u7684\u884c\u7ec4\u7684\u5217\u5bbd\u4e0d\u540c\u3002\u5176\u4ed6\u7684\u8f93\u51fa\u683c\u5f0f\u4f1a\u66f4\u597d\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">HIDE_TABLEAM</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6b64\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">true</code>\uff0c\u5219\u4e0d\u663e\u793a\u8868\u7684\u8bbf\u95ee\u65b9\u6cd5\u7684\u8be6\u7ec6\u4fe1\u606f\u3002\u8fd9\u4e3b\u8981\u7528\u4e8e\u56de\u5f52\u6d4b\u8bd5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">HISTCONTROL</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">ignorespace</code>\uff0c\u5219\u4ee5\u4e00\u4e2a\u7a7a\u683c\u5f00\u59cb\u7684\u884c\u4e0d\u4f1a\u88ab\u653e\u5165\u5230\u5386\u53f2\u5217\u8868\u4e2d\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">ignoredups</code>\uff0c\u5219\u4e0e\u4e0a\u4e00\u6761\u5386\u53f2\u8bb0\u5f55\u76f8\u540c\u7684\u884c\u4e0d\u4f1a\u88ab\u653e\u5165\u3002\u503c<code class=\"literal\">ignoreboth</code>\u7ec4\u5408\u4e86\u4e0a\u8ff0\u4e24\u79cd\u503c\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">none</code>\uff08\u9ed8\u8ba4\u503c\uff09\uff0c\u6240\u6709\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e2d\u88ab\u8bfb\u5165\u7684\u884c\u90fd\u4f1a\u4fdd\u5b58\u5728\u5386\u53f2\u5217\u8868\u4e2d\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">HISTFILE</code></span></dt>\n<dd>\n<p lang=\"zh\">\u7528\u4e8e\u5b58\u50a8\u5386\u53f2\u8bb0\u5f55\u5217\u8868\u7684\u6587\u4ef6\u540d\u3002\u5982\u679c\u672a\u8bbe\u7f6e\uff0c\u5219\u4ece\u73af\u5883\u53d8\u91cf <code class=\"envar\">PSQL_HISTORY</code> \u4e2d\u83b7\u53d6\u6587\u4ef6\u540d\u3002\u5982\u679c\u8be5\u73af\u5883\u53d8\u91cf\u4e5f\u672a\u8bbe\u7f6e\uff0c\u5219\u9ed8\u8ba4\u4f7f\u7528 <code class=\"filename\">~/.psql_history</code>\uff0c\u5728 Windows \u4e0a\u5219\u4f7f\u7528 <code class=\"filename\">%APPDATA%\\postgresql\\psql_history</code>\u3002\u4f8b\u5982\uff0c\u5c06\u4ee5\u4e0b\u5185\u5bb9\uff1a</p>\n<pre class=\"programlisting\">\\set HISTFILE ~/.psql_history- :DBNAME\n</pre>\n<p lang=\"zh\">\u653e\u5165 <code class=\"filename\">~/.psqlrc</code> \u4f1a\u4f7f <span class=\"application\">psql</span> \u4e3a\u6bcf\u4e2a\u6570\u636e\u5e93\u7ef4\u62a4\u5355\u72ec\u7684\u5386\u53f2\u8bb0\u5f55\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">HISTSIZE</code></span></dt>\n<dd>\n<p lang=\"zh\">\u547d\u4ee4\u5386\u53f2\u4e2d\u6700\u591a\u4fdd\u5b58\u7684\u547d\u4ee4\u6570\uff08\u9ed8\u8ba4 500\uff09\u3002\u8bbe\u4e3a\u8d1f\u503c\u65f6\uff0c\u4e0d\u8bbe\u4e0a\u9650\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">HOST</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e3b\u673a\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u4e5f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">IGNOREEOF</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8bbe\u4e3a 1 \u6216\u66f4\u5c0f\u7684\u503c\uff0c\u5411 psql \u4ea4\u4e92\u4f1a\u8bdd\u53d1\u9001 EOF \u5b57\u7b26\uff08\u901a\u5e38\u4e3a Control + D\uff09\u5c31\u4f1a\u7ec8\u6b62\u5e94\u7528\u3002\u5982\u679c\u8bbe\u4e3a\u66f4\u5927\u7684\u6570\u503c\uff0c\u5219\u5fc5\u987b\u8fde\u7eed\u8f93\u5165\u76f8\u5e94\u6b21\u6570\u7684 EOF \u5b57\u7b26\u624d\u4f1a\u7ec8\u6b62\u4ea4\u4e92\u4f1a\u8bdd\u3002\u5982\u679c\u53d8\u91cf\u8bbe\u4e3a\u975e\u6570\u503c\uff0c\u4f1a\u88ab\u89e3\u91ca\u4e3a 10\u3002\u9ed8\u8ba4\u503c\u4e3a 0\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">LASTOID</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6700\u8fd1\u4e00\u6b21\u53d7\u5f71\u54cd\u7684 OID \u503c\uff0c\u7531 INSERT \u6216 \\lo_import \u547d\u4ee4\u8fd4\u56de\u3002\u6b64\u53d8\u91cf\u4ec5\u4fdd\u8bc1\u5728\u4e0b\u4e00\u6761 SQL \u547d\u4ee4\u7684\u7ed3\u679c\u663e\u793a\u4e4b\u524d\u6709\u6548\u3002\u4ece\u7248\u672c 12 \u8d77\uff0cPostgreSQL \u670d\u52a1\u5668\u4e0d\u518d\u652f\u6301 OID \u7cfb\u7edf\u5217\uff0c\u56e0\u6b64\u8fde\u63a5\u5230\u8fd9\u4e9b\u670d\u52a1\u5668\u65f6\uff0c\u6267\u884c INSERT \u540e LASTOID \u59cb\u7ec8\u4e3a 0\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">LAST_ERROR_MESSAGE</code><br/></span><span class=\"term\"><code class=\"varname\">LAST_ERROR_SQLSTATE</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d<span class=\"application\">psql</span>\u4f1a\u8bdd\u4e2d\u6700\u8fd1\u4e00\u4e2a\u5931\u8d25\u67e5\u8be2\u7684\u4e3b\u9519\u8bef\u6d88\u606f\u548c\u76f8\u5173\u7684SQLSTATE\u4ee3\u7801\uff0c\u5982\u679c\u5728\u5f53\u524d\u4f1a\u8bdd\u4e2d\u6ca1\u6709\u53d1\u751f\u9519\u8bef\uff0c\u5219\u662f\u4e00\u4e2a\u7a7a\u5b57\u7b26\u4e32\u548c<code class=\"literal\">00000</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ON_ERROR_ROLLBACK</code> </span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u65f6\uff0c\u5982\u679c\u4e8b\u52a1\u5757\u4e2d\u7684\u4e00\u4e2a\u8bed\u53e5\u4ea7\u751f\u4e00\u4e2a\u9519\u8bef\uff0c\u8be5\u9519\u8bef\u4f1a\u88ab\u5ffd\u7565\u5e76\u4e14\u8be5\u4e8b\u52a1\u4f1a\u7ee7\u7eed\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">interactive</code>\u65f6\uff0c\u53ea\u5728\u4ea4\u4e92\u5f0f\u4f1a\u8bdd\u4e2d\u5ffd\u7565\u8fd9\u7c7b\u9519\u8bef\uff0c\u800c\u8bfb\u53d6\u811a\u672c\u6587\u4ef6\u65f6\u5219\u4e0d\u4f1a\u5ffd\u7565\u9519\u8bef\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">off</code>\uff08\u9ed8\u8ba4\u503c\uff09\u65f6\uff0c\u4e8b\u52a1\u5757\u4e2d\u4ea7\u751f\u9519\u8bef\u7684\u4e00\u4e2a\u8bed\u53e5\u4f1a\u4e2d\u6b62\u6574\u4e2a\u4e8b\u52a1\u3002\u9519\u8bef\u56de\u6eda\u6a21\u5f0f\u7684\u5de5\u4f5c\u539f\u7406\u662f\u5728\u4e8b\u52a1\u5757\u7684\u6bcf\u4e2a\u547d\u4ee4\u4e4b\u524d\u90fd\u4e3a\u4f60\u53d1\u51fa\u4e00\u4e2a\u9690\u5f0f\u7684<code class=\"command\">SAVEPOINT</code>\uff0c\u7136\u540e\u5728\u8be5\u547d\u4ee4\u5931\u8d25\u65f6\u56de\u6eda\u5230\u8be5\u4fdd\u5b58\u70b9\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ON_ERROR_STOP</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u51fa\u9519\u540e\u4ecd\u4f1a\u7ee7\u7eed\u5904\u7406\u547d\u4ee4\u3002\u5c06\u6b64\u53d8\u91cf\u8bbe\u4e3a on \u540e\uff0c\u5904\u7406\u4f1a\u7acb\u5373\u505c\u6b62\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\uff0cpsql \u4f1a\u8fd4\u56de\u547d\u4ee4\u63d0\u793a\u7b26\uff1b\u5426\u5219\uff0cpsql \u4f1a\u9000\u51fa\u5e76\u8fd4\u56de\u9519\u8bef\u7801 3\uff0c\u4ee5\u533a\u522b\u4e8e\u9519\u8bef\u7801 1 \u6240\u8868\u793a\u7684\u81f4\u547d\u9519\u8bef\u3002\u65e0\u8bba\u54ea\u79cd\u60c5\u51b5\uff0c\u5f53\u524d\u6b63\u5728\u8fd0\u884c\u7684\u6240\u6709\u811a\u672c\uff08\u5982\u679c\u5b58\u5728\u9876\u5c42\u811a\u672c\uff0c\u5219\u5305\u62ec\u8be5\u811a\u672c\u53ca\u5176\u8c03\u7528\u7684\u5176\u4ed6\u811a\u672c\uff09\u90fd\u4f1a\u7acb\u5373\u7ec8\u6b62\u3002\u5982\u679c\u9876\u5c42\u547d\u4ee4\u5b57\u7b26\u4e32\u5305\u542b\u591a\u6761 SQL \u547d\u4ee4\uff0c\u5219\u4f1a\u5728\u5f53\u524d\u547d\u4ee4\u5904\u505c\u6b62\u5904\u7406\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">PORT</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u7aef\u53e3\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u4e5f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">PROMPT1</code><br/></span><span class=\"term\"><code class=\"varname\">PROMPT2</code><br/></span><span class=\"term\"><code class=\"varname\">PROMPT3</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e9b\u53d8\u91cf\u6307\u5b9a<span class=\"application\">psql</span>\u53d1\u51fa\u7684\u63d0\u793a\u7b26\u7684\u6a21\u6837\u3002\u89c1\u4e0b\u6587\u7684<a class=\"xref\" href=\"/docs/12/app-psql.html#APP-PSQL-PROMPTING\" title=\"\u63d0\u793a\u7b26\">\u63d0\u793a\u7b26</a>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">QUIET</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u8fd9\u4e2a\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-q</code>\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\u53ef\u80fd\u7528\u5904\u4e0d\u5927\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ROW_COUNT</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6700\u8fd1\u4e00\u6761 SQL \u67e5\u8be2\u8fd4\u56de\u6216\u5f71\u54cd\u7684\u884c\u6570\uff1b\u5982\u679c\u67e5\u8be2\u5931\u8d25\u6216\u6ca1\u6709\u62a5\u544a\u884c\u6570\uff0c\u5219\u4e3a 0\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">SERVER_VERSION_NAME</code><br/></span><span class=\"term\"><code class=\"varname\">SERVER_VERSION_NUM</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b57\u7b26\u4e32\u5f62\u5f0f\u7684\u670d\u52a1\u5668\u7248\u672c\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">9.6.2</code>\u3001<code class=\"literal\">10.1</code>\u6216\u8005<code class=\"literal\">11beta1</code>\uff0c\u4ee5\u53ca\u6570\u5b57\u5f62\u5f0f\u7684\u670d\u52a1\u5668\u7248\u672c\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">90602</code>\u6216\u8005<code class=\"literal\">100001</code>\u3002\u6bcf\u6b21\u4f60\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\uff09\u65f6\uff0c\u8fd9\u4e9b\u90fd\u4f1a\u88ab\u8bbe\u7f6e\uff0c\u4f46\u53ef\u4ee5\u88ab\u6539\u53d8\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">SHOW_CONTEXT</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u53d8\u91cf\u53ef\u4ee5\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">never</code>\u3001<code class=\"literal\">errors</code>\u6216\u8005<code class=\"literal\">always</code>\u6765\u63a7\u5236\u662f\u5426\u5728\u6765\u81ea\u670d\u52a1\u5668\u7684\u6d88\u606f\u4e2d\u663e\u793a<code class=\"literal\">CONTEXT</code>\u5b57\u6bb5\u3002\u9ed8\u8ba4\u662f<code class=\"literal\">errors</code>\uff08\u8868\u793a\u5728\u9519\u8bef\u6d88\u606f\u4e2d\u663e\u793a\u4e0a\u4e0b\u6587\uff0c\u4f46\u5728\u901a\u77e5\u548c\u8b66\u544a\u6d88\u606f\u4e2d\u4e0d\u663e\u793a\uff09\u3002\u5f53<code class=\"varname\">VERBOSITY</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">terse</code>\u6216<code class=\"literal\">sqlstate</code>\u65f6\uff0c\u8fd9\u4e2a\u8bbe\u7f6e\u65e0\u6548\uff08\u53e6\u89c1<code class=\"command\">\\errverbose</code>\uff0c\u5b83\u53ef\u4ee5\u7528\u6765\u5f97\u5230\u521a\u9047\u5230\u7684\u9519\u8bef\u7684\u8be6\u7ec6\u4fe1\u606f\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">SINGLELINE</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u8fd9\u4e2a\u53d8\u91cf\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-S</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">SINGLESTEP</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u8fd9\u4e2a\u53d8\u91cf\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-s</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">SQLSTATE</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0e\u4e0a\u4e00\u4e2aSQL\u67e5\u8be2\u7684\u5931\u8d25\u76f8\u5173\u7684\u9519\u8bef\u4ee3\u7801\uff08\u89c1<a class=\"xref\" href=\"/docs/12/errcodes-appendix.html\" title=\"\u9644\u5f55\u00a0A.\u00a0PostgreSQL\u9519\u8bef\u4ee3\u7801\">\u9644\u5f55\u00a0A</a>\uff09\uff0c\u5982\u679c\u4e0a\u4e00\u4e2a\u67e5\u8be2\u6210\u529f\u5219\u4e3a<code class=\"literal\">00000</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">USER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7528\u6237\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u662f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">VERBOSITY</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u53d8\u91cf\u53ef\u4ee5\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">default</code>\u3001<code class=\"literal\">verbose</code>\u3001<code class=\"literal\">terse</code>\u6216\u8005<code class=\"literal\">sqlstate</code>\u6765\u63a7\u5236\u9519\u8bef\u62a5\u544a\u7684\u8be6\u7ec6\u7a0b\u5ea6\uff08\u53e6\u89c1<code class=\"command\">\\errverbose</code>\uff0c\u5728\u60f3\u5f97\u5230\u521a\u9047\u5230\u7684\u9519\u8bef\u7684\u8be6\u7ec6\u4fe1\u606f\u65f6\u4f7f\u7528\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">VERSION</code><br/></span><span class=\"term\"><code class=\"varname\">VERSION_NAME</code><br/></span><span class=\"term\"><code class=\"varname\">VERSION_NUM</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e9b\u53d8\u91cf\u5728\u7a0b\u5e8f\u542f\u52a8\u65f6\u88ab\u8bbe\u7f6e\u4ee5\u53cd\u6620<span class=\"application\">psql</span>\u7684\u7248\u672c\uff0c\u5206\u522b\u662f\u4e00\u4e2a\u8be6\u7ec6\u7684\u5b57\u7b26\u4e32\u3001\u4e00\u4e2a\u77ed\u5b57\u7b26\u4e32\uff08\u4f8b\u5982<code class=\"literal\">9.6.2</code>\u3001<code class=\"literal\">10.1</code>\u6216\u8005<code class=\"literal\">11beta1</code>\uff09\u4ee5\u53ca\u4e00\u4e2a\u6570\u5b57\uff08\u4f8b\u5982<code class=\"literal\">90602</code>\u6216\u8005<code class=\"literal\">100001</code>\uff09\u3002\u5b83\u4eec\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-INTERPOLATION\">\n<h4 lang=\"zh\"><acronym class=\"acronym\">SQL</acronym> \u63d2\u503c</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u53d8\u91cf\u7684\u4e00\u4e2a\u5173\u952e\u7279\u6027\u662f\u53ef\u4ee5\u628a\u5b83\u4eec\u66ff\u6362\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u63d2\u503c</span>\u201d</span>\uff09\u5230\u5e38\u89c4<acronym class=\"acronym\">SQL</acronym>\u8bed\u53e5\u4e2d\uff0c\u4e5f\u53ef\u4ee5\u628a\u5b83\u4eec\u66ff\u6362\u5230\u5143\u547d\u4ee4\u7684\u53c2\u6570\u4e2d\u3002\u6b64\u5916\uff0c<span class=\"application\">psql</span>\u8fd8\u63d0\u4f9b\u4e86\u529f\u80fd\u6765\u786e\u4fdd\u88ab\u7528\u4f5c SQL \u5b57\u9762\u91cf\u548c\u6807\u8bc6\u7b26\u7684\u53d8\u91cf\u503c\u4f1a\u88ab\u6b63\u786e\u5730\u52a0\u5f15\u53f7\u3002\u4e0d\u52a0\u5f15\u53f7\u5730\u63d2\u503c\u4e00\u4e2a\u503c\u7684\u8bed\u6cd5\u662f\u5728\u53d8\u91cf\u540d\u524d\u9762\u52a0\u4e0a\u4e00\u4e2a\u5192\u53f7\uff08<code class=\"literal\">:</code>\uff09\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo 'my_table'</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM :foo;</code></strong>\n</pre>\n<p lang=\"zh\">\u5c06\u67e5\u8be2\u8868<code class=\"literal\">my_table</code>\u3002\u6ce8\u610f\u8fd9\u53ef\u80fd\u4f1a\u4e0d\u5b89\u5168\uff1a\u8be5\u53d8\u91cf\u7684\u503c\u4f1a\u88ab\u6309\u5b57\u9762\u62f7\u8d1d\uff0c\u56e0\u6b64\u5b83\u53ef\u80fd\u5305\u542b\u4e0d\u5e73\u8861\u7684\u5f15\u53f7\u751a\u81f3\u53cd\u659c\u7ebf\u547d\u4ee4\u3002\u5fc5\u987b\u786e\u4fdd\u628a\u5b83\u653e\u5728\u90a3\u91cc\u662f\u6709\u610f\u4e49\u7684\u3002</p>\n<p lang=\"zh\">\u5f53\u4e00\u4e2a\u503c\u8981\u7528\u4f5c SQL \u5b57\u9762\u91cf\u6216\u6807\u8bc6\u7b26\u65f6\uff0c\u6700\u5b89\u5168\u7684\u505a\u6cd5\u662f\u4e3a\u5b83\u52a0\u4e0a\u5f15\u53f7\u3002\u8981\u5c06\u53d8\u91cf\u503c\u4f5c\u4e3a SQL \u5b57\u9762\u91cf\u52a0\u5f15\u53f7\uff0c\u5e94\u5199\u4e00\u4e2a\u5192\u53f7\uff0c\u540e\u9762\u8ddf\u7528\u5355\u5f15\u53f7\u62ec\u8d77\u6765\u7684\u53d8\u91cf\u540d\u3002\u8981\u5c06\u53d8\u91cf\u503c\u4f5c\u4e3a SQL \u6807\u8bc6\u7b26\u52a0\u5f15\u53f7\uff0c\u5219\u5728\u5192\u53f7\u540e\u9762\u7528\u53cc\u5f15\u53f7\u62ec\u8d77\u53d8\u91cf\u540d\u3002\u8fd9\u4e9b\u5199\u6cd5\u80fd\u6b63\u786e\u5904\u7406\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165\u7684\u5f15\u53f7\u548c\u5176\u4ed6\u7279\u6b8a\u5b57\u7b26\u3002\u524d\u9762\u7684\u793a\u4f8b\u53ef\u7528\u4ee5\u4e0b\u66f4\u5b89\u5168\u7684\u5199\u6cd5\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo 'my_table'</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM :\"foo\";</code></strong>\n</pre>\n<p lang=\"zh\">\u5728\u52a0\u5f15\u53f7\u7684<acronym class=\"acronym\">SQL</acronym>\u5b57\u9762\u91cf\u548c\u6807\u8bc6\u7b26\u5185\u90e8\uff0c\u4e0d\u4f1a\u6267\u884c\u53d8\u91cf\u63d2\u503c\u3002\u56e0\u6b64\uff0c<code class=\"literal\">':foo'</code>\u8fd9\u6837\u7684\u5199\u6cd5\u4e0d\u80fd\u6839\u636e\u53d8\u91cf\u503c\u751f\u6210\u52a0\u5f15\u53f7\u7684\u5b57\u9762\u91cf\uff08\u5373\u4f7f\u80fd\u591f\u751f\u6548\uff0c\u4e5f\u4e0d\u5b89\u5168\uff0c\u56e0\u4e3a\u5b83\u65e0\u6cd5\u6b63\u786e\u5904\u7406\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165\u7684\u5f15\u53f7\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8fd9\u79cd\u673a\u5236\u7684\u4e00\u4e2a\u793a\u4f8b\u662f\u628a\u4e00\u4e2a\u6587\u4ef6\u7684\u5185\u5bb9\u62f7\u8d1d\u5230\u4e00\u4e2a\u8868\u5217\u4e2d\u3002\u9996\u5148\u628a\u8be5\u6587\u4ef6\u8f7d\u5165\u5230\u4e00\u4e2a\u53d8\u91cf\uff0c\u7136\u540e\u628a\u8be5\u53d8\u91cf\u7684\u503c\u4f5c\u4e3a\u4e00\u4e2a\u52a0\u5f15\u53f7\u7684\u5b57\u7b26\u4e32\u8fdb\u884c\u63d2\u503c\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set content `cat my_file.txt`</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>INSERT INTO my_table VALUES (:'content');</code></strong>\n</pre>\n<p lang=\"zh\">\uff08\u6ce8\u610f\u5982\u679c<code class=\"filename\">my_file.txt</code>\u5305\u542b NUL \u5b57\u8282\uff0c\u8fd9\u6837\u4e5f\u4e0d\u884c\u3002<span class=\"application\">psql</span>\u4e0d\u652f\u6301\u5728\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165 NUL \u5b57\u8282\uff09\u3002</p>\n<p lang=\"zh\">\u56e0\u4e3a\u5192\u53f7\u53ef\u4ee5\u5408\u6cd5\u5730\u51fa\u73b0\u5728 SQL \u547d\u4ee4\u4e2d\uff0c\u4e00\u6b21\u660e\u663e\u7684\u63d2\u503c\u5c1d\u8bd5\uff08\u5373<code class=\"literal\">:name</code>\u3001<code class=\"literal\">:'name'</code>\u6216\u8005<code class=\"literal\">:\"name\"</code>\uff09\u4e0d\u4f1a\u88ab\u66ff\u6362\uff0c\u9664\u975e\u6240\u6307\u7684\u53d8\u91cf\u5f53\u524d\u5df2\u8bbe\u7f6e\u3002\u5728\u4efb\u4f55\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u7528\u4e00\u4e2a\u53cd\u659c\u7ebf\u5bf9\u5192\u53f7\u8fdb\u884c\u8f6c\u4e49\u4ee5\u907f\u514d\u5b83\u88ab\u66ff\u6362\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">:{?<em class=\"replaceable\"><code>name</code></em>}</code>\u7279\u6b8a\u8bed\u6cd5\u4f1a\u6839\u636e\u8be5\u53d8\u91cf\u662f\u5426\u5b58\u5728\u8fd4\u56de TRUE \u6216 FALSE\uff0c\u56e0\u6b64\u603b\u662f\u4f1a\u88ab\u66ff\u6362\uff0c\u9664\u975e\u5192\u53f7\u88ab\u53cd\u659c\u7ebf\u8f6c\u4e49\u3002</p>\n<p lang=\"zh\">\u53d8\u91cf\u7684\u5192\u53f7\u8bed\u6cd5\u5bf9\u5d4c\u5165\u5f0f\u67e5\u8be2\u8bed\u8a00\uff08\u4f8b\u5982<span class=\"application\">ECPG</span>\uff09\u6765\u8bf4\u662f\u6807\u51c6\u7684<acronym class=\"acronym\">SQL</acronym>\u3002\u7528\u4e8e\u6570\u7ec4\u5207\u7247\u548c\u7c7b\u578b\u8f6c\u6362\u7684\u5192\u53f7\u8bed\u6cd5\u662f<span class=\"productname\">PostgreSQL</span>\u6269\u5c55\uff0c\u5b83\u6709\u65f6\u53ef\u80fd\u4f1a\u4e0e\u6807\u51c6\u7528\u6cd5\u51b2\u7a81\u3002\u628a\u4e00\u4e2a\u53d8\u91cf\u503c\u8f6c\u4e49\u6210 SQL \u5b57\u9762\u91cf\u6216\u8005\u6807\u8bc6\u7b26\u7684\u5192\u53f7\u52a0\u5f15\u53f7\u8bed\u6cd5\u662f\u4e00\u79cd<span class=\"application\">psql</span>\u6269\u5c55\u3002</p>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-PROMPTING\">\n<h4 lang=\"zh\">\u63d0\u793a\u7b26</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u53d1\u51fa\u7684\u63d0\u793a\u7b26\u53ef\u4ee5\u6309\u4f60\u7684\u559c\u597d\u8fdb\u884c\u5b9a\u5236\u3002<code class=\"varname\">PROMPT1</code>\u3001<code class=\"varname\">PROMPT2</code> \u548c <code class=\"varname\">PROMPT3</code> \u8fd9\u4e09\u4e2a\u53d8\u91cf\u5305\u542b\u63cf\u8ff0\u63d0\u793a\u7b26\u5916\u89c2\u7684\u5b57\u7b26\u4e32\u548c\u7279\u6b8a\u8f6c\u4e49\u5e8f\u5217\u3002\u63d0\u793a\u7b26 1 \u662f <span class=\"application\">psql</span> \u8bf7\u6c42\u65b0\u547d\u4ee4\u65f6\u53d1\u51fa\u7684\u5e38\u89c4\u63d0\u793a\u7b26\u3002\u63d0\u793a\u7b26 2 \u4f1a\u5728\u5f55\u5165\u547d\u4ee4\u671f\u95f4\u8fd8\u9700\u8981\u66f4\u591a\u8f93\u5165\u65f6\u53d1\u51fa\uff0c\u4f8b\u5982\u547d\u4ee4\u5c1a\u672a\u4ee5\u5206\u53f7\u7ed3\u675f\uff0c\u6216\u8005\u5f15\u53f7\u5c1a\u672a\u95ed\u5408\u65f6\u3002\u5728\u6267\u884c <acronym class=\"acronym\">SQL</acronym> <code class=\"command\">COPY FROM STDIN</code> \u547d\u4ee4\u5e76\u9700\u8981\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4e00\u884c\u503c\u65f6\uff0c\u4f1a\u53d1\u51fa\u63d0\u793a\u7b26 3\u3002</p>\n<p lang=\"zh\">\u6240\u9009\u63d0\u793a\u7b26\u53d8\u91cf\u7684\u503c\u4f1a\u539f\u6837\u6253\u5370\uff0c\u9664\u975e\u9047\u5230\u767e\u5206\u53f7\uff08<code class=\"literal\">%</code>\uff09\u3002\u6b64\u65f6\u4f1a\u6839\u636e\u4e0b\u4e00\u4e2a\u5b57\u7b26\u66ff\u6362\u4e3a\u5176\u4ed6\u6587\u672c\u3002\u5df2\u5b9a\u4e49\u7684\u66ff\u6362\u9879\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">%M</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5b8c\u6574\u4e3b\u673a\u540d\uff08\u542b\u57df\u540d\uff09\uff1b\u5982\u679c\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\uff0c\u5219\u4e3a<code class=\"literal\">[local]</code>\uff1b\u5982\u679c Unix \u57df\u5957\u63a5\u5b57\u4e0d\u5728\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u9ed8\u8ba4\u4f4d\u7f6e\uff0c\u5219\u4e3a<code class=\"literal\">[local:<em class=\"replaceable\"><code>/dir/name</code></em>]</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%m</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\uff0c\u5728\u7b2c\u4e00\u4e2a\u70b9\u53f7\u5904\u622a\u65ad\uff1b\u5982\u679c\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\uff0c\u5219\u4e3a<code class=\"literal\">[local]</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%&gt;</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u76d1\u542c\u7684\u7aef\u53e3\u53f7\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%n</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u4f1a\u8bdd\u7528\u6237\u540d\u3002\uff08\u5728\u6570\u636e\u5e93\u4f1a\u8bdd\u671f\u95f4\uff0c<code class=\"command\">SET SESSION AUTHORIZATION</code>\u547d\u4ee4\u53ef\u80fd\u6539\u53d8\u8be5\u503c\u7684\u6269\u5c55\u7ed3\u679c\u3002\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%/</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%~</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7c7b\u4f3c <code class=\"literal\">%/</code>\uff0c\u4f46\u5982\u679c\u8be5\u6570\u636e\u5e93\u662f\u4f60\u7684\u9ed8\u8ba4\u6570\u636e\u5e93\uff0c\u5219\u8f93\u51fa <code class=\"literal\">~</code>\uff08\u6ce2\u6d6a\u53f7\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%#</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u4f1a\u8bdd\u7528\u6237\u662f\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\uff0c\u5219\u4e3a<code class=\"literal\">#</code>\uff0c\u5426\u5219\u4e3a<code class=\"literal\">&gt;</code>\u3002\uff08\u5728\u6570\u636e\u5e93\u4f1a\u8bdd\u671f\u95f4\uff0c<code class=\"command\">SET SESSION AUTHORIZATION</code>\u547d\u4ee4\u53ef\u80fd\u6539\u53d8\u8be5\u503c\u7684\u6269\u5c55\u7ed3\u679c\u3002\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%p</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u6240\u8fde\u63a5\u540e\u7aef\u7684\u8fdb\u7a0b ID\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%R</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u63d0\u793a\u7b26 1 \u4e2d\uff0c\u901a\u5e38\u663e\u793a =\uff1b\u4f46\u5982\u679c\u4f1a\u8bdd\u5904\u4e8e\u6761\u4ef6\u5757\u4e2d\u672a\u6fc0\u6d3b\u7684\u5206\u652f\uff0c\u5219\u663e\u793a @\uff1b\u5982\u679c\u5904\u4e8e\u5355\u884c\u6a21\u5f0f\uff0c\u5219\u663e\u793a ^\uff1b\u5982\u679c\u4f1a\u8bdd\u5df2\u65ad\u5f00\u6570\u636e\u5e93\u8fde\u63a5\uff08\u4f8b\u5982 \\connect \u5931\u8d25\u65f6\uff09\uff0c\u5219\u663e\u793a !\u3002\u5728\u63d0\u793a\u7b26 2 \u4e2d\uff0c%R \u4f1a\u66ff\u6362\u4e3a\u8868\u793a psql \u7b49\u5f85\u66f4\u591a\u8f93\u5165\u539f\u56e0\u7684\u5b57\u7b26\uff1a\u547d\u4ee4\u5c1a\u672a\u7ed3\u675f\u65f6\u4e3a -\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684 /* ... */ \u6ce8\u91ca\u65f6\u4e3a *\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u5e26\u5f15\u53f7\u5b57\u7b26\u4e32\u65f6\u4e3a\u5355\u5f15\u53f7\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u5e26\u5f15\u53f7\u6807\u8bc6\u7b26\u65f6\u4e3a\u53cc\u5f15\u53f7\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u7f8e\u5143\u5f15\u7528\u5b57\u7b26\u4e32\u65f6\u4e3a\u7f8e\u5143\u7b26\u53f7\uff1b\u5b58\u5728\u672a\u5339\u914d\u7684\u5de6\u62ec\u53f7\u65f6\u4e3a (\u3002\u5728\u63d0\u793a\u7b26 3 \u4e2d\uff0c%R \u4e0d\u4ea7\u751f\u4efb\u4f55\u5185\u5bb9\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%x</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u72b6\u6001\uff1a\u5982\u679c\u5f53\u524d\u4e0d\u5728\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff1b\u5982\u679c\u5904\u4e8e\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a <code class=\"literal\">*</code>\uff1b\u5982\u679c\u5904\u4e8e\u5931\u8d25\u7684\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a <code class=\"literal\">!</code>\uff1b\u5982\u679c\u4e8b\u52a1\u72b6\u6001\u4e0d\u786e\u5b9a\uff08\u4f8b\u5982\u56e0\u4e3a\u5f53\u524d\u6ca1\u6709\u8fde\u63a5\uff09\uff0c\u5219\u4e3a <code class=\"literal\">?</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%l</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8bed\u53e5\u4e2d\u7684\u884c\u53f7\uff0c\u4ece <code class=\"literal\">1</code> \u5f00\u59cb\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%</code><em class=\"replaceable\"><code>digits</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u66ff\u6362\u4e3a\u6307\u5b9a\u516b\u8fdb\u5236\u4ee3\u7801\u5bf9\u5e94\u7684\u5b57\u7b26\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%:</code><em class=\"replaceable\"><code>name</code></em><code class=\"literal\">:</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><span class=\"application\">psql</span> \u53d8\u91cf <em class=\"replaceable\"><code>name</code></em> \u7684\u503c\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/12/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%`</code><em class=\"replaceable\"><code>command</code></em><code class=\"literal\">`</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><em class=\"replaceable\"><code>command</code></em> \u7684\u8f93\u51fa\uff0c\u7c7b\u4f3c\u666e\u901a\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u53cd\u5f15\u53f7</span>\u201d</span>\u66ff\u6362\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%[</code> ... <code class=\"literal\">%]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u63d0\u793a\u7b26\u4e2d\u53ef\u4ee5\u5305\u542b\u7ec8\u7aef\u63a7\u5236\u5b57\u7b26\uff0c\u4f8b\u5982\u6539\u53d8\u63d0\u793a\u6587\u672c\u7684\u989c\u8272\u3001\u80cc\u666f\u6216\u6837\u5f0f\uff0c\u6216\u8005\u6539\u53d8\u7ec8\u7aef\u7a97\u53e3\u6807\u9898\u3002\u4e3a\u4e86\u8ba9 <span class=\"application\">Readline</span> \u7684\u884c\u7f16\u8f91\u529f\u80fd\u6b63\u5e38\u5de5\u4f5c\uff0c\u8fd9\u4e9b\u4e0d\u53ef\u6253\u5370\u7684\u63a7\u5236\u5b57\u7b26\u5fc5\u987b\u7528 <code class=\"literal\">%[</code> \u548c <code class=\"literal\">%]</code> \u5305\u56f4\u8d77\u6765\uff0c\u4ee5\u6807\u8bb0\u4e3a\u4e0d\u53ef\u89c1\u5b57\u7b26\u3002\u63d0\u793a\u7b26\u4e2d\u53ef\u4ee5\u51fa\u73b0\u591a\u7ec4\u8fd9\u6837\u7684\u6807\u8bb0\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; \\set PROMPT1 '%[%033[1;33;40m%]%n@%/%R%[%033[0m%]%# '\n</pre>\n<p lang=\"zh\">\u5176\u6548\u679c\u662f\u5728\u517c\u5bb9 VT100 \u4e14\u652f\u6301\u989c\u8272\u7684\u7ec8\u7aef\u4e0a\uff0c\u751f\u6210\u4e00\u4e2a\u7c97\u4f53\uff08<code class=\"literal\">1;</code>\uff09\u7684\u9ed1\u5e95\u9ec4\u5b57\u63d0\u793a\u7b26\uff08<code class=\"literal\">33;40</code>\uff09\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8981\u5728\u63d0\u793a\u7b26\u4e2d\u63d2\u5165\u767e\u5206\u53f7\uff0c\u8bf7\u5199 %%\u3002\u63d0\u793a\u7b26 1 \u548c 2 \u7684\u9ed8\u8ba4\u503c\u4e3a '%/%R%# '\uff0c\u63d0\u793a\u7b26 3 \u7684\u9ed8\u8ba4\u503c\u4e3a '&gt;&gt; '\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">tcsh</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</div>\n<div class=\"refsect3\" id=\"id-1.9.4.18.8.5.5\">\n<h4 lang=\"zh\">\u547d\u4ee4\u884c\u7f16\u8f91</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u652f\u6301 <span class=\"application\">Readline</span> \u5e93\uff0c\u4fbf\u4e8e\u7f16\u8f91\u548c\u68c0\u7d22\u8f93\u5165\u884c\u3002\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\u4f1a\u5728 <span class=\"application\">psql</span> \u9000\u51fa\u65f6\u81ea\u52a8\u4fdd\u5b58\uff0c\u5e76\u5728 <span class=\"application\">psql</span> \u542f\u52a8\u65f6\u91cd\u65b0\u8f7d\u5165\u3002\u4e5f\u652f\u6301 Tab \u8865\u5168\uff0c\u4e0d\u8fc7\u5176\u8865\u5168\u903b\u8f91\u5e76\u4e0d\u58f0\u79f0\u81ea\u5df1\u662f <acronym class=\"acronym\">SQL</acronym> \u89e3\u6790\u5668\u3002Tab \u8865\u5168\u751f\u6210\u7684\u67e5\u8be2\u8fd8\u53ef\u80fd\u5e72\u6270\u5176\u4ed6 SQL \u547d\u4ee4\uff0c\u4f8b\u5982 <code class=\"literal\">SET TRANSACTION ISOLATION LEVEL</code>\u3002\u5982\u679c\u51fa\u4e8e\u67d0\u79cd\u539f\u56e0\u4f60\u4e0d\u559c\u6b22 Tab \u8865\u5168\uff0c\u53ef\u4ee5\u5c06\u4ee5\u4e0b\u5185\u5bb9\u653e\u5165\u4e3b\u76ee\u5f55\u4e0b\u540d\u4e3a <code class=\"filename\">.inputrc</code> \u7684\u6587\u4ef6\u4e2d\uff0c\u5c06\u5176\u5173\u95ed\uff1a</p>\n<pre class=\"programlisting\">$if psql\nset disable-completion on\n$endif\n</pre>\n<p lang=\"zh\">\uff08\u8fd9\u4e0d\u662f <span class=\"application\">psql</span> \u7684\u529f\u80fd\uff0c\u800c\u662f <span class=\"application\">Readline</span> \u7684\u529f\u80fd\u3002\u66f4\u591a\u7ec6\u8282\u8bf7\u9605\u8bfb\u5176\u6587\u6863\u3002\uff09</p>\n</div>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PSQL-ENVIRONMENT\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">COLUMNS</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c<code class=\"literal\">\\pset columns</code>\u4e3a\u96f6\uff0c\u8fd9\u4e2a\u73af\u5883\u53d8\u91cf\u63a7\u5236\u7528\u4e8e<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u5bbd\u5ea6\u4ee5\u53ca\u7528\u6765\u786e\u5b9a\u662f\u5426\u8f93\u51fa\u9700\u8981\u7528\u5230\u5206\u9875\u5668\u6216\u8005\u5207\u6362\u5230\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e2d\u7684\u5782\u76f4\u683c\u5f0f\u7684\u5bbd\u5ea6\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PGDATABASE</code><br/></span><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\uff08\u89c1<a class=\"xref\" href=\"/docs/12/libpq-envars.html\" title=\"33.14.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a033.14\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u89c4\u5b9a\u5728\u8bca\u65ad\u6d88\u606f\u4e2d\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u80fd\u7684\u503c\u4e3a<code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u3001<code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PSQL_EDITOR</code><br/></span><span class=\"term\"><code class=\"envar\">EDITOR</code><br/></span><span class=\"term\"><code class=\"envar\">VISUAL</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"command\">\\e</code>\u3001<code class=\"command\">\\ef</code>\u4ee5\u53ca<code class=\"command\">\\ev</code>\u547d\u4ee4\u6240\u4f7f\u7528\u7684\u7f16\u8f91\u5668\u3002\u4f1a\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u68c0\u67e5\u8fd9\u4e9b\u53d8\u91cf\uff0c\u7b2c\u4e00\u4e2a\u88ab\u8bbe\u7f6e\u7684\u5c06\u88ab\u4f7f\u7528\u3002\u5982\u679c\u90fd\u6ca1\u6709\u88ab\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u662f\u4f7f\u7528Unix\u7cfb\u7edf\u4e0a\u7684<code class=\"filename\">vi</code>\u6216\u8005Windows\u7cfb\u7edf\u4e0a\u7684<code class=\"filename\">notepad.exe</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PSQL_EDITOR_LINENUMBER_ARG</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f53 <code class=\"command\">\\e</code>\u3001<code class=\"command\">\\ef</code> \u6216 <code class=\"command\">\\ev</code> \u5e26\u6709\u884c\u53f7\u53c2\u6570\u4f7f\u7528\u65f6\uff0c\u6b64\u53d8\u91cf\u6307\u5b9a\u5c06\u8d77\u59cb\u884c\u53f7\u4f20\u7ed9\u7528\u6237\u7f16\u8f91\u5668\u65f6\u6240\u7528\u7684\u547d\u4ee4\u884c\u53c2\u6570\u3002\u5bf9\u4e8e <span class=\"productname\">Emacs</span> \u6216 <span class=\"productname\">vi</span> \u4e4b\u7c7b\u7684\u7f16\u8f91\u5668\uff0c\u8fd9\u4e2a\u53c2\u6570\u662f\u4e00\u4e2a\u52a0\u53f7\u3002\u5982\u679c\u9009\u9879\u540d\u548c\u884c\u53f7\u4e4b\u95f4\u9700\u8981\u7a7a\u683c\uff0c\u8bf7\u5728\u53d8\u91cf\u503c\u4e2d\u5305\u542b\u672b\u5c3e\u7a7a\u683c\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">PSQL_EDITOR_LINENUMBER_ARG='+'\nPSQL_EDITOR_LINENUMBER_ARG='--line '\n</pre>\n<p lang=\"zh\">\u5728 Unix \u7cfb\u7edf\u4e0a\u9ed8\u8ba4\u662f<code class=\"literal\">+</code>\uff08\u5bf9\u5e94\u4e8e\u9ed8\u8ba4\u7f16\u8f91\u5668<code class=\"filename\">vi</code>\uff0c\u4e14\u5bf9\u5f88\u591a\u5176\u4ed6\u5e38\u89c1\u7f16\u8f91\u5668\u53ef\u7528\uff09\u3002\u5728 Windows \u7cfb\u7edf\u4e0a\u6ca1\u6709\u9ed8\u8ba4\u503c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PSQL_HISTORY</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u547d\u4ee4\u5386\u53f2\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08<code class=\"literal\">~</code>\uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PSQL_PAGER</code><br/></span><span class=\"term\"><code class=\"envar\">PAGER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u67e5\u8be2\u7ed3\u679c\u65e0\u6cd5\u5728\u5c4f\u5e55\u4e0a\u663e\u793a\u5b8c\u6574\uff0c\u5b83\u4eec\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6b64\u547d\u4ee4\u3002\u5178\u578b\u7684\u503c\u662f<code class=\"literal\">more</code>\u6216<code class=\"literal\">less</code>\u3002\u53ef\u4ee5\u901a\u8fc7\u5c06<code class=\"envar\">PSQL_PAGER</code>\u6216<code class=\"envar\">PAGER</code>\u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u6216\u901a\u8fc7\u8c03\u6574<code class=\"command\">\\pset</code>\u547d\u4ee4\u7684\u4e0e\u5206\u9875\u76f8\u5173\u7684\u9009\u9879\u6765\u7981\u7528\u5206\u9875\u5668\u3002\u8fd9\u4e9b\u53d8\u91cf\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u8fdb\u884c\u68c0\u67e5\uff1b\u4f7f\u7528\u6309\u8be5\u987a\u5e8f\u627e\u5230\u7684\u7b2c\u4e00\u4e2a\u5df2\u8bbe\u7f6e\u7684\u53d8\u91cf\u3002\u5982\u679c\u5b83\u4eec\u90fd\u6ca1\u6709\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5728\u5927\u591a\u6570\u5e73\u53f0\u4e0a\u4f7f\u7528<code class=\"literal\">more</code>\uff0c\u4f46\u5728Cygwin\u4e0a\u4f7f\u7528<code class=\"literal\">less</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PSQLRC</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7528\u6237\u7684<code class=\"filename\">.psqlrc</code>\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08<code class=\"literal\">~</code>\uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">SHELL</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u88ab<code class=\"command\">\\!</code>\u547d\u4ee4\u6267\u884c\u7684\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">TMPDIR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b58\u50a8\u4e34\u65f6\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u662f<code class=\"filename\">/tmp</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6 <span class=\"productname\">PostgreSQL</span> \u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528 <span class=\"application\">libpq</span> \u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/12/libpq-envars.html\" title=\"33.14.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a033.14\u00a0\u8282</a>\uff09\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.18.10\">\n<h2 lang=\"zh\">\u6587\u4ef6</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt lang=\"zh\"><span class=\"term\"><code class=\"filename\">psqlrc</code> \u548c <code class=\"filename\">~/.psqlrc</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u6ca1\u6709<code class=\"option\">-X</code>\u9009\u9879\uff0c\u5728\u8fde\u63a5\u5230\u6570\u636e\u5e93\u540e\u4f46\u5728\u63a5\u6536\u6b63\u5e38\u7684\u547d\u4ee4\u4e4b\u524d\uff0c<span class=\"application\">psql</span>\u4f1a\u5c1d\u8bd5\u4f9d\u6b21\u4ece\u7cfb\u7edf\u7ea7\u7684\u542f\u52a8\u6587\u4ef6\uff08<code class=\"filename\">psqlrc</code>\uff09\u548c\u7528\u6237\u7684\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\uff08<code class=\"filename\">~/.psqlrc</code>\uff09\u4e2d\u8bfb\u53d6\u5e76\u4e14\u6267\u884c\u547d\u4ee4\u3002\u8fd9\u4e9b\u6587\u4ef6\u53ef\u4ee5\u88ab\u7528\u6765\u8bbe\u7f6e\u5ba2\u6237\u7aef\u6216\u8005\u670d\u52a1\u5668\uff0c\u901a\u5e38\u662f\u4e00\u4e9b<code class=\"command\">\\set</code>\u548c<code class=\"command\">SET</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u7cfb\u7edf\u8303\u56f4\u7684\u542f\u52a8\u6587\u4ef6\u540d\u4e3a <code class=\"filename\">psqlrc</code>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4f1a\u5728\u5b89\u88c5\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u7cfb\u7edf\u914d\u7f6e</span>\u201d</span>\u76ee\u5f55\u4e2d\u67e5\u627e\u5b83\uff0c\u6700\u53ef\u9760\u7684\u8bc6\u522b\u65b9\u5f0f\u662f\u8fd0\u884c <code class=\"literal\">pg_config --sysconfdir</code>\u3002\u901a\u5e38\u8fd9\u4e2a\u76ee\u5f55\u662f\u76f8\u5bf9\u4e8e\u5305\u542b <span class=\"productname\">PostgreSQL</span> \u53ef\u6267\u884c\u6587\u4ef6\u7684\u76ee\u5f55\u7684 <code class=\"filename\">../etc/</code>\u3002\u4e5f\u53ef\u4ee5\u901a\u8fc7 <code class=\"envar\">PGSYSCONFDIR</code> \u73af\u5883\u53d8\u91cf\u663e\u5f0f\u6307\u5b9a\u67e5\u627e\u76ee\u5f55\u3002</p>\n<p lang=\"zh\">\u7528\u6237\u7684\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\u540d\u4e3a<code class=\"filename\">.psqlrc</code>\uff0c\u5e76\u4e14\u5728\u8c03\u7528\u7528\u6237\u7684\u4e3b\u76ee\u5f55\u4e2d\u5bfb\u627e\u3002Windows \u6ca1\u6709\u4e3b\u76ee\u5f55\u8fd9\u4e00\u6982\u5ff5\uff0c\u5728 Windows \u4e0a\uff0c\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\u7684\u540d\u79f0\u4e3a<code class=\"filename\">%APPDATA%\\postgresql\\psqlrc.conf</code>\u3002\u5728\u4efb\u4f55\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e<code class=\"envar\">PSQLRC</code>\u73af\u5883\u53d8\u91cf\u6765\u8986\u76d6\u6b64\u9ed8\u8ba4\u6587\u4ef6\u8def\u5f84\u3002</p>\n<p lang=\"zh\">\u7cfb\u7edf\u8303\u56f4\u7684\u542f\u52a8\u6587\u4ef6\u548c\u7528\u6237\u4e2a\u4eba\u7684\u542f\u52a8\u6587\u4ef6\u90fd\u53ef\u4ee5\u901a\u8fc7\u5728\u6587\u4ef6\u540d\u540e\u9644\u52a0\u8fde\u5b57\u7b26\u548c<span class=\"productname\">PostgreSQL</span>\u7684\u5927\u7248\u672c\u6216\u5c0f\u7248\u672c\u53f7\u6765\u4f7f\u5176\u4e0e<span class=\"application\">psql</span>\u7248\u672c\u76f8\u5173\uff0c\u4f8b\u5982<code class=\"filename\">~/.psqlrc-9.2</code>\u6216<code class=\"filename\">~/.psqlrc-9.2.5</code>\u3002\u6700\u5177\u4f53\u7248\u672c\u5339\u914d\u7684\u6587\u4ef6\u5c06\u4f18\u5148\u8bfb\u53d6\uff0c\u800c\u4e0d\u662f\u975e\u7279\u5b9a\u7248\u672c\u7684\u6587\u4ef6\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"filename\">.psql_history</code></span></dt>\n<dd>\n<p lang=\"zh\">\u547d\u4ee4\u884c\u5386\u53f2\u88ab\u5b58\u50a8\u5728\u6587\u4ef6<code class=\"filename\">~/.psql_history</code>\u4e2d\uff0c\u6216\u8005\u662f Windows \u7684\u6587\u4ef6<code class=\"filename\">%APPDATA%\\postgresql\\psql_history</code>\u4e2d\u3002</p>\n<p lang=\"zh\">\u5386\u53f2\u6587\u4ef6\u7684\u4f4d\u7f6e\u53ef\u4ee5\u901a\u8fc7<code class=\"varname\">HISTFILE</code> <span class=\"application\">psql</span>\u53d8\u91cf\u6216\u8005<code class=\"envar\">PSQL_HISTORY</code>\u73af\u5883\u53d8\u91cf\u663e\u5f0f\u8bbe\u7f6e\u3002</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.18.11\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">psql</span>\u6700\u9002\u5408\u4e0e\u76f8\u540c\u6216\u8f83\u65e7\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\u914d\u5408\u4f7f\u7528\u3002\u5982\u679c\u670d\u52a1\u5668\u7684\u7248\u672c\u6bd4<span class=\"application\">psql</span>\u672c\u8eab\u66f4\u65b0\uff0c\u53cd\u659c\u7ebf\u547d\u4ee4\u7279\u522b\u5bb9\u6613\u5931\u8d25\u3002\u7136\u800c\uff0c<code class=\"literal\">\\d</code>\u7cfb\u5217\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u5e94\u8be5\u53ef\u4ee5\u5728\u6700\u4f4e\u81f3 7.4 \u7248\u672c\u7684\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\uff0c\u4f46\u4e0d\u4e00\u5b9a\u9002\u7528\u4e8e\u6bd4<span class=\"application\">psql</span>\u672c\u8eab\u66f4\u65b0\u7684\u670d\u52a1\u5668\u3002\u8fd0\u884cSQL\u547d\u4ee4\u548c\u663e\u793a\u67e5\u8be2\u7ed3\u679c\u7684\u4e00\u822c\u529f\u80fd\u4e5f\u5e94\u8be5\u53ef\u4ee5\u5728\u66f4\u65b0\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\uff0c\u4f46\u4e0d\u80fd\u4fdd\u8bc1\u5728\u6240\u6709\u60c5\u51b5\u4e0b\u90fd\u80fd\u5b9e\u73b0\u3002</p>\n<p>\u5982\u679c\u4f60\u60f3\u7528<span class=\"application\">psql</span>\u8fde\u63a5\u5230\u591a\u4e2a\u5177\u6709\u4e0d\u540c\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\uff0c\u63a8\u8350\u4f7f\u7528\u6700\u65b0\u7248\u672c\u7684<span class=\"application\">psql</span>\u3002\u6216\u8005\uff0c\u4f60\u53ef\u4ee5\u4e3a\u6bcf\u4e00\u4e2a\u5927\u7248\u672c\u4fdd\u7559\u4e00\u4efd<span class=\"application\">psql</span>\u62f7\u8d1d\uff0c\u5e76\u4e14\u9488\u5bf9\u76f8\u5e94\u7684\u670d\u52a1\u5668\u4f7f\u7528\u5339\u914d\u7684\u7248\u672c\u3002\u4f46\u5b9e\u9645\u4e0a\uff0c\u8fd9\u79cd\u989d\u5916\u7684\u9ebb\u70e6\u662f\u4e0d\u5fc5\u8981\u7684\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5728 <span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\uff0c<code class=\"option\">-c</code> \u9009\u9879\u610f\u5473\u7740 <code class=\"option\">-X</code>\uff08<code class=\"option\">--no-psqlrc</code>\uff09\uff1b\u73b0\u5728\u5df2\u7ecf\u4e0d\u662f\u8fd9\u6837\u4e86\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5728<span class=\"productname\">PostgreSQL</span> 8.4 \u4e4b\u524d\uff0c<span class=\"application\">psql</span>\u5141\u8bb8\u4e00\u4e2a\u5355\u5b57\u6bcd\u53cd\u659c\u7ebf\u547d\u4ee4\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u76f4\u63a5\u5199\u5728\u8be5\u547d\u4ee4\u540e\u9762\uff0c\u4e2d\u95f4\u4e0d\u9700\u8981\u7a7a\u767d\u3002\u73b0\u5728\u5219\u8981\u6c42\u7528\u7a7a\u767d\u5206\u9694\u3002</p>\n</li>\n</ul>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.18.12\">\n<h2 lang=\"zh\">\u7ed9 Windows \u7528\u6237\u7684\u6ce8\u89e3</h2>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u662f\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u63a7\u5236\u53f0\u5e94\u7528</span>\u201d</span>\u3002\u7531\u4e8e Windows \u7684\u63a7\u5236\u53f0\u7a97\u53e3\u4f7f\u7528\u7684\u662f\u4e00\u79cd\u548c\u7cfb\u7edf\u4e2d\u5176\u4ed6\u5e94\u7528\u4e0d\u540c\u7684\u7f16\u7801\uff0c\u5728<span class=\"application\">psql</span>\u4e2d\u4f7f\u7528 8 \u4f4d\u5b57\u7b26\u65f6\u8981\u7279\u522b\u6ce8\u610f\u3002\u5982\u679c<span class=\"application\">psql</span>\u68c0\u6d4b\u5230\u4e00\u4e2a\u6709\u95ee\u9898\u7684\u63a7\u5236\u53f0\u4ee3\u7801\u9875\uff0c\u5b83\u5c06\u4f1a\u5728\u542f\u52a8\u65f6\u8b66\u544a\u4f60\u3002\u8981\u66f4\u6539\u63a7\u5236\u53f0\u4ee3\u7801\u9875\uff0c\u6709\u4e24\u4ef6\u4e8b\u662f\u5fc5\u8981\u7684\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u8f93\u5165<strong class=\"userinput\"><code>cmd.exe /c chcp 1252</code></strong>\u53ef\u4ee5\u8bbe\u7f6e\u4ee3\u7801\u9875\uff081252 \u662f\u9002\u7528\u4e8e\u5fb7\u8bed\u7684\u4e00\u4e2a\u4ee3\u7801\u9875\uff0c\u8bf7\u5728\u8fd9\u91cc\u66ff\u6362\u6210\u4f60\u7684\u503c\uff09\u3002\u5982\u679c\u6b63\u5728\u4f7f\u7528 Cygwin\uff0c\u53ef\u4ee5\u628a\u8fd9\u4e2a\u547d\u4ee4\u653e\u5728<code class=\"filename\">/etc/profile</code>\u4e2d\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u628a\u63a7\u5236\u53f0\u5b57\u4f53\u8bbe\u7f6e\u4e3a<code class=\"literal\">Lucida Console</code>\uff0c\u56e0\u4e3a\u6805\u683c\u5b57\u4f53\u65e0\u6cd5\u4e0e ANSI \u4ee3\u7801\u9875\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</li>\n</ul>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PSQL-EXAMPLES\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u7b2c\u4e00\u4e2a\u793a\u4f8b\u5c55\u793a\u4e86\u5982\u4f55\u628a\u4e00\u6761\u547d\u4ee4\u5206\u6563\u5230\u591a\u884c\u8f93\u5165\u4e2d\u3002\u6ce8\u610f\u63d0\u793a\u7b26\u7684\u53d8\u5316\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>CREATE TABLE my_table (</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code> first integer not null default 0,</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code> second text)</code></strong>\ntestdb-&gt; <strong class=\"userinput\"><code>;</code></strong>\nCREATE TABLE\n</pre>\n<p lang=\"zh\">\u73b0\u5728\u518d\u6765\u770b\u4e00\u4e0b\u8fd9\u4e2a\u8868\u7684\u5b9a\u4e49\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\d my_table</code></strong>\n              Table \"public.my_table\"\n Column |  Type   | Collation | Nullable | Default\n--------+---------+-----------+----------+---------\n first  | integer |           | not null | 0\n second | text    |           |          | \n</pre>\n<p lang=\"zh\">\u73b0\u5728\u6211\u4eec\u628a\u63d0\u793a\u7b26\u6539\u6210\u66f4\u6709\u8da3\u7684\u5f62\u5f0f\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set PROMPT1 '%n@%m %~%R%# '</code></strong>\npeter@localhost testdb=&gt;\n</pre>\n<p lang=\"zh\">\u5047\u8bbe\u4f60\u5df2\u7ecf\u5411\u8868\u4e2d\u586b\u5165\u6570\u636e\uff0c\u5e76\u60f3\u770b\u4e00\u770b\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; SELECT * FROM my_table;\n first | second\n-------+--------\n     1 | one\n     2 | two\n     3 | three\n     4 | four\n(4 rows)\n\n</pre>\n<p lang=\"zh\">\u4f60\u53ef\u4ee5\u4f7f\u7528 <code class=\"command\">\\pset</code> \u547d\u4ee4\u4ee5\u4e0d\u540c\u65b9\u5f0f\u663e\u793a\u8868\u683c\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 2</code></strong>\nBorder style is 2.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\n+-------+--------+\n| first | second |\n+-------+--------+\n|     1 | one    |\n|     2 | two    |\n|     3 | three  |\n|     4 | four   |\n+-------+--------+\n(4 rows)\n\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 0</code></strong>\nBorder style is 0.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\nfirst second\n----- ------\n    1 one\n    2 two\n    3 three\n    4 four\n(4 rows)\n\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 1</code></strong>\nBorder style is 1.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset format csv</code></strong>\nOutput format is csv.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset tuples_only</code></strong>\nTuples only is on.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT second, first FROM my_table;</code></strong>\none,1\ntwo,2\nthree,3\nfour,4\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset format unaligned</code></strong>\nOutput format is unaligned.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset fieldsep '\\t'</code></strong>\nField separator is \"    \".\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT second, first FROM my_table;</code></strong>\none     1\ntwo     2\nthree   3\nfour    4\n</pre>\n<p lang=\"zh\">\u6216\u8005\u4f7f\u7528\u77ed\u547d\u4ee4\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\a \\t \\x</code></strong>\nOutput format is aligned.\nTuples only is off.\nExpanded display is on.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\n-[ RECORD 1 ]-\nfirst  | 1\nsecond | one\n-[ RECORD 2 ]-\nfirst  | 2\nsecond | two\n-[ RECORD 3 ]-\nfirst  | 3\nsecond | three\n-[ RECORD 4 ]-\nfirst  | 4\nsecond | four\n</pre>\n<p lang=\"zh\">\u5728\u9002\u5408\u7684\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u4f7f\u7528 <code class=\"command\">\\crosstabview</code> \u547d\u4ee4\u5c06\u67e5\u8be2\u7ed3\u679c\u663e\u793a\u4e3a\u4ea4\u53c9\u8868\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>SELECT first, second, first &gt; 2 AS gt2 FROM my_table;</code></strong>\n first | second | gt2 \n-------+--------+-----\n     1 | one    | f\n     2 | two    | f\n     3 | three  | t\n     4 | four   | t\n(4 rows)\n\ntestdb=&gt; <strong class=\"userinput\"><code>\\crosstabview first second</code></strong>\n first | one | two | three | four \n-------+-----+-----+-------+------\n     1 | f   |     |       | \n     2 |     | f   |       | \n     3 |     |     | t     | \n     4 |     |     |       | t\n(4 rows)\n</pre>\n<p lang=\"zh\">\u7b2c\u4e8c\u4e2a\u793a\u4f8b\u5c55\u793a\u4e86\u4e00\u4e2a\u4e58\u6cd5\u8868\uff0c\u5176\u4e2d\u884c\u6309\u6570\u5b57\u5012\u5e8f\u6392\u5217\uff0c\u800c\u5217\u6309\u72ec\u7acb\u7684\u5347\u5e8f\u6570\u5b57\u6392\u5217\u3002</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>SELECT t1.first as \"A\", t2.first+100 AS \"B\", t1.first*(t2.first+100) as \"AxB\",</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code>row_number() over(order by t2.first) AS ord</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code>FROM my_table t1 CROSS JOIN my_table t2 ORDER BY 1 DESC</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code>\\crosstabview \"A\" \"B\" \"AxB\" ord</code></strong>\n A | 101 | 102 | 103 | 104 \n---+-----+-----+-----+-----\n 4 | 404 | 408 | 412 | 416\n 3 | 303 | 306 | 309 | 312\n 2 | 202 | 204 | 206 | 208\n 1 | 101 | 102 | 103 | 104\n(4 rows)\n</pre>\n</div>\n</div></div>", "manual_path": "app-psql.html", "localization": {"status": "complete", "sources": [{"url": "/docs/12/app-psql.html", "method": "same-major semantic node", "sha256": "1eb88d17f6ce811d722e5c4ed036f78a7872bf88410c08db794c428e3cfc98ce", "language": "zh", "matched_nodes": ["#APP-PSQL/div[10]/div[1]/ul[0]/li[0]", "#APP-PSQL/div[10]/div[1]/ul[0]/li[1]", "#APP-PSQL/div[10]/div[1]/ul[0]/li[2]", "#APP-PSQL/div[10]/h2[0]", "#APP-PSQL/div[11]/div[2]/ul[0]/li[0]", "#APP-PSQL/div[11]/div[2]/ul[0]/li[1]", "#APP-PSQL/div[11]/h2[0]", "#APP-PSQL/div[11]/p[1]", "#APP-PSQL/div[12]/p[11]", "#APP-PSQL/div[12]/p[13]", "#APP-PSQL/div[12]/p[15]", "#APP-PSQL/div[12]/p[1]", "#APP-PSQL/div[12]/p[3]", "#APP-PSQL/div[12]/p[5]", "#APP-PSQL/div[12]/p[7]", "#APP-PSQL/div[12]/p[9]", "#APP-PSQL/div[2]/p[1]", "#APP-PSQL/div[3]/h2[0]", "#APP-PSQL/div[4]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[11]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[13]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[15]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]/p[2]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[19]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[21]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[23]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[25]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[25]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[27]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[29]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[31]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[35]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[37]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[39]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[3]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[41]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]/div[1]/h3[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]/div[1]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[45]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[47]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[49]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[51]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[53]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[55]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[55]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[57]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[57]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[59]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[5]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[61]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[63]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[65]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[67]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[67]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[69]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[3]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[5]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[6]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[7]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[9]", "#APP-PSQL/div[6]/h2[0]", "#APP-PSQL/div[6]/p[1]", "#APP-PSQL/div[7]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[1]/p[1]", "#APP-PSQL/div[7]/div[1]/p[2]", "#APP-PSQL/div[7]/div[1]/p[5]", "#APP-PSQL/div[7]/div[1]/p[6]", "#APP-PSQL/div[7]/div[1]/p[7]", "#APP-PSQL/div[7]/div[2]/h3[0]", "#APP-PSQL/div[7]/div[2]/p[1]", "#APP-PSQL/div[7]/div[2]/p[3]", "#APP-PSQL/div[7]/div[2]/p[4]", "#APP-PSQL/div[7]/div[2]/p[5]", "#APP-PSQL/div[7]/div[2]/p[6]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[101]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[101]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[103]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[105]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[105]/p[0]/a[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[105]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[105]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[105]/p[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[107]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[109]/div[2]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[109]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[109]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[111]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[113]/div[2]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[113]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[113]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[115]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[115]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[115]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[115]/p[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[115]/p[6]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[117]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[119]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]/div[5]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[121]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[123]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[123]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[123]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[125]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[127]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[129]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[129]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[129]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[131]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dd[15]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dd[15]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dd[15]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dd[15]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dd[17]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dd[17]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dd[17]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dd[17]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dd[21]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dd[23]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dd[29]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dd[31]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dd[31]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dd[37]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dd[41]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dt[30]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dt[32]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dt[34]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/dl[0]/dt[6]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[5]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/p[4]/a[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[139]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[141]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[143]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[149]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[153]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[153]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[153]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[157]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[159]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[15]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[15]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[161]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[161]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[163]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[165]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[167]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[169]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[169]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[171]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[171]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[173]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[175]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[175]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[175]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[175]/p[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[0]/a[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[21]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[23]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[25]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[29]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[29]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[29]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[31]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[33]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[33]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[37]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[41]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[41]/div[1]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[41]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[43]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[45]/div[1]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[45]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[47]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[49]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[51]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[53]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[55]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[57]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[59]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[61]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[63]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[65]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[67]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[67]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[69]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[69]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[69]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[71]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[71]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[73]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[75]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[77]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[79]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[7]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[7]/div[1]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[7]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[81]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[83]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[85]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[85]/div[3]/p[1]/a[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[85]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[85]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[85]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[87]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[87]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[87]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[89]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[89]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[89]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[89]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[91]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[93]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[95]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[95]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[95]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[95]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[97]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[99]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[99]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[99]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[108]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[110]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[112]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[116]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[118]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[128]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[130]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[138]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[142]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[162]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[84]", "#APP-PSQL/div[7]/div[3]/div[11]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/p[6]", "#APP-PSQL/div[7]/div[3]/h3[0]", "#APP-PSQL/div[7]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/p[2]", "#APP-PSQL/div[7]/div[3]/p[3]", "#APP-PSQL/div[7]/div[3]/p[4]", "#APP-PSQL/div[7]/div[3]/p[4]/a[2]", "#APP-PSQL/div[7]/div[3]/p[5]", "#APP-PSQL/div[7]/div[3]/p[7]", "#APP-PSQL/div[7]/div[3]/p[8]", "#APP-PSQL/div[7]/div[3]/p[9]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[15]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[17]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[19]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[19]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/div[2]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[21]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[21]/p[2]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[25]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[31]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[37]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[39]/p[0]/a[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[41]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[45]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[47]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[49]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[51]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[53]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[55]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[57]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[59]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[4]/div[1]/div[8]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/p[10]", "#APP-PSQL/div[7]/div[4]/div[1]/p[11]", "#APP-PSQL/div[7]/div[4]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/p[2]", "#APP-PSQL/div[7]/div[4]/div[1]/p[4]", "#APP-PSQL/div[7]/div[4]/div[1]/p[6]", "#APP-PSQL/div[7]/div[4]/div[1]/p[7]", "#APP-PSQL/div[7]/div[4]/div[1]/p[9]", "#APP-PSQL/div[7]/div[4]/div[2]/p[10]", "#APP-PSQL/div[7]/div[4]/div[2]/p[11]", "#APP-PSQL/div[7]/div[4]/div[2]/p[12]", "#APP-PSQL/div[7]/div[4]/div[2]/p[1]", "#APP-PSQL/div[7]/div[4]/div[2]/p[3]", "#APP-PSQL/div[7]/div[4]/div[2]/p[4]", "#APP-PSQL/div[7]/div[4]/div[2]/p[6]", "#APP-PSQL/div[7]/div[4]/div[2]/p[7]", "#APP-PSQL/div[7]/div[4]/div[2]/p[9]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[15]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[21]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[23]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[25]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[29]/p[0]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[29]/p[2]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[4]/div[3]/div[5]/p[1]", "#APP-PSQL/div[7]/div[4]/div[3]/p[1]", "#APP-PSQL/div[7]/div[4]/div[3]/p[2]", "#APP-PSQL/div[7]/div[4]/div[4]/h4[0]", "#APP-PSQL/div[7]/div[4]/div[4]/p[1]", "#APP-PSQL/div[7]/div[4]/div[4]/p[3]", "#APP-PSQL/div[7]/div[4]/h3[0]", "#APP-PSQL/div[7]/h2[0]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[11]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[13]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[15]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[17]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[19]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[1]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[3]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[5]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[7]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]/p[0]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]/p[2]", "#APP-PSQL/div[8]/p[2]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[0]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[1]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[2]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[3]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[3]/p[0]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[3]/p[1]", "#APP-PSQL/div[9]/div[1]/dl[0]/dt[0]", "#APP-PSQL/div[9]/h2[0]"]}, {"url": "/docs/12/indexes-index-only-scans.html", "method": "same-major semantic node", "sha256": "571af82505bb47028d135429568cb749837143a90fb0b8ec9bce0497e33d9378", "language": "zh", "matched_nodes": ["#INDEXES-INDEX-ONLY-SCANS/p[25]/span[2]"]}], "language": "zh", "original_text": {"/versions/12/description/0": "psql \u2014 PostgreSQL interactive terminal", "/versions/12/facts/0/label": "Documented executable", "/versions/12/facts/1/label": "Executable version", "/versions/12/facts/2/label": "Reference inventory", "/versions/12/facts/2/value": "Client applications", "/versions/12/facts/3/label": "Option definition groups", "/versions/12/tables/0/title": "Documented options", "/versions/12/tables/1/title": "Environment variables", "/versions/12/related/0/label": "psql meta-commands", "/versions/12/related/1/label": "libpq connection parameters", "/versions/12/tables/0/rows/0/summary": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all .", "/versions/12/tables/0/rows/1/summary": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned .", "/versions/12/tables/0/rows/2/summary": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors .", "/versions/12/tables/0/rows/3/summary": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence.", "/versions/12/tables/0/rows/4/summary": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv .", "/versions/12/tables/0/rows/5/summary": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "/versions/12/tables/0/rows/6/summary": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries .", "/versions/12/tables/0/rows/7/summary": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on .", "/versions/12/tables/0/rows/8/summary": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i .", "/versions/12/tables/0/rows/9/summary": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f .", "/versions/12/tables/0/columns/0/label": "Option and arguments", "/versions/12/tables/0/columns/1/label": "Description", "/versions/12/tables/0/rows/10/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket.", "/versions/12/tables/0/rows/11/summary": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command.", "/versions/12/tables/0/rows/12/summary": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list .", "/versions/12/tables/0/rows/13/summary": "Write all query output into file filename , in addition to the normal output destination.", "/versions/12/tables/0/rows/14/summary": "Do not use Readline for line editing and do not use the command history. This can be useful to turn off tab expansion when cutting and pasting.", "/versions/12/tables/0/rows/15/summary": "Put all query output into file filename . This is equivalent to the command \\o .", "/versions/12/tables/0/rows/16/summary": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432.", "/versions/12/tables/0/rows/17/summary": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex .", "/versions/12/tables/0/rows/18/summary": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on .", "/versions/12/tables/0/rows/19/summary": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep .", "/versions/12/tables/0/rows/20/summary": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts.", "/versions/12/tables/0/rows/21/summary": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does.", "/versions/12/tables/0/rows/22/summary": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only .", "/versions/12/tables/0/rows/23/summary": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details.", "/versions/12/tables/0/rows/24/summary": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)", "/versions/12/tables/0/rows/25/summary": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later.", "/versions/12/tables/0/rows/26/summary": "Print the psql version and exit.", "/versions/12/tables/0/rows/27/summary": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/12/tables/0/rows/28/summary": "Force psql to prompt for a password before connecting to a database, even if the password will not be used.", "/versions/12/tables/0/rows/29/summary": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded .", "/versions/12/tables/0/rows/30/summary": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file).", "/versions/12/tables/0/rows/31/summary": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero .", "/versions/12/tables/0/rows/32/summary": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero .", "/versions/12/tables/0/rows/33/summary": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. This ensures that either all the commands complete successfully, or no changes are applied.", "/versions/12/tables/0/rows/34/summary": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables.", "/versions/12/tables/1/columns/0/label": "Variable", "/versions/12/tables/1/columns/1/label": "Meaning", "/versions/12/tables/1/rows/0/description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode.", "/versions/12/tables/1/rows/1/description": "Default connection parameters (see Section 33.14 ).", "/versions/12/tables/1/rows/2/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .", "/versions/12/tables/1/rows/3/description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems.", "/versions/12/tables/1/rows/4/description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems.", "/versions/12/tables/1/rows/5/description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed.", "/versions/12/tables/1/rows/6/description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use more on most platforms, but less on Cygwin.", "/versions/12/tables/1/rows/7/description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed.", "/versions/12/tables/1/rows/8/description": "Command executed by the \\! command.", "/versions/12/tables/1/rows/9/description": "Directory for storing temporary files. The default is /tmp ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "6674a093dbf4250da404ef89d40dab7f0527cb125e5adef7d50eae26a3ae3709"}, "comparison_data": {"options": [{"names": ["-a", "--echo-all"], "signature": "-a --echo-all", "description": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all ."}, {"names": ["-A", "--no-align"], "signature": "-A --no-align", "description": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned ."}, {"names": ["-b", "--echo-errors"], "signature": "-b --echo-errors", "description": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors ."}, {"names": ["-c command", "--command= command"], "signature": "-c command --command= command", "description": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. command must be either a command string that is completely parsable by the server (i.e., it contains no psql -specific features), or a single backslash command. Thus you cannot mix SQL and psql meta-commands within a -c option. To achieve that, you could use repeated -c options or pipe the string into psql , for example: psql -c '\\x' -c 'SELECT * FROM foo;' or echo '\\x \\\\ SELECT * FROM foo;' | psql ( \\\\ is the separator meta-command.) Each SQL command string passed to -c is sent to the server as a single request. Because of this, the server executes it as a single transaction even if the string contains multiple SQL commands, unless there are explicit BEGIN / COMMIT commands included in the string to divide it into multiple transactions. (See Section 52.2.2.1 for more details about how the server handles multi-query strings.) Also, psql only prints the result of the last SQL command in the string. This is different from the behavior when the same string is read from a file or fed to psql 's standard input, because then psql sends each SQL command separately. Because of this behavior, putting more than one SQL command in a single -c string often has unexpected results. It's better to use repeated -c commands or feed multiple commands to psql 's standard input, either using echo as illustrated above, or via a shell here-document, for example: psql <<EOF \\x SELECT * FROM foo; EOF"}, {"names": ["--csv"], "signature": "--csv", "description": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv ."}, {"names": ["-d dbname", "--dbname= dbname"], "signature": "-d dbname --dbname= dbname", "description": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--echo-queries"], "signature": "-e --echo-queries", "description": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries ."}, {"names": ["-E", "--echo-hidden"], "signature": "-E --echo-hidden", "description": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on ."}, {"names": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i . If filename is - (hyphen), then standard input is read until an EOF indication or \\q meta-command. This can be used to intersperse interactive input with input from files. Note however that Readline is not used in this case (much as if -n had been specified). Using this option is subtly different from writing psql < filename . In general, both will do what you expect, but using -f enables some nice features such as error messages with line numbers. There is also a slight chance that using this option will reduce the start-up overhead. On the other hand, the variant using the shell's input redirection is (in theory) guaranteed to yield exactly the same output you would have received had you entered everything by hand."}, {"names": ["-F separator", "--field-separator= separator"], "signature": "-F separator --field-separator= separator", "description": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f ."}, {"names": ["-h hostname", "--host= hostname"], "signature": "-h hostname --host= hostname", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket."}, {"names": ["-H", "--html"], "signature": "-H --html", "description": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command."}, {"names": ["-l", "--list"], "signature": "-l --list", "description": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list . When this option is used, psql will connect to the database postgres , unless a different database is named on the command line (option -d or non-option argument, possibly via a service entry, but not via an environment variable)."}, {"names": ["-L filename", "--log-file= filename"], "signature": "-L filename --log-file= filename", "description": "Write all query output into file filename , in addition to the normal output destination."}, {"names": ["-n", "--no-readline"], "signature": "-n --no-readline", "description": "Do not use Readline for line editing and do not use the command history. This can be useful to turn off tab expansion when cutting and pasting."}, {"names": ["-o filename", "--output= filename"], "signature": "-o filename --output= filename", "description": "Put all query output into file filename . This is equivalent to the command \\o ."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432."}, {"names": ["-P assignment", "--pset= assignment"], "signature": "-P assignment --pset= assignment", "description": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex ."}, {"names": ["-q", "--quiet"], "signature": "-q --quiet", "description": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on ."}, {"names": ["-R separator", "--record-separator= separator"], "signature": "-R separator --record-separator= separator", "description": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep ."}, {"names": ["-s", "--single-step"], "signature": "-s --single-step", "description": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts."}, {"names": ["-S", "--single-line"], "signature": "-S --single-line", "description": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does. Note This mode is provided for those who insist on it, but you are not necessarily encouraged to use it. In particular, if you mix SQL and meta-commands on a line the order of execution might not always be clear to the inexperienced user."}, {"names": ["-t", "--tuples-only"], "signature": "-t --tuples-only", "description": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only ."}, {"names": ["-T table_options", "--table-attr= table_options"], "signature": "-T table_options --table-attr= table_options", "description": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)"}, {"names": ["-v assignment", "--set= assignment", "--variable= assignment"], "signature": "-v assignment --set= assignment --variable= assignment", "description": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the psql version and exit."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Force psql to prompt for a password before connecting to a database, even if the password will not be used. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, psql will prompt for a password in any case. However, psql will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-x", "--expanded"], "signature": "-x --expanded", "description": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded ."}, {"names": ["-X", "--no-psqlrc"], "signature": "-X --no-psqlrc", "description": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file)."}, {"names": ["-z", "--field-separator-zero"], "signature": "-z --field-separator-zero", "description": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero ."}, {"names": ["-0", "--record-separator-zero"], "signature": "-0 --record-separator-zero", "description": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero ."}, {"names": ["-1", "--single-transaction"], "signature": "-1 --single-transaction", "description": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. This ensures that either all the commands complete successfully, or no changes are applied. If the commands themselves contain BEGIN , COMMIT , or ROLLBACK , this option will not have the desired effects. Also, if an individual command cannot be executed inside a transaction block, specifying this option will cause the whole transaction to fail."}, {"names": ["-?", "--help[= topic ]"], "signature": "-? --help[= topic ]", "description": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables."}], "synopsis": ["psql [ option ...] [ dbname [ username ]]"], "environment": [{"name": "COLUMNS", "description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode."}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters (see Section 33.14 )."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems."}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems."}, {"name": "PSQL_HISTORY", "description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed."}, {"name": "PSQL_PAGER PAGER", "description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use more on most platforms, but less on Cygwin."}, {"name": "PSQLRC", "description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed."}, {"name": "SHELL", "description": "Command executed by the \\! command."}, {"name": "TMPDIR", "description": "Directory for storing temporary files. The default is /tmp ."}]}, "comparison_hash": "4a4dd0a7d0a689cfa3f6b44663814fe61d2b6de414e7e11e0e20923a28151f08", "manual_language": "zh"}, "13": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "psql"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "13.23"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "35"}], "tables": [{"key": "options", "rows": [{"summary": "\u5728\u8bfb\u5165\u65f6\u5c06\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u884c\u8bfb\u53d6\uff09\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a all \u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-a --echo-all"}}, {"summary": "\u5207\u6362\u5230\u975e\u5bf9\u9f50\u8f93\u51fa\u6a21\u5f0f\uff08\u9ed8\u8ba4\u8f93\u51fa\u6a21\u5f0f\u662f aligned \uff09\u3002\u8fd9\u7b49\u6548\u4e8e \\pset format unaligned \u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-A --no-align"}}, {"summary": "\u628a\u5931\u8d25\u7684 SQL \u547d\u4ee4\u6253\u5370\u5230\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a errors \u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-b --echo-errors"}}, {"summary": "\u6307\u5b9a psql \u6267\u884c\u4e00\u4e2a\u7ed9\u5b9a\u7684\u547d\u4ee4\u5b57\u7b26\u4e32 command \u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u591a\u6b21\u5e76\u4e14\u4ee5\u4efb\u4f55\u987a\u5e8f\u4e0e -f \u9009\u9879\u7ec4\u5408\u5728\u4e00\u8d77\u3002\u5f53 -c \u6216\u8005 -f \u88ab\u6307\u5b9a\u65f6\uff0c psql \u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709 -c \u548c -f \u9009\u9879\u540e\u7ec8\u6b62\u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-c command --command= command"}}, {"summary": "\u5207\u6362\u5230 CSV \uff08\u9017\u53f7\u5206\u9694\u503c\uff09\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u76f8\u5f53\u4e8e \\pset format csv \u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "--csv"}}, {"summary": "\u6307\u5b9a\u8981\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002\u8fd9\u7b49\u6548\u4e8e\u6307\u5b9a dbname \u4e3a\u547d\u4ee4\u884c\u4e0a\u7684\u7b2c\u4e00\u4e2a\u975e\u9009\u9879\u53c2\u6570\u3002 dbname \u53ef\u4ee5\u662f \u8fde\u63a5\u5b57\u7b26\u4e32 \u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u5c06\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-d dbname --dbname= dbname"}}, {"summary": "\u4e5f\u628a\u53d1\u9001\u5230\u670d\u52a1\u5668\u7684\u6240\u6709 SQL \u547d\u4ee4\u590d\u5236\u5230\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a queries \u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-e --echo-queries"}}, {"summary": "\u56de\u663e \\d \u4ee5\u53ca\u5176\u4ed6\u53cd\u659c\u7ebf\u547d\u4ee4\u751f\u6210\u7684\u5b9e\u9645\u67e5\u8be2\u3002\u53ef\u4ee5\u7528\u5b83\u6765\u5b66\u4e60 psql \u7684\u5185\u90e8\u64cd\u4f5c\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO_HIDDEN \u8bbe\u7f6e\u4e3a on \u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-E --echo-hidden"}}, {"summary": "\u4ece\u6587\u4ef6 filename \u800c\u4e0d\u662f\u6807\u51c6\u8f93\u5165\u4e2d\u8bfb\u53d6\u547d\u4ee4\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u6307\u5b9a\uff0c\u4e5f\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u4e0e -c \u9009\u9879\u7ec4\u5408\u4f7f\u7528\u3002\u5f53\u6307\u5b9a\u4e86 -c \u6216 -f \u65f6\uff0c psql \u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709 -c \u548c -f \u9009\u9879\u540e\u7ec8\u6b62\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u7b49\u4ef7\u4e8e\u5143\u547d\u4ee4 \\i \u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-f filename --file= filename"}}, {"summary": "\u4f7f\u7528 separator \u4f5c\u4e3a\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e \\pset fieldsep \u6216\u8005 \\f \u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-F separator --field-separator= separator"}}, {"summary": "\u6307\u5b9a\u8fd0\u884c\u670d\u52a1\u5668\u7684\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u6240\u5728\u7684\u76ee\u5f55\u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-h hostname --host= hostname"}}, {"summary": "\u5207\u6362\u5230 HTML \u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e \\pset format html \u6216\u8005 \\H \u547d\u4ee4\u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-H --html"}}, {"summary": "\u5217\u51fa\u6240\u6709\u53ef\u7528\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u9000\u51fa\u3002\u5176\u4ed6\u975e\u8fde\u63a5\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002\u8fd9\u4e0e\u5143\u547d\u4ee4 \\list \u7c7b\u4f3c\u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-l --list"}}, {"summary": "\u9664\u4e86\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u5199\u5230\u666e\u901a\u8f93\u51fa\u76ee\u6807\u4e4b\u5916\uff0c\u8fd8\u5199\u5230\u6587\u4ef6 filename \u4e2d\u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-L filename --log-file= filename"}}, {"summary": "\u4e0d\u8981\u4f7f\u7528 Readline \u8fdb\u884c\u884c\u7f16\u8f91\uff0c\u4e5f\u4e0d\u8981\u4f7f\u7528\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\u3002\u8fd9\u6709\u52a9\u4e8e\u5728\u526a\u5207\u548c\u7c98\u8d34\u65f6\u5173\u95edTAB \u8865\u5168\u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-n --no-readline"}}, {"summary": "\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u653e\u5230\u6587\u4ef6 filename \u4e2d\u3002\u8fd9\u7b49\u6548\u4e8e\u547d\u4ee4 \\o \u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-o filename --output= filename"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u7684\u6587\u4ef6\u540d\u540e\u7f00\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u7684\u503c\uff1b\u672a\u8bbe\u7f6e\u65f6\uff0c\u4f7f\u7528\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u7aef\u53e3\uff0c\u901a\u5e38\u4e3a 5432\u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-p port --port= port"}}, {"summary": "\u4ee5 \\pset \u7684\u5f62\u5f0f\u6307\u5b9a\u6253\u5370\u9009\u9879\u3002\u6ce8\u610f\uff0c\u8fd9\u91cc\u4f60\u5fc5\u987b\u7528\u4e00\u4e2a\u7b49\u53f7\u800c\u4e0d\u662f\u7a7a\u683c\u6765\u5206\u9694\u540d\u79f0\u548c\u503c\u3002\u4f8b\u5982\uff0c\u8981\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a LaTeX \uff0c\u5e94\u8be5\u5199\u6210 -P format=latex \u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-P assignment --pset= assignment"}}, {"summary": "\u6307\u5b9a psql \u5e94\u8be5\u5b89\u9759\u5730\u5de5\u4f5c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4f1a\u6253\u5370\u51fa\u6b22\u8fce\u6d88\u606f\u548c\u5404\u79cd\u63d0\u793a\u4fe1\u606f\u3002\u5982\u679c\u4f7f\u7528\u4e86\u8fd9\u4e2a\u9009\u9879\uff0c\u4ee5\u4e0a\u90a3\u4e9b\u5c31\u90fd\u4e0d\u4f1a\u8f93\u51fa\u3002\u5728\u4f7f\u7528 -c \u9009\u9879\u65f6\uff0c\u914d\u5408\u8fd9\u4e2a\u9009\u9879\u5f88\u6709\u7528\u3002\u8fd9\u7b49\u6548\u4e8e\u8bbe\u7f6e\u53d8\u91cf QUIET \u4e3a on \u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-q --quiet"}}, {"summary": "\u628a separator \u7528\u4f5c\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e \\pset recordsep \u547d\u4ee4\u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-R separator --record-separator= separator"}}, {"summary": "\u8fd0\u884c\u5728\u5355\u6b65\u6a21\u5f0f\u4e2d\u3002\u8fd9\u610f\u5473\u7740\u5728\u6bcf\u4e2a\u547d\u4ee4\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u4e4b\u524d\u90fd\u4f1a\u63d0\u793a\u7528\u6237\uff0c\u5e76\u5141\u8bb8\u53d6\u6d88\u6267\u884c\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u8c03\u8bd5\u811a\u672c\u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-s --single-step"}}, {"summary": "\u8fd0\u884c\u5728\u5355\u884c\u6a21\u5f0f\u4e2d\uff0c\u5176\u4e2d\u6362\u884c\u7b26\u4f1a\u7ec8\u6b62\u4e00\u4e2a SQL \u547d\u4ee4\uff0c\u5c31\u50cf\u5206\u53f7\u7684\u4f5c\u7528\u4e00\u6837\u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-S --single-line"}}, {"summary": "\u5173\u95ed\u6253\u5370\u5217\u540d\u548c\u7ed3\u679c\u884c\u8ba1\u6570\u9875\u811a\u7b49\u3002\u8fd9\u7b49\u6548\u4e8e \\t \u6216\u8005 \\pset tuples_only \u547d\u4ee4\u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-t --tuples-only"}}, {"summary": "\u6307\u5b9a\u8981\u653e\u5728 HTML table \u6807\u7b7e\u5185\u7684\u9009\u9879\u3002\u8be6\u89c1 \\pset tableattr \u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-T table_options --table-attr= table_options"}}, {"summary": "\u4f5c\u4e3a\u7528\u6237 username \u800c\u4e0d\u662f\u9ed8\u8ba4\u7528\u6237\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff08\u5f53\u7136\uff0c\u4f60\u5fc5\u987b\u5177\u6709\u8fd9\u6837\u505a\u7684\u6743\u9650\uff09\u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-U username --username= username"}}, {"summary": "\u6267\u884c\u4e00\u6b21\u53d8\u91cf\u8d4b\u503c\uff0c\u548c \\set \u5143\u547d\u4ee4\u76f8\u4f3c\u3002\u6ce8\u610f\u4f60\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u7528\u7b49\u53f7\u5206\u9694\u540d\u5b57\u548c\u503c\uff08\u5982\u679c\u6709\uff09\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u7684\u8bbe\u7f6e\uff0c\u53bb\u6389\u7b49\u53f7\u5c31\u884c\u3002\u8981\u628a\u4e00\u4e2a\u53d8\u91cf\u8bbe\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u4f7f\u7528\u7b49\u53f7\u4f46\u662f\u53bb\u6389\u503c\u3002\u8fd9\u4e9b\u8d4b\u503c\u5728\u547d\u4ee4\u884c\u5904\u7406\u671f\u95f4\u88ab\u5b8c\u6210\uff0c\u56e0\u6b64\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u7684\u53d8\u91cf\u5c06\u5728\u7a0d\u540e\u88ab\u8986\u76d6\u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-v assignment --set= assignment --variable= assignment"}}, {"summary": "\u6253\u5370 psql \u7248\u672c\u5e76\u4e14\u9000\u51fa\u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-V --version"}}, {"summary": "\u6c38\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982 .pgpass \u6587\u4ef6\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u8fd9\u4e2a\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4efb\u52a1\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u65f6\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 psql \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\uff0c\u5373\u4f7f\u8be5\u5bc6\u7801\u5b9e\u9645\u4e0a\u4e0d\u4f1a\u88ab\u4f7f\u7528\u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-W --password"}}, {"summary": "\u6253\u5f00\u6269\u5c55\u8868\u683c\u5f0f\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e \\x \u6216\u8005 \\pset expanded \u547d\u4ee4\u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-x --expanded"}}, {"summary": "\u4e0d\u8bfb\u53d6\u542f\u52a8\u6587\u4ef6\uff08\u65e2\u4e0d\u8bfb\u53d6\u7cfb\u7edf\u8303\u56f4\u7684 psqlrc \u6587\u4ef6\uff0c\u4e5f\u4e0d\u8bfb\u53d6\u7528\u6237\u7684 ~/.psqlrc \u6587\u4ef6\uff09\u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-X --no-psqlrc"}}, {"summary": "\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u8fd9\u7b49\u6548\u4e8e \\pset fieldsep_zero \u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-z --field-separator-zero"}}, {"summary": "\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u4f8b\u5982\uff0c\u8fd9\u6709\u52a9\u4e8e\u4e0e xargs -0 \u914d\u5408\u4f7f\u7528\u3002\u8fd9\u7b49\u6548\u4e8e \\pset recordsep_zero \u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-0 --record-separator-zero"}}, {"summary": "\u8fd9\u4e2a\u9009\u9879\u53ea\u80fd\u4e0e\u4e00\u4e2a\u6216\u591a\u4e2a -c \u548c/\u6216 -f \u9009\u9879\u7ed3\u5408\u4f7f\u7528\u3002\u5b83\u4f1a\u5bfc\u81f4 psql \u5728\u7b2c\u4e00\u4e2a\u8fd9\u6837\u7684\u9009\u9879\u4e4b\u524d\u53d1\u51fa\u4e00\u4e2a BEGIN \u547d\u4ee4\uff0c\u5e76\u5728\u6700\u540e\u4e00\u4e2a\u9009\u9879\u4e4b\u540e\u53d1\u51fa\u4e00\u4e2a COMMIT \u547d\u4ee4\uff0c\u4ece\u800c\u5c06\u6240\u6709\u547d\u4ee4\u5305\u88c5\u6210\u4e00\u4e2a\u5355\u72ec\u7684\u4e8b\u52a1\u3002\u8fd9\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-1 --single-transaction"}}, {"summary": "\u663e\u793a\u6709\u5173 psql \u7684\u5e2e\u52a9\u5e76\u4e14\u9000\u51fa\u3002\u53ef\u9009\u7684 topic \u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a options \uff09\u9009\u62e9\u8981\u89e3\u91ca psql \u7684\u54ea\u4e00\u90e8\u5206\uff1a commands \u63cf\u8ff0 psql \u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b options \u63cf\u8ff0\u53ef\u4ee5\u88ab\u4f20\u9012\u7ed9 psql \u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c variables \u5219\u663e\u793a\u6709\u5173 psql \u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002", "signature": {"url": "/docs/13/app-psql.html", "text": "-? --help[= topic ]"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "COLUMNS", "description": "\u5982\u679c \\pset columns \u4e3a\u96f6\uff0c\u8fd9\u4e2a\u73af\u5883\u53d8\u91cf\u63a7\u5236\u7528\u4e8e wrapped \u683c\u5f0f\u7684\u5bbd\u5ea6\u4ee5\u53ca\u7528\u6765\u786e\u5b9a\u662f\u5426\u8f93\u51fa\u9700\u8981\u7528\u5230\u5206\u9875\u5668\u6216\u8005\u5207\u6362\u5230\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e2d\u7684\u5782\u76f4\u683c\u5f0f\u7684\u5bbd\u5ea6\u3002"}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\uff08\u89c1 \u7b2c 33.14 \u8282 \uff09\u3002"}, {"name": "PG_COLOR", "description": "\u89c4\u5b9a\u5728\u8bca\u65ad\u6d88\u606f\u4e2d\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u80fd\u7684\u503c\u4e3a always \u3001 auto \u3001 never \u3002"}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "\\e \u3001 \\ef \u4ee5\u53ca \\ev \u547d\u4ee4\u6240\u4f7f\u7528\u7684\u7f16\u8f91\u5668\u3002\u4f1a\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u68c0\u67e5\u8fd9\u4e9b\u53d8\u91cf\uff0c\u7b2c\u4e00\u4e2a\u88ab\u8bbe\u7f6e\u7684\u5c06\u88ab\u4f7f\u7528\u3002\u5982\u679c\u90fd\u6ca1\u6709\u88ab\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u662f\u4f7f\u7528Unix\u7cfb\u7edf\u4e0a\u7684 vi \u6216\u8005Windows\u7cfb\u7edf\u4e0a\u7684 notepad.exe \u3002"}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "\u5f53 \\e \u3001 \\ef \u6216 \\ev \u5e26\u6709\u884c\u53f7\u53c2\u6570\u4f7f\u7528\u65f6\uff0c\u6b64\u53d8\u91cf\u6307\u5b9a\u5c06\u8d77\u59cb\u884c\u53f7\u4f20\u7ed9\u7528\u6237\u7f16\u8f91\u5668\u65f6\u6240\u7528\u7684\u547d\u4ee4\u884c\u53c2\u6570\u3002\u5bf9\u4e8e Emacs \u6216 vi \u4e4b\u7c7b\u7684\u7f16\u8f91\u5668\uff0c\u8fd9\u4e2a\u53c2\u6570\u662f\u4e00\u4e2a\u52a0\u53f7\u3002\u5982\u679c\u9009\u9879\u540d\u548c\u884c\u53f7\u4e4b\u95f4\u9700\u8981\u7a7a\u683c\uff0c\u8bf7\u5728\u53d8\u91cf\u503c\u4e2d\u5305\u542b\u672b\u5c3e\u7a7a\u683c\u3002\u4f8b\u5982\uff1a PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' \u5728 Unix \u7cfb\u7edf\u4e0a\u9ed8\u8ba4\u662f + \uff08\u5bf9\u5e94\u4e8e\u9ed8\u8ba4\u7f16\u8f91\u5668 vi \uff0c\u4e14\u5bf9\u5f88\u591a\u5176\u4ed6\u5e38\u89c1\u7f16\u8f91\u5668\u53ef\u7528\uff09\u3002\u5728 Windows \u7cfb\u7edf\u4e0a\u6ca1\u6709\u9ed8\u8ba4\u503c\u3002"}, {"name": "PSQL_HISTORY", "description": "\u547d\u4ee4\u5386\u53f2\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08 ~ \uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002"}, {"name": "PSQL_PAGER PAGER", "description": "\u5982\u679c\u67e5\u8be2\u7ed3\u679c\u65e0\u6cd5\u5728\u5c4f\u5e55\u4e0a\u663e\u793a\u5b8c\u6574\uff0c\u5b83\u4eec\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6b64\u547d\u4ee4\u3002\u5178\u578b\u7684\u503c\u662f more \u6216 less \u3002\u53ef\u4ee5\u901a\u8fc7\u5c06 PSQL_PAGER \u6216 PAGER \u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u6216\u901a\u8fc7\u8c03\u6574 \\pset \u547d\u4ee4\u7684\u4e0e\u5206\u9875\u76f8\u5173\u7684\u9009\u9879\u6765\u7981\u7528\u5206\u9875\u5668\u3002\u8fd9\u4e9b\u53d8\u91cf\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u8fdb\u884c\u68c0\u67e5\uff1b\u4f7f\u7528\u6309\u8be5\u987a\u5e8f\u627e\u5230\u7684\u7b2c\u4e00\u4e2a\u5df2\u8bbe\u7f6e\u7684\u53d8\u91cf\u3002\u5982\u679c\u5b83\u4eec\u90fd\u6ca1\u6709\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5728\u5927\u591a\u6570\u5e73\u53f0\u4e0a\u4f7f\u7528 more \uff0c\u4f46\u5728Cygwin\u4e0a\u4f7f\u7528 less \u3002"}, {"name": "PSQLRC", "description": "\u7528\u6237\u7684 .psqlrc \u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08 ~ \uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002"}, {"name": "SHELL", "description": "\u88ab \\! \u547d\u4ee4\u6267\u884c\u7684\u547d\u4ee4\u3002"}, {"name": "TMPDIR", "description": "\u5b58\u50a8\u4e34\u65f6\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u662f /tmp \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-a", "--echo-all"], "summary": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all .", "signature": "-a --echo-all", "source_url": "/docs/13/app-psql.html", "description": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all ."}, {"names": ["-A", "--no-align"], "summary": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned .", "signature": "-A --no-align", "source_url": "/docs/13/app-psql.html", "description": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned ."}, {"names": ["-b", "--echo-errors"], "summary": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors .", "signature": "-b --echo-errors", "source_url": "/docs/13/app-psql.html", "description": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors ."}, {"names": ["-c command", "--command= command"], "summary": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence.", "signature": "-c command --command= command", "source_url": "/docs/13/app-psql.html", "description": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. command must be either a command string that is completely parsable by the server (i.e., it contains no psql -specific features), or a single backslash command. Thus you cannot mix SQL and psql meta-commands within a -c option. To achieve that, you could use repeated -c options or pipe the string into psql , for example: psql -c '\\x' -c 'SELECT * FROM foo;' or echo '\\x \\\\ SELECT * FROM foo;' | psql ( \\\\ is the separator meta-command.) Each SQL command string passed to -c is sent to the server as a single request. Because of this, the server executes it as a single transaction even if the string contains multiple SQL commands, unless there are explicit BEGIN / COMMIT commands included in the string to divide it into multiple transactions. (See Section 52.2.2.1 for more details about how the server handles multi-query strings.) Also, psql only prints the result of the last SQL command in the string. This is different from the behavior when the same string is read from a file or fed to psql 's standard input, because then psql sends each SQL command separately. Because of this behavior, putting more than one SQL command in a single -c string often has unexpected results. It's better to use repeated -c commands or feed multiple commands to psql 's standard input, either using echo as illustrated above, or via a shell here-document, for example: psql <<EOF \\x SELECT * FROM foo; EOF"}, {"names": ["--csv"], "summary": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv .", "signature": "--csv", "source_url": "/docs/13/app-psql.html", "description": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv ."}, {"names": ["-d dbname", "--dbname= dbname"], "summary": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "signature": "-d dbname --dbname= dbname", "source_url": "/docs/13/app-psql.html", "description": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--echo-queries"], "summary": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries .", "signature": "-e --echo-queries", "source_url": "/docs/13/app-psql.html", "description": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries ."}, {"names": ["-E", "--echo-hidden"], "summary": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on .", "signature": "-E --echo-hidden", "source_url": "/docs/13/app-psql.html", "description": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on ."}, {"names": ["-f filename", "--file= filename"], "summary": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i .", "signature": "-f filename --file= filename", "source_url": "/docs/13/app-psql.html", "description": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i . If filename is - (hyphen), then standard input is read until an EOF indication or \\q meta-command. This can be used to intersperse interactive input with input from files. Note however that Readline is not used in this case (much as if -n had been specified). Using this option is subtly different from writing psql < filename . In general, both will do what you expect, but using -f enables some nice features such as error messages with line numbers. There is also a slight chance that using this option will reduce the start-up overhead. On the other hand, the variant using the shell's input redirection is (in theory) guaranteed to yield exactly the same output you would have received had you entered everything by hand."}, {"names": ["-F separator", "--field-separator= separator"], "summary": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f .", "signature": "-F separator --field-separator= separator", "source_url": "/docs/13/app-psql.html", "description": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f ."}, {"names": ["-h hostname", "--host= hostname"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket.", "signature": "-h hostname --host= hostname", "source_url": "/docs/13/app-psql.html", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket."}, {"names": ["-H", "--html"], "summary": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command.", "signature": "-H --html", "source_url": "/docs/13/app-psql.html", "description": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command."}, {"names": ["-l", "--list"], "summary": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list .", "signature": "-l --list", "source_url": "/docs/13/app-psql.html", "description": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list . When this option is used, psql will connect to the database postgres , unless a different database is named on the command line (option -d or non-option argument, possibly via a service entry, but not via an environment variable)."}, {"names": ["-L filename", "--log-file= filename"], "summary": "Write all query output into file filename , in addition to the normal output destination.", "signature": "-L filename --log-file= filename", "source_url": "/docs/13/app-psql.html", "description": "Write all query output into file filename , in addition to the normal output destination."}, {"names": ["-n", "--no-readline"], "summary": "Do not use Readline for line editing and do not use the command history. This can be useful to turn off tab expansion when cutting and pasting.", "signature": "-n --no-readline", "source_url": "/docs/13/app-psql.html", "description": "Do not use Readline for line editing and do not use the command history. This can be useful to turn off tab expansion when cutting and pasting."}, {"names": ["-o filename", "--output= filename"], "summary": "Put all query output into file filename . This is equivalent to the command \\o .", "signature": "-o filename --output= filename", "source_url": "/docs/13/app-psql.html", "description": "Put all query output into file filename . This is equivalent to the command \\o ."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432.", "signature": "-p port --port= port", "source_url": "/docs/13/app-psql.html", "description": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432."}, {"names": ["-P assignment", "--pset= assignment"], "summary": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex .", "signature": "-P assignment --pset= assignment", "source_url": "/docs/13/app-psql.html", "description": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex ."}, {"names": ["-q", "--quiet"], "summary": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on .", "signature": "-q --quiet", "source_url": "/docs/13/app-psql.html", "description": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on ."}, {"names": ["-R separator", "--record-separator= separator"], "summary": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep .", "signature": "-R separator --record-separator= separator", "source_url": "/docs/13/app-psql.html", "description": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep ."}, {"names": ["-s", "--single-step"], "summary": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts.", "signature": "-s --single-step", "source_url": "/docs/13/app-psql.html", "description": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts."}, {"names": ["-S", "--single-line"], "summary": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does.", "signature": "-S --single-line", "source_url": "/docs/13/app-psql.html", "description": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does. Note This mode is provided for those who insist on it, but you are not necessarily encouraged to use it. In particular, if you mix SQL and meta-commands on a line the order of execution might not always be clear to the inexperienced user."}, {"names": ["-t", "--tuples-only"], "summary": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only .", "signature": "-t --tuples-only", "source_url": "/docs/13/app-psql.html", "description": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only ."}, {"names": ["-T table_options", "--table-attr= table_options"], "summary": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details.", "signature": "-T table_options --table-attr= table_options", "source_url": "/docs/13/app-psql.html", "description": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details."}, {"names": ["-U username", "--username= username"], "summary": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)", "signature": "-U username --username= username", "source_url": "/docs/13/app-psql.html", "description": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)"}, {"names": ["-v assignment", "--set= assignment", "--variable= assignment"], "summary": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later.", "signature": "-v assignment --set= assignment --variable= assignment", "source_url": "/docs/13/app-psql.html", "description": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later."}, {"names": ["-V", "--version"], "summary": "Print the psql version and exit.", "signature": "-V --version", "source_url": "/docs/13/app-psql.html", "description": "Print the psql version and exit."}, {"names": ["-w", "--no-password"], "summary": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/13/app-psql.html", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-W", "--password"], "summary": "Force psql to prompt for a password before connecting to a database, even if the password will not be used.", "signature": "-W --password", "source_url": "/docs/13/app-psql.html", "description": "Force psql to prompt for a password before connecting to a database, even if the password will not be used. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, psql will prompt for a password in any case. However, psql will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-x", "--expanded"], "summary": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded .", "signature": "-x --expanded", "source_url": "/docs/13/app-psql.html", "description": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded ."}, {"names": ["-X", "--no-psqlrc"], "summary": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file).", "signature": "-X --no-psqlrc", "source_url": "/docs/13/app-psql.html", "description": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file)."}, {"names": ["-z", "--field-separator-zero"], "summary": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero .", "signature": "-z --field-separator-zero", "source_url": "/docs/13/app-psql.html", "description": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero ."}, {"names": ["-0", "--record-separator-zero"], "summary": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero .", "signature": "-0 --record-separator-zero", "source_url": "/docs/13/app-psql.html", "description": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero ."}, {"names": ["-1", "--single-transaction"], "summary": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. This ensures that either all the commands complete successfully, or no changes are applied.", "signature": "-1 --single-transaction", "source_url": "/docs/13/app-psql.html", "description": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. This ensures that either all the commands complete successfully, or no changes are applied. If the commands themselves contain BEGIN , COMMIT , or ROLLBACK , this option will not have the desired effects. Also, if an individual command cannot be executed inside a transaction block, specifying this option will cause the whole transaction to fail."}, {"names": ["-?", "--help[= topic ]"], "summary": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables.", "signature": "-? --help[= topic ]", "source_url": "/docs/13/app-psql.html", "description": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables."}], "related": [{"url": "/wiki/psql/?v=13", "label": "psql \u5143\u547d\u4ee4"}, {"url": "/wiki/conn/?v=13", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v13.23/postgresql-13.23.tar.bz2", "label": "13.23", "major": "13", "channel": "historical", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/13/postgresql-13-A4.pdf", "bytes": 13843239, "pages": 2826, "sha256": "171cc09f90936dbc1cbd503a98ff07ae72ea58ab9771ff051313f1217737799c", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/13/postgresql-13-US.pdf", "bytes": 13739572, "pages": 2984, "sha256": "48d09c6e197d9db4220f41afe83efe848a8661b1b168d3b89419751ecaf6c24d", "built_at": "2026-09-26"}}, "tree": "13", "index": "index.html", "major": "13", "pages": 1139, "release": "13.23", "source_url": "https://ftp.postgresql.org/pub/source/v13.23/postgresql-13.23.tar.bz2", "svg_assets": 3, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "6ec3c82726af92b7dec873fa1cdf881eca92a4219787dfad05acb6b10e041fd6"}, "revision": "614ee3133270254e476c118cdf6f72af78d4e4b8bbd9b28ed9ab1e14e4e9c0f6", "evidence_kind": "English manual and source declarations", "source_sha256": "6ec3c82726af92b7dec873fa1cdf881eca92a4219787dfad05acb6b10e041fd6"}, "sources": [{"url": "https://pg.center/docs/13/app-psql.html", "file": "app-psql.html", "label": "13.23 English manual \u00b7 app-psql.html", "anchor": "", "sha256": "30347083b7a58da020d968643e2479d2dfb534191d4493d454603ca53db151b0", "language": "en", "original_url": "/docs/13/app-psql.html"}, {"url": "https://pg.center/docs/13/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "2a16c2982d9803edd4bd6920f76b66083e7f2959182d6a3bcec7ccfbac0a9ad8", "language": "en", "original_url": "/docs/13/reference-client.html"}], "sections": [], "synopsis": ["psql [ option ...] [ dbname [ username ]]"], "signature": "psql [ option ...] [ dbname [ username ]]", "description": ["psql \u2014 PostgreSQL \u7684\u4ea4\u4e92\u5f0f\u7ec8\u7aef"], "environment": [{"name": "COLUMNS", "description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode."}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters (see Section 33.14 )."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems."}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems."}, {"name": "PSQL_HISTORY", "description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed."}, {"name": "PSQL_PAGER PAGER", "description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use more on most platforms, but less on Cygwin."}, {"name": "PSQLRC", "description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed."}, {"name": "SHELL", "description": "Command executed by the \\! command."}, {"name": "TMPDIR", "description": "Directory for storing temporary files. The default is /tmp ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PSQL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></h2>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u2014 <span class=\"productname\">PostgreSQL</span>\u7684\u4ea4\u4e92\u5f0f\u7ec8\u7aef</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.19.4.1\"><code class=\"command\">psql</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em> [<em class=\"replaceable\"><code>username</code></em>]]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.19.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u662f<span class=\"productname\">PostgreSQL</span>\u7684\u4e00\u4e2a\u57fa\u4e8e\u7ec8\u7aef\u7684\u524d\u7aef\u3002\u5b83\u4f7f\u4f60\u80fd\u591f\u4ea4\u4e92\u5f0f\u5730\u8f93\u5165\u67e5\u8be2\uff0c\u5c06\u5176\u53d1\u9001\u7ed9<span class=\"productname\">PostgreSQL</span>\uff0c\u5e76\u67e5\u770b\u67e5\u8be2\u7ed3\u679c\u3002\u4e5f\u53ef\u4ee5\u4ece\u6587\u4ef6\u6216\u547d\u4ee4\u884c\u53c2\u6570\u63d0\u4f9b\u8f93\u5165\u3002\u6b64\u5916\uff0c<span class=\"application\">psql</span>\u8fd8\u63d0\u4f9b\u4e86\u82e5\u5e72\u5143\u547d\u4ee4\u548c\u591a\u79cd\u7c7b\u4f3c shell \u7684\u7279\u6027\uff0c\u4ee5\u4fbf\u4e8e\u7f16\u5199\u811a\u672c\u548c\u81ea\u52a8\u5316\u6267\u884c\u5404\u79cd\u4efb\u52a1\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-PSQL-3\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-a</code><br/></span><span class=\"term\"><code class=\"option\">--echo-all</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8bfb\u5165\u65f6\u5c06\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u884c\u8bfb\u53d6\uff09\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a <code class=\"literal\">all</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-A</code><br/></span><span class=\"term\"><code class=\"option\">--no-align</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230\u975e\u5bf9\u9f50\u8f93\u51fa\u6a21\u5f0f\uff08\u9ed8\u8ba4\u8f93\u51fa\u6a21\u5f0f\u662f<code class=\"literal\">aligned</code>\uff09\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset format unaligned</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-b</code><br/></span><span class=\"term\"><code class=\"option\">--echo-errors</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u5931\u8d25\u7684 SQL \u547d\u4ee4\u6253\u5370\u5230\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">errors</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>command</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--command=<em class=\"replaceable\"><code>command</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a<span class=\"application\">psql</span>\u6267\u884c\u4e00\u4e2a\u7ed9\u5b9a\u7684\u547d\u4ee4\u5b57\u7b26\u4e32<em class=\"replaceable\"><code>command</code></em>\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u591a\u6b21\u5e76\u4e14\u4ee5\u4efb\u4f55\u987a\u5e8f\u4e0e<code class=\"option\">-f</code>\u9009\u9879\u7ec4\u5408\u5728\u4e00\u8d77\u3002\u5f53<code class=\"option\">-c</code>\u6216\u8005<code class=\"option\">-f</code>\u88ab\u6307\u5b9a\u65f6\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709<code class=\"option\">-c</code>\u548c<code class=\"option\">-f</code>\u9009\u9879\u540e\u7ec8\u6b62\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>command</code></em>\u5fc5\u987b\u662f\u4e00\u4e2a\u670d\u52a1\u5668\u5b8c\u5168\u53ef\u89e3\u6790\u7684\u547d\u4ee4\u5b57\u7b26\u4e32\uff08\u5373\u4e0d\u5305\u542b<span class=\"application\">psql</span>\u4e13\u6709\u7684\u7279\u6027\uff09\u6216\u8005\u5355\u4e2a\u53cd\u659c\u7ebf\u547d\u4ee4\u3002\u56e0\u6b64\u4e0d\u80fd\u5728\u4e00\u4e2a<code class=\"option\">-c</code>\u9009\u9879\u4e2d\u6df7\u5408<acronym class=\"acronym\">SQL</acronym>\u548c<span class=\"application\">psql</span>\u5143\u547d\u4ee4\u3002\u8981\u90a3\u6837\u505a\uff0c\u53ef\u4ee5\u4f7f\u7528\u591a\u4e2a<code class=\"option\">-c</code>\u9009\u9879\u6216\u8005\u628a\u5b57\u7b26\u4e32\u7528\u7ba1\u9053\u8f93\u9001\u5230<span class=\"application\">psql</span>\u4e2d\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">psql -c '\\x' -c 'SELECT * FROM foo;'\n</pre>\n<p lang=\"zh\">\u6216\u8005</p>\n<pre class=\"programlisting\">echo '\\x \\\\ SELECT * FROM foo;' | psql\n</pre>\n<p lang=\"zh\">\uff08<code class=\"literal\">\\\\</code>\u662f\u5206\u9694\u7b26\u5143\u547d\u4ee4\uff09\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u5b57\u7b26\u4e32\u4f20\u9012\u7ed9<code class=\"option\">-c</code>\u90fd\u4f5c\u4e3a\u4e00\u4e2a\u5355\u72ec\u7684\u8bf7\u6c42\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u56e0\u6b64\uff0c\u5373\u4f7f\u5b57\u7b26\u4e32\u5305\u542b\u591a\u4e2a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\uff0c\u670d\u52a1\u5668\u4e5f\u4f1a\u5c06\u5176\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff0c\u9664\u975e\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u663e\u5f0f\u7684<code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code>\u547d\u4ee4\u5c06\u5176\u5206\u6210\u591a\u4e2a\u4e8b\u52a1\u3002\uff08\u6709\u5173\u670d\u52a1\u5668\u5982\u4f55\u5904\u7406\u591a\u67e5\u8be2\u5b57\u7b26\u4e32\u7684\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/13/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT\" title=\"52.2.2.1.\u00a0\u4e00\u4e2a\u7b80\u5355\u67e5\u8be2\u4e2d\u7684\u591a\u6761\u8bed\u53e5\">\u7b2c\u00a052.2.2.1\u00a0\u8282</a>\u3002\uff09\u6b64\u5916\uff0c<span class=\"application\">psql</span>\u53ea\u6253\u5370\u5b57\u7b26\u4e32\u4e2d\u6700\u540e\u4e00\u6761<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u7684\u7ed3\u679c\u3002\u8fd9\u4e0e\u4ece\u6587\u4ef6\u8bfb\u53d6\u540c\u4e00\u5b57\u7b26\u4e32\u6216\u5c06\u5176\u9001\u5165<span class=\"application\">psql</span>\u6807\u51c6\u8f93\u5165\u65f6\u7684\u884c\u4e3a\u4e0d\u540c\uff0c\u56e0\u4e3a\u5728\u8fd9\u4e9b\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">psql</span>\u4f1a\u5206\u522b\u53d1\u9001\u6bcf\u6761<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u7531\u4e8e\u8fd9\u79cd\u884c\u4e3a\uff0c\u5728\u5355\u4e2a <code class=\"option\">-c</code> \u5b57\u7b26\u4e32\u4e2d\u653e\u5165\u591a\u6761 SQL \u547d\u4ee4\u5e38\u5e38\u4f1a\u4ea7\u751f\u610f\u5916\u7ed3\u679c\u3002\u6700\u597d\u91cd\u590d\u4f7f\u7528 <code class=\"option\">-c</code> \u547d\u4ee4\uff0c\u6216\u5c06\u591a\u6761\u547d\u4ee4\u9001\u5165 <span class=\"application\">psql</span> \u7684\u6807\u51c6\u8f93\u5165\uff0c\u53ef\u4ee5\u50cf\u4e0a\u9762\u6240\u793a\u4f7f\u7528 <span class=\"application\">echo</span>\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528 shell \u7684 here-document\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">psql &lt;&lt;EOF\n\\x\nSELECT * FROM foo;\nEOF\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--csv</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230<acronym class=\"acronym\">CSV</acronym>\uff08\u9017\u53f7\u5206\u9694\u503c\uff09\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u76f8\u5f53\u4e8e<code class=\"command\">\\pset format csv</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>dbname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>dbname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002\u8fd9\u7b49\u6548\u4e8e\u6307\u5b9a<em class=\"replaceable\"><code>dbname</code></em>\u4e3a\u547d\u4ee4\u884c\u4e0a\u7684\u7b2c\u4e00\u4e2a\u975e\u9009\u9879\u53c2\u6570\u3002<em class=\"replaceable\"><code>dbname</code></em> \u53ef\u4ee5\u662f<a class=\"link\" href=\"/docs/13/libpq.html#LIBPQ-CONNSTRING\" title=\"33.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u5c06\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-e</code><br/></span><span class=\"term\"><code class=\"option\">--echo-queries</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e5f\u628a\u53d1\u9001\u5230\u670d\u52a1\u5668\u7684\u6240\u6709 SQL \u547d\u4ee4\u590d\u5236\u5230\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">queries</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-E</code><br/></span><span class=\"term\"><code class=\"option\">--echo-hidden</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u56de\u663e<code class=\"command\">\\d</code>\u4ee5\u53ca\u5176\u4ed6\u53cd\u659c\u7ebf\u547d\u4ee4\u751f\u6210\u7684\u5b9e\u9645\u67e5\u8be2\u3002\u53ef\u4ee5\u7528\u5b83\u6765\u5b66\u4e60<span class=\"application\">psql</span>\u7684\u5185\u90e8\u64cd\u4f5c\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO_HIDDEN</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u800c\u4e0d\u662f\u6807\u51c6\u8f93\u5165\u4e2d\u8bfb\u53d6\u547d\u4ee4\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u6307\u5b9a\uff0c\u4e5f\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u4e0e<code class=\"option\">-c</code>\u9009\u9879\u7ec4\u5408\u4f7f\u7528\u3002\u5f53\u6307\u5b9a\u4e86<code class=\"option\">-c</code>\u6216<code class=\"option\">-f</code>\u65f6\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709<code class=\"option\">-c</code>\u548c<code class=\"option\">-f</code>\u9009\u9879\u540e\u7ec8\u6b62\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u7b49\u4ef7\u4e8e\u5143\u547d\u4ee4<code class=\"command\">\\i</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c<em class=\"replaceable\"><code>filename</code></em>\u662f<code class=\"literal\">-</code>\uff08\u8fde\u5b57\u7b26\uff09\uff0c\u5219\u4f1a\u8bfb\u53d6\u6807\u51c6\u8f93\u5165\uff0c\u76f4\u5230\u9047\u5230 <acronym class=\"acronym\">EOF</acronym> \u6307\u793a\u6216<code class=\"command\">\\q</code>\u5143\u547d\u4ee4\u3002\u8fd9\u53ef\u7528\u4e8e\u5c06\u4ea4\u4e92\u5f0f\u8f93\u5165\u4e0e\u6587\u4ef6\u8f93\u5165\u4ea4\u9519\u4f7f\u7528\u3002\u4e0d\u8fc7\u8bf7\u6ce8\u610f\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\u4e0d\u4f1a\u4f7f\u7528 <span class=\"application\">Readline</span>\uff08\u5f88\u50cf\u6307\u5b9a\u4e86<code class=\"option\">-n</code>\u65f6\u7684\u60c5\u51b5\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u4e0e\u5199\u6210<code class=\"literal\">psql &lt; <em class=\"replaceable\"><code>filename</code></em></code>\u6709\u7ec6\u5fae\u5dee\u522b\u3002\u901a\u5e38\u4e24\u79cd\u5f62\u5f0f\u90fd\u4f1a\u5f97\u5230\u4f60\u671f\u671b\u7684\u7ed3\u679c\uff0c\u4f46\u4f7f\u7528<code class=\"literal\">-f</code>\u53ef\u4ee5\u542f\u7528\u4e00\u4e9b\u6709\u7528\u7684\u7279\u6027\uff0c\u4f8b\u5982\u5e26\u884c\u53f7\u7684\u9519\u8bef\u6d88\u606f\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u4e5f\u8fd8\u6709\u4e00\u70b9\u673a\u4f1a\u964d\u4f4e\u542f\u52a8\u5f00\u9500\u3002\u53e6\u4e00\u65b9\u9762\uff0c\u4f7f\u7528 shell \u8f93\u5165\u91cd\u5b9a\u5411\u7684\u5f62\u5f0f\u5728\u7406\u8bba\u4e0a\u80fd\u4fdd\u8bc1\u5f97\u5230\u4e0e\u4f60\u624b\u5de5\u9010\u884c\u8f93\u5165\u65f6\u5b8c\u5168\u76f8\u540c\u7684\u8f93\u51fa\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>separator</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--field-separator=<em class=\"replaceable\"><code>separator</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f7f\u7528<em class=\"replaceable\"><code>separator</code></em>\u4f5c\u4e3a\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset fieldsep</code>\u6216\u8005<code class=\"command\">\\f</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>hostname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>hostname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8fd0\u884c\u670d\u52a1\u5668\u7684\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u8be5\u503c\u4ee5\u659c\u7ebf\u5f00\u5934\uff0c\u5219\u5b83\u4f1a\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u6240\u5728\u7684\u76ee\u5f55\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-H</code><br/></span><span class=\"term\"><code class=\"option\">--html</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230<acronym class=\"acronym\">HTML</acronym>\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset format html</code>\u6216\u8005<code class=\"command\">\\H</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--list</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u6240\u6709\u53ef\u7528\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u9000\u51fa\u3002\u5176\u4ed6\u975e\u8fde\u63a5\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002\u8fd9\u4e0e\u5143\u547d\u4ee4<code class=\"command\">\\list</code>\u7c7b\u4f3c\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8be5\u9009\u9879\u65f6\uff0c<span class=\"application\">psql</span>\u5c06\u8fde\u63a5\u5230\u6570\u636e\u5e93<code class=\"literal\">postgres</code>\uff0c\u9664\u975e\u547d\u4ee4\u884c\u4e0a\u6307\u5b9a\u4e86\u5176\u4ed6\u6570\u636e\u5e93\uff08\u901a\u8fc7<code class=\"option\">-d</code>\u9009\u9879\u6216\u975e\u9009\u9879\u53c2\u6570\uff0c\u4e5f\u53ef\u80fd\u901a\u8fc7\u670d\u52a1\u9879\uff0c\u4f46\u4e0d\u80fd\u901a\u8fc7\u73af\u5883\u53d8\u91cf\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--log-file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9664\u4e86\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u5199\u5230\u666e\u901a\u8f93\u51fa\u76ee\u6807\u4e4b\u5916\uff0c\u8fd8\u5199\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-readline</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8981\u4f7f\u7528<span class=\"application\">Readline</span>\u8fdb\u884c\u884c\u7f16\u8f91\uff0c\u4e5f\u4e0d\u8981\u4f7f\u7528\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\u3002\u8fd9\u6709\u52a9\u4e8e\u5728\u526a\u5207\u548c\u7c98\u8d34\u65f6\u5173\u95edTAB \u8865\u5168\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-o <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--output=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u653e\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u3002\u8fd9\u7b49\u6548\u4e8e\u547d\u4ee4<code class=\"command\">\\o</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u7684\u6587\u4ef6\u540d\u540e\u7f00\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u7684\u503c\uff1b\u672a\u8bbe\u7f6e\u65f6\uff0c\u4f7f\u7528\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u7aef\u53e3\uff0c\u901a\u5e38\u4e3a 5432\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P <em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--pset=<em class=\"replaceable\"><code>assignment</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ee5<code class=\"command\">\\pset</code>\u7684\u5f62\u5f0f\u6307\u5b9a\u6253\u5370\u9009\u9879\u3002\u6ce8\u610f\uff0c\u8fd9\u91cc\u4f60\u5fc5\u987b\u7528\u4e00\u4e2a\u7b49\u53f7\u800c\u4e0d\u662f\u7a7a\u683c\u6765\u5206\u9694\u540d\u79f0\u548c\u503c\u3002\u4f8b\u5982\uff0c\u8981\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a<span class=\"application\">LaTeX</span>\uff0c\u5e94\u8be5\u5199\u6210<code class=\"literal\">-P format=latex</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-q</code><br/></span><span class=\"term\"><code class=\"option\">--quiet</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a<span class=\"application\">psql</span>\u5e94\u8be5\u5b89\u9759\u5730\u5de5\u4f5c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4f1a\u6253\u5370\u51fa\u6b22\u8fce\u6d88\u606f\u548c\u5404\u79cd\u63d0\u793a\u4fe1\u606f\u3002\u5982\u679c\u4f7f\u7528\u4e86\u8fd9\u4e2a\u9009\u9879\uff0c\u4ee5\u4e0a\u90a3\u4e9b\u5c31\u90fd\u4e0d\u4f1a\u8f93\u51fa\u3002\u5728\u4f7f\u7528<code class=\"option\">-c</code>\u9009\u9879\u65f6\uff0c\u914d\u5408\u8fd9\u4e2a\u9009\u9879\u5f88\u6709\u7528\u3002\u8fd9\u7b49\u6548\u4e8e\u8bbe\u7f6e\u53d8\u91cf<code class=\"varname\">QUIET</code>\u4e3a<code class=\"literal\">on</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R <em class=\"replaceable\"><code>separator</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--record-separator=<em class=\"replaceable\"><code>separator</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a<em class=\"replaceable\"><code>separator</code></em>\u7528\u4f5c\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset recordsep</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code><br/></span><span class=\"term\"><code class=\"option\">--single-step</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5728\u5355\u6b65\u6a21\u5f0f\u4e2d\u3002\u8fd9\u610f\u5473\u7740\u5728\u6bcf\u4e2a\u547d\u4ee4\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u4e4b\u524d\u90fd\u4f1a\u63d0\u793a\u7528\u6237\uff0c\u5e76\u5141\u8bb8\u53d6\u6d88\u6267\u884c\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u8c03\u8bd5\u811a\u672c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S</code><br/></span><span class=\"term\"><code class=\"option\">--single-line</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd0\u884c\u5728\u5355\u884c\u6a21\u5f0f\u4e2d\uff0c\u5176\u4e2d\u6362\u884c\u7b26\u4f1a\u7ec8\u6b62\u4e00\u4e2a SQL \u547d\u4ee4\uff0c\u5c31\u50cf\u5206\u53f7\u7684\u4f5c\u7528\u4e00\u6837\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u79cd\u6a21\u5f0f\u662f\u4e3a\u575a\u6301\u4f7f\u7528\u5b83\u7684\u7528\u6237\u63d0\u4f9b\u7684\uff0c\u4f46\u5e76\u4e0d\u4e00\u5b9a\u503c\u5f97\u63a8\u8350\u3002\u7279\u522b\u662f\uff0c\u5982\u679c\u5728\u4e00\u884c\u4e2d\u6df7\u5408\u4e86<acronym class=\"acronym\">SQL</acronym>\u548c\u5143\u547d\u4ee4\uff0c\u5bf9\u4e8e\u6ca1\u6709\u7ecf\u9a8c\u7684\u7528\u6237\u6765\u8bf4\uff0c\u5b83\u4eec\u7684\u6267\u884c\u987a\u5e8f\u672a\u5fc5\u603b\u662f\u6e05\u695a\u7684\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t</code><br/></span><span class=\"term\"><code class=\"option\">--tuples-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5173\u95ed\u6253\u5370\u5217\u540d\u548c\u7ed3\u679c\u884c\u8ba1\u6570\u9875\u811a\u7b49\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\t</code>\u6216\u8005<code class=\"command\">\\pset tuples_only</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>table_options</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--table-attr=<em class=\"replaceable\"><code>table_options</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u653e\u5728<acronym class=\"acronym\">HTML</acronym> <code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u9009\u9879\u3002\u8be6\u89c1<code class=\"command\">\\pset tableattr</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f5c\u4e3a\u7528\u6237<em class=\"replaceable\"><code>username</code></em>\u800c\u4e0d\u662f\u9ed8\u8ba4\u7528\u6237\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff08\u5f53\u7136\uff0c\u4f60\u5fc5\u987b\u5177\u6709\u8fd9\u6837\u505a\u7684\u6743\u9650\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v <em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--set=<em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--variable=<em class=\"replaceable\"><code>assignment</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6267\u884c\u4e00\u6b21\u53d8\u91cf\u8d4b\u503c\uff0c\u548c<code class=\"command\">\\set</code>\u5143\u547d\u4ee4\u76f8\u4f3c\u3002\u6ce8\u610f\u4f60\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u7528\u7b49\u53f7\u5206\u9694\u540d\u5b57\u548c\u503c\uff08\u5982\u679c\u6709\uff09\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u7684\u8bbe\u7f6e\uff0c\u53bb\u6389\u7b49\u53f7\u5c31\u884c\u3002\u8981\u628a\u4e00\u4e2a\u53d8\u91cf\u8bbe\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u4f7f\u7528\u7b49\u53f7\u4f46\u662f\u53bb\u6389\u503c\u3002\u8fd9\u4e9b\u8d4b\u503c\u5728\u547d\u4ee4\u884c\u5904\u7406\u671f\u95f4\u88ab\u5b8c\u6210\uff0c\u56e0\u6b64\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u7684\u53d8\u91cf\u5c06\u5728\u7a0d\u540e\u88ab\u8986\u76d6\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">psql</span>\u7248\u672c\u5e76\u4e14\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6c38\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u8fd9\u4e2a\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4efb\u52a1\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u65f6\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u6574\u4e2a\u4f1a\u8bdd\u671f\u95f4\u90fd\u4f1a\u4fdd\u6301\u751f\u6548\uff0c\u56e0\u6b64\u5b83\u4e0d\u4ec5\u5f71\u54cd\u521d\u59cb\u8fde\u63a5\u5c1d\u8bd5\uff0c\u4e5f\u4f1a\u5f71\u54cd\u5143\u547d\u4ee4<code class=\"command\">\\connect</code>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236<span class=\"application\">psql</span>\u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\uff0c\u5373\u4f7f\u8be5\u5bc6\u7801\u5b9e\u9645\u4e0a\u4e0d\u4f1a\u88ab\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff0c\u5219<span class=\"application\">psql</span>\u65e0\u8bba\u5982\u4f55\u90fd\u4f1a\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">psql</span>\u9700\u8981\u5148\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\uff0c\u624d\u80fd\u77e5\u9053\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u663e\u5f0f\u6307\u5b9a<code class=\"option\">-W</code>\u503c\u5f97\u7528\u6765\u907f\u514d\u8fd9\u6b21\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u6574\u4e2a\u4f1a\u8bdd\u671f\u95f4\u90fd\u4f1a\u4fdd\u6301\u751f\u6548\uff0c\u56e0\u6b64\u5b83\u4e0d\u4ec5\u5f71\u54cd\u521d\u59cb\u8fde\u63a5\u5c1d\u8bd5\uff0c\u4e5f\u4f1a\u5f71\u54cd\u5143\u547d\u4ee4<code class=\"command\">\\connect</code>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x</code><br/></span><span class=\"term\"><code class=\"option\">--expanded</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5f00\u6269\u5c55\u8868\u683c\u5f0f\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\x</code>\u6216\u8005<code class=\"command\">\\pset expanded</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-X</code><br/></span><span class=\"term\"><code class=\"option\">--no-psqlrc</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8bfb\u53d6\u542f\u52a8\u6587\u4ef6\uff08\u65e2\u4e0d\u8bfb\u53d6\u7cfb\u7edf\u8303\u56f4\u7684<code class=\"filename\">psqlrc</code>\u6587\u4ef6\uff0c\u4e5f\u4e0d\u8bfb\u53d6\u7528\u6237\u7684<code class=\"filename\">~/.psqlrc</code>\u6587\u4ef6\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-z</code><br/></span><span class=\"term\"><code class=\"option\">--field-separator-zero</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset fieldsep_zero</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-0</code><br/></span><span class=\"term\"><code class=\"option\">--record-separator-zero</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u4f8b\u5982\uff0c\u8fd9\u6709\u52a9\u4e8e\u4e0e<code class=\"literal\">xargs -0</code>\u914d\u5408\u4f7f\u7528\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset recordsep_zero</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-1</code><br/></span><span class=\"term\"><code class=\"option\">--single-transaction</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u9009\u9879\u53ea\u80fd\u4e0e\u4e00\u4e2a\u6216\u591a\u4e2a<code class=\"option\">-c</code>\u548c/\u6216<code class=\"option\">-f</code>\u9009\u9879\u7ed3\u5408\u4f7f\u7528\u3002\u5b83\u4f1a\u5bfc\u81f4<span class=\"application\">psql</span>\u5728\u7b2c\u4e00\u4e2a\u8fd9\u6837\u7684\u9009\u9879\u4e4b\u524d\u53d1\u51fa\u4e00\u4e2a<code class=\"command\">BEGIN</code>\u547d\u4ee4\uff0c\u5e76\u5728\u6700\u540e\u4e00\u4e2a\u9009\u9879\u4e4b\u540e\u53d1\u51fa\u4e00\u4e2a<code class=\"command\">COMMIT</code>\u547d\u4ee4\uff0c\u4ece\u800c\u5c06\u6240\u6709\u547d\u4ee4\u5305\u88c5\u6210\u4e00\u4e2a\u5355\u72ec\u7684\u4e8b\u52a1\u3002\u8fd9\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u547d\u4ee4\u672c\u8eab\u5305\u542b<code class=\"command\">BEGIN</code>\u3001<code class=\"command\">COMMIT</code>\u6216<code class=\"command\">ROLLBACK</code>\uff0c\u8fd9\u4e2a\u9009\u9879\u5c31\u4e0d\u4f1a\u4ea7\u751f\u671f\u671b\u7684\u6548\u679c\u3002\u53e6\u5916\uff0c\u5982\u679c\u67d0\u4e2a\u5355\u72ec\u547d\u4ee4\u4e0d\u80fd\u5728\u4e8b\u52a1\u5757\u4e2d\u6267\u884c\uff0c\u6307\u5b9a\u8fd9\u4e2a\u9009\u9879\u5c06\u5bfc\u81f4\u6574\u4e2a\u4e8b\u52a1\u5931\u8d25\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help[=<em class=\"replaceable\"><code>topic</code></em>]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u6709\u5173<span class=\"application\">psql</span>\u7684\u5e2e\u52a9\u5e76\u4e14\u9000\u51fa\u3002\u53ef\u9009\u7684<em class=\"replaceable\"><code>topic</code></em>\u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a<code class=\"literal\">options</code>\uff09\u9009\u62e9\u8981\u89e3\u91ca<span class=\"application\">psql</span>\u7684\u54ea\u4e00\u90e8\u5206\uff1a<code class=\"literal\">commands</code>\u63cf\u8ff0<span class=\"application\">psql</span>\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b<code class=\"literal\">options</code>\u63cf\u8ff0\u53ef\u4ee5\u88ab\u4f20\u9012\u7ed9<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c<code class=\"literal\">variables</code>\u5219\u663e\u793a\u6709\u5173<span class=\"application\">psql</span>\u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.19.7\">\n<h2 lang=\"zh\">\u9000\u51fa\u72b6\u6001</h2>\n<p lang=\"zh\">\u5982\u679c<span class=\"application\">psql</span>\u6b63\u5e38\u7ed3\u675f\uff0c\u5b83\u4f1a\u5411 shell \u8fd4\u56de 0\uff1b\u5982\u679c\u5b83\u81ea\u8eab\u53d1\u751f\u81f4\u547d\u9519\u8bef\uff08\u4f8b\u5982\u5185\u5b58\u8017\u5c3d\u3001\u627e\u4e0d\u5230\u6587\u4ef6\uff09\uff0c\u5219\u8fd4\u56de 1\uff1b\u5982\u679c\u5230\u670d\u52a1\u5668\u7684\u8fde\u63a5\u53d1\u751f\u6545\u969c\u4e14\u8be5\u4f1a\u8bdd\u4e0d\u662f\u4ea4\u4e92\u5f0f\u7684\uff0c\u5219\u8fd4\u56de 2\uff1b\u5982\u679c\u811a\u672c\u4e2d\u53d1\u751f\u9519\u8bef\u4e14\u53d8\u91cf<code class=\"varname\">ON_ERROR_STOP</code>\u5df2\u8bbe\u7f6e\uff0c\u5219\u8fd4\u56de 3\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.19.8\">\n<h2 lang=\"zh\">\u7528\u6cd5</h2>\n<div class=\"refsect2\" id=\"R2-APP-PSQL-CONNECTING\">\n<h3 lang=\"zh\">\u8fde\u63a5\u5230\u6570\u636e\u5e93</h3>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u662f\u5e38\u89c4\u7684 <span class=\"productname\">PostgreSQL</span> \u5ba2\u6237\u7aef\u5e94\u7528\u7a0b\u5e8f\u3002\u8981\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff0c\u4f60\u9700\u8981\u77e5\u9053\u76ee\u6807\u6570\u636e\u5e93\u540d\u79f0\u3001\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u548c\u7aef\u53e3\u53f7\uff0c\u4ee5\u53ca\u8981\u4ee5\u54ea\u4e2a\u6570\u636e\u5e93\u7528\u6237\u540d\u8fde\u63a5\u3002<span class=\"application\">psql</span> \u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u9009\u9879 <code class=\"option\">-d</code>\u3001<code class=\"option\">-h</code>\u3001<code class=\"option\">-p</code> \u548c <code class=\"option\">-U</code> \u5206\u522b\u6307\u5b9a\u8fd9\u4e9b\u53c2\u6570\u3002\u5982\u679c\u9047\u5230\u4e00\u4e2a\u4e0d\u5c5e\u4e8e\u4efb\u4f55\u9009\u9879\u7684\u53c2\u6570\uff0c\u5b83\u5c06\u88ab\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u540d\uff08\u5982\u679c\u6570\u636e\u5e93\u540d\u5df2\u7ecf\u7ed9\u51fa\uff0c\u5219\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u7528\u6237\u540d\uff09\u3002\u5e76\u975e\u6240\u6709\u8fd9\u4e9b\u9009\u9879\u90fd\u662f\u5fc5\u9700\u7684\uff1b\u5b83\u4eec\u90fd\u6709\u6709\u7528\u7684\u9ed8\u8ba4\u503c\u3002\u5982\u679c\u7701\u7565\u4e3b\u673a\u540d\uff0c<span class=\"application\">psql</span> \u5c06\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u5230\u672c\u5730\u4e3b\u673a\u4e0a\u7684\u670d\u52a1\u5668\uff0c\u800c\u5728\u6ca1\u6709 Unix \u57df\u5957\u63a5\u5b57\u7684\u673a\u5668\u4e0a\u5219\u901a\u8fc7 TCP/IP \u8fde\u63a5\u5230 <code class=\"literal\">localhost</code>\u3002\u9ed8\u8ba4\u7aef\u53e3\u53f7\u5728\u7f16\u8bd1\u65f6\u786e\u5b9a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u670d\u52a1\u5668\u4f7f\u7528\u76f8\u540c\u7684\u9ed8\u8ba4\u503c\uff0c\u56e0\u6b64\u5728\u5927\u591a\u6570\u60c5\u51b5\u4e0b\u4e0d\u5fc5\u6307\u5b9a\u7aef\u53e3\u3002\u9ed8\u8ba4\u7528\u6237\u540d\u662f\u4f60\u7684\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\uff0c\u9ed8\u8ba4\u6570\u636e\u5e93\u540d\u4e5f\u662f\u5982\u6b64\u3002\u8bf7\u6ce8\u610f\uff0c\u4f60\u4e0d\u80fd\u968f\u610f\u4ee5\u4efb\u610f\u6570\u636e\u5e93\u7528\u6237\u540d\u8fde\u63a5\u5230\u4efb\u610f\u6570\u636e\u5e93\u3002\u6570\u636e\u5e93\u7ba1\u7406\u5458\u5e94\u5f53\u5df2\u7ecf\u544a\u77e5\u4f60\u62e5\u6709\u7684\u8bbf\u95ee\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5f53\u9ed8\u8ba4\u503c\u4e0d\u5b8c\u5168\u5408\u9002\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7\u628a\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGDATABASE</code>\u3001<code class=\"envar\">PGHOST</code>\u3001<code class=\"envar\">PGPORT</code>\u548c<code class=\"envar\">PGUSER</code>\u8bbe\u7f6e\u4e3a\u9002\u5f53\u7684\u503c\u6765\u5c11\u6572\u4e00\u4e9b\u952e\u76d8\uff08\u989d\u5916\u7684\u73af\u5883\u53d8\u91cf\u89c1<a class=\"xref\" href=\"/docs/13/libpq-envars.html\" title=\"33.14.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a033.14\u00a0\u8282</a>\uff09\u3002\u53e6\u5916\uff0c\u51c6\u5907\u4e00\u4e2a<code class=\"filename\">~/.pgpass</code>\u6587\u4ef6\u4e5f\u5f88\u65b9\u4fbf\uff0c\u8fd9\u6837\u5c31\u4e0d\u5fc5\u7ecf\u5e38\u624b\u5de5\u8f93\u5165\u5bc6\u7801\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/13/libpq-pgpass.html\" title=\"33.15.\u00a0\u5bc6\u7801\u6587\u4ef6\">\u7b2c\u00a033.15\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u53e6\u4e00\u79cd\u6307\u5b9a\u8fde\u63a5\u53c2\u6570\u7684\u65b9\u6cd5\u662f\u4f7f\u7528 conninfo \u5b57\u7b26\u4e32\u6216 URI \u6765\u4ee3\u66ff\u6570\u636e\u5e93\u540d\u3002\u6b64\u673a\u5236\u5141\u8bb8\u5bf9\u8fde\u63a5\u8fdb\u884c\u975e\u5e38\u5e7f\u6cdb\u7684\u63a7\u5236\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">$ <strong class=\"userinput\"><code>psql \"service=myservice sslmode=require\"</code></strong>\n$ <strong class=\"userinput\"><code>psql postgresql://dbmaster:5433/mydb?sslmode=require</code></strong>\n</pre>\n<p lang=\"zh\">\u7528\u8fd9\u79cd\u65b9\u5f0f\uff0c\u4f60\u4e5f\u53ef\u4ee5\u628a<acronym class=\"acronym\">LDAP</acronym>\u7528\u4e8e<a class=\"xref\" href=\"/docs/13/libpq-ldap.html\" title=\"33.17.\u00a0\u8fde\u63a5\u53c2\u6570\u7684 LDAP \u67e5\u627e\">\u7b2c\u00a033.17\u00a0\u8282</a>\u4e2d\u63cf\u8ff0\u7684\u8fde\u63a5\u53c2\u6570\u67e5\u627e\u3002\u53ef\u7528\u8fde\u63a5\u9009\u9879\u7684\u66f4\u591a\u4fe1\u606f\u8bf7\u89c1<a class=\"xref\" href=\"/docs/13/libpq.html#LIBPQ-PARAMKEYWORDS\" title=\"33.1.2.\u00a0\u53c2\u6570\u5173\u952e\u8bcd\">\u7b2c\u00a033.1.2\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7531\u4e8e\u4efb\u4f55\u539f\u56e0\uff08\u4f8b\u5982\u6743\u9650\u4e0d\u8db3\u3001\u670d\u52a1\u5668\u6ca1\u6709\u5728\u76ee\u6807\u4e3b\u673a\u4e0a\u8fd0\u884c\u7b49\uff09\u5bfc\u81f4\u8fde\u63a5\u65e0\u6cd5\u5efa\u7acb\uff0c<span class=\"application\">psql</span>\u5c06\u8fd4\u56de\u4e00\u4e2a\u9519\u8bef\u5e76\u4e14\u7ec8\u6b62\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6807\u51c6\u8f93\u5165\u548c\u6807\u51c6\u8f93\u51fa\u90fd\u662f\u7ec8\u7aef\uff0c\u90a3\u4e48<span class=\"application\">psql</span>\u4f1a\u628a\u5ba2\u6237\u7aef\u7f16\u7801\u8bbe\u7f6e\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">auto</span>\u201d</span>\uff0c\u4ece\u533a\u57df\u8bbe\u7f6e\u4e2d\u68c0\u6d4b\u5408\u9002\u7684\u5ba2\u6237\u7aef\u7f16\u7801\uff08\u5728 Unix \u7cfb\u7edf\u4e0a\u662f<code class=\"envar\">LC_CTYPE</code>\u73af\u5883\u53d8\u91cf\uff09\u3002\u5982\u679c\u7ed3\u679c\u4e0d\u7b26\u5408\u9884\u671f\uff0c\u53ef\u4ee5\u4f7f\u7528\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGCLIENTENCODING</code>\u8986\u76d6\u5ba2\u6237\u7aef\u7f16\u7801\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"R2-APP-PSQL-4\">\n<h3 lang=\"zh\">\u8f93\u5165 SQL \u547d\u4ee4</h3>\n<p lang=\"zh\">\u5728\u6b63\u5e38\u64cd\u4f5c\u65f6\uff0c<span class=\"application\">psql</span>\u4f1a\u63d0\u4f9b\u4e00\u4e2a\u63d0\u793a\u7b26\uff0c\u8be5\u63d0\u793a\u7b26\u662f<span class=\"application\">psql</span>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u540d\u79f0\u540e\u9762\u8ddf\u4e0a\u5b57\u7b26\u4e32<code class=\"literal\">=&gt;</code>\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">$ <strong class=\"userinput\"><code>psql testdb</code></strong>\npsql (13.23)\nType \"help\" for help.\n\ntestdb=&gt;\n</pre>\n<p lang=\"zh\">\u5728\u63d0\u793a\u7b26\u4e0b\uff0c\u7528\u6237\u53ef\u4ee5\u8f93\u5165<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u3002\u901a\u5e38\uff0c\u5f53\u9047\u5230\u8868\u793a\u547d\u4ee4\u7ed3\u675f\u7684\u5206\u53f7\u65f6\uff0c\u8f93\u5165\u7684\u5185\u5bb9\u5c31\u4f1a\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u3002\u884c\u7ed3\u675f\u5e76\u4e0d\u4f1a\u7ec8\u6b62\u4e00\u6761\u547d\u4ee4\uff0c\u56e0\u6b64\u4e3a\u4e86\u63d0\u9ad8\u6e05\u6670\u5ea6\uff0c\u547d\u4ee4\u53ef\u4ee5\u5206\u5e03\u5728\u591a\u884c\u4e0a\u3002\u5982\u679c\u547d\u4ee4\u88ab\u53d1\u9001\u5e76\u6210\u529f\u6267\u884c\uff0c\u5176\u7ed3\u679c\u5c31\u4f1a\u663e\u793a\u5728\u5c4f\u5e55\u4e0a\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u53d7\u4fe1\u4efb\u7684\u7528\u6237\u80fd\u591f\u8bbf\u95ee\u5c1a\u672a\u91c7\u7528<a class=\"link\" href=\"/docs/13/ddl-schemas.html#DDL-SCHEMAS-PATTERNS\" title=\"5.9.6.\u00a0\u4f7f\u7528\u65b9\u5f0f\">\u6a21\u5f0f\u7684\u5b89\u5168\u4f7f\u7528\u65b9\u5f0f</a>\u7684\u6570\u636e\u5e93\uff0c\u8bf7\u5728\u4f1a\u8bdd\u5f00\u59cb\u65f6\u4ece<code class=\"varname\">search_path</code>\u4e2d\u79fb\u9664\u6240\u6709\u516c\u4f17\u53ef\u5199\u7684\u6a21\u5f0f\u3002\u53ef\u4ee5\u5728\u8fde\u63a5\u5b57\u7b26\u4e32\u4e2d\u52a0\u5165<code class=\"literal\">options=-csearch_path=</code>\uff0c\u6216\u8005\u5728\u6267\u884c\u5176\u4ed6 SQL \u547d\u4ee4\u4e4b\u524d\u53d1\u51fa<code class=\"literal\">SELECT pg_catalog.set_config('search_path', '', false)</code>\u3002\u8fd9\u79cd\u8003\u8651\u5e76\u975e<span class=\"application\">psql</span>\u7279\u6709\uff1b\u5b83\u9002\u7528\u4e8e\u4efb\u4f55\u6267\u884c\u4efb\u610f SQL \u547d\u4ee4\u7684\u63a5\u53e3\u3002</p>\n<p lang=\"zh\">\u6bcf\u5f53\u6267\u884c\u547d\u4ee4\u65f6\uff0c<span class=\"application\">psql</span>\u4e5f\u4f1a\u8f6e\u8be2\u7531<a class=\"xref\" href=\"/docs/13/sql-listen.html\" title=\"LISTEN\"><span class=\"refentrytitle\">LISTEN</span></a>\u548c<a class=\"xref\" href=\"/docs/13/sql-notify.html\" title=\"NOTIFY\"><span class=\"refentrytitle\">NOTIFY</span></a>\u751f\u6210\u7684\u5f02\u6b65\u901a\u77e5\u4e8b\u4ef6\u3002</p>\n<p lang=\"zh\">\u867d\u7136 C \u98ce\u683c\u7684\u5757\u6ce8\u91ca\u4f1a\u88ab\u4f20\u7ed9\u670d\u52a1\u5668\u5904\u7406\u5e76\u79fb\u9664\uff0c\u4f46 SQL \u6807\u51c6\u6ce8\u91ca\u4f1a\u7531<span class=\"application\">psql</span>\u81ea\u884c\u79fb\u9664\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"APP-PSQL-META-COMMANDS\">\n<h3 lang=\"zh\">\u5143\u547d\u4ee4</h3>\n<p lang=\"zh\">\u4f60\u8f93\u5165\u5230<span class=\"application\">psql</span>\u4e2d\u7684\u4efb\u4f55\u4ee5\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u5f00\u59cb\u7684\u4e1c\u897f\u90fd\u662f\u4e00\u4e2a<span class=\"application\">psql</span>\u5143\u547d\u4ee4\uff0c\u5b83\u4eec\u7531<span class=\"application\">psql</span>\u81ea\u884c\u5904\u7406\u3002\u8fd9\u4e9b\u547d\u4ee4\u8ba9<span class=\"application\">psql</span>\u5bf9\u7ba1\u7406\u548c\u7f16\u5199\u811a\u672c\u66f4\u6709\u7528\u3002\u5143\u547d\u4ee4\u5e38\u5e38\u88ab\u79f0\u4f5c\u659c\u7ebf\u6216\u8005\u53cd\u659c\u7ebf\u547d\u4ee4\u3002</p>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u547d\u4ee4\u7684\u683c\u5f0f\u662f\u7528\u53cd\u659c\u7ebf\u540e\u9762\u76f4\u63a5\u8ddf\u4e0a\u4e00\u4e2a\u547d\u4ee4\u52a8\u8bcd\uff0c\u7136\u540e\u662f\u4e00\u4e9b\u53c2\u6570\u3002\u53c2\u6570\u4e0e\u547d\u4ee4\u52a8\u8bcd\u548c\u5176\u4ed6\u53c2\u6570\u4e4b\u95f4\u7528\u4efb\u610f\u591a\u4e2a\u7a7a\u767d\u5b57\u7b26\u5206\u9694\u5f00\u3002</p>\n<p lang=\"zh\">\u8981\u5728\u53c2\u6570\u4e2d\u5305\u542b\u7a7a\u767d\uff0c\u53ef\u4ee5\u7528\u5355\u5f15\u53f7\u5c06\u5b83\u62ec\u8d77\u6765\u3002\u8981\u5728\u53c2\u6570\u4e2d\u5305\u542b\u4e00\u4e2a\u5355\u5f15\u53f7\uff0c\u53ef\u4ee5\u5728\u5355\u5f15\u53f7\u6587\u672c\u5185\u5199\u4e24\u4e2a\u5355\u5f15\u53f7\u3002\u5355\u5f15\u53f7\u4e2d\u7684\u5185\u5bb9\u8fd8\u4f1a\u63a5\u53d7\u7c7b\u4f3c C \u8bed\u8a00\u7684\u66ff\u6362\uff1a<code class=\"literal\">\\n</code>\uff08\u6362\u884c\uff09\u3001<code class=\"literal\">\\t</code>\uff08\u5236\u8868\u7b26\uff09\u3001<code class=\"literal\">\\b</code>\uff08\u9000\u683c\uff09\u3001<code class=\"literal\">\\r</code>\uff08\u56de\u8f66\uff09\u3001<code class=\"literal\">\\f</code>\uff08\u6362\u9875\uff09\u3001<code class=\"literal\">\\</code><em class=\"replaceable\"><code>digits</code></em>\uff08\u516b\u8fdb\u5236\uff09\u4ee5\u53ca<code class=\"literal\">\\x</code><em class=\"replaceable\"><code>digits</code></em>\uff08\u5341\u516d\u8fdb\u5236\uff09\u3002\u5728\u5355\u5f15\u53f7\u6587\u672c\u5185\uff0c\u53cd\u659c\u7ebf\u51fa\u73b0\u5728\u4efb\u4f55\u5176\u4ed6\u5b57\u7b26\u524d\u9762\u65f6\uff0c\u53ea\u662f\u5bf9\u8be5\u5355\u4e2a\u5b57\u7b26\u8fdb\u884c\u8f6c\u4e49\uff0c\u4e0d\u8bba\u5b83\u662f\u4ec0\u4e48\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u53c2\u6570\u4e2d\u51fa\u73b0\u4e00\u4e2a\u672a\u52a0\u5f15\u53f7\u7684\u5192\u53f7\uff08<code class=\"literal\">:</code>\uff09\uff0c\u540e\u9762\u7d27\u8ddf\u4e00\u4e2a<span class=\"application\">psql</span>\u53d8\u91cf\u540d\uff0c\u5b83\u5c31\u4f1a\u88ab\u8be5\u53d8\u91cf\u7684\u503c\u66ff\u6362\uff0c\u5982\u4e0b\u9762<a class=\"xref\" href=\"/docs/13/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL \u63d2\u503c\">SQL \u63d2\u503c</a>\u6240\u8ff0\u3002\u5176\u4e2d\u4ecb\u7ecd\u7684<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u548c<code class=\"literal\">:\"<em class=\"replaceable\"><code>variable_name</code></em>\"</code>\u5f62\u5f0f\u4e5f\u540c\u6837\u9002\u7528\u3002<code class=\"literal\">:{?<em class=\"replaceable\"><code>variable_name</code></em>}</code>\u8bed\u6cd5\u5141\u8bb8\u6d4b\u8bd5\u53d8\u91cf\u662f\u5426\u5df2\u5b9a\u4e49\uff1b\u5b83\u4f1a\u88ab TRUE \u6216 FALSE \u66ff\u6362\u3002\u7528\u53cd\u659c\u7ebf\u8f6c\u4e49\u8be5\u5192\u53f7\u53ef\u4ee5\u9632\u6b62\u66ff\u6362\u53d1\u751f\u3002</p>\n<p lang=\"zh\">\u5728\u53c2\u6570\u4e2d\uff0c\u7528\u53cd\u5f15\u53f7\uff08<code class=\"literal\">`</code>\uff09\u5305\u56f4\u7684\u6587\u672c\u4f1a\u88ab\u89c6\u4e3a\u4f20\u7ed9 shell \u7684\u547d\u4ee4\u884c\u3002\u8be5\u547d\u4ee4\u7684\u8f93\u51fa\uff08\u53bb\u6389\u672b\u5c3e\u7684\u6362\u884c\u7b26\uff09\u4f1a\u66ff\u6362\u53cd\u5f15\u53f7\u4e2d\u7684\u6587\u672c\u3002\u5728\u53cd\u5f15\u53f7\u5305\u56f4\u7684\u6587\u672c\u5185\u90e8\uff0c\u4e0d\u4f1a\u8fdb\u884c\u7279\u6b8a\u7684\u5f15\u53f7\u5904\u7406\u6216\u5176\u4ed6\u5904\u7406\uff0c\u4f46\u51fa\u73b0<code class=\"literal\">:<em class=\"replaceable\"><code>variable_name</code></em></code>\u65f6\uff0c\u5982\u679c<em class=\"replaceable\"><code>variable_name</code></em>\u662f<span class=\"application\">psql</span>\u53d8\u91cf\u540d\uff0c\u5c31\u4f1a\u88ab\u66ff\u6362\u4e3a\u8be5\u53d8\u91cf\u7684\u503c\u3002\u6b64\u5916\uff0c<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u4e5f\u4f1a\u88ab\u66ff\u6362\u4e3a\u8be5\u53d8\u91cf\u7684\u503c\uff0c\u5e76\u4f1a\u9002\u5f53\u5730\u52a0\u4e0a\u5f15\u53f7\uff0c\u4f7f\u5176\u6210\u4e3a\u5355\u4e2a shell \u547d\u4ee4\u53c2\u6570\u3002\uff08\u540e\u4e00\u79cd\u5f62\u5f0f\u51e0\u4e4e\u603b\u662f\u66f4\u53ef\u53d6\uff0c\u9664\u975e\u4f60\u975e\u5e38\u786e\u5b9a\u53d8\u91cf\u4e2d\u5305\u542b\u4ec0\u4e48\u3002\uff09\u7531\u4e8e\u65e0\u6cd5\u4fdd\u8bc1\u5728\u6240\u6709\u5e73\u53f0\u4e0a\u90fd\u80fd\u5bf9\u56de\u8f66\u548c\u6362\u884c\u5b57\u7b26\u5b89\u5168\u5730\u52a0\u5f15\u53f7\uff0c\u5f53\u53d8\u91cf\u503c\u4e2d\u51fa\u73b0\u8fd9\u7c7b\u5b57\u7b26\u65f6\uff0c<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u5f62\u5f0f\u4f1a\u6253\u5370\u9519\u8bef\u6d88\u606f\uff0c\u5e76\u4e14\u4e0d\u4f1a\u66ff\u6362\u53d8\u91cf\u503c\u3002</p>\n<p lang=\"zh\">\u4e00\u4e9b\u547d\u4ee4\u63a5\u53d7 SQL \u6807\u8bc6\u7b26\uff08\u4f8b\u5982\u8868\u540d\uff09\u4f5c\u4e3a\u53c2\u6570\u3002\u8fd9\u4e9b\u53c2\u6570\u9075\u5faa SQL \u8bed\u6cd5\u89c4\u5219\uff1a\u672a\u52a0\u5f15\u53f7\u7684\u5b57\u6bcd\u4f1a\u5f3a\u5236\u8f6c\u6362\u4e3a\u5c0f\u5199\uff0c\u800c\u53cc\u5f15\u53f7\uff08\"\uff09\u4f1a\u4fdd\u62a4\u5b57\u6bcd\u4e0d\u88ab\u8f6c\u6362\u5927\u5c0f\u5199\uff0c\u5e76\u5141\u8bb8\u6807\u8bc6\u7b26\u5305\u542b\u7a7a\u767d\u5b57\u7b26\u3002\u5728\u53cc\u5f15\u53f7\u5185\u90e8\uff0c\u8fde\u7eed\u4e24\u4e2a\u53cc\u5f15\u53f7\u4f1a\u5728\u6700\u7ec8\u540d\u79f0\u4e2d\u53d8\u4e3a\u4e00\u4e2a\u53cc\u5f15\u53f7\u3002\u4f8b\u5982\uff0cFOO\"BAR\"BAZ \u4f1a\u88ab\u89e3\u91ca\u4e3a fooBARbaz\uff0c\u800c \"A weird\"\" name\" \u4f1a\u53d8\u4e3a A weird\" name\u3002</p>\n<p lang=\"zh\">\u53c2\u6570\u89e3\u6790\u4f1a\u5728\u884c\u5c3e\u6216\u9047\u5230\u53e6\u4e00\u4e2a\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u65f6\u505c\u6b62\u3002\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u4f1a\u88ab\u89c6\u4e3a\u65b0\u5143\u547d\u4ee4\u7684\u5f00\u59cb\u3002\u7279\u6b8a\u5e8f\u5217<code class=\"literal\">\\\\</code>\uff08\u4e24\u4e2a\u53cd\u659c\u7ebf\uff09\u8868\u793a\u53c2\u6570\u7ed3\u675f\uff0c\u5e76\u7ee7\u7eed\u89e3\u6790<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\uff08\u5982\u679c\u8fd8\u6709\uff09\u3002\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u548c<span class=\"application\">psql</span>\u547d\u4ee4\u53ef\u4ee5\u81ea\u7531\u5730\u6df7\u5408\u5728\u540c\u4e00\u884c\u4e2d\u3002\u4f46\u65e0\u8bba\u5982\u4f55\uff0c\u5143\u547d\u4ee4\u7684\u53c2\u6570\u90fd\u4e0d\u80fd\u5ef6\u7eed\u5230\u4e0b\u4e00\u884c\u3002</p>\n<p lang=\"zh\">\u8bb8\u591a\u5143\u547d\u4ee4\u4f5c\u7528\u4e8e<em class=\"firstterm\">\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a</em>\u3002\u8fd9\u53ea\u662f\u4e00\u4e2a\u4fdd\u5b58\u5df2\u8f93\u5165\u4f46\u5c1a\u672a\u53d1\u9001\u5230\u670d\u52a1\u5668\u6267\u884c\u7684 SQL \u547d\u4ee4\u6587\u672c\u7684\u7f13\u51b2\u533a\u3002\u5176\u4e2d\u65e2\u5305\u62ec\u5148\u524d\u8f93\u5165\u7684\u884c\uff0c\u4e5f\u5305\u62ec\u540c\u4e00\u884c\u4e0a\u4f4d\u4e8e\u5143\u547d\u4ee4\u4e4b\u524d\u7684\u6587\u672c\u3002</p>\n<p lang=\"zh\">\u5b9a\u4e49\u4e86\u4ee5\u4e0b\u5143\u547d\u4ee4\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">\\a</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u5f53\u524d\u8868\u683c\u8f93\u51fa\u683c\u5f0f\u662f\u975e\u5bf9\u9f50\uff0c\u5219\u5207\u6362\u4e3a\u5bf9\u9f50\uff1b\u5426\u5219\u5207\u6362\u4e3a\u975e\u5bf9\u9f50\u3002\u4fdd\u7559\u6b64\u547d\u4ee4\u662f\u4e3a\u4e86\u5411\u540e\u517c\u5bb9\u3002\u66f4\u901a\u7528\u7684\u89e3\u51b3\u65b9\u6848\u8bf7\u53c2\u89c1<code class=\"command\">\\pset</code>\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\c</code> \u6216 <code class=\"literal\">\\connect [ -reuse-previous=<em class=\"replaceable\"><code>on|off</code></em> ] [ <em class=\"replaceable\"><code>dbname</code></em> [ <em class=\"replaceable\"><code>username</code></em> ] [ <em class=\"replaceable\"><code>host</code></em> ] [ <em class=\"replaceable\"><code>port</code></em> ] | <em class=\"replaceable\"><code>conninfo</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5efa\u7acb\u5230<span class=\"productname\">PostgreSQL</span>\u670d\u52a1\u5668\u7684\u65b0\u8fde\u63a5\u3002\u8fde\u63a5\u53c2\u6570\u65e2\u53ef\u4ee5\u4f7f\u7528\u6309\u4f4d\u7f6e\u6307\u5b9a\u7684\u8bed\u6cd5\uff08\u6570\u636e\u5e93\u540d\u3001\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\u4e2d\u7684\u4e00\u4e2a\u6216\u591a\u4e2a\uff09\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528<em class=\"replaceable\"><code>conninfo</code></em>\u8fde\u63a5\u5b57\u7b26\u4e32\uff0c\u8be6\u89c1<a class=\"xref\" href=\"/docs/13/libpq.html#LIBPQ-CONNSTRING\" title=\"33.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u7b2c\u00a033.1.1\u00a0\u8282</a>\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa\u53c2\u6570\uff0c\u5219\u4f7f\u7528\u4e0e\u4e4b\u524d\u76f8\u540c\u7684\u53c2\u6570\u5efa\u7acb\u65b0\u8fde\u63a5\u3002</p>\n<p lang=\"zh\">\u5c06<em class=\"replaceable\"><code>dbname</code></em>\u3001<em class=\"replaceable\"><code>username</code></em>\u3001<em class=\"replaceable\"><code>host</code></em>\u6216<em class=\"replaceable\"><code>port</code></em>\u4e2d\u7684\u4efb\u4f55\u4e00\u4e2a\u6307\u5b9a\u4e3a<code class=\"literal\">-</code>\uff0c\u90fd\u7b49\u4ef7\u4e8e\u7701\u7565\u8be5\u53c2\u6570\u3002</p>\n<p lang=\"zh\">\u65b0\u8fde\u63a5\u53ef\u4ee5\u91cd\u7528\u524d\u4e00\u4e2a\u8fde\u63a5\u7684\u8fde\u63a5\u53c2\u6570\uff1b\u4e0d\u4ec5\u5305\u62ec\u6570\u636e\u5e93\u540d\u79f0\u3001\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\uff0c\u8fd8\u5305\u62ec\u5176\u4ed6\u8bbe\u7f6e\uff0c\u5982<em class=\"replaceable\"><code>sslmode</code></em>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53c2\u6570\u5728\u4f4d\u7f6e\u8bed\u6cd5\u4e2d\u88ab\u91cd\u7528\uff0c\u4f46\u5728\u7ed9\u5b9a<em class=\"replaceable\"><code>conninfo</code></em>\u5b57\u7b26\u4e32\u65f6\u4e0d\u4f1a\u88ab\u91cd\u7528\u3002\u4f20\u9012<code class=\"literal\">-reuse-previous=on</code>\u6216<code class=\"literal\">-reuse-previous=off</code>\u4f5c\u4e3a\u7b2c\u4e00\u4e2a\u53c2\u6570\u5c06\u8986\u76d6\u8be5\u9ed8\u8ba4\u8bbe\u7f6e\u3002\u5982\u679c\u53c2\u6570\u88ab\u91cd\u7528\uff0c\u5219\u4efb\u4f55\u672a\u660e\u786e\u6307\u5b9a\u4e3a\u4f4d\u7f6e\u53c2\u6570\u6216\u5728<em class=\"replaceable\"><code>conninfo</code></em>\u5b57\u7b26\u4e32\u4e2d\u7684\u53c2\u6570\u5c06\u4ece\u73b0\u6709\u8fde\u63a5\u7684\u53c2\u6570\u4e2d\u83b7\u53d6\u3002\u4e00\u4e2a\u4f8b\u5916\u662f\uff0c\u5982\u679c\u4f7f\u7528\u4f4d\u7f6e\u8bed\u6cd5\u66f4\u6539<em class=\"replaceable\"><code>host</code></em>\u8bbe\u7f6e\uff0c\u4f7f\u5176\u4e0d\u540c\u4e8e\u5148\u524d\u7684\u503c\uff0c\u5219\u73b0\u6709\u8fde\u63a5\u53c2\u6570\u4e2d\u5b58\u5728\u7684\u4efb\u4f55<em class=\"replaceable\"><code>hostaddr</code></em>\u8bbe\u7f6e\u5c06\u88ab\u5220\u9664\u3002\u6b64\u5916\uff0c\u4ec5\u5f53\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\u8bbe\u7f6e\u672a\u66f4\u6539\u65f6\uff0c\u624d\u4f1a\u91cd\u7528\u73b0\u6709\u8fde\u63a5\u4f7f\u7528\u7684\u4efb\u4f55\u5bc6\u7801\u3002\u5f53\u547d\u4ee4\u65e2\u4e0d\u6307\u5b9a\u4e5f\u4e0d\u91cd\u7528\u7279\u5b9a\u53c2\u6570\u65f6\uff0c\u5c06\u4f7f\u7528<span class=\"application\">libpq</span>\u7684\u9ed8\u8ba4\u503c\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6210\u529f\u5efa\u7acb\u4e86\u65b0\u8fde\u63a5\uff0c\u5219\u5173\u95ed\u5148\u524d\u7684\u8fde\u63a5\u3002\u5982\u679c\u8fde\u63a5\u5c1d\u8bd5\u5931\u8d25\uff08\u7528\u6237\u540d\u9519\u8bef\u3001\u8bbf\u95ee\u88ab\u62d2\u7edd\u7b49\uff09\uff0c\u5f53<span class=\"application\">psql</span>\u5904\u4e8e\u4ea4\u4e92\u6a21\u5f0f\u65f6\uff0c\u4f1a\u4fdd\u7559\u5148\u524d\u7684\u8fde\u63a5\u3002\u4f46\u5728\u6267\u884c\u975e\u4ea4\u4e92\u5f0f\u811a\u672c\u65f6\uff0c\u4f1a\u7acb\u5373\u62a5\u9519\u5e76\u505c\u6b62\u5904\u7406\u3002\u8fd9\u4e00\u533a\u522b\u4e00\u65b9\u9762\u4f7f\u7528\u6237\u80fd\u591f\u65b9\u4fbf\u5730\u5e94\u5bf9\u8f93\u5165\u9519\u8bef\uff0c\u53e6\u4e00\u65b9\u9762\u4e5f\u4f5c\u4e3a\u5b89\u5168\u673a\u5236\uff0c\u9632\u6b62\u811a\u672c\u610f\u5916\u5730\u4f5c\u7528\u4e8e\u9519\u8bef\u7684\u6570\u636e\u5e93\u3002</p>\n<p lang=\"zh\">\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">=&gt; \\c mydb myuser host.dom 6432\n=&gt; \\c service=foo\n=&gt; \\c \"host=localhost port=5432 dbname=mydb connect_timeout=10 sslmode=disable\"\n=&gt; \\c -reuse-previous=on sslmode=require    -- changes only sslmode\n=&gt; \\c postgresql://tom@localhost/mydb?application_name=myapp\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\C [ <em class=\"replaceable\"><code>title</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u4f5c\u4e3a\u67e5\u8be2\u7ed3\u679c\u6253\u5370\u7684\u8868\u7684\u6807\u9898\uff0c\u6216\u53d6\u6d88\u6b64\u7c7b\u6807\u9898\u3002\u8be5\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset title <em class=\"replaceable\"><code>title</code></em></code>\u3002\uff08\u6b64\u547d\u4ee4\u7684\u540d\u79f0\u6e90\u81ea<span class=\"quote\">\u201c<span class=\"quote\">caption</span>\u201d</span>\uff0c\u56e0\u4e3a\u5b83\u8fc7\u53bb\u53ea\u7528\u4e8e\u8bbe\u7f6e<acronym class=\"acronym\">HTML</acronym>\u8868\u7684\u6807\u9898\u3002\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\cd [ <em class=\"replaceable\"><code>directory</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u66f4\u6539\u4e3a<em class=\"replaceable\"><code>directory</code></em>\u3002\u5982\u679c\u6ca1\u6709\u53c2\u6570\uff0c\u5219\u5207\u6362\u5230\u5f53\u524d\u7528\u6237\u7684\u4e3b\u76ee\u5f55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8981\u6253\u5370\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\uff0c\u8bf7\u4f7f\u7528<code class=\"literal\">\\! pwd</code>\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\conninfo</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa\u5f53\u524d\u6570\u636e\u5e93\u8fde\u63a5\u7684\u4fe1\u606f\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMANDS-COPY\"><span class=\"term\"><code class=\"literal\">\\copy { <em class=\"replaceable\"><code>table</code></em> [ ( <em class=\"replaceable\"><code>column_list</code></em> ) ] } <code class=\"literal\">from</code> { <em class=\"replaceable\"><code>'filename'</code></em> | program <em class=\"replaceable\"><code>'command'</code></em> | stdin | pstdin } [ [ with ] ( <em class=\"replaceable\"><code>option</code></em> [, ...] ) ] [ where <em class=\"replaceable\"><code>condition</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\copy { <em class=\"replaceable\"><code>table</code></em> [ ( <em class=\"replaceable\"><code>column_list</code></em> ) ] | ( <em class=\"replaceable\"><code>query</code></em> ) } <code class=\"literal\">to</code> { <em class=\"replaceable\"><code>'filename'</code></em> | program <em class=\"replaceable\"><code>'command'</code></em> | stdout | pstdout } [ [ with ] ( <em class=\"replaceable\"><code>option</code></em> [, ...] ) ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6267\u884c\u524d\u7aef\uff08\u5ba2\u6237\u7aef\uff09\u590d\u5236\u3002\u8be5\u64cd\u4f5c\u4f1a\u8fd0\u884c\u4e00\u4e2a<acronym class=\"acronym\">SQL</acronym> <a class=\"xref\" href=\"/docs/13/sql-copy.html\" title=\"COPY\"><span class=\"refentrytitle\">COPY</span></a>\u547d\u4ee4\uff0c\u4f46\u5e76\u4e0d\u662f\u7531\u670d\u52a1\u5668\u8bfb\u53d6\u6216\u5199\u5165\u6307\u5b9a\u6587\u4ef6\uff0c\u800c\u662f\u7531<span class=\"application\">psql</span>\u8bfb\u53d6\u6216\u5199\u5165\u6587\u4ef6\uff0c\u5e76\u5728\u670d\u52a1\u5668\u4e0e\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e4b\u95f4\u8f6c\u9001\u6570\u636e\u3002\u8fd9\u610f\u5473\u7740\u6587\u4ef6\u53ef\u8bbf\u95ee\u6027\u548c\u6743\u9650\u53d6\u51b3\u4e8e\u672c\u5730\u7528\u6237\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\uff0c\u4e5f\u4e0d\u9700\u8981 SQL \u8d85\u7ea7\u7528\u6237\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5f53\u6307\u5b9a<code class=\"literal\">program</code>\u65f6\uff0c<em class=\"replaceable\"><code>command</code></em> \u7531<span class=\"application\">psql</span>\u6267\u884c\uff0c\u4f20\u7ed9<em class=\"replaceable\"><code>command</code></em>\u7684\u6570\u636e\u6216\u4ece\u5176\u4e2d\u8bfb\u51fa\u7684\u6570\u636e\u90fd\u4f1a\u5728\u670d\u52a1\u5668\u4e0e\u5ba2\u6237\u7aef\u4e4b\u95f4\u8f6c\u9001\u3002\u518d\u6b21\u5f3a\u8c03\uff0c\u6267\u884c\u6743\u9650\u5c5e\u4e8e\u672c\u5730\u7528\u6237\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\uff0c\u4e5f\u4e0d\u9700\u8981 SQL \u8d85\u7ea7\u7528\u6237\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e \\copy ... from stdin\uff0c\u4ece\u53d1\u51fa\u547d\u4ee4\u7684\u540c\u4e00\u8f93\u5165\u6e90\u8bfb\u53d6\u6570\u636e\u884c\uff0c\u76f4\u5230\u8bfb\u53d6\u5230 \\.\u6216\u8f93\u5165\u6d41\u5230\u8fbe EOF\u3002\u8fd9\u9002\u5408\u5728 SQL \u811a\u672c\u4e2d\u5185\u8054\u586b\u5145\u8868\u3002\u5bf9\u4e8e \\copy ... to stdout\uff0c\u8f93\u51fa\u53d1\u5f80\u4e0e psql \u547d\u4ee4\u8f93\u51fa\u76f8\u540c\u7684\u4f4d\u7f6e\uff0c\u4e14\u4e0d\u6253\u5370 COPY count \u547d\u4ee4\u72b6\u6001\uff0c\u4ee5\u514d\u4e0e\u6570\u636e\u884c\u6df7\u6dc6\u3002\u82e5\u8981\u59cb\u7ec8\u8bfb\u5199 psql \u7684\u6807\u51c6\u8f93\u5165\u6216\u8f93\u51fa\uff0c\u800c\u4e0d\u53d7\u5f53\u524d\u547d\u4ee4\u6765\u6e90\u6216 \\o \u9009\u9879\u5f71\u54cd\uff0c\u8bf7\u4f7f\u7528 from pstdin \u6216 to pstdout\u3002</p>\n<p lang=\"zh\">\u8be5\u547d\u4ee4\u7684\u8bed\u6cd5\u4e0e<acronym class=\"acronym\">SQL</acronym> <a class=\"xref\" href=\"/docs/13/sql-copy.html\" title=\"COPY\"><span class=\"refentrytitle\">COPY</span></a>\u547d\u4ee4\u7c7b\u4f3c\u3002\u9664\u6570\u636e\u6e90\u6216\u76ee\u6807\u4e4b\u5916\uff0c\u5176\u4ed6\u6240\u6709\u9009\u9879\u90fd\u4e0e<a class=\"xref\" href=\"/docs/13/sql-copy.html\" title=\"COPY\"><span class=\"refentrytitle\">COPY</span></a>\u4e2d\u7684\u6307\u5b9a\u76f8\u540c\u3002\u56e0\u6b64\uff0c\u7279\u6b8a\u7684\u89e3\u6790\u89c4\u5219\u9002\u7528\u4e8e<code class=\"command\">\\copy</code>\u5143\u547d\u4ee4\u3002\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u5269\u4f59\u884c\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\copy</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u6267\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u53e6\u4e00\u79cd\u83b7\u5f97\u4e0e<code class=\"literal\">\\copy ... to</code>\u76f8\u540c\u7ed3\u679c\u7684\u65b9\u6cd5\u662f\u4f7f\u7528<acronym class=\"acronym\">SQL</acronym> <code class=\"literal\">COPY ... TO STDOUT</code>\u547d\u4ee4\uff0c\u5e76\u4ee5<code class=\"literal\">\\g <em class=\"replaceable\"><code>filename</code></em></code> \u6216<code class=\"literal\">\\g |<em class=\"replaceable\"><code>program</code></em></code>\u7ed3\u675f\u3002\u4e0e<code class=\"literal\">\\copy</code>\u4e0d\u540c\uff0c\u8fd9\u79cd\u65b9\u6cd5\u5141\u8bb8\u547d\u4ee4\u8de8\u8d8a\u591a\u884c\uff1b\u6b64\u5916\uff0c\u53ef\u4ee5\u4f7f\u7528\u53d8\u91cf\u63d2\u503c\u548c\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</div>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8fd9\u4e9b\u64cd\u4f5c\u4e0d\u5982\u4ee5\u6587\u4ef6\u6216\u7a0b\u5e8f\u4f5c\u4e3a\u6570\u636e\u6e90\u6216\u76ee\u6807\u7684<acronym class=\"acronym\">SQL</acronym> <code class=\"command\">COPY</code>\u547d\u4ee4\u9ad8\u6548\uff0c\u56e0\u4e3a\u6240\u6709\u6570\u636e\u90fd\u5fc5\u987b\u901a\u8fc7\u5ba2\u6237\u7aef/\u670d\u52a1\u5668\u8fde\u63a5\u4f20\u8f93\u3002\u5bf9\u4e8e\u5927\u91cf\u6570\u636e\uff0c\u4f7f\u7528<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u53ef\u80fd\u66f4\u5408\u9002\u3002\u53e6\u5916\uff0c\u7531\u4e8e\u91c7\u7528\u8fd9\u79cd\u6570\u636e\u8f6c\u9001\u65b9\u5f0f\uff0c<acronym class=\"acronym\">CSV</acronym>\u6a21\u5f0f\u4e0b\u7684<code class=\"literal\">\\copy ... from</code>\u4f1a\u9519\u8bef\u5730\u628a\u5355\u72ec\u5360\u636e\u4e00\u884c\u7684<code class=\"literal\">\\.</code>\u6570\u636e\u503c\u5f53\u4f5c\u8f93\u5165\u7ed3\u675f\u6807\u8bb0\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\copyright</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"productname\">PostgreSQL</span>\u7684\u7248\u6743\u548c\u5206\u53d1\u6761\u6b3e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMANDS-CROSSTABVIEW\"><span class=\"term\"><code class=\"literal\">\\crosstabview [ <em class=\"replaceable\"><code>colV</code></em> [ <em class=\"replaceable\"><code>colH</code></em> [ <em class=\"replaceable\"><code>colD</code></em> [ <em class=\"replaceable\"><code>sortcolH</code></em> ] ] ] ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6267\u884c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\uff08\u4e0e<code class=\"literal\">\\g</code>\u7c7b\u4f3c\uff09\uff0c\u5e76\u4ee5\u4ea4\u53c9\u8868\u7f51\u683c\u663e\u793a\u7ed3\u679c\u3002\u67e5\u8be2\u5fc5\u987b\u8fd4\u56de\u81f3\u5c11\u4e09\u5217\u3002\u7531<em class=\"replaceable\"><code>colV</code></em>\u6807\u8bc6\u7684\u8f93\u51fa\u5217\u6210\u4e3a\u7eb5\u5411\u8868\u5934\uff0c\u7531<em class=\"replaceable\"><code>colH</code></em>\u6807\u8bc6\u7684\u8f93\u51fa\u5217\u6210\u4e3a\u6a2a\u5411\u8868\u5934\u3002<em class=\"replaceable\"><code>colD</code></em>\u6807\u8bc6\u8981\u5728\u7f51\u683c\u4e2d\u663e\u793a\u7684\u8f93\u51fa\u5217\u3002<em class=\"replaceable\"><code>sortcolH</code></em>\u6807\u8bc6\u6a2a\u5411\u8868\u5934\u7684\u53ef\u9009\u6392\u5e8f\u5217\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a\u5217\u6307\u5b9a\u9879\u53ef\u4ee5\u662f\u4ece 1 \u5f00\u59cb\u7684\u5217\u53f7\uff0c\u4e5f\u53ef\u4ee5\u662f\u5217\u540d\uff1b\u5217\u540d\u9075\u5faa\u5e38\u89c4 SQL \u5927\u5c0f\u5199\u6298\u53e0\u548c\u5f15\u53f7\u89c4\u5219\u3002\u7701\u7565\u65f6\uff0ccolV \u9ed8\u8ba4\u4e3a\u7b2c 1 \u5217\uff0ccolH \u9ed8\u8ba4\u4e3a\u7b2c 2 \u5217\u3002colH \u5fc5\u987b\u4e0e colV \u4e0d\u540c\u3002\u82e5\u4e0d\u6307\u5b9a colD\uff0c\u67e5\u8be2\u7ed3\u679c\u5fc5\u987b\u6070\u6709\u4e09\u5217\uff0c\u65e2\u975e colV \u4e5f\u975e colH \u7684\u90a3\u4e00\u5217\u4f5c\u4e3a colD\u3002</p>\n<p lang=\"zh\">\u7eb5\u5411\u8868\u5934\u663e\u793a\u4e3a\u6700\u5de6\u5217\uff0c\u5305\u542b<em class=\"replaceable\"><code>colV</code></em>\u5217\u4e2d\u7684\u503c\uff0c\u5176\u987a\u5e8f\u4e0e\u67e5\u8be2\u7ed3\u679c\u4e2d\u76f8\u540c\uff0c\u4f46\u4f1a\u79fb\u9664\u91cd\u590d\u503c\u3002</p>\n<p lang=\"zh\">\u6a2a\u5411\u8868\u5934\u663e\u793a\u4e3a\u7b2c\u4e00\u884c\uff0c\u5305\u542b<em class=\"replaceable\"><code>colH</code></em>\u5217\u4e2d\u7684\u503c\uff0c\u5e76\u79fb\u9664\u91cd\u590d\u503c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4eec\u6309\u67e5\u8be2\u7ed3\u679c\u4e2d\u7684\u76f8\u540c\u987a\u5e8f\u663e\u793a\u3002\u4f46\u5982\u679c\u7ed9\u51fa\u4e86\u53ef\u9009\u7684<em class=\"replaceable\"><code>sortcolH</code></em>\u53c2\u6570\uff0c\u5b83\u6240\u6807\u8bc6\u7684\u5217\u7684\u503c\u5fc5\u987b\u662f\u6574\u6570\uff0c\u800c<em class=\"replaceable\"><code>colH</code></em>\u4e2d\u7684\u503c\u4f1a\u6309\u7167\u5bf9\u5e94\u7684<em class=\"replaceable\"><code>sortcolH</code></em>\u503c\u6392\u5e8f\u540e\u663e\u793a\u5728\u6a2a\u5411\u8868\u5934\u4e2d\u3002</p>\n<p lang=\"zh\">\u4ea4\u53c9\u8868\u4e2d\uff0c\u5bf9\u4e8e colH \u7684\u6bcf\u4e2a\u4e0d\u540c\u503c x \u548c colV \u7684\u6bcf\u4e2a\u4e0d\u540c\u503c y\uff0c\u4ea4\u70b9 (x,y) \u7684\u5355\u5143\u683c\u4fdd\u5b58\u67e5\u8be2\u7ed3\u679c\u4e2d colH=x \u4e14 colV=y \u90a3\u4e00\u884c\u7684 colD \u503c\u3002\u6ca1\u6709\u5339\u914d\u884c\u65f6\u5355\u5143\u683c\u4e3a\u7a7a\uff1b\u5b58\u5728\u591a\u884c\u65f6\u4f1a\u62a5\u9519\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\d[S+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5bf9\u4e8e\u6bcf\u4e2a\u5339\u914d<em class=\"replaceable\"><code>pattern</code></em>\u7684\u5173\u7cfb\uff08\u8868\u3001\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u7d22\u5f15\u3001\u5e8f\u5217\u6216\u5916\u90e8\u8868\uff09\u6216\u590d\u5408\u7c7b\u578b\uff0c\u663e\u793a\u6240\u6709\u5217\u53ca\u5176\u7c7b\u578b\u3001\u8868\u7a7a\u95f4\uff08\u5982\u679c\u4e0d\u662f\u9ed8\u8ba4\u8868\u7a7a\u95f4\uff09\uff0c\u4ee5\u53ca<code class=\"literal\">NOT NULL</code>\u6216\u9ed8\u8ba4\u503c\u7b49\u7279\u6b8a\u5c5e\u6027\u3002\u8fd8\u4f1a\u663e\u793a\u5173\u8054\u7684\u7d22\u5f15\u3001\u7ea6\u675f\u3001\u89c4\u5219\u548c\u89e6\u53d1\u5668\u3002\u5bf9\u4e8e\u5916\u90e8\u8868\uff0c\u8fd8\u4f1a\u663e\u793a\u5173\u8054\u7684\u5916\u90e8\u670d\u52a1\u5668\u3002\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u5339\u914d\u6a21\u5f0f</span>\u201d</span>\u7684\u5b9a\u4e49\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"\u6a21\u5f0f\">\u6a21\u5f0f</a>\u3002\uff09</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u67d0\u4e9b\u5173\u7cfb\u7c7b\u578b\uff0c<code class=\"literal\">\\d</code>\u4f1a\u4e3a\u6bcf\u5217\u663e\u793a\u9644\u52a0\u4fe1\u606f\uff1a\u5e8f\u5217\u7684\u5217\u503c\u3001\u7d22\u5f15\u7684\u7d22\u5f15\u8868\u8fbe\u5f0f\uff0c\u4ee5\u53ca\u5916\u90e8\u8868\u7684\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u9009\u9879\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">\\d+</code>\u5f62\u5f0f\u7684\u547d\u4ee4\u4e0e\u4e4b\u76f8\u540c\uff0c\u4f46\u4f1a\u663e\u793a\u66f4\u591a\u4fe1\u606f\uff1a\u8868\u5404\u5217\u5173\u8054\u7684\u6ce8\u91ca\u3001\u8868\u4e2d\u662f\u5426\u5b58\u5728 OID\u3001\u89c6\u56fe\u5b9a\u4e49\uff08\u5982\u679c\u5173\u7cfb\u662f\u89c6\u56fe\uff09\uff0c\u4ee5\u53ca\u975e\u9ed8\u8ba4\u7684<a class=\"link\" href=\"/docs/13/sql-altertable.html#SQL-CREATETABLE-REPLICA-IDENTITY\">\u590d\u5236\u6807\u8bc6</a>\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528<code class=\"command\">\\d</code>\u800c\u6ca1\u6709<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\uff0c\u5b83\u7b49\u540c\u4e8e<code class=\"command\">\\dtvmsE</code>\uff0c\u5b83\u5c06\u663e\u793a\u6240\u6709\u53ef\u89c1\u7684\u8868\u3001\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u7684\u5217\u8868\u3002\u8fd9\u7eaf\u7cb9\u662f\u4e00\u79cd\u4fbf\u5229\u63aa\u65bd\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\da[S] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u805a\u5408\u51fd\u6570\uff0c\u4ee5\u53ca\u5b83\u4eec\u7684\u8fd4\u56de\u7c7b\u578b\u548c\u6240\u4f5c\u7528\u7684\u6570\u636e\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u805a\u5408\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dA[+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8bbf\u95ee\u65b9\u6cd5\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bbf\u95ee\u65b9\u6cd5\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u8bbf\u95ee\u65b9\u6cd5\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u7684\u5904\u7406\u5668\u51fd\u6570\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dAc[+] [<a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>input-type-pattern</code></em></a>]]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u64cd\u4f5c\u7b26\u7c7b\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/13/xindex.html#XINDEX-OPCLASS\" title=\"37.16.1.\u00a0\u7d22\u5f15\u65b9\u6cd5\u548c\u64cd\u4f5c\u7b26\u7c7b\">\u7b2c\u00a037.16.1\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u7c7b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>input-type-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8f93\u5165\u7c7b\u578b\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u7c7b\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u7c7b\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u548c\u6240\u6709\u8005\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dAf[+] [<a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>input-type-pattern</code></em></a>]]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u64cd\u4f5c\u7b26\u65cf\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/13/xindex.html#XINDEX-OPFAMILY\" title=\"37.16.5.\u00a0\u64cd\u4f5c\u7b26\u7c7b\u548c\u64cd\u4f5c\u7b26\u65cf\">\u7b2c\u00a037.16.5\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>input-type-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8f93\u5165\u7c7b\u578b\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u65cf\u90fd\u4f1a\u8fde\u540c\u5176\u6240\u6709\u8005\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dAo[+] [<a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>operator-family-pattern</code></em></a>]]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u4e0e\u64cd\u4f5c\u7b26\u65cf\u5173\u8054\u7684\u64cd\u4f5c\u7b26\uff08\u89c1<a class=\"xref\" href=\"/docs/13/xindex.html#XINDEX-STRATEGIES\" title=\"37.16.2.\u00a0\u7d22\u5f15\u65b9\u6cd5\u7b56\u7565\">\u7b2c\u00a037.16.2\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u5173\u8054\u8bbf\u95ee\u65b9\u6cd5\u7684\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u64cd\u4f5c\u7b26\u65cf\u6210\u5458\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>operator-family-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u64cd\u4f5c\u7b26\u65cf\u6210\u5458\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u5217\u51fa\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u7684\u6392\u5e8f\u64cd\u4f5c\u7b26\u65cf\uff08\u5982\u679c\u5b83\u662f\u4e00\u4e2a\u6392\u5e8f\u64cd\u4f5c\u7b26\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dAp[+] [<a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>operator-family-pattern</code></em></a>]]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u4e0e\u64cd\u4f5c\u7b26\u65cf\u5173\u8054\u7684\u652f\u6301\u51fd\u6570\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/13/xindex.html#XINDEX-SUPPORT\" title=\"37.16.3.\u00a0\u7d22\u5f15\u65b9\u6cd5\u652f\u6301\u4f8b\u7a0b\">\u7b2c\u00a037.16.3\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u6240\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u51fd\u6570\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>operator-family-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u8be5\u6a21\u5f0f\u5339\u914d\u7684\u64cd\u4f5c\u7b26\u65cf\u51fd\u6570\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u51fd\u6570\u4f1a\u4ee5\u8be6\u7ec6\u5f62\u5f0f\u663e\u793a\uff0c\u5e76\u5e26\u6709\u5176\u5b9e\u9645\u53c2\u6570\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\db[+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8868\u7a7a\u95f4\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8868\u7a7a\u95f4\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u8868\u7a7a\u95f4\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u9009\u9879\u3001\u78c1\u76d8\u5927\u5c0f\u3001\u6743\u9650\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dc[S+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5b57\u7b26\u96c6\u7f16\u7801\u4e4b\u95f4\u7684\u8f6c\u6362\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8f6c\u6362\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dC[+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u7c7b\u578b\u8f6c\u6362\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u6e90\u7c7b\u578b\u6216\u76ee\u6807\u7c7b\u578b\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u7c7b\u578b\u8f6c\u6362\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u5217\u51fa\u6bcf\u4e2a\u5bf9\u8c61\u5173\u8054\u7684\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dd[S] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u663e\u793a\u7c7b\u578b\u4e3a<code class=\"literal\">constraint</code>\u3001<code class=\"literal\">operator class</code>\u3001<code class=\"literal\">operator family</code>\u3001<code class=\"literal\">rule</code>\u548c<code class=\"literal\">trigger</code>\u7684\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002\u5176\u4ed6\u6240\u6709\u6ce8\u91ca\u90fd\u53ef\u4ee5\u901a\u8fc7\u76f8\u5e94\u5bf9\u8c61\u7c7b\u578b\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u67e5\u770b\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">\\dd</code>\u663e\u793a\u5339\u914d<em class=\"replaceable\"><code>pattern</code></em>\u7684\u5bf9\u8c61\u7684\u63cf\u8ff0\uff1b\u5982\u679c\u6ca1\u6709\u7ed9\u51fa\u53c2\u6570\uff0c\u5219\u663e\u793a\u9002\u5f53\u7c7b\u578b\u7684\u53ef\u89c1\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002\u4f46\u65e0\u8bba\u54ea\u79cd\u60c5\u51b5\uff0c\u90fd\u53ea\u5217\u51fa\u6709\u63cf\u8ff0\u7684\u5bf9\u8c61\u3002\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528<a class=\"xref\" href=\"/docs/13/sql-comment.html\" title=\"COMMENT\"><span class=\"refentrytitle\">COMMENT</span></a> <acronym class=\"acronym\">SQL</acronym> \u547d\u4ee4\u521b\u5efa\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dD[S+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u57df\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u57df\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u6743\u9650\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\ddp [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u9ed8\u8ba4\u8bbf\u95ee\u6743\u9650\u8bbe\u7f6e\u3002\u5bf9\u4e8e\u9ed8\u8ba4\u6743\u9650\u8bbe\u7f6e\u5df2\u504f\u79bb\u5185\u7f6e\u9ed8\u8ba4\u503c\u7684\u6bcf\u4e2a\u89d2\u8272\uff08\u4ee5\u53ca\u6a21\u5f0f\uff0c\u5982\u679c\u9002\u7528\uff09\uff0c\u90fd\u4f1a\u663e\u793a\u4e00\u4e2a\u6761\u76ee\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u89d2\u8272\u540d\u6216\u6a21\u5f0f\u540d\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6761\u76ee\u3002</p>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/13/sql-alterdefaultprivileges.html\" title=\"ALTER DEFAULT PRIVILEGES\"><span class=\"refentrytitle\">ALTER DEFAULT PRIVILEGES</span></a>\u547d\u4ee4\u7528\u4e8e\u8bbe\u7f6e\u9ed8\u8ba4\u8bbf\u95ee\u6743\u9650\u3002\u6743\u9650\u663e\u793a\u7684\u542b\u4e49\u5728<a class=\"xref\" href=\"/docs/13/ddl-priv.html\" title=\"5.7.\u00a0\u6743\u9650\">\u7b2c\u00a05.7\u00a0\u8282</a>\u4e2d\u6709\u89e3\u91ca\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dE[S+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\di[S+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dm[S+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\ds[S+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dt[S+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dv[S+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd9\u7ec4\u547d\u4ee4\u4e2d\uff0c\u5b57\u6bcd <code class=\"literal\">E</code>\u3001<code class=\"literal\">i</code>\u3001<code class=\"literal\">m</code>\u3001<code class=\"literal\">s</code>\u3001<code class=\"literal\">t</code> \u548c <code class=\"literal\">v</code> \u5206\u522b\u8868\u793a\u5916\u90e8\u8868\u3001\u7d22\u5f15\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u3001\u8868\u548c\u89c6\u56fe\u3002\u4f60\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u6307\u5b9a\u5176\u4e2d\u4efb\u610f\u4e00\u4e2a\u6216\u591a\u4e2a\u5b57\u6bcd\uff0c\u4ee5\u83b7\u53d6\u8fd9\u4e9b\u7c7b\u578b\u5bf9\u8c61\u7684\u5217\u8868\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dti</code> \u4f1a\u5217\u51fa\u8868\u548c\u7d22\u5f15\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u6301\u4e45\u6027\u72b6\u6001\uff08\u6c38\u4e45\u3001\u4e34\u65f6\u6216\u4e0d\u8bb0\u5f55 WAL\uff09\u3001\u78c1\u76d8\u4e0a\u7684\u7269\u7406\u5927\u5c0f\u4ee5\u53ca\u76f8\u5173\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u4e00\u8d77\u5217\u51fa\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u5bf9\u8c61\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\des[+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u670d\u52a1\u5668\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external servers</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u670d\u52a1\u5668\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\des+</code>\u5f62\u5f0f\uff0c\u5219\u663e\u793a\u6bcf\u4e2a\u670d\u52a1\u5668\u7684\u5b8c\u6574\u8bf4\u660e\uff0c\u5305\u62ec\u670d\u52a1\u5668\u7684\u8bbf\u95ee\u6743\u9650\u3001\u7c7b\u578b\u3001\u7248\u672c\u3001\u9009\u9879\u548c\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\det[+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u8868\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external tables</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u8868\u540d\u6216\u6a21\u5f0f\u540d\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6761\u76ee\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\det+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u901a\u7528\u9009\u9879\u548c\u5916\u90e8\u8868\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\deu[+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u7528\u6237\u6620\u5c04\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external users</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u7528\u6237\u540d\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6620\u5c04\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\deu+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u6620\u5c04\u7684\u9644\u52a0\u4fe1\u606f\u3002</p>\n<div class=\"caution\">\n<h3 class=\"title\" lang=\"zh\">\u5c0f\u5fc3</h3>\n<p lang=\"zh\"><code class=\"literal\">\\deu+</code>\u8fd8\u53ef\u80fd\u663e\u793a\u8fdc\u7a0b\u7528\u6237\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u56e0\u6b64\u5e94\u6ce8\u610f\u4e0d\u8981\u6cc4\u9732\u5b83\u4eec\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dew[+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external wrappers</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dew+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u7684\u8bbf\u95ee\u6743\u9650\u3001\u9009\u9879\u548c\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\df[anptwS+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u51fd\u6570\u53ca\u5176\u7ed3\u679c\u6570\u636e\u7c7b\u578b\u3001\u53c2\u6570\u6570\u636e\u7c7b\u578b\u548c\u51fd\u6570\u7c7b\u578b\u3002\u51fd\u6570\u7c7b\u578b\u5206\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">agg</span>\u201d</span>\uff08\u805a\u5408\uff09\u3001<span class=\"quote\">\u201c<span class=\"quote\">normal</span>\u201d</span>\u3001<span class=\"quote\">\u201c<span class=\"quote\">procedure</span>\u201d</span>\u3001<span class=\"quote\">\u201c<span class=\"quote\">trigger</span>\u201d</span>\u6216<span class=\"quote\">\u201c<span class=\"quote\">window</span>\u201d</span>\u3002\u8981\u4ec5\u663e\u793a\u7279\u5b9a\u7c7b\u578b\u7684\u51fd\u6570\uff0c\u53ef\u5728\u547d\u4ee4\u4e2d\u6dfb\u52a0\u5bf9\u5e94\u7684\u5b57\u6bcd<code class=\"literal\">a</code>\u3001<code class=\"literal\">n</code>\u3001<code class=\"literal\">p</code>\u3001<code class=\"literal\">t</code>\u6216<code class=\"literal\">w</code>\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u51fd\u6570\u3002\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\df+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u51fd\u6570\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u6613\u53d8\u6027\u3001\u5e76\u884c\u5b89\u5168\u6027\u3001\u62e5\u6709\u8005\u3001\u5b89\u5168\u5206\u7c7b\u3001\u8bbf\u95ee\u6743\u9650\u3001\u8bed\u8a00\u3001\u6e90\u4ee3\u7801\u548c\u63cf\u8ff0\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8981\u67e5\u627e\u63a5\u53d7\u7279\u5b9a\u6570\u636e\u7c7b\u578b\u53c2\u6570\u6216\u8fd4\u56de\u7279\u5b9a\u6570\u636e\u7c7b\u578b\u503c\u7684\u51fd\u6570\uff0c\u8bf7\u4f7f\u7528\u5206\u9875\u5668\u7684\u641c\u7d22\u529f\u80fd\u6d4f\u89c8<code class=\"literal\">\\df</code>\u8f93\u51fa\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dF[+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u914d\u7f6e\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u914d\u7f6e\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dF+</code>\u5f62\u5f0f\uff0c\u5219\u663e\u793a\u6bcf\u4e2a\u914d\u7f6e\u7684\u5b8c\u6574\u8bf4\u660e\uff0c\u5305\u62ec\u5e95\u5c42\u5168\u6587\u68c0\u7d22\u89e3\u6790\u5668\u548c\u6bcf\u79cd\u89e3\u6790\u5668\u8bcd\u5143\u7c7b\u578b\u7684\u8bcd\u5178\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dFd[+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u8bcd\u5178\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bcd\u5178\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dFd+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u9009\u4e2d\u8bcd\u5178\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5e95\u5c42\u5168\u6587\u68c0\u7d22\u6a21\u677f\u548c\u9009\u9879\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dFp[+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u89e3\u6790\u5668\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u89e3\u6790\u5668\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dFp+</code>\u5f62\u5f0f\uff0c\u5219\u663e\u793a\u6bcf\u4e2a\u89e3\u6790\u5668\u7684\u5b8c\u6574\u8bf4\u660e\uff0c\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u548c\u53ef\u8bc6\u522b\u7684\u8bcd\u5143\u7c7b\u578b\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dFt[+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u6a21\u677f\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6a21\u677f\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dFt+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u6a21\u677f\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dg[S+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u5e93\u89d2\u8272\u3002\uff08\u7531\u4e8e<span class=\"quote\">\u201c<span class=\"quote\">\u7528\u6237</span>\u201d</span>\u548c<span class=\"quote\">\u201c<span class=\"quote\">\u7ec4</span>\u201d</span>\u7684\u6982\u5ff5\u5df2\u7ecf\u7edf\u4e00\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">\u89d2\u8272</span>\u201d</span>\uff0c\u6b64\u547d\u4ee4\u73b0\u5728\u7b49\u4ef7\u4e8e<code class=\"literal\">\\du</code>\u3002\uff09\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u89d2\u8272\uff1b\u63d0\u4f9b<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u89d2\u8272\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u89d2\u8272\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dg+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u89d2\u8272\u7684\u9644\u52a0\u4fe1\u606f\uff1b\u76ee\u524d\u4f1a\u589e\u52a0\u6bcf\u4e2a\u89d2\u8272\u7684\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dl</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u662f<code class=\"command\">\\lo_list</code>\u7684\u522b\u540d\uff0c\u7528\u4e8e\u663e\u793a\u5927\u5bf9\u8c61\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dL[S+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8fc7\u7a0b\u8bed\u8a00\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bed\u8a00\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u8bed\u8a00\uff1b\u63d0\u4f9b <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u79cd\u8bed\u8a00\u90fd\u4f1a\u8fde\u540c\u5176\u8c03\u7528\u5904\u7406\u5668\u3001\u9a8c\u8bc1\u5668\u3001\u8bbf\u95ee\u6743\u9650\u4ee5\u53ca\u5b83\u662f\u5426\u4e3a\u7cfb\u7edf\u5bf9\u8c61\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dn[S+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6a21\u5f0f\uff08\u547d\u540d\u7a7a\u95f4\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6a21\u5f0f\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u6743\u9650\u548c\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\do[S+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u64cd\u4f5c\u7b26\u53ca\u5176\u64cd\u4f5c\u6570\u7c7b\u578b\u548c\u7ed3\u679c\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u64cd\u4f5c\u7b26\u3002\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u76ee\u524d\u53ea\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dO[S+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6392\u5e8f\u89c4\u5219\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6392\u5e8f\u89c4\u5219\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u6392\u5e8f\u89c4\u5219\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u4e00\u8d77\u5217\u51fa\u3002\u8bf7\u6ce8\u610f\uff0c\u53ea\u4f1a\u663e\u793a\u4e0e\u5f53\u524d\u6570\u636e\u5e93\u7f16\u7801\u517c\u5bb9\u7684\u6392\u5e8f\u89c4\u5219\uff0c\u56e0\u6b64\u5728\u540c\u4e00\u5b89\u88c5\u4e2d\u7684\u4e0d\u540c\u6570\u636e\u5e93\u91cc\u7ed3\u679c\u53ef\u80fd\u4e0d\u540c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dp [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u53ca\u5176\u5173\u8054\u7684\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u3002</p>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/13/sql-grant.html\" title=\"GRANT\"><span class=\"refentrytitle\">GRANT</span></a>\u548c<a class=\"xref\" href=\"/docs/13/sql-revoke.html\" title=\"REVOKE\"><span class=\"refentrytitle\">REVOKE</span></a>\u547d\u4ee4\u7528\u4e8e\u8bbe\u7f6e\u8bbf\u95ee\u6743\u9650\u3002\u6743\u9650\u663e\u793a\u7684\u542b\u4e49\u5728<a class=\"xref\" href=\"/docs/13/ddl-priv.html\" title=\"5.7.\u00a0\u6743\u9650\">\u7b2c\u00a05.7\u00a0\u8282</a>\u4e2d\u6709\u89e3\u91ca\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dP[itn+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5206\u533a\u5173\u7cfb\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6761\u76ee\u3002\u53ef\u4ee5\u5728\u547d\u4ee4\u540e\u9644\u52a0\u4fee\u9970\u7b26<code class=\"literal\">t</code>\uff08\u8868\uff09\u548c<code class=\"literal\">i</code>\uff08\u7d22\u5f15\uff09\uff0c\u7b5b\u9009\u8981\u5217\u51fa\u7684\u5173\u7cfb\u7c7b\u578b\u3002\u9ed8\u8ba4\u4f1a\u5217\u51fa\u5206\u533a\u8868\u548c\u5206\u533a\u7d22\u5f15\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528\u4e86\u4fee\u9970\u7b26<code class=\"literal\">n</code>\uff08<span class=\"quote\">\u201c<span class=\"quote\">nested</span>\u201d</span>\uff09\uff0c\u6216\u6307\u5b9a\u4e86\u6a21\u5f0f\uff0c\u5219\u4f1a\u5305\u542b\u975e\u6839\u5206\u533a\u5173\u7cfb\uff0c\u5e76\u663e\u793a\u4e00\u5217\uff0c\u5217\u51fa\u6bcf\u4e2a\u5206\u533a\u5173\u7cfb\u7684\u7236\u5173\u7cfb\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u5173\u7cfb\u7684\u5404\u4e2a\u5206\u533a\u7684\u5927\u5c0f\u4e4b\u548c\uff0c\u4ee5\u53ca\u8be5\u5173\u7cfb\u7684\u63cf\u8ff0\u3002\u5982\u679c\u5c06<code class=\"literal\">n</code>\u4e0e<code class=\"literal\">+</code>\u7ed3\u5408\u4f7f\u7528\uff0c\u5219\u663e\u793a\u4e24\u4e2a\u5927\u5c0f\uff1a\u4e00\u4e2a\u662f\u76f4\u63a5\u9644\u52a0\u7684\u53f6\u5b50\u5206\u533a\u7684\u603b\u5927\u5c0f\uff0c\u53e6\u4e00\u4e2a\u662f\u6240\u6709\u5206\u533a\u7684\u603b\u5927\u5c0f\uff0c\u5305\u62ec\u95f4\u63a5\u9644\u52a0\u7684\u5b50\u5206\u533a\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\drds [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>role-pattern</code></em></a> [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>database-pattern</code></em></a> ] ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5df2\u5b9a\u4e49\u7684\u914d\u7f6e\u8bbe\u7f6e\u3002\u8fd9\u4e9b\u8bbe\u7f6e\u53ef\u4ee5\u7279\u5b9a\u4e8e\u89d2\u8272\u3001\u7279\u5b9a\u4e8e\u6570\u636e\u5e93\uff0c\u6216\u540c\u65f6\u7279\u5b9a\u4e8e\u4e24\u8005\u3002<em class=\"replaceable\"><code>role-pattern</code></em>\u548c<em class=\"replaceable\"><code>database-pattern</code></em>\u5206\u522b\u7528\u4e8e\u9009\u62e9\u8981\u5217\u51fa\u7684\u89d2\u8272\u548c\u6570\u636e\u5e93\u3002\u7701\u7565\u67d0\u4e2a\u6a21\u5f0f\u53c2\u6570\u6216\u5c06\u5176\u6307\u5b9a\u4e3a<code class=\"literal\">*</code>\u65f6\uff0c\u4e0d\u4f1a\u6309\u8be5\u53c2\u6570\u7b5b\u9009\uff0c\u8fd8\u4f1a\u5206\u522b\u5305\u542b\u4e0d\u7279\u5b9a\u4e8e\u89d2\u8272\u6216\u4e0d\u7279\u5b9a\u4e8e\u6570\u636e\u5e93\u7684\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\"><a class=\"xref\" href=\"/docs/13/sql-alterrole.html\" title=\"ALTER ROLE\"><span class=\"refentrytitle\">ALTER ROLE</span></a>\u548c<a class=\"xref\" href=\"/docs/13/sql-alterdatabase.html\" title=\"ALTER DATABASE\"><span class=\"refentrytitle\">ALTER DATABASE</span></a>\u547d\u4ee4\u7528\u4e8e\u5b9a\u4e49\u89d2\u8272\u4e13\u5c5e\u548c\u6570\u636e\u5e93\u4e13\u5c5e\u7684\u914d\u7f6e\u8bbe\u7f6e\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dRp[+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u590d\u5236\u53d1\u5e03\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u53d1\u5e03\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u663e\u793a\u4e0e\u6bcf\u4e2a\u53d1\u5e03\u5173\u8054\u7684\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dRs[+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u903b\u8f91\u590d\u5236\u8ba2\u9605\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8ba2\u9605\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u8ba2\u9605\u7684\u5176\u4ed6\u5c5e\u6027\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dT[S+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u7c7b\u578b\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u7c7b\u578b\u90fd\u4f1a\u8fde\u540c\u5176\u5185\u90e8\u540d\u79f0\u3001\u5927\u5c0f\u4ee5\u53ca\u76f8\u5173\u6743\u9650\u4e00\u8d77\u5217\u51fa\uff1b\u5bf9\u4e8e <code class=\"type\">enum</code> \u7c7b\u578b\uff0c\u8fd8\u4f1a\u663e\u793a\u5176\u5141\u8bb8\u503c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\du[S+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u5e93\u89d2\u8272\u3002\uff08\u7531\u4e8e<span class=\"quote\">\u201c<span class=\"quote\">\u7528\u6237</span>\u201d</span>\u548c<span class=\"quote\">\u201c<span class=\"quote\">\u7ec4</span>\u201d</span>\u7684\u6982\u5ff5\u5df2\u7ecf\u7edf\u4e00\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">\u89d2\u8272</span>\u201d</span>\uff0c\u6b64\u547d\u4ee4\u73b0\u5728\u7b49\u4ef7\u4e8e<code class=\"literal\">\\dg</code>\u3002\uff09\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u89d2\u8272\uff1b\u63d0\u4f9b<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u89d2\u8272\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u89d2\u8272\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\du+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u89d2\u8272\u7684\u9644\u52a0\u4fe1\u606f\uff1b\u76ee\u524d\u4f1a\u589e\u52a0\u6bcf\u4e2a\u89d2\u8272\u7684\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dx[+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5df2\u5b89\u88c5\u7684\u6269\u5c55\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6269\u5c55\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dx+</code>\u5f62\u5f0f\uff0c\u5219\u5217\u51fa\u5c5e\u4e8e\u6bcf\u4e2a\u5339\u914d\u6269\u5c55\u7684\u6240\u6709\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dy[+] [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u4e8b\u4ef6\u89e6\u53d1\u5668\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u4e8b\u4ef6\u89e6\u53d1\u5668\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\e</code> \u6216 <code class=\"literal\">\\edit</code> <code class=\"literal\">[ <span class=\"optional\"><em class=\"replaceable\"><code>filename</code></em></span> ] [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5219\u7f16\u8f91\u8be5\u6587\u4ef6\uff1b\u7f16\u8f91\u5668\u9000\u51fa\u540e\uff0c\u5c06\u6587\u4ef6\u5185\u5bb9\u590d\u5236\u5230\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u3002\u5982\u679c\u672a\u7ed9\u51fa<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5219\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u590d\u5236\u5230\u4e34\u65f6\u6587\u4ef6\uff0c\u518d\u4ee5\u76f8\u540c\u65b9\u5f0f\u7f16\u8f91\u3002\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u5c06\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u590d\u5236\u5230\u4e34\u65f6\u6587\u4ef6\uff0c\u5e76\u4ee5\u76f8\u540c\u65b9\u5f0f\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u968f\u540e\uff0c\u6309\u7167<span class=\"application\">psql</span>\u7684\u6b63\u5e38\u89c4\u5219\u91cd\u65b0\u89e3\u6790\u67e5\u8be2\u7f13\u51b2\u533a\u7684\u65b0\u5185\u5bb9\uff0c\u5c06\u6574\u4e2a\u7f13\u51b2\u533a\u89c6\u4e3a\u4e00\u884c\u3002\u4efb\u4f55\u5b8c\u6574\u7684\u67e5\u8be2\u90fd\u4f1a\u7acb\u5373\u6267\u884c\uff1b\u4e5f\u5c31\u662f\u8bf4\uff0c\u5982\u679c\u67e5\u8be2\u7f13\u51b2\u533a\u5305\u542b\u5206\u53f7\u6216\u4ee5\u5206\u53f7\u7ed3\u675f\uff0c\u5c31\u4f1a\u6267\u884c\u5230\u8be5\u4f4d\u7f6e\u4e3a\u6b62\u7684\u6240\u6709\u5185\u5bb9\uff0c\u5e76\u5c06\u5176\u4ece\u67e5\u8be2\u7f13\u51b2\u533a\u79fb\u9664\u3002\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u5269\u4f59\u7684\u5185\u5bb9\u4f1a\u91cd\u65b0\u663e\u793a\u3002\u952e\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u952e\u5165<code class=\"literal\">\\r</code>\u6e05\u7a7a\u67e5\u8be2\u7f13\u51b2\u533a\u4ee5\u53d6\u6d88\u5b83\u3002</p>\n<p lang=\"zh\">\u5c06\u7f13\u51b2\u533a\u89c6\u4e3a\u5355\u884c\u4e3b\u8981\u5f71\u54cd\u5143\u547d\u4ee4\uff1a\u5728\u5143\u547d\u4ee4\u540e\u7684\u7f13\u51b2\u533a\u5c06\u88ab\u89c6\u4e3a\u5143\u547d\u4ee4\u7684\u53c2\u6570\uff0c\u5373\u4f7f\u5b83\u8de8\u8d8a\u591a\u884c\u3002\uff08\u56e0\u6b64\uff0c\u4e0d\u80fd\u7528\u8fd9\u79cd\u65b9\u5f0f\u521b\u5efa\u4f7f\u7528\u5143\u547d\u4ee4\u7684\u811a\u672c\u3002\u8bf7\u4f7f\u7528<code class=\"command\">\\i</code>\u3002\uff09</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u4f1a\u5c06\u5149\u6807\u5b9a\u4f4d\u5230\u6587\u4ef6\u6216\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u7684\u6307\u5b9a\u884c\u3002\u8bf7\u6ce8\u610f\uff0c\u5982\u679c\u53ea\u7ed9\u51fa\u4e00\u4e2a\u5168\u7531\u6570\u5b57\u7ec4\u6210\u7684\u53c2\u6570\uff0c<span class=\"application\">psql</span>\u4f1a\u5047\u5b9a\u5b83\u662f\u884c\u53f7\uff0c\u800c\u4e0d\u662f\u6587\u4ef6\u540d\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u6709\u5173\u5982\u4f55\u914d\u7f6e\u548c\u5b9a\u5236\u7f16\u8f91\u5668\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/13/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"\u73af\u5883\">\u73af\u5883</a>\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\echo <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6c42\u503c\u540e\u7684\u53c2\u6570\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff0c\u7528\u7a7a\u683c\u5206\u9694\uff0c\u5e76\u5728\u672b\u5c3e\u52a0\u4e0a\u6362\u884c\u7b26\u3002\u8fd9\u5bf9\u4e8e\u5728\u811a\u672c\u8f93\u51fa\u4e2d\u7a7f\u63d2\u4fe1\u606f\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>\\echo `date`</code></strong>\nTue Oct 26 21:40:57 CEST 1999\n</pre>\n<p lang=\"zh\">\u5982\u679c\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f\u672a\u52a0\u5f15\u53f7\u7684<code class=\"literal\">-n</code>\uff0c\u5219\u4e0d\u4f1a\u5199\u5165\u5c3e\u968f\u7684\u6362\u884c\u7b26\uff08\u4e5f\u4e0d\u4f1a\u5199\u5165\u7b2c\u4e00\u4e2a\u53c2\u6570\uff09\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528<code class=\"command\">\\o</code>\u547d\u4ee4\u91cd\u5b9a\u5411\u67e5\u8be2\u8f93\u51fa\uff0c\u53ef\u80fd\u4f1a\u60f3\u7528<code class=\"command\">\\qecho</code>\u4ee3\u66ff\u8fd9\u4e2a\u547d\u4ee4\u3002\u53e6\u8bf7\u53c2\u9605<code class=\"command\">\\warn</code>\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\ef [ <span class=\"optional\"><em class=\"replaceable\"><code>function_description</code></em> [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</span> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u7f16\u8f91\u6307\u5b9a\u51fd\u6570\u6216\u8fc7\u7a0b\u7684\u5b9a\u4e49\uff0c\u5f62\u5f0f\u4e3a<code class=\"command\">CREATE OR REPLACE FUNCTION</code>\u6216 <code class=\"command\">CREATE OR REPLACE PROCEDURE</code>\u547d\u4ee4\u3002\u7f16\u8f91\u65b9\u5f0f\u4e0e<code class=\"literal\">\\edit</code>\u76f8\u540c\u3002\u7f16\u8f91\u5668\u9000\u51fa\u540e\uff0c\u5982\u679c\u4f60\u5728\u547d\u4ee4\u4e2d\u6dfb\u52a0\u4e86\u5206\u53f7\uff0c\u5219\u66f4\u65b0\u540e\u7684\u547d\u4ee4\u4f1a\u7acb\u5373\u6267\u884c\u3002\u5426\u5219\u5b83\u4f1a\u91cd\u65b0\u663e\u793a\uff1b\u952e\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u7528<code class=\"literal\">\\r</code>\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u76ee\u6807\u51fd\u6570\u53ef\u4ec5\u7528\u540d\u79f0\u6307\u5b9a\uff0c\u4e5f\u53ef\u7528\u540d\u79f0\u548c\u53c2\u6570\u6307\u5b9a\uff0c\u4f8b\u5982 foo(integer, text)\u3002\u82e5\u6709\u591a\u4e2a\u540c\u540d\u51fd\u6570\uff0c\u5219\u5fc5\u987b\u63d0\u4f9b\u53c2\u6570\u7c7b\u578b\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u51fd\u6570\uff0c\u5219\u4f1a\u5448\u73b0\u4e00\u4e2a\u7a7a\u7684<code class=\"command\">CREATE FUNCTION</code>\u6a21\u677f\u4f9b\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u4f1a\u5c06\u5149\u6807\u5b9a\u4f4d\u5230\u51fd\u6570\u4f53\u4e2d\u7684\u6307\u5b9a\u884c\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u51fd\u6570\u4f53\u901a\u5e38\u5e76\u4e0d\u4ece\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u5f00\u59cb\u3002\uff09</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\ef</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u6709\u5173\u5982\u4f55\u914d\u7f6e\u548c\u5b9a\u5236\u7f16\u8f91\u5668\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/13/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"\u73af\u5883\">\u73af\u5883</a>\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\encoding [ <em class=\"replaceable\"><code>encoding</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5ba2\u6237\u7aef\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u6ca1\u6709\u53c2\u6570\u65f6\uff0c\u6b64\u547d\u4ee4\u663e\u793a\u5f53\u524d\u7f16\u7801\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\errverbose</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ee5\u6700\u5927\u7684\u8be6\u7ec6\u7a0b\u5ea6\u91cd\u590d\u6700\u8fd1\u7684\u670d\u52a1\u5668\u9519\u8bef\u6d88\u606f\uff0c\u5c31\u597d\u50cf<code class=\"varname\">VERBOSITY</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">verbose</code>\uff0c<code class=\"varname\">SHOW_CONTEXT</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">always</code>\u4e00\u6837\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\ev [ <span class=\"optional\"><em class=\"replaceable\"><code>view_name</code></em> [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</span> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u7f16\u8f91\u6307\u5b9a\u89c6\u56fe\u7684\u5b9a\u4e49\uff0c\u5f62\u5f0f\u4e3a<code class=\"command\">CREATE OR REPLACE VIEW</code>\u547d\u4ee4\u3002\u7f16\u8f91\u65b9\u5f0f\u4e0e<code class=\"literal\">\\edit</code>\u76f8\u540c\u3002\u7f16\u8f91\u5668\u9000\u51fa\u540e\uff0c\u5982\u679c\u4f60\u5728\u547d\u4ee4\u4e2d\u6dfb\u52a0\u4e86\u5206\u53f7\uff0c\u5219\u66f4\u65b0\u540e\u7684\u547d\u4ee4\u4f1a\u7acb\u5373\u6267\u884c\uff1b\u5426\u5219\u5c06\u91cd\u65b0\u663e\u793a\uff1b\u8f93\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u7528<code class=\"literal\">\\r</code>\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u89c6\u56fe\uff0c\u5219\u4f1a\u5448\u73b0\u4e00\u4e2a\u7a7a\u7684<code class=\"command\">CREATE VIEW</code>\u6a21\u677f\u4f9b\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u4f1a\u5c06\u5149\u6807\u5b9a\u4f4d\u5230\u89c6\u56fe\u5b9a\u4e49\u4e2d\u7684\u6307\u5b9a\u884c\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\ev</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\f [ <em class=\"replaceable\"><code>string</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u67e5\u8be2\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u9ed8\u8ba4\u503c\u662f\u7ad6\u7ebf\uff08<code class=\"literal\">|</code>\uff09\u3002\u5b83\u7b49\u540c\u4e8e<code class=\"command\">\\pset fieldsep</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\g [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\g [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u6267\u884c\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728<code class=\"literal\">\\g</code>\u540e\u9762\u51fa\u73b0\u62ec\u53f7\uff0c\u5219\u62ec\u53f7\u4e2d\u662f\u7528\u7a7a\u683c\u5206\u9694\u7684<em class=\"replaceable\"><code>option</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em>\u683c\u5f0f\u9009\u9879\u5b50\u53e5\u5217\u8868\u3002\u8fd9\u4e9b\u5b50\u53e5\u7684\u89e3\u91ca\u65b9\u5f0f\u4e0e<code class=\"literal\">\\pset</code> <em class=\"replaceable\"><code>option</code></em> <em class=\"replaceable\"><code>value</code></em>\u547d\u4ee4\u76f8\u540c\uff0c\u4f46\u4ec5\u5728\u6b64\u67e5\u8be2\u6267\u884c\u671f\u95f4\u751f\u6548\u3002\u5728\u6b64\u5217\u8868\u4e2d\uff0c<code class=\"literal\">=</code>\u7b26\u53f7\u5468\u56f4\u4e0d\u5141\u8bb8\u6709\u7a7a\u683c\uff0c\u4f46\u9009\u9879\u5b50\u53e5\u4e4b\u95f4\u5fc5\u987b\u6709\u7a7a\u683c\u3002\u5982\u679c<code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em>\u88ab\u7701\u7565\uff0c\u5219\u6307\u5b9a\u7684<em class=\"replaceable\"><code>option</code></em>\u4f1a\u6309\u4ee5\u4e0b\u547d\u4ee4\u7684\u65b9\u5f0f\u66f4\u6539\uff1a<code class=\"literal\">\\pset</code> <em class=\"replaceable\"><code>option</code></em>\uff0c\u5176\u4e2d\u4e0d\u663e\u5f0f\u6307\u5b9a<em class=\"replaceable\"><code>value</code></em>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7ed9\u51fa\u4e86<em class=\"replaceable\"><code>filename</code></em>\u6216<code class=\"literal\">|</code><em class=\"replaceable\"><code>command</code></em>\u53c2\u6570\uff0c\u67e5\u8be2\u8f93\u51fa\u5c31\u4f1a\u5199\u5165\u6307\u5b9a\u6587\u4ef6\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6307\u5b9a\u7684 shell \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u7167\u5e38\u663e\u793a\u3002\u53ea\u6709\u5f53\u67e5\u8be2\u6210\u529f\u8fd4\u56de\u96f6\u4e2a\u6216\u591a\u4e2a\u5143\u7ec4\u65f6\uff0c\u624d\u4f1a\u5411\u6587\u4ef6\u6216\u547d\u4ee4\u5199\u5165\uff1b\u5982\u679c\u67e5\u8be2\u5931\u8d25\uff0c\u6216\u6267\u884c\u7684\u662f\u4e0d\u8fd4\u56de\u6570\u636e\u7684 SQL \u547d\u4ee4\uff0c\u5219\u4e0d\u4f1a\u5199\u5165\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u5c06\u88ab\u91cd\u65b0\u6267\u884c\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u6ca1\u6709\u4efb\u4f55\u53c2\u6570\u7684<code class=\"literal\">\\g</code>\u57fa\u672c\u4e0a\u7b49\u540c\u4e8e\u4e00\u4e2a\u5206\u53f7\u3002\u5e26\u6709\u53c2\u6570\u7684<code class=\"literal\">\\g</code>\u63d0\u4f9b\u4e86\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u4e00\u6b21\u6027</span>\u201d</span>\u66ff\u4ee3<code class=\"command\">\\o</code>\u547d\u4ee4\u7684\u9009\u62e9\uff0c\u5e76\u4e14\u8fd8\u5141\u8bb8\u4e00\u6b21\u6027\u8c03\u6574\u901a\u5e38\u7531<code class=\"literal\">\\pset</code>\u8bbe\u7f6e\u7684\u8f93\u51fa\u683c\u5f0f\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u5f53\u6700\u540e\u4e00\u4e2a\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\u65f6\uff0c\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u90fd\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u65e2\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\uff0c\u4e5f\u4e0d\u8fdb\u884c\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u90e8\u5206\u4f1a\u76f4\u63a5\u6309\u5b57\u9762\u4f20\u7ed9 shell\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\gdesc</code></span></dt>\n<dd>\n<p lang=\"zh\">\u663e\u793a\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u67e5\u8be2\u7ed3\u679c\u7684\u63cf\u8ff0\uff08\u5373\u5217\u540d\u548c\u6570\u636e\u7c7b\u578b\uff09\u3002\u67e5\u8be2\u5e76\u4e0d\u4f1a\u5b9e\u9645\u6267\u884c\uff1b\u4e0d\u8fc7\uff0c\u5982\u679c\u5176\u4e2d\u5b58\u5728\u8bed\u6cd5\u9519\u8bef\uff0c\u4f1a\u6309\u901a\u5e38\u7684\u65b9\u5f0f\u62a5\u544a\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6539\u4e3a\u63cf\u8ff0\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\gexec</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u7136\u540e\u628a\u67e5\u8be2\u8f93\u51fa\uff08\u5982\u679c\u6709\uff09\u7684\u6bcf\u4e00\u884c\u7684\u6bcf\u4e00\u5217\u89c6\u4e3a\u8981\u6267\u884c\u7684 SQL \u8bed\u53e5\u3002\u4f8b\u5982\uff0c\u4e0b\u9762\u4e3a\u6bcf\u4e00\u5217\u521b\u5efa\u4e00\u4e2a\u7d22\u5f15\uff0c\u76ee\u6807\u8868\u662f <code class=\"structname\">my_table</code>\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT format('create index on my_table(%I)', attname)</code></strong>\n-&gt; <strong class=\"userinput\"><code>FROM pg_attribute</code></strong>\n-&gt; <strong class=\"userinput\"><code>WHERE attrelid = 'my_table'::regclass AND attnum &gt; 0</code></strong>\n-&gt; <strong class=\"userinput\"><code>ORDER BY attnum</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gexec</code></strong>\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\n</pre>\n<p lang=\"zh\">\u751f\u6210\u7684\u67e5\u8be2\u6309\u8fd4\u56de\u884c\u7684\u987a\u5e8f\u6267\u884c\uff1b\u540c\u4e00\u884c\u6709\u591a\u5217\u65f6\u4ece\u5de6\u5230\u53f3\u6267\u884c\uff0c\u5ffd\u7565 NULL \u5b57\u6bb5\u3002\u67e5\u8be2\u539f\u6837\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u56e0\u6b64\u4e0d\u80fd\u662f psql \u5143\u547d\u4ee4\uff0c\u4e5f\u4e0d\u80fd\u5305\u542b psql \u53d8\u91cf\u5f15\u7528\u3002\u9664\u975e\u8bbe\u7f6e ON_ERROR_STOP\uff0c\u67d0\u6761\u67e5\u8be2\u5931\u8d25\u540e\u4ecd\u7ee7\u7eed\u6267\u884c\u5176\u4f59\u67e5\u8be2\u3002\u6bcf\u6761\u67e5\u8be2\u5747\u9075\u5faa ECHO \u8bbe\u7f6e\uff08\u4f7f\u7528 \\gexec \u65f6\uff0c\u901a\u5e38\u5efa\u8bae\u5c06 ECHO \u8bbe\u4e3a all \u6216 queries\uff09\uff0c\u67e5\u8be2\u65e5\u5fd7\u3001\u5355\u6b65\u6a21\u5f0f\u3001\u8ba1\u65f6\u7b49\u6267\u884c\u529f\u80fd\u4e5f\u5206\u522b\u5e94\u7528\u4e8e\u6bcf\u6761\u751f\u6210\u7684\u67e5\u8be2\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\gset [ <em class=\"replaceable\"><code>prefix</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u5e76\u5c06\u67e5\u8be2\u8f93\u51fa\u5b58\u5165 <span class=\"application\">psql</span> \u53d8\u91cf\uff08\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/13/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\uff09\u3002\u8981\u6267\u884c\u7684\u67e5\u8be2\u5fc5\u987b\u6070\u597d\u8fd4\u56de\u4e00\u884c\u3002\u8be5\u884c\u7684\u6bcf\u4e00\u5217\u5206\u522b\u5b58\u5165\u4e00\u4e2a\u53d8\u91cf\uff0c\u53d8\u91cf\u540d\u4e0e\u5217\u540d\u76f8\u540c\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT 'hello' AS var1, 10 AS var2</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gset</code></strong>\n=&gt; <strong class=\"userinput\"><code>\\echo :var1 :var2</code></strong>\nhello 10\n</pre>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>prefix</code></em>\uff0c\u5219\u4f1a\u5c06\u8be5\u5b57\u7b26\u4e32\u52a0\u5230\u67e5\u8be2\u7684\u5217\u540d\u524d\u9762\uff0c\u4ee5\u6784\u6210\u8981\u4f7f\u7528\u7684\u53d8\u91cf\u540d\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT 'hello' AS var1, 10 AS var2</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gset result_</code></strong>\n=&gt; <strong class=\"userinput\"><code>\\echo :result_var1 :result_var2</code></strong>\nhello 10\n</pre>\n<p lang=\"zh\">\u5982\u679c\u67d0\u4e00\u5217\u7684\u7ed3\u679c\u4e3a NULL\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u5bf9\u5e94\u7684\u53d8\u91cf\uff0c\u800c\u4e0d\u662f\u8bbe\u7f6e\u5b83\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u67e5\u8be2\u5931\u8d25\u6216\u6ca1\u6709\u6070\u597d\u8fd4\u56de\u4e00\u884c\uff0c\u5219\u4e0d\u4f1a\u66f4\u6539\u4efb\u4f55\u53d8\u91cf\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\gx [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\gx [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\\gx \u4e0e \\g \u7b49\u4ef7\uff0c\u4f46\u4f1a\u5f3a\u5236\u6b64\u67e5\u8be2\u4f7f\u7528\u6269\u5c55\u8f93\u51fa\u6a21\u5f0f\uff0c\u76f8\u5f53\u4e8e\u5728 \\pset \u9009\u9879\u5217\u8868\u4e2d\u6307\u5b9a expanded=on\u3002\u53e6\u89c1 \\x\u3002</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\h</code> \u6216 <code class=\"literal\">\\help</code> <code class=\"literal\">[ <em class=\"replaceable\"><code>command</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u7ed9\u51fa\u6307\u5b9a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u7684\u8bed\u6cd5\u5e2e\u52a9\u3002\u5982\u679c\u672a\u6307\u5b9a<em class=\"replaceable\"><code>command</code></em>\uff0c\u5219<span class=\"application\">psql</span>\u5c06\u5217\u51fa\u6240\u6709\u53ef\u7528\u8bed\u6cd5\u5e2e\u52a9\u7684\u547d\u4ee4\u3002\u5982\u679c<em class=\"replaceable\"><code>command</code></em>\u662f\u661f\u53f7\uff08<code class=\"literal\">*</code>\uff09\uff0c\u5219\u663e\u793a\u6240\u6709<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u7684\u8bed\u6cd5\u5e2e\u52a9\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\help</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u4e3a\u4e86\u7b80\u5316\u8f93\u5165\uff0c\u7531\u591a\u4e2a\u5355\u8bcd\u7ec4\u6210\u7684\u547d\u4ee4\u4e0d\u9700\u8981\u52a0\u5f15\u53f7\u3002\u56e0\u6b64\uff0c\u53ef\u4ee5\u76f4\u63a5\u8f93\u5165<strong class=\"userinput\"><code>\\help alter table</code></strong>\u3002</p>\n</div>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\H</code> \u6216 <code class=\"literal\">\\html</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5f00<acronym class=\"acronym\">HTML</acronym>\u67e5\u8be2\u8f93\u51fa\u683c\u5f0f\u3002\u5982\u679c<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u5df2\u7ecf\u6253\u5f00\uff0c\u5219\u5207\u6362\u56de\u9ed8\u8ba4\u7684\u5bf9\u9f50\u6587\u672c\u683c\u5f0f\u3002\u6b64\u547d\u4ee4\u662f\u4e3a\u517c\u5bb9\u6027\u548c\u4fbf\u5229\u6027\u800c\u4fdd\u7559\u7684\uff1b\u8bbe\u7f6e\u5176\u4ed6\u8f93\u51fa\u9009\u9879\u7684\u65b9\u6cd5\u89c1<code class=\"command\">\\pset</code>\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\i</code> \u6216 <code class=\"literal\">\\include</code> <em class=\"replaceable\"><code>filename</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u8bfb\u53d6\u8f93\u5165\uff0c\u5e76\u50cf\u5728\u952e\u76d8\u4e0a\u8f93\u5165\u4e00\u6837\u6267\u884c\u5b83\u3002</p>\n<p lang=\"zh\">\u5982\u679c<em class=\"replaceable\"><code>filename</code></em>\u662f<code class=\"literal\">-</code>\uff08\u8fde\u5b57\u7b26\uff09\uff0c\u5219\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\uff0c\u76f4\u5230\u9047\u5230 EOF \u6307\u793a\u6216<code class=\"command\">\\q</code>\u5143\u547d\u4ee4\u3002\u8fd9\u53ef\u7528\u4e8e\u5c06\u4ea4\u4e92\u5f0f\u8f93\u5165\u4e0e\u6587\u4ef6\u8f93\u5165\u4ea4\u9519\u4f7f\u7528\u3002\u8bf7\u6ce8\u610f\uff0c\u53ea\u6709\u5728\u6700\u5916\u5c42\u542f\u7528\u4e86 Readline\uff0c\u6b64\u5904\u624d\u4f1a\u4f7f\u7528 Readline \u529f\u80fd\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5982\u679c\u60f3\u5728\u5c4f\u5e55\u4e0a\u770b\u5230\u88ab\u8bfb\u5165\u7684\u5404\u884c\uff0c\u8bf7\u5c06\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">all</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"PSQL-METACOMMAND-IF\"><span class=\"term\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\elif</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\else</code><br/></span><span class=\"term\"><code class=\"literal\">\\endif</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u7ec4\u547d\u4ee4\u5b9e\u73b0\u4e86\u53ef\u5d4c\u5957\u7684\u6761\u4ef6\u5757\u3002\u6761\u4ef6\u5757\u5fc5\u987b\u4ee5<code class=\"command\">\\if</code>\u5f00\u59cb\uff0c\u4ee5<code class=\"command\">\\endif</code>\u7ed3\u675f\u3002\u4e2d\u95f4\u53ef\u4ee5\u5305\u542b\u4efb\u610f\u6570\u91cf\u7684<code class=\"command\">\\elif</code>\u5b50\u53e5\uff0c\u540e\u9762\u8fd8\u53ef\u4ee5\u9009\u62e9\u8ddf\u968f\u4e00\u4e2a<code class=\"command\">\\else</code>\u5b50\u53e5\u3002\u666e\u901a\u67e5\u8be2\u548c\u5176\u4ed6\u7c7b\u578b\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u53ef\u4ee5\uff08\u901a\u5e38\u4e5f\u4f1a\uff09\u51fa\u73b0\u5728\u6784\u6210\u6761\u4ef6\u5757\u7684\u547d\u4ee4\u4e4b\u95f4\u3002</p>\n<p lang=\"zh\">\\if \u548c \\elif \u8bfb\u53d6\u53c2\u6570\u5e76\u5c06\u5176\u4f5c\u4e3a\u5e03\u5c14\u8868\u8fbe\u5f0f\u6c42\u503c\u3002\u7ed3\u679c\u4e3a\u771f\u65f6\u7ee7\u7eed\u6b63\u5e38\u5904\u7406\uff0c\u5426\u5219\u8df3\u8fc7\u540e\u7eed\u884c\uff0c\u76f4\u5230\u9047\u5230\u5339\u914d\u7684 \\elif\u3001\\else \u6216 \\endif\u3002\u67d0\u4e2a \\if \u6216 \\elif \u6761\u4ef6\u6210\u7acb\u540e\uff0c\u540c\u4e00\u5757\u4e2d\u540e\u7eed \\elif \u7684\u53c2\u6570\u4e0d\u518d\u6c42\u503c\uff0c\u76f4\u63a5\u89c6\u4e3a\u5047\u3002\u53ea\u6709\u4e4b\u524d\u5339\u914d\u7684 \\if \u548c \\elif \u5747\u672a\u6210\u7acb\uff0c\u624d\u5904\u7406 \\else \u540e\u7684\u884c\u3002</p>\n<p lang=\"zh\">\u4e0e\u5176\u4ed6\u53cd\u659c\u6760\u547d\u4ee4\u53c2\u6570\u4e00\u6837\uff0c\\if \u6216 \\elif \u7684\u8868\u8fbe\u5f0f\u53c2\u6570\u5148\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u548c\u53cd\u5f15\u53f7\u5c55\u5f00\uff0c\u7136\u540e\u50cf\u5f00\u5173\u9009\u9879\u53d8\u91cf\u4e00\u6837\u6c42\u503c\u3002\u6709\u6548\u503c\u4e3a true\u3001false\u30011\u30010\u3001on\u3001off\u3001yes\u3001no \u7684\u4efb\u610f\u65e0\u6b67\u4e49\u3001\u4e0d\u533a\u5206\u5927\u5c0f\u5199\u7684\u5339\u914d\u3002\u4f8b\u5982 t\u3001T \u548c tR \u90fd\u4f1a\u89c6\u4e3a\u771f\u3002</p>\n<p lang=\"zh\">\u4e0d\u80fd\u6b63\u786e\u6c42\u503c\u4e3a\u771f\u6216\u5047\u7684\u8868\u8fbe\u5f0f\u4f1a\u4ea7\u751f\u8b66\u544a\uff0c\u5e76\u88ab\u89c6\u4e3a\u5047\u3002</p>\n<p lang=\"zh\">\u88ab\u8df3\u8fc7\u7684\u884c\u4ecd\u4f1a\u6b63\u5e38\u89e3\u6790\uff0c\u4ee5\u8bc6\u522b\u67e5\u8be2\u548c\u53cd\u659c\u7ebf\u547d\u4ee4\uff0c\u4f46\u67e5\u8be2\u4e0d\u4f1a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u6761\u4ef6\u547d\u4ee4\uff08<code class=\"command\">\\if</code>\u3001<code class=\"command\">\\elif</code>\u3001<code class=\"command\">\\else</code>\u3001<code class=\"command\">\\endif</code>\uff09\u4ee5\u5916\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u4f1a\u88ab\u5ffd\u7565\u3002\u5bf9\u4e8e\u6761\u4ef6\u547d\u4ee4\uff0c\u53ea\u68c0\u67e5\u5d4c\u5957\u662f\u5426\u5408\u6cd5\u3002\u88ab\u8df3\u8fc7\u7684\u884c\u4e2d\u7684\u53d8\u91cf\u5f15\u7528\u4e0d\u4f1a\u5c55\u5f00\uff0c\u4e5f\u4e0d\u4f1a\u6267\u884c\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<p lang=\"zh\">\u540c\u4e00\u4e2a\u6761\u4ef6\u5757\u7684\u6240\u6709\u53cd\u659c\u7ebf\u547d\u4ee4\u5fc5\u987b\u51fa\u73b0\u5728\u540c\u4e00\u4e2a\u6e90\u6587\u4ef6\u4e2d\u3002\u5982\u679c\u4e3b\u8f93\u5165\u6587\u4ef6\u6216\u901a\u8fc7<code class=\"command\">\\include</code>\u5f15\u5165\u7684\u6587\u4ef6\u5230\u8fbe EOF \u65f6\uff0c\u4ecd\u6709\u672c\u5730<code class=\"command\">\\if</code>\u5757\u672a\u5173\u95ed\uff0c<span class=\"application\">psql</span>\u5c31\u4f1a\u62a5\u9519\u3002</p>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4e00\u4e2a\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">-- check for the existence of two separate records in the database and store\n-- the results in separate psql variables\nSELECT\n    EXISTS(SELECT 1 FROM customer WHERE customer_id = 123) as is_customer,\n    EXISTS(SELECT 1 FROM employee WHERE employee_id = 456) as is_employee\n\\gset\n\\if :is_customer\n    SELECT * FROM customer WHERE customer_id = 123;\n\\elif :is_employee\n    \\echo 'is not a customer but is an employee'\n    SELECT * FROM employee WHERE employee_id = 456;\n\\else\n    \\if yes\n        \\echo 'not a customer or employee'\n    \\else\n        \\echo 'this will never print'\n    \\endif\n\\endif\n</pre>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\ir</code> \u6216 <code class=\"literal\">\\include_relative</code> <em class=\"replaceable\"><code>filename</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"literal\">\\ir</code>\u547d\u4ee4\u4e0e<code class=\"literal\">\\i</code>\u76f8\u4f3c\uff0c\u4f46\u89e3\u6790\u76f8\u5bf9\u6587\u4ef6\u540d\u7684\u65b9\u5f0f\u4e0d\u540c\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\u6267\u884c\u65f6\uff0c\u8fd9\u4e24\u4e2a\u547d\u4ee4\u7684\u884c\u4e3a\u76f8\u540c\u3002\u4e0d\u8fc7\uff0c\u5728\u811a\u672c\u4e2d\u8c03\u7528\u65f6\uff0c<code class=\"literal\">\\ir</code>\u4f1a\u76f8\u5bf9\u4e8e\u811a\u672c\u6240\u5728\u7684\u76ee\u5f55\u6765\u89e3\u91ca\u6587\u4ef6\u540d\uff0c\u800c\u4e0d\u662f\u76f8\u5bf9\u4e8e\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\l[+]</code> \u6216 <code class=\"literal\">\\list[+] [ <a class=\"link\" href=\"/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"\u6a21\u5f0f\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u670d\u52a1\u5668\u4e2d\u7684\u6570\u636e\u5e93\uff0c\u5e76\u663e\u793a\u5176\u540d\u79f0\u3001\u62e5\u6709\u8005\u3001\u5b57\u7b26\u96c6\u7f16\u7801\u548c\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6570\u636e\u5e93\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u663e\u793a\u6570\u636e\u5e93\u5927\u5c0f\u3001\u9ed8\u8ba4\u8868\u7a7a\u95f4\u548c\u63cf\u8ff0\u3002\uff08\u5927\u5c0f\u4fe1\u606f\u53ea\u5bf9\u5f53\u524d\u7528\u6237\u80fd\u591f\u8fde\u63a5\u7684\u6570\u636e\u5e93\u53ef\u7528\u3002\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\lo_export <em class=\"replaceable\"><code>loid</code></em> <em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6570\u636e\u5e93\u4e2d\u8bfb\u53d6\u5177\u6709<acronym class=\"acronym\">OID</acronym><em class=\"replaceable\"><code>loid</code></em>\u7684\u5927\u5bf9\u8c61\uff0c\u5e76\u5c06\u5176\u5199\u5165<em class=\"replaceable\"><code>filename</code></em>\u3002\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e0e\u670d\u52a1\u5668\u51fd\u6570 <code class=\"function\">lo_export</code>\u7565\u6709\u4e0d\u540c\uff0c\u540e\u8005\u4f7f\u7528\u8fd0\u884c\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7528\u6237\u7684\u6743\u9650\uff0c\u5e76\u5728\u670d\u52a1\u5668\u7684\u6587\u4ef6\u7cfb\u7edf\u4e0a\u64cd\u4f5c\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u4f7f\u7528 \\lo_list \u67e5\u627e\u5927\u5bf9\u8c61\u7684 OID\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\lo_import <em class=\"replaceable\"><code>filename</code></em> [ <em class=\"replaceable\"><code>comment</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6587\u4ef6\u5b58\u50a8\u5230\u4e00\u4e2a<span class=\"productname\">PostgreSQL</span>\u5927\u5bf9\u8c61\u4e2d\u3002\u53ef\u9009\u5730\uff0c\u5b83\u5c06\u7ed9\u5b9a\u7684\u6ce8\u91ca\u4e0e\u5bf9\u8c61\u5173\u8054\u8d77\u6765\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">foo=&gt; <strong class=\"userinput\"><code>\\lo_import '/home/peter/pictures/photo.xcf' 'a picture of me'</code></strong>\nlo_import 152801\n</pre>\n<p lang=\"zh\">\u54cd\u5e94\u8868\u660e\u5927\u5bf9\u8c61\u83b7\u5f97\u4e86\u5bf9\u8c61 ID 152801\uff0c\u8fd9\u4e2a ID \u53ef\u4ee5\u7528\u6765\u5728\u5c06\u6765\u8bbf\u95ee\u65b0\u521b\u5efa\u7684\u5927\u5bf9\u8c61\u3002\u4e3a\u4fbf\u4e8e\u9605\u8bfb\uff0c\u5efa\u8bae\u59cb\u7ec8\u4e3a\u6bcf\u4e2a\u5bf9\u8c61\u5173\u8054\u4e00\u6761\u4fbf\u4e8e\u4eba\u9605\u8bfb\u7684\u6ce8\u91ca\u3002\u67e5\u770b OID \u548c\u6ce8\u91ca\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528<code class=\"command\">\\lo_list</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u6b64\u547d\u4ee4\u4e0e\u670d\u52a1\u5668\u7aef\u7684<code class=\"function\">lo_import</code>\u7565\u6709\u4e0d\u540c\uff0c\u56e0\u4e3a\u5b83\u4f5c\u4e3a\u672c\u5730\u7528\u6237\u5728\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e0a\u64cd\u4f5c\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\u7684\u7528\u6237\u548c\u6587\u4ef6\u7cfb\u7edf\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\lo_list</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5f53\u524d\u5b58\u50a8\u5728\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709<span class=\"productname\">PostgreSQL</span>\u5927\u5bf9\u8c61\uff0c\u4ee5\u53ca\u4e3a\u5b83\u4eec\u63d0\u4f9b\u7684\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\lo_unlink <em class=\"replaceable\"><code>loid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6570\u636e\u5e93\u4e2d\u5220\u9664<acronym class=\"acronym\">OID</acronym> \u4e3a <em class=\"replaceable\"><code>loid</code></em>\u7684\u5927\u5bf9\u8c61\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u4f7f\u7528 \\lo_list \u67e5\u627e\u5927\u5bf9\u8c61\u7684 OID\u3002</p>\n</div>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\o</code> \u6216 <code class=\"literal\">\\out [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\o</code> \u6216 <code class=\"literal\">\\out [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u540e\u7eed\u67e5\u8be2\u7ed3\u679c\u4fdd\u5b58\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9 shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002\u5982\u679c\u6ca1\u6709\u6307\u5b9a\u53c2\u6570\uff0c\u67e5\u8be2\u8f93\u51fa\u5c06\u6062\u590d\u4e3a\u6807\u51c6\u8f93\u51fa\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\uff0c\u5219\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u7684\u5185\u5bb9\u53ea\u4f1a\u539f\u6837\u4f20\u9012\u7ed9 shell\u3002</p>\n<p lang=\"zh\"><span class=\"quote\">\u201c<span class=\"quote\">\u67e5\u8be2\u7ed3\u679c</span>\u201d</span>\u5305\u62ec\u4ece\u6570\u636e\u5e93\u670d\u52a1\u5668\u83b7\u53d6\u7684\u6240\u6709\u8868\u683c\u3001\u547d\u4ee4\u54cd\u5e94\u548c\u901a\u77e5\uff0c\u4ee5\u53ca\u67e5\u8be2\u6570\u636e\u5e93\u7684\u5404\u79cd\u53cd\u659c\u6760\u547d\u4ee4\u7684\u8f93\u51fa\uff08\u4f8b\u5982<code class=\"command\">\\d</code>\uff09\uff1b\u4f46\u4e0d\u5305\u62ec\u9519\u8bef\u6d88\u606f\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8981\u5728\u67e5\u8be2\u7ed3\u679c\u4e4b\u95f4\u63d2\u5165\u6587\u672c\u8f93\u51fa\uff0c\u4f7f\u7528<code class=\"command\">\\qecho</code>\u3002</p>\n</div>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\p</code> \u6216 <code class=\"literal\">\\print</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\u3002\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6253\u5370\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\password [ <em class=\"replaceable\"><code>username</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u66f4\u6539\u6307\u5b9a\u7528\u6237\uff08\u9ed8\u8ba4\u4e3a\u5f53\u524d\u7528\u6237\uff09\u7684\u5bc6\u7801\u3002\u6b64\u547d\u4ee4\u63d0\u793a\u8f93\u5165\u65b0\u5bc6\u7801\uff0c\u5bf9\u5176\u8fdb\u884c\u52a0\u5bc6\uff0c\u5e76\u5c06\u5176\u4f5c\u4e3a<code class=\"command\">ALTER ROLE</code>\u547d\u4ee4\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u65b0\u5bc6\u7801\u4e0d\u4f1a\u4ee5\u660e\u6587\u5f62\u5f0f\u51fa\u73b0\u5728\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\u3001\u670d\u52a1\u5668\u65e5\u5fd7\u6216\u5176\u4ed6\u5730\u65b9\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\prompt [ <em class=\"replaceable\"><code>text</code></em> ] <em class=\"replaceable\"><code>name</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u63d0\u793a\u7528\u6237\u63d0\u4f9b\u6587\u672c\uff0c\u5c06\u5176\u8d4b\u503c\u7ed9\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u3002\u53ef\u4ee5\u6307\u5b9a\u4e00\u4e2a\u53ef\u9009\u7684\u63d0\u793a\u5b57\u7b26\u4e32<em class=\"replaceable\"><code>text</code></em>\u3002\uff08\u5bf9\u4e8e\u591a\u4e2a\u5355\u8bcd\u7684\u63d0\u793a\uff0c\u7528\u5355\u5f15\u53f7\u62ec\u8d77\u6587\u672c\u3002\uff09</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"literal\">\\prompt</code> \u4f7f\u7528\u7ec8\u7aef\u8fdb\u884c\u8f93\u5165\u548c\u8f93\u51fa\u3002\u7136\u800c\uff0c\u5982\u679c\u4f7f\u7528\u4e86 <code class=\"option\">-f</code> \u547d\u4ee4\u884c\u5f00\u5173\uff0c<code class=\"literal\">\\prompt</code> \u5c06\u4f7f\u7528\u6807\u51c6\u8f93\u5165\u548c\u6807\u51c6\u8f93\u51fa\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\pset [ <em class=\"replaceable\"><code>option</code></em> [ <em class=\"replaceable\"><code>value</code></em> ] ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u8bbe\u7f6e\u5f71\u54cd\u67e5\u8be2\u7ed3\u679c\u8868\u8f93\u51fa\u7684\u9009\u9879\u3002<em class=\"replaceable\"><code>option</code></em>\u6307\u5b9a\u8981\u8bbe\u7f6e\u54ea\u4e2a\u9009\u9879\u3002<em class=\"replaceable\"><code>value</code></em>\u7684\u542b\u4e49\u53d6\u51b3\u4e8e\u6240\u9009\u7684\u9009\u9879\u3002\u5bf9\u4e8e\u67d0\u4e9b\u9009\u9879\uff0c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\u4f1a\u5207\u6362\u6216\u53d6\u6d88\u8bbe\u7f6e\u8be5\u9009\u9879\uff0c\u5177\u4f53\u89c1\u5404\u9009\u9879\u7684\u8bf4\u660e\u3002\u5982\u679c\u6ca1\u6709\u63d0\u53ca\u8fd9\u7c7b\u884c\u4e3a\uff0c\u90a3\u4e48\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\u53ea\u4f1a\u663e\u793a\u5f53\u524d\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\">\u4e0d\u5e26\u4efb\u4f55\u53c2\u6570\u7684<code class=\"command\">\\pset</code>\u4f1a\u663e\u793a\u6240\u6709\u6253\u5370\u9009\u9879\u7684\u5f53\u524d\u72b6\u6001\u3002</p>\n<p lang=\"zh\">\u53ef\u8c03\u6574\u7684\u6253\u5370\u9009\u9879\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">border</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><em class=\"replaceable\"><code>value</code></em>\u5fc5\u987b\u662f\u6570\u5b57\u3002\u4e00\u822c\u6765\u8bf4\uff0c\u6570\u5b57\u8d8a\u5927\uff0c\u8868\u683c\u7684\u8fb9\u6846\u548c\u5206\u9694\u7ebf\u5c31\u8d8a\u591a\uff0c\u4f46\u7ec6\u8282\u53d6\u51b3\u4e8e\u5177\u4f53\u683c\u5f0f\u3002\u5728<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u4e2d\uff0c\u5b83\u4f1a\u76f4\u63a5\u8f6c\u6362\u4e3a<code class=\"literal\">border=...</code>\u5c5e\u6027\u3002\u5728\u5927\u591a\u6570\u5176\u4ed6\u683c\u5f0f\u4e2d\uff0c\u53ea\u6709\u503c 0\uff08\u65e0\u8fb9\u6846\uff09\u30011\uff08\u5185\u90e8\u5206\u9694\u7ebf\uff09\u548c 2\uff08\u8868\u683c\u5916\u6846\uff09\u6709\u610f\u4e49\uff0c\u5927\u4e8e 2 \u7684\u503c\u4f1a\u4e0e<code class=\"literal\">border = 2</code>\u4f5c\u76f8\u540c\u5904\u7406\u3002<code class=\"literal\">latex</code>\u548c<code class=\"literal\">latex-longtable</code>\u683c\u5f0f\u8fd8\u5141\u8bb8\u4f7f\u7528\u503c 3\uff0c\u4ee5\u5728\u6570\u636e\u884c\u4e4b\u95f4\u6dfb\u52a0\u5206\u9694\u7ebf\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><em>\u5217</em></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u76ee\u6807\u5bbd\u5ea6\uff0c\u540c\u65f6\u4e5f\u662f\u786e\u5b9a\u8f93\u51fa\u662f\u5426\u8db3\u591f\u5bbd\u4ee5\u9700\u8981\u5206\u9875\u5668\u6216\u5728\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e0b\u5207\u6362\u5230\u5782\u76f4\u663e\u793a\u7684\u5bbd\u5ea6\u9650\u5236\u3002\u96f6\uff08\u9ed8\u8ba4\u503c\uff09\u4f1a\u5bfc\u81f4\u76ee\u6807\u5bbd\u5ea6\u7531\u73af\u5883\u53d8\u91cf<code class=\"envar\">COLUMNS</code>\u63a7\u5236\uff0c\u6216\u8005\u5982\u679c\u672a\u8bbe\u7f6e <code class=\"envar\">COLUMNS</code>\u5219\u7531\u68c0\u6d4b\u5230\u7684\u5c4f\u5e55\u5bbd\u5ea6\u63a7\u5236\u3002\u53e6\u5916\uff0c\u5982\u679c<code class=\"literal\">columns</code>\u4e3a\u96f6\uff0c\u5219<code class=\"literal\">wrapped</code>\u683c\u5f0f\u4ec5\u5f71\u54cd\u5c4f\u5e55\u8f93\u51fa\u3002\u5982\u679c<code class=\"literal\">columns</code>\u4e3a\u975e\u96f6\uff0c\u5219\u6587\u4ef6\u548c\u7ba1\u9053\u8f93\u51fa\u4e5f\u4f1a\u6309\u8be5\u5bbd\u5ea6\u6298\u884c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">csv_fieldsep</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728<acronym class=\"acronym\">CSV</acronym>\u8f93\u51fa\u683c\u5f0f\u4e2d\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u5982\u679c\u5206\u9694\u7b26\u5b57\u7b26\u51fa\u73b0\u5728\u5b57\u6bb5\u7684\u503c\u4e2d\uff0c\u5219\u8be5\u5b57\u6bb5\u5c06\u6839\u636e\u6807\u51c6<acronym class=\"acronym\">CSV</acronym>\u89c4\u5219\u5728\u53cc\u5f15\u53f7\u5185\u8f93\u51fa\u3002\u9ed8\u8ba4\u503c\u662f\u9017\u53f7\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">expanded</code>\uff08\u6216 <code class=\"literal\">x</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff08\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u6269\u5c55\u6a21\u5f0f\uff09\uff0c\u6216\u8005\u662f<code class=\"literal\">auto</code>\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5f00\u542f\u548c\u5173\u95ed\u8bbe\u7f6e\u4e4b\u95f4\u5207\u6362\u3002\u542f\u7528\u6269\u5c55\u6a21\u5f0f\u65f6\uff0c\u67e5\u8be2\u7ed3\u679c\u4ee5\u4e24\u5217\u663e\u793a\uff0c\u5de6\u4fa7\u4e3a\u5217\u540d\uff0c\u53f3\u4fa7\u4e3a\u6570\u636e\u3002\u5982\u679c\u6570\u636e\u5728\u901a\u5e38\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u6a2a\u5411</span>\u201d</span>\u6a21\u5f0f\u4e0b\u65e0\u6cd5\u9002\u5e94\u5c4f\u5e55\uff0c\u8fd9\u79cd\u6a21\u5f0f\u5c31\u5f88\u6709\u7528\u3002\u5728\u81ea\u52a8\u8bbe\u7f6e\u4e0b\uff0c\u5f53\u67e5\u8be2\u8f93\u51fa\u5305\u542b\u591a\u5217\u4e14\u5bbd\u5ea6\u8d85\u8fc7\u5c4f\u5e55\u65f6\uff0c\u4f1a\u4f7f\u7528\u6269\u5c55\u6a21\u5f0f\uff1b\u5426\u5219\u4f7f\u7528\u5e38\u89c4\u6a21\u5f0f\u3002\u81ea\u52a8\u8bbe\u7f6e\u53ea\u5728\u5bf9\u9f50\u548c\u6298\u884c\u683c\u5f0f\u4e2d\u6709\u6548\u3002\u5728\u5176\u4ed6\u683c\u5f0f\u4e2d\uff0c\u5b83\u7684\u884c\u4e3a\u59cb\u7ec8\u4e0e\u5173\u95ed\u6269\u5c55\u6a21\u5f0f\u76f8\u540c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">fieldsep</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u6837\u53ef\u4ee5\u521b\u5efa\u4f8b\u5982\u5236\u8868\u7b26\u5206\u9694\u7684\u8f93\u51fa\uff0c\u8fd9\u53ef\u80fd\u66f4\u7b26\u5408\u5176\u4ed6\u7a0b\u5e8f\u7684\u9700\u8981\u3002\u8981\u5c06\u5236\u8868\u7b26\u8bbe\u7f6e\u4e3a\u5b57\u6bb5\u5206\u9694\u7b26\uff0c\u8bf7\u8f93\u5165<code class=\"literal\">\\pset fieldsep '\\t'</code>\u3002\u9ed8\u8ba4\u5b57\u6bb5\u5206\u9694\u7b26\u662f<code class=\"literal\">'|'</code>\uff08\u7ad6\u7ebf\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">fieldsep_zero</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u8bbe\u7f6e\u4e3a\u96f6\u5b57\u8282\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">footer</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u8868\u683c\u9875\u811a\uff08<code class=\"literal\">(<em class=\"replaceable\"><code>n</code></em> rows)</code>\u8ba1\u6570\uff09\u7684\u663e\u793a\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5207\u6362\u9875\u811a\u663e\u793a\u7684\u5f00\u5173\u72b6\u6001\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">format</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a<code class=\"literal\">aligned</code>\u3001<code class=\"literal\">asciidoc</code>\u3001<code class=\"literal\">csv</code>\u3001<code class=\"literal\">html</code>\u3001<code class=\"literal\">latex</code>\u3001<code class=\"literal\">latex-longtable</code>\u3001<code class=\"literal\">troff-ms</code>\u3001<code class=\"literal\">unaligned</code>\u6216<code class=\"literal\">wrapped</code>\u3002\u5141\u8bb8\u4f7f\u7528\u552f\u4e00\u7f29\u5199\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">aligned</code>\u683c\u5f0f\u662f\u6807\u51c6\u7684\u3001\u9002\u5408\u4eba\u9605\u8bfb\u4e14\u6392\u7248\u6574\u9f50\u7684\u6587\u672c\u8f93\u51fa\uff1b\u8fd9\u662f\u9ed8\u8ba4\u683c\u5f0f\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">unaligned</code>\u683c\u5f0f\u5c06\u4e00\u884c\u4e2d\u7684\u6240\u6709\u5217\u5199\u5728\u4e00\u884c\u4e0a\uff0c\u7531\u5f53\u524d\u6d3b\u52a8\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u5206\u9694\u3002\u8fd9\u5bf9\u4e8e\u521b\u5efa\u53ef\u80fd\u88ab\u5176\u4ed6\u7a0b\u5e8f\u8bfb\u53d6\u7684\u8f93\u51fa\u5f88\u6709\u7528\uff0c\u4f8b\u5982\uff0c\u5236\u8868\u7b26\u5206\u9694\u6216\u9017\u53f7\u5206\u9694\u683c\u5f0f\u3002\u7136\u800c\uff0c\u5982\u679c\u5b57\u6bb5\u5206\u9694\u7b26\u5b57\u7b26\u51fa\u73b0\u5728\u5217\u7684\u503c\u4e2d\uff0c\u5219\u4e0d\u4f1a\u88ab\u7279\u6b8a\u5904\u7406\uff1b\u56e0\u6b64\uff0c<acronym class=\"acronym\">CSV</acronym>\u683c\u5f0f\u53ef\u80fd\u66f4\u9002\u5408\u8fd9\u4e9b\u76ee\u7684\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">csv</code>\u683c\u5f0f<a class=\"indexterm\" id=\"id-1.9.4.19.8.4.10.1.73.2.3.1.8.2.4.2\" name=\"id-1.9.4.19.8.4.10.1.73.2.3.1.8.2.4.2\"></a>\u6309\u9017\u53f7\u5206\u9694\u7684\u5217\u503c\u8f93\u51fa\uff0c\u5e76\u5e94\u7528 <a class=\"ulink\" href=\"https://datatracker.ietf.org/doc/html/rfc4180\" target=\"_top\">RFC 4180</a> \u4e2d\u63cf\u8ff0\u7684\u52a0\u5f15\u53f7\u89c4\u5219\u3002\u6b64\u8f93\u51fa\u4e0e\u670d\u52a1\u5668\u7684CSV\u683c\u5f0f\u7684 <code class=\"command\">COPY</code>\u547d\u4ee4\u517c\u5bb9\u3002\u751f\u6210\u5305\u542b\u5217\u540d\u7684\u8868\u5934\u884c\uff0c\u9664\u975e <code class=\"literal\">tuples_only</code>\u53c2\u6570\u8bbe\u7f6e\u4e3a <code class=\"literal\">on</code>\u3002\u4e0d\u6253\u5370\u8868\u683c\u6807\u9898\u548c\u9875\u811a\u3002\u6bcf\u884c\u4ee5\u7cfb\u7edf\u76f8\u5173\u7684\u884c\u7ed3\u675f\u5b57\u7b26\u7ed3\u675f\uff0c\u5bf9\u4e8e\u7c7bUnix\u7cfb\u7edf\u901a\u5e38\u662f\u5355\u4e2a\u6362\u884c\u7b26\uff08<code class=\"literal\">\\n</code>\uff09\uff0c\u5bf9\u4e8eMicrosoft Windows\u5219\u662f\u56de\u8f66\u548c\u6362\u884c\u5e8f\u5217\uff08<code class=\"literal\">\\r\\n</code>\uff09\u3002\u53ef\u4ee5\u7528<code class=\"command\">\\pset csv_fieldsep</code>\u9009\u62e9\u9017\u53f7\u4ee5\u5916\u7684\u5b57\u6bb5\u5206\u9694\u5b57\u7b26\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">wrapped</code>\u683c\u5f0f\u4e0e<code class=\"literal\">aligned</code>\u76f8\u4f3c\uff0c\u4f46\u4f1a\u5c06\u8f83\u5bbd\u7684\u6570\u636e\u503c\u6298\u6210\u591a\u884c\uff0c\u4f7f\u8f93\u51fa\u9002\u5e94\u76ee\u6807\u5217\u5bbd\u3002\u76ee\u6807\u5bbd\u5ea6\u7684\u786e\u5b9a\u65b9\u5f0f\u89c1<code class=\"literal\">columns</code>\u9009\u9879\u7684\u8bf4\u660e\u3002\u8bf7\u6ce8\u610f\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u5c1d\u8bd5\u5bf9\u5217\u6807\u9898\u6298\u884c\uff1b\u56e0\u6b64\uff0c\u5982\u679c\u5217\u6807\u9898\u6240\u9700\u7684\u603b\u5bbd\u5ea6\u8d85\u8fc7\u76ee\u6807\u5bbd\u5ea6\uff0c<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u884c\u4e3a\u5c31\u4e0e<code class=\"literal\">aligned</code>\u76f8\u540c\u3002</p>\n<p lang=\"zh\">asciidoc\u3001html\u3001latex\u3001latex-longtable \u548c troff-ms \u683c\u5f0f\u8f93\u51fa\u7684\u662f\u53ef\u5d4c\u5165\u76f8\u5e94\u6807\u8bb0\u8bed\u8a00\u6587\u6863\u7684\u8868\u683c\uff0c\u5e76\u975e\u5b8c\u6574\u6587\u6863\u3002HTML \u53ef\u80fd\u4e0d\u8981\u6c42\u5b8c\u6574\u5c01\u88c5\uff0c\u4f46 LaTeX \u5fc5\u987b\u6709\u5b8c\u6574\u6587\u6863\u7ed3\u6784\u3002latex \u4f7f\u7528 LaTeX \u7684 tabular \u73af\u5883\uff1blatex-longtable \u9700\u8981 LaTeX \u7684 longtable \u548c booktabs \u5b8f\u5305\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">linestyle</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u8fb9\u6846\u7ebf\u7ed8\u5236\u6837\u5f0f\u4e3a<code class=\"literal\">ascii</code>\u3001<code class=\"literal\">old-ascii</code>\u6216<code class=\"literal\">unicode</code>\u4e4b\u4e00\u3002\u5141\u8bb8\u4f7f\u7528\u552f\u4e00\u7f29\u5199\u3002\uff08\u8fd9\u610f\u5473\u7740\u4e00\u4e2a\u5b57\u6bcd\u5c31\u8db3\u591f\u4e86\u3002\uff09\u9ed8\u8ba4\u8bbe\u7f6e\u4e3a<code class=\"literal\">ascii</code>\u3002\u6b64\u9009\u9879\u4ec5\u5f71\u54cd<code class=\"literal\">aligned</code>\u548c<code class=\"literal\">wrapped</code>\u8f93\u51fa\u683c\u5f0f\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">ascii</code>\u6837\u5f0f\u4f7f\u7528\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u53f3\u8fb9\u7f18\u7684<code class=\"literal\">+</code>\u7b26\u53f7\u8868\u793a\u3002\u5f53<code class=\"literal\">wrapped</code>\u683c\u5f0f\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u628a\u6570\u636e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u4f1a\u5728\u7b2c\u4e00\u884c\u7684\u53f3\u8fb9\u7f18\u663e\u793a\u4e00\u4e2a\u70b9\uff08<code class=\"literal\">.</code>\uff09\uff0c\u5e76\u5728\u4e0b\u4e00\u884c\u7684\u5de6\u8fb9\u7f18\u518d\u6b21\u663e\u793a\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">old-ascii</code>\u6837\u5f0f\u4f7f\u7528\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\uff0c\u91c7\u7528<span class=\"productname\">PostgreSQL</span> 8.4 \u53ca\u66f4\u65e9\u7248\u672c\u7684\u683c\u5f0f\u6837\u5f0f\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u66ff\u4ee3\u5de6\u4fa7\u5217\u5206\u9694\u7b26\u7684<code class=\"literal\">:</code>\u7b26\u53f7\u8868\u793a\u3002\u5f53\u6570\u636e\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u5219\u7528<code class=\"literal\">;</code>\u7b26\u53f7\u66ff\u4ee3\u5de6\u4fa7\u5217\u5206\u9694\u7b26\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">unicode</code>\u6837\u5f0f\u4f7f\u7528 Unicode \u6846\u7ebf\u7ed8\u5236\u5b57\u7b26\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u53f3\u8fb9\u7f18\u7684\u56de\u8f66\u7b26\u53f7\u8868\u793a\u3002\u5f53\u6570\u636e\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u4f1a\u5728\u7b2c\u4e00\u884c\u7684\u53f3\u8fb9\u7f18\u663e\u793a\u7701\u7565\u53f7\u7b26\u53f7\uff0c\u5e76\u5728\u4e0b\u4e00\u884c\u7684\u5de6\u8fb9\u7f18\u518d\u6b21\u663e\u793a\u3002</p>\n<p lang=\"zh\">\u5f53<code class=\"literal\">border</code>\u8bbe\u7f6e\u5927\u4e8e\u96f6\u65f6\uff0c<code class=\"literal\">linestyle</code>\u9009\u9879\u8fd8\u51b3\u5b9a\u7528\u54ea\u4e9b\u5b57\u7b26\u7ed8\u5236\u8fb9\u6846\u7ebf\u3002\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\u5728\u4efb\u4f55\u73af\u5883\u4e2d\u90fd\u53ef\u7528\uff0c\u4f46\u5728\u652f\u6301 Unicode \u7684\u663e\u793a\u8bbe\u5907\u4e0a\uff0cUnicode \u5b57\u7b26\u66f4\u7f8e\u89c2\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">null</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u7528\u4e8e\u4ee3\u66ff\u7a7a\u503c\u6253\u5370\u7684\u5b57\u7b26\u4e32\u3002\u9ed8\u8ba4\u4e0d\u6253\u5370\u4efb\u4f55\u5185\u5bb9\uff0c\u8fd9\u5f88\u5bb9\u6613\u88ab\u8bef\u8ba4\u4e3a\u7a7a\u5b57\u7b26\u4e32\u3002\u4f8b\u5982\uff0c\u4f60\u53ef\u80fd\u66f4\u559c\u6b22\u4f7f\u7528<code class=\"literal\">\\pset null '(null)'</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">numericlocale</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u4f7f\u7528\u533a\u57df\u8bbe\u7f6e\u7279\u5b9a\u7684\u5b57\u7b26\u6765\u5206\u9694\u5c0f\u6570\u70b9\u5de6\u4fa7\u7684\u6570\u5b57\u7ec4\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5e38\u89c4\u6570\u5b57\u8f93\u51fa\u548c\u533a\u57df\u8bbe\u7f6e\u7279\u5b9a\u7684\u6570\u5b57\u8f93\u51fa\u4e4b\u95f4\u5207\u6362\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">pager</code></span></dt>\n<dd>\n<p lang=\"zh\">\u63a7\u5236\u67e5\u8be2\u548c<span class=\"application\">psql</span>\u5e2e\u52a9\u8f93\u51fa\u662f\u5426\u4f7f\u7528\u5206\u9875\u5668\u7a0b\u5e8f\u3002\u5982\u679c\u8bbe\u7f6e\u4e86\u73af\u5883\u53d8\u91cf<code class=\"envar\">PSQL_PAGER</code>\u6216<code class=\"envar\">PAGER</code>\uff0c\u8f93\u51fa\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u9012\u7ed9\u6307\u5b9a\u7684\u7a0b\u5e8f\u3002\u5426\u5219\uff0c\u4f7f\u7528\u4e0e\u5e73\u53f0\u6709\u5173\u7684\u9ed8\u8ba4\u7a0b\u5e8f\uff08\u5982<code class=\"filename\">more</code>\uff09\u3002</p>\n<p lang=\"zh\">\u5f53 pager \u4e3a off \u65f6\uff0c\u4e0d\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\uff1b\u4e3a on \u65f6\uff0c\u5728\u9002\u5f53\u60c5\u51b5\u4e0b\u4f7f\u7528\uff0c\u5373\u8f93\u51fa\u76ee\u6807\u662f\u7ec8\u7aef\u4e14\u5185\u5bb9\u65e0\u6cd5\u5728\u5c4f\u5e55\u5185\u663e\u793a\u5b8c\u3002\u8bbe\u4e3a always \u65f6\uff0c\u6240\u6709\u7ec8\u7aef\u8f93\u51fa\u5747\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\uff0c\u65e0\u8bba\u662f\u5426\u80fd\u5728\u5c4f\u5e55\u5185\u663e\u793a\u5b8c\u3002\u4e0d\u5e26\u503c\u7684 \\pset pager \u4f1a\u5207\u6362\u5206\u9875\u7684\u5f00\u5173\u72b6\u6001\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">pager_min_lines</code></span></dt>\n<dd>\n<p lang=\"zh\">\u82e5 pager_min_lines \u5927\u4e8e\u5c4f\u5e55\u9875\u9ad8\uff0c\u53ea\u6709\u8f93\u51fa\u884c\u6570\u8fbe\u5230\u8be5\u503c\u65f6\u624d\u8c03\u7528\u5206\u9875\u7a0b\u5e8f\u3002\u9ed8\u8ba4\u503c\u4e3a 0\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">recordsep</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u8bb0\u5f55\uff08\u884c\uff09\u5206\u9694\u7b26\u3002\u9ed8\u8ba4\u4e3a\u6362\u884c\u7b26\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">recordsep_zero</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u8bbe\u7f6e\u4e3a\u96f6\u5b57\u8282\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">tableattr</code>\uff08\u6216 <code class=\"literal\">T</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\u5728<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u4e2d\uff0c\u8fd9\u6307\u5b9a\u8981\u653e\u5728<code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u5c5e\u6027\uff0c\u4f8b\u5982<code class=\"literal\">cellpadding</code>\u6216<code class=\"literal\">bgcolor</code>\u3002\u8bf7\u6ce8\u610f\uff0c\u4f60\u53ef\u80fd\u4e0d\u9700\u8981\u5728\u8fd9\u91cc\u6307\u5b9a<code class=\"literal\">border</code>\uff0c\u56e0\u4e3a<code class=\"literal\">\\pset border</code>\u5df2\u7ecf\u8d1f\u8d23\u5904\u7406\u5b83\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u8868\u683c\u5c5e\u6027\u3002</p>\n<p lang=\"zh\">\u5728<code class=\"literal\">latex-longtable</code>\u683c\u5f0f\u4e2d\uff0c\u8fd9\u63a7\u5236\u6bcf\u4e2a\u5305\u542b\u5de6\u5bf9\u9f50\u6570\u636e\u7c7b\u578b\u7684\u5217\u7684\u5bbd\u5ea6\u6bd4\u4f8b\u3002\u5b83\u4ee5\u7a7a\u767d\u5206\u9694\u7684\u503c\u5217\u8868\u6307\u5b9a\uff0c\u4f8b\u5982<code class=\"literal\">'0.2 0.2 0.6'</code>\u3002\u672a\u6307\u5b9a\u7684\u8f93\u51fa\u5217\u4f7f\u7528\u6700\u540e\u6307\u5b9a\u7684\u503c\u3002</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">title</code>\uff08\u6216 <code class=\"literal\">C</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u968f\u540e\u6253\u5370\u7684\u6240\u6709\u8868\u683c\u7684\u6807\u9898\u3002\u8fd9\u53ef\u4ee5\u4e3a\u8f93\u51fa\u63d0\u4f9b\u63cf\u8ff0\u6027\u6807\u7b7e\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u6807\u9898\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">tuples_only</code>\uff08\u6216 <code class=\"literal\">t</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u4ec5\u5143\u7ec4\u6a21\u5f0f\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5e38\u89c4\u8f93\u51fa\u548c\u4ec5\u5143\u7ec4\u8f93\u51fa\u4e4b\u95f4\u5207\u6362\u3002\u5e38\u89c4\u8f93\u51fa\u5305\u542b\u5217\u6807\u9898\u3001\u8868\u683c\u6807\u9898\u548c\u5404\u79cd\u9875\u811a\u7b49\u9644\u52a0\u4fe1\u606f\u3002\u5728\u4ec5\u5143\u7ec4\u6a21\u5f0f\u4e0b\uff0c\u53ea\u663e\u793a\u5b9e\u9645\u7684\u8868\u683c\u6570\u636e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">unicode_border_linestyle</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u8fb9\u6846\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">unicode_column_linestyle</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u5217\u5206\u9694\u7ebf\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">unicode_header_linestyle</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u8868\u5934\u5206\u9694\u7ebf\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8fd9\u4e9b\u4e0d\u540c\u683c\u5f0f\u7684\u5916\u89c2\u793a\u4f8b\u53ef\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/13/app-psql.html#APP-PSQL-EXAMPLES\" title=\"\u793a\u4f8b\">\u793a\u4f8b</a>\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u6709\u5404\u79cd\u5feb\u6377\u547d\u4ee4\u7528\u4e8e<code class=\"command\">\\pset</code>\u3002\u8bf7\u53c2\u89c1<code class=\"command\">\\a</code>\u3001<code class=\"command\">\\C</code>\u3001<code class=\"command\">\\f</code>\u3001<code class=\"command\">\\H</code>\u3001<code class=\"command\">\\t</code>\u3001<code class=\"command\">\\T</code>\u548c<code class=\"command\">\\x</code>\u3002</p>\n</div>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\q</code> \u6216 <code class=\"literal\">\\quit</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9000\u51fa<span class=\"application\">psql</span>\u7a0b\u5e8f\u3002\u5728\u811a\u672c\u6587\u4ef6\u4e2d\uff0c\u53ea\u4f1a\u7ec8\u6b62\u8be5\u811a\u672c\u7684\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\qecho <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u547d\u4ee4\u4e0e<code class=\"command\">\\echo</code>\u76f8\u540c\uff0c\u53ea\u662f\u8f93\u51fa\u4f1a\u5199\u5165\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u7684\u67e5\u8be2\u8f93\u51fa\u901a\u9053\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\r</code> \u6216 <code class=\"literal\">\\reset</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u91cd\u7f6e\uff08\u6e05\u7a7a\uff09\u67e5\u8be2\u7f13\u51b2\u533a\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\restrict <em class=\"replaceable\"><code>restrict_key</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528\u7ed9\u5b9a\u7684\u5bc6\u94a5\u8fdb\u5165<span class=\"quote\">\u201c<span class=\"quote\">\u53d7\u9650</span>\u201d</span>\u6a21\u5f0f\u3002\u5728\u8be5\u6a21\u5f0f\u4e0b\uff0c\u552f\u4e00\u5141\u8bb8\u7684\u5143\u547d\u4ee4\u662f\u7528\u4e8e\u9000\u51fa\u53d7\u9650\u6a21\u5f0f\u7684<code class=\"command\">\\unrestrict</code>\u3002\u5bc6\u94a5\u53ea\u80fd\u5305\u542b\u5b57\u6bcd\u6570\u5b57\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4e3b\u8981\u7528\u4e8e pg_dump\u3001pg_dumpall \u548c pg_restore \u751f\u6210\u7684\u7eaf\u6587\u672c\u8f6c\u50a8\uff0c\u4e5f\u53ef\u80fd\u9002\u7528\u4e8e\u5176\u4ed6\u573a\u666f\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\s [ <em class=\"replaceable\"><code>filename</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u5386\u53f2\u8bb0\u5f55\u5230<em class=\"replaceable\"><code>filename</code></em>\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5386\u53f2\u8bb0\u5f55\u5c06\u88ab\u5199\u5165\u6807\u51c6\u8f93\u51fa\uff08\u5982\u679c\u9002\u7528\uff0c\u5c06\u4f7f\u7528\u5206\u9875\u5668\uff09\u3002\u5982\u679c<span class=\"application\">psql</span>\u5728\u6784\u5efa\u65f6\u6ca1\u6709\u4f7f\u7528<span class=\"application\">Readline</span>\u652f\u6301\uff0c\u5219\u6b64\u547d\u4ee4\u4e0d\u53ef\u7528\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\set [ <em class=\"replaceable\"><code>name</code></em> [ <em class=\"replaceable\"><code>value</code></em> [ ... ] ] ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06<span class=\"application\">psql</span>\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u8bbe\u7f6e\u4e3a<em class=\"replaceable\"><code>value</code></em>\uff0c\u5982\u679c\u7ed9\u51fa\u591a\u4e2a\u503c\uff0c\u5219\u8bbe\u7f6e\u4e3a\u6240\u6709\u503c\u7684\u4e32\u63a5\u3002\u5982\u679c\u53ea\u7ed9\u51fa\u4e00\u4e2a\u53c2\u6570\uff0c\u5219\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\u503c\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u8bbe\u7f6e\uff0c\u8bf7\u4f7f\u7528<code class=\"command\">\\unset</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\"><code class=\"command\">\\set</code>\u6ca1\u6709\u4efb\u4f55\u53c2\u6570\u65f6\uff0c\u663e\u793a\u5f53\u524d\u8bbe\u7f6e\u7684\u6240\u6709<span class=\"application\">psql</span>\u53d8\u91cf\u7684\u540d\u79f0\u548c\u503c\u3002</p>\n<p lang=\"zh\">\u5408\u6cd5\u7684\u53d8\u91cf\u540d\u53ef\u4ee5\u5305\u542b\u5b57\u6bcd\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u3002\u8be6\u60c5\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/13/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002\u53d8\u91cf\u540d\u533a\u5206\u5927\u5c0f\u5199\u3002</p>\n<p lang=\"zh\">\u67d0\u4e9b\u53d8\u91cf\u662f\u7279\u6b8a\u7684\uff0c\u5b83\u4eec\u63a7\u5236<span class=\"application\">psql</span>\u7684\u884c\u4e3a\uff0c\u6216\u8005\u7531\u7cfb\u7edf\u81ea\u52a8\u8bbe\u7f6e\u4ee5\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u3002\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/13/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u4ecb\u7ecd\u4e86\u8fd9\u4e9b\u53d8\u91cf\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u4e0e<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4<a class=\"xref\" href=\"/docs/13/sql-set.html\" title=\"SET\"><span class=\"refentrytitle\">SET</span></a>\u65e0\u5173\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\setenv <em class=\"replaceable\"><code>name</code></em> [ <em class=\"replaceable\"><code>value</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u4e3a<em class=\"replaceable\"><code>value</code></em>\uff0c\u6216\u8005\u5982\u679c\u672a\u63d0\u4f9b<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3002\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\setenv PAGER less</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>\\setenv LESS -imx4F</code></strong>\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\sf[+] <em class=\"replaceable\"><code>function_description</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u663e\u793a\u6307\u5b9a\u51fd\u6570\u6216\u8fc7\u7a0b\u7684\u5b9a\u4e49\uff0c\u4ee5<code class=\"command\">CREATE OR REPLACE FUNCTION</code>\u6216 <code class=\"command\">CREATE OR REPLACE PROCEDURE</code>\u547d\u4ee4\u7684\u5f62\u5f0f\u5448\u73b0\u3002\u5b9a\u4e49\u5c06\u6253\u5370\u5230\u5f53\u524d\u67e5\u8be2\u8f93\u51fa\u901a\u9053\uff0c\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\">\u76ee\u6807\u51fd\u6570\u53ef\u4ec5\u7528\u540d\u79f0\u6307\u5b9a\uff0c\u4e5f\u53ef\u7528\u540d\u79f0\u548c\u53c2\u6570\u6307\u5b9a\uff0c\u4f8b\u5982 foo(integer, text)\u3002\u82e5\u6709\u591a\u4e2a\u540c\u540d\u51fd\u6570\uff0c\u5219\u5fc5\u987b\u63d0\u4f9b\u53c2\u6570\u7c7b\u578b\u3002</p>\n<p lang=\"zh\">\u5728\u547d\u4ee4\u540d\u540e\u6dfb\u52a0 +\uff0c\u4f1a\u4e3a\u8f93\u51fa\u884c\u7f16\u53f7\uff0c\u51fd\u6570\u4f53\u7b2c\u4e00\u884c\u4e3a\u7b2c 1 \u884c\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\sf</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\sv[+] <em class=\"replaceable\"><code>view_name</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u6307\u5b9a\u89c6\u56fe\u7684\u5b9a\u4e49\uff0c\u5e76\u4ee5<code class=\"command\">CREATE OR REPLACE VIEW</code>\u547d\u4ee4\u7684\u5f62\u5f0f\u663e\u793a\u3002\u5b9a\u4e49\u4f1a\u6253\u5370\u5230\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u7684\u5f53\u524d\u67e5\u8be2\u8f93\u51fa\u901a\u9053\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u547d\u4ee4\u540d\u79f0\u540e\u6dfb\u52a0<code class=\"literal\">+</code>\uff0c\u90a3\u4e48\u8f93\u51fa\u884c\u5c06\u4ece1\u5f00\u59cb\u7f16\u53f7\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\sv</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\t</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u8f93\u51fa\u4e2d\u7684\u5217\u540d\u6807\u9898\u548c\u884c\u6570\u9875\u811a\u7684\u663e\u793a\u72b6\u6001\u3002\u8fd9\u4e2a\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset tuples_only</code>\uff0c\u63d0\u4f9b\u5b83\u662f\u4e3a\u4e86\u4f7f\u7528\u65b9\u4fbf\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\T <em class=\"replaceable\"><code>table_options</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728<acronym class=\"acronym\">HTML</acronym>\u8f93\u51fa\u683c\u5f0f\u4e2d\u653e\u5728<code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u5c5e\u6027\u3002\u8fd9\u4e2a\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset tableattr <em class=\"replaceable\"><code>table_options</code></em></code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\timing [ <em class=\"replaceable\"><code>on</code></em> | <em class=\"replaceable\"><code>off</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5e26\u53c2\u6570\u65f6\uff0c\u5f00\u542f\u6216\u5173\u95ed\u6bcf\u6761 SQL \u8bed\u53e5\u6267\u884c\u8017\u65f6\u7684\u663e\u793a\u3002\u4e0d\u5e26\u53c2\u6570\u65f6\uff0c\u5207\u6362\u663e\u793a\u7684\u5f00\u5173\u72b6\u6001\u3002\u8017\u65f6\u4ee5\u6beb\u79d2\u663e\u793a\uff1b\u8d85\u8fc7 1 \u79d2\u7684\u65f6\u95f4\u95f4\u9694\u8fd8\u4f1a\u4ee5\u5206\u949f:\u79d2\u7684\u683c\u5f0f\u663e\u793a\uff0c\u5fc5\u8981\u65f6\u6dfb\u52a0\u5c0f\u65f6\u548c\u5929\u5b57\u6bb5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\unrestrict <em class=\"replaceable\"><code>restrict_key</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u9000\u51fa<span class=\"quote\">\u201c<span class=\"quote\">\u53d7\u9650</span>\u201d</span>\u6a21\u5f0f\uff08\u5373\u6240\u6709\u5176\u4ed6\u5143\u547d\u4ee4\u90fd\u88ab\u963b\u6b62\u7684\u6a21\u5f0f\uff09\uff0c\u524d\u63d0\u662f\u6307\u5b9a\u7684\u5bc6\u94a5\u4e0e\u8fdb\u5165\u53d7\u9650\u6a21\u5f0f\u65f6\u4f20\u7ed9<code class=\"command\">\\restrict</code>\u7684\u5bc6\u94a5\u5339\u914d\u3002</p>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4e3b\u8981\u7528\u4e8e pg_dump\u3001pg_dumpall \u548c pg_restore \u751f\u6210\u7684\u7eaf\u6587\u672c\u8f6c\u50a8\uff0c\u4e5f\u53ef\u80fd\u9002\u7528\u4e8e\u5176\u4ed6\u573a\u666f\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\unset <em class=\"replaceable\"><code>name</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u53d6\u6d88\u8bbe\u7f6e\uff08\u5220\u9664\uff09<span class=\"application\">psql</span>\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u3002</p>\n<p lang=\"zh\">\u5927\u591a\u6570\u63a7\u5236<span class=\"application\">psql</span>\u884c\u4e3a\u7684\u53d8\u91cf\u4e0d\u80fd\u53d6\u6d88\u8bbe\u7f6e\uff1b\u5bf9\u4e8e\u8fd9\u4e9b\u53d8\u91cf\uff0c<code class=\"literal\">\\unset</code>\u547d\u4ee4\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u5176\u8bbe\u7f6e\u4e3a\u9ed8\u8ba4\u503c\u3002\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/13/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\w</code> \u6216 <code class=\"literal\">\\write</code> <em class=\"replaceable\"><code>filename</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\w</code> \u6216 <code class=\"literal\">\\write</code> <code class=\"literal\">|</code><em class=\"replaceable\"><code>command</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u5199\u5165\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u9012\u7ed9 shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6539\u4e3a\u5199\u5165\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\uff0c\u5219\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u7684\u5185\u5bb9\u53ea\u4f1a\u539f\u6837\u4f20\u9012\u7ed9 shell\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\warn <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u547d\u4ee4\u4e0e<code class=\"command\">\\echo</code>\u547d\u4ee4\u76f8\u540c\uff0c\u53ea\u662f\u8f93\u51fa\u5c06\u88ab\u5199\u5165<span class=\"application\">psql</span>\u7684\u6807\u51c6\u9519\u8bef\u901a\u9053\uff0c\u800c\u4e0d\u662f\u6807\u51c6\u8f93\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\watch [ <em class=\"replaceable\"><code>seconds</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u91cd\u590d\u6267\u884c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\uff08\u5982\u540c <code class=\"literal\">\\g</code> \u4e00\u6837\uff09\uff0c\u76f4\u5230\u88ab\u4e2d\u65ad\u6216\u67e5\u8be2\u5931\u8d25\u3002\u4e24\u6b21\u6267\u884c\u4e4b\u95f4\u7b49\u5f85\u6307\u5b9a\u7684\u79d2\u6570\uff08\u9ed8\u8ba4 2 \u79d2\uff09\u3002\u6bcf\u6b21\u67e5\u8be2\u7ed3\u679c\u90fd\u4f1a\u5e26\u6709\u4e00\u4e2a\u5934\u90e8\uff0c\u5176\u4e2d\u5305\u542b <code class=\"literal\">\\pset title</code> \u5b57\u7b26\u4e32\uff08\u5982\u679c\u6709\uff09\u3001\u67e5\u8be2\u5f00\u59cb\u65f6\u7684\u65f6\u95f4\u4ee5\u53ca\u5ef6\u8fdf\u95f4\u9694\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\x [ <em class=\"replaceable\"><code>on</code></em> | <em class=\"replaceable\"><code>off</code></em> | <em class=\"replaceable\"><code>auto</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u6216\u5207\u6362\u6269\u5c55\u8868\u683c\u683c\u5f0f\u6a21\u5f0f\u3002\u5b83\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset expanded</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\z [ <a class=\"link\" href=\"https://pg.center/docs/13/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u53ca\u5176\u5173\u8054\u7684\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u3002</p>\n<p lang=\"zh\">\u8fd9\u662f<code class=\"command\">\\dp</code>\u7684\u522b\u540d\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u663e\u793a\u6743\u9650</span>\u201d</span>\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\! [ <em class=\"replaceable\"><code>command</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u5e26\u53c2\u6570\u65f6\uff0c\u8fdb\u5165\u4e00\u4e2a\u5b50 shell\uff1b\u5b50 shell \u9000\u51fa\u540e\uff0c<span class=\"application\">psql</span>\u6062\u590d\u8fd0\u884c\u3002\u5e26\u53c2\u6570\u65f6\uff0c\u6267\u884c shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\!</code>\u7684\u53c2\u6570\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u5185\u5bb9\u4f1a\u539f\u6837\u4f20\u7ed9 shell\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\? [ <em class=\"replaceable\"><code>topic</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5e2e\u52a9\u4fe1\u606f\u3002\u53ef\u9009\u7684<em class=\"replaceable\"><code>topic</code></em>\u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a<code class=\"literal\">commands</code>\uff09\u9009\u62e9\u8981\u89e3\u91ca\u7684<span class=\"application\">psql</span>\u7684\u54ea\u4e2a\u90e8\u5206\uff1a<code class=\"literal\">commands</code>\u63cf\u8ff0<span class=\"application\">psql</span>\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b<code class=\"literal\">options</code>\u63cf\u8ff0\u53ef\u4ee5\u4f20\u9012\u7ed9<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c<code class=\"literal\">variables</code>\u663e\u793a\u5173\u4e8e<span class=\"application\">psql</span>\u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\;</code></span></dt>\n<dd>\n<p lang=\"zh\">\u53cd\u659c\u7ebf\u52a0\u5206\u53f7\u5e76\u4e0d\u662f\u4e0e\u524d\u8ff0\u547d\u4ee4\u76f8\u540c\u7684\u5143\u547d\u4ee4\uff1b\u5b83\u53ea\u662f\u5c06\u4e00\u4e2a\u5206\u53f7\u6dfb\u52a0\u5230\u67e5\u8be2\u7f13\u51b2\u533a\uff0c\u800c\u4e0d\u8fdb\u884c\u4efb\u4f55\u8fdb\u4e00\u6b65\u5904\u7406\u3002</p>\n<p lang=\"zh\">\u901a\u5e38\uff0c<span class=\"application\">psql</span>\u4e00\u9047\u5230\u7ed3\u675f\u547d\u4ee4\u7684\u5206\u53f7\uff0c\u5c31\u4f1a\u5c06 SQL \u547d\u4ee4\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u5373\u4f7f\u5f53\u524d\u884c\u4ecd\u6709\u66f4\u591a\u8f93\u5165\u4e5f\u662f\u5982\u6b64\u3002\u4f8b\u5982\uff0c\u8f93\u5165</p>\n<pre class=\"programlisting\">select 1; select 2; select 3;\n</pre>\n<p lang=\"zh\">\u4f1a\u5c06\u8fd9\u4e09\u6761 SQL \u547d\u4ee4\u5206\u522b\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u6bcf\u6761\u547d\u4ee4\u7684\u7ed3\u679c\u4f1a\u5728\u7ee7\u7eed\u5904\u7406\u4e0b\u4e00\u6761\u547d\u4ee4\u4e4b\u524d\u663e\u793a\u3002\u4e0d\u8fc7\uff0c\u4ee5\u4ee5\u4e0b\u5f62\u5f0f\u8f93\u5165\u7684\u5206\u53f7\uff1a<code class=\"literal\">\\;</code>\uff0c\u4e0d\u4f1a\u89e6\u53d1\u547d\u4ee4\u5904\u7406\uff0c\u56e0\u6b64\u5b83\u524d\u540e\u7684\u547d\u4ee4\u5b9e\u9645\u4e0a\u4f1a\u5408\u5e76\u5230\u4e00\u4e2a\u8bf7\u6c42\u4e2d\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u3002\u4f8b\u5982\uff0c\u8f93\u5165</p>\n<pre class=\"programlisting\">select 1\\; select 2\\; select 3;\n</pre>\n<p lang=\"zh\">\u4f1a\u5728\u9047\u5230\u672a\u52a0\u53cd\u659c\u7ebf\u7684\u5206\u53f7\u65f6\uff0c\u5c06\u8fd9\u4e09\u6761 SQL \u547d\u4ee4\u4f5c\u4e3a\u4e00\u4e2a\u8bf7\u6c42\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u3002\u670d\u52a1\u5668\u4f1a\u5c06\u8fd9\u6837\u7684\u8bf7\u6c42\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff0c\u9664\u975e\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u663e\u5f0f\u7684<code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code>\u547d\u4ee4\uff0c\u5c06\u5176\u5212\u5206\u4e3a\u591a\u4e2a\u4e8b\u52a1\u3002\uff08\u6709\u5173\u670d\u52a1\u5668\u5982\u4f55\u5904\u7406\u591a\u67e5\u8be2\u5b57\u7b26\u4e32\u7684\u66f4\u591a\u7ec6\u8282\uff0c\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/13/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT\" title=\"52.2.2.1.\u00a0\u4e00\u4e2a\u7b80\u5355\u67e5\u8be2\u4e2d\u7684\u591a\u6761\u8bed\u53e5\">\u7b2c\u00a052.2.2.1\u00a0\u8282</a>\u3002\uff09<span class=\"application\">psql</span>\u5bf9\u6bcf\u4e2a\u8bf7\u6c42\u53ea\u6253\u5370\u6536\u5230\u7684\u6700\u540e\u4e00\u4e2a\u67e5\u8be2\u7ed3\u679c\uff1b\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u867d\u7136\u4e09\u6761<code class=\"command\">SELECT</code>\u547d\u4ee4\u786e\u5b9e\u90fd\u4f1a\u6267\u884c\uff0c\u4f46<span class=\"application\">psql</span>\u53ea\u6253\u5370<code class=\"literal\">3</code>\u3002</p>\n</dd>\n</dl>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-PATTERNS\">\n<h4 lang=\"zh\">\u6a21\u5f0f</h4>\n<p lang=\"zh\">\u5f88\u591a<code class=\"literal\">\\d</code>\u547d\u4ee4\u90fd\u53ef\u4ee5\u7528\u4e00\u4e2a<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\u6765\u6307\u5b9a\u8981\u88ab\u663e\u793a\u7684\u5bf9\u8c61\u540d\u79f0\u3002\u5728\u6700\u7b80\u5355\u7684\u60c5\u51b5\u4e0b\uff0c\u6a21\u5f0f\u6b63\u597d\u5c31\u662f\u8be5\u5bf9\u8c61\u7684\u51c6\u786e\u540d\u79f0\u3002\u5728\u6a21\u5f0f\u4e2d\u7684\u5b57\u7b26\u901a\u5e38\u4f1a\u88ab\u53d8\u6210\u5c0f\u5199\u5f62\u5f0f\uff08\u5c31\u50cf\u5728 SQL \u540d\u79f0\u4e2d\u90a3\u6837\uff09\uff0c\u4f8b\u5982<code class=\"literal\">\\dt FOO</code>\u5c06\u4f1a\u663e\u793a\u540d\u4e3a<code class=\"literal\">foo</code>\u7684\u8868\u3002\u5c31\u50cf\u5728 SQL \u540d\u79f0\u4e2d\u90a3\u6837\uff0c\u628a\u6a21\u5f0f\u653e\u5728\u53cc\u5f15\u53f7\u4e2d\u53ef\u4ee5\u963b\u6b62\u5b83\u88ab\u8f6c\u6362\u6210\u5c0f\u5199\u5f62\u5f0f\u3002\u5982\u679c\u9700\u8981\u5728\u4e00\u4e2a\u6a21\u5f0f\u4e2d\u5305\u62ec\u4e00\u4e2a\u771f\u6b63\u7684\u53cc\u5f15\u53f7\u5b57\u7b26\uff0c\u5219\u9700\u8981\u5728\u53cc\u5f15\u53f7\u5305\u56f4\u7684\u6587\u672c\u5185\u628a\u5b83\u5199\u6210\u4e24\u4e2a\u76f8\u90bb\u7684\u53cc\u5f15\u53f7\uff0c\u8fd9\u540c\u6837\u662f\u7b26\u5408 SQL \u52a0\u5f15\u53f7\u6807\u8bc6\u7b26\u7684\u89c4\u5219\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dt \"FOO\"\"BAR\"</code>\u5c06\u663e\u793a\u540d\u4e3a<code class=\"literal\">FOO\"BAR</code>\uff08\u4e0d\u662f<code class=\"literal\">foo\"bar</code>\uff09\u7684\u8868\u3002\u548c\u666e\u901a\u7684 SQL \u540d\u79f0\u89c4\u5219\u4e0d\u540c\uff0c\u4f60\u53ef\u4ee5\u53ea\u5728\u6a21\u5f0f\u7684\u4e00\u90e8\u5206\u5468\u56f4\u653e\u4e0a\u53cc\u5f15\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">\\dt FOO\"FOO\"BAR</code>\u5c06\u4f1a\u663e\u793a\u540d\u4e3a<code class=\"literal\">fooFOObar</code>\u7684\u8868\u3002</p>\n<p lang=\"zh\">\u53ea\u8981\u5b8c\u5168\u7701\u7565<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\uff0c<code class=\"literal\">\\d</code>\u547d\u4ee4\u5c31\u4f1a\u663e\u793a\u5f53\u524d\u6a21\u5f0f\u641c\u7d22\u8def\u5f84\u4e2d\u53ef\u89c1\u7684\u5168\u90e8\u5bf9\u8c61 \u2014 \u8fd9\u7b49\u4ef7\u4e8e\u7528<code class=\"literal\">*</code>\u4f5c\u4e3a\u6a21\u5f0f\uff08\u5982\u679c\u4e00\u4e2a\u5bf9\u8c61\u6240\u5728\u7684\u6a21\u5f0f\u4f4d\u4e8e\u641c\u7d22\u8def\u5f84\u4e2d\uff0c\u5e76\u4e14\u5728\u641c\u7d22\u8def\u5f84\u4e2d\u8be5\u6a21\u5f0f\u4e4b\u524d\u6ca1\u6709\u540c\u7c7b\u4e14\u540c\u540d\u7684\u5bf9\u8c61\uff0c\u5219\u8be5\u5bf9\u8c61\u5c31\u662f<em class=\"firstterm\">\u53ef\u89c1</em>\u7684\u3002\u8fd9\u8868\u793a\u53ef\u4ee5\u76f4\u63a5\u7528\u540d\u79f0\u5f15\u7528\u8be5\u5bf9\u8c61\uff0c\u800c\u4e0d\u9700\u8981\u7528\u6a21\u5f0f\u6765\u9650\u5b9a\uff09\u3002\u8981\u67e5\u770b\u6570\u636e\u5e93\u4e2d\u6240\u6709\u5bf9\u8c61\u800c\u4e0d\u8003\u8651\u5176\u53ef\u89c1\u6027\uff0c\u53ef\u4ee5\u628a<code class=\"literal\">*.*</code>\u7528\u4f5c\u6a21\u5f0f\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u653e\u5728\u4e00\u4e2a\u6a21\u5f0f\u4e2d\uff0c<code class=\"literal\">*</code>\u5c06\u5339\u914d\u4efb\u610f\u5b57\u7b26\u5e8f\u5217\uff08\u5305\u62ec\u7a7a\u5e8f\u5217\uff09\uff0c\u800c<code class=\"literal\">?</code>\u4f1a\u5339\u914d\u4efb\u610f\u7684\u5355\u4e2a\u5b57\u7b26\uff08\u8fd9\u79cd\u8bb0\u53f7\u65b9\u6cd5\u5c31\u50cf Unix shell \u7684\u6587\u4ef6\u540d\u6a21\u5f0f\u4e00\u6837\uff09\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dt int*</code>\u4f1a\u663e\u793a\u540d\u79f0\u4ee5<code class=\"literal\">int</code>\u5f00\u59cb\u7684\u8868\u3002\u4f46\u662f\u5982\u679c\u88ab\u653e\u5728\u53cc\u5f15\u53f7\u5185\uff0c<code class=\"literal\">*</code>\u548c<code class=\"literal\">?</code>\u5c31\u4f1a\u5931\u53bb\u8fd9\u4e9b\u7279\u6b8a\u542b\u4e49\u800c\u53d8\u6210\u666e\u901a\u7684\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u5305\u542b\u70b9\u53f7\uff08.\uff09\u7684\u6a21\u5f0f\u4f1a\u88ab\u89e3\u91ca\u4e3a\u6a21\u5f0f\u540d\u5339\u914d\u6a21\u5f0f\uff0c\u540e\u63a5\u5bf9\u8c61\u540d\u5339\u914d\u6a21\u5f0f\u3002\u4f8b\u5982\uff0c\\dt foo*.*bar* \u4f1a\u663e\u793a\u6240\u6709\u6a21\u5f0f\u540d\u4ee5 foo \u5f00\u5934\u3001\u8868\u540d\u5305\u542b bar \u7684\u8868\u3002\u6ca1\u6709\u70b9\u53f7\u65f6\uff0c\u53ea\u5339\u914d\u5f53\u524d\u6a21\u5f0f\u641c\u7d22\u8def\u5f84\u4e2d\u53ef\u89c1\u7684\u5bf9\u8c61\u3002\u540c\u6837\uff0c\u53cc\u5f15\u53f7\u5185\u7684\u70b9\u53f7\u4e0d\u5177\u6709\u7279\u6b8a\u542b\u4e49\uff0c\u6309\u5b57\u9762\u5339\u914d\u3002</p>\n<p lang=\"zh\">\u9ad8\u7ea7\u7528\u6237\u53ef\u4ee5\u4f7f\u7528\u5b57\u7b26\u7c7b\u7b49\u6b63\u5219\u8868\u8fbe\u5f0f\u8bb0\u6cd5\uff0c\u5982<code class=\"literal\">[0-9]</code>\u53ef\u4ee5\u5339\u914d\u4efb\u610f\u6570\u5b57\u3002\u6240\u6709\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u90fd\u6309\u7167<a class=\"xref\" href=\"/docs/13/functions-matching.html#FUNCTIONS-POSIX-REGEXP\" title=\"9.7.3.\u00a0POSIX\u6b63\u5219\u8868\u8fbe\u5f0f\">\u7b2c\u00a09.7.3\u00a0\u8282</a>\u6240\u8bf4\u7684\u5de5\u4f5c\uff0c\u4ee5\u4e0b\u5b57\u7b26\u9664\u5916\uff1a<code class=\"literal\">.</code>\u4f1a\u6309\u7167\u4e0a\u9762\u6240\u8bf4\u7684\u4f5c\u4e3a\u4e00\u79cd\u5206\u9694\u7b26\uff0c<code class=\"literal\">*</code>\u4f1a\u88ab\u7ffb\u8bd1\u6210\u6b63\u5219\u8868\u8fbe\u5f0f\u8bb0\u53f7<code class=\"literal\">.*</code>\uff0c<code class=\"literal\">?</code>\u4f1a\u88ab\u7ffb\u8bd1\u6210<code class=\"literal\">.</code>\uff0c\u800c<code class=\"literal\">$</code>\u5219\u6309\u5b57\u9762\u610f\u601d\u5339\u914d\u3002\u6839\u636e\u9700\u8981\uff0c\u53ef\u4ee5\u7528<code class=\"literal\">?</code>\u6a21\u62df<code class=\"literal\">.</code>\uff0c\u7528<code class=\"literal\">(<em class=\"replaceable\"><code>R</code></em>+|)</code>\u6a21\u62df<code class=\"literal\"><em class=\"replaceable\"><code>R</code></em>*</code>\uff0c\u6216\u7528<code class=\"literal\">(<em class=\"replaceable\"><code>R</code></em>|)</code>\u6a21\u62df<code class=\"literal\"><em class=\"replaceable\"><code>R</code></em>?</code>\u3002<code class=\"literal\">$</code>\u4e0d\u9700\u8981\u4f5c\u4e3a\u4e00\u4e2a\u6b63\u5219\u8868\u8fbe\u5f0f\u5b57\u7b26\uff0c\u56e0\u4e3a\u6a21\u5f0f\u5fc5\u987b\u5339\u914d\u6574\u4e2a\u540d\u79f0\uff0c\u800c\u4e0d\u662f\u50cf\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5e38\u89c4\u7528\u6cd5\u90a3\u6837\u89e3\u91ca\uff08\u6362\u53e5\u8bdd\u8bf4\uff0c<code class=\"literal\">$</code>\u4f1a\u88ab\u81ea\u52a8\u5730\u8ffd\u52a0\u5230\u6a21\u5f0f\u4e0a\uff09\u3002\u5982\u679c\u4e0d\u5e0c\u671b\u8be5\u6a21\u5f0f\u7684\u5339\u914d\u4f4d\u7f6e\u88ab\u56fa\u5b9a\uff0c\u53ef\u4ee5\u5728\u5f00\u5934\u6216\u8005\u7ed3\u5c3e\u5199\u4e0a<code class=\"literal\">*</code>\u3002\u6ce8\u610f\u5728\u53cc\u5f15\u53f7\u5185\uff0c\u6240\u6709\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u4f1a\u5931\u53bb\u5176\u7279\u6b8a\u542b\u4e49\u5e76\u4e14\u6309\u7167\u5176\u5b57\u9762\u610f\u601d\u8fdb\u884c\u5339\u914d\u3002\u8fd8\u6709\uff0c\u5728\u64cd\u4f5c\u7b26\u540d\u79f0\u6a21\u5f0f\u4e2d\uff08\u5373\u4f5c\u4e3a<code class=\"literal\">\\do</code>\u7684\u53c2\u6570\uff09\uff0c\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u4e5f\u6309\u7167\u5b57\u9762\u610f\u601d\u8fdb\u884c\u5339\u914d\u3002</p>\n</div>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.19.8.5\">\n<h3 lang=\"zh\">\u9ad8\u7ea7\u7279\u6027</h3>\n<div class=\"refsect3\" id=\"APP-PSQL-VARIABLES\">\n<h4 lang=\"zh\">\u53d8\u91cf</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u63d0\u4f9b\u4e86\u548c\u666e\u901a Unix \u547d\u4ee4 shell \u76f8\u4f3c\u7684\u53d8\u91cf\u66ff\u6362\u7279\u6027\u3002\u53d8\u91cf\u7b80\u5355\u6765\u8bf4\u5c31\u662f\u4e00\u5bf9\u540d\u79f0/\u503c\uff0c\u5176\u4e2d\u503c\u53ef\u4ee5\u662f\u4efb\u610f\u957f\u5ea6\u7684\u4efb\u610f\u5b57\u7b26\u4e32\u3002\u540d\u79f0\u5fc5\u987b\u7531\u5b57\u6bcd\uff08\u5305\u62ec\u975e\u62c9\u4e01\u5b57\u6bcd\uff09\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u6784\u6210\u3002</p>\n<p lang=\"zh\">\u8981\u8bbe\u7f6e\u4e00\u4e2a\u53d8\u91cf\uff0c\u53ef\u4ee5\u4f7f\u7528<span class=\"application\">psql</span>\u7684\u5143\u547d\u4ee4<code class=\"command\">\\set</code>\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo bar</code></strong>\n</pre>\n<p lang=\"zh\">\u4f1a\u5c06<code class=\"literal\">foo</code>\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">bar</code>\u3002\u8981\u68c0\u7d22\u8be5\u53d8\u91cf\u7684\u5185\u5bb9\uff0c\u53ef\u4ee5\u5728\u540d\u79f0\u524d\u653e\u4e00\u4e2a\u5192\u53f7\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\echo :foo</code></strong>\nbar\n</pre>\n<p lang=\"zh\">\u8fd9\u5728\u5e38\u89c4 SQL \u547d\u4ee4\u548c\u5143\u547d\u4ee4\u4e2d\u5747\u6709\u6548\uff0c\u4e0b\u6587\u7684<a class=\"xref\" href=\"/docs/13/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL \u63d2\u503c\">SQL \u63d2\u503c</a>\u4e2d\u6709\u66f4\u591a\u7ec6\u8282\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u8c03\u7528<code class=\"command\">\\set</code>\u65f6\u6ca1\u6709\u7b2c\u4e8c\u4e2a\u53c2\u6570\uff0c\u8be5\u53d8\u91cf\u4f1a\u88ab\u8bbe\u7f6e\u4e3a\u4e00\u4e2a\u7a7a\u5b57\u7b26\u4e32\u503c\u3002\u8981\u53d6\u6d88\u8bbe\u7f6e\uff08\u5373\u5220\u9664\uff09\u4e00\u4e2a\u53d8\u91cf\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4<code class=\"command\">\\unset</code>\u3002\u8981\u663e\u793a\u6240\u6709\u53d8\u91cf\u7684\u503c\uff0c\u5728\u8c03\u7528<code class=\"command\">\\set</code>\u65f6\u4e0d\u5e26\u4efb\u4f55\u53c2\u6570\u5373\u53ef\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\"><code class=\"command\">\\set</code>\u7684\u53c2\u6570\u670d\u4ece\u4e0e\u5176\u4ed6\u547d\u4ee4\u76f8\u540c\u7684\u66ff\u6362\u89c4\u5219\u3002\u56e0\u6b64\u53ef\u4ee5\u6784\u9020\u6709\u8da3\u7684\u5f15\u7528\uff0c\u4f8b\u5982<code class=\"literal\">\\set :foo 'something'</code>\u4ee5\u53ca\u5206\u522b\u5f97\u5230<span class=\"productname\">Perl</span>\u6216\u8005<span class=\"productname\"><acronym class=\"acronym\">PHP</acronym></span>\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u8f6f\u94fe\u63a5</span>\u201d</span>\u6216\u8005<span class=\"quote\">\u201c<span class=\"quote\">\u53ef\u53d8\u53d8\u91cf</span>\u201d</span>\u3002\u4e0d\u5e78\u7684\u662f\uff08\u6216\u8005\u5e78\u8fd0\u7684\u662f\uff1f\uff09\uff0c\u8fd9\u4e9b\u6784\u9020\u51fa\u6765\u7684\u4e1c\u897f\u5e76\u6ca1\u6709\u4ec0\u4e48\u7528\u5904\u3002\u5728\u53e6\u4e00\u65b9\u9762\uff0c<code class=\"literal\">\\set bar :foo</code>\u662f\u4e00\u79cd\u5f88\u597d\u7684\u62f7\u8d1d\u53d8\u91cf\u7684\u65b9\u6cd5\u3002</p>\n</div>\n<p lang=\"zh\">\u6709\u4e00\u4e9b\u53d8\u91cf\u4f1a\u88ab<span class=\"application\">psql</span>\u7279\u6b8a\u5bf9\u5f85\u3002\u5b83\u4eec\u8868\u793a\u7279\u5b9a\u7684\u9009\u9879\u8bbe\u7f6e\uff0c\u8fd0\u884c\u65f6\u8fd9\u7c7b\u9009\u9879\u8bbe\u7f6e\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539\u8be5\u53d8\u91cf\u7684\u503c\u6765\u6539\u53d8\uff0c\u6216\u8005\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u5b83\u4eec\u8868\u793a<span class=\"application\">psql</span>\u7684\u53ef\u66f4\u6539\u7684\u72b6\u6001\u3002\u6309\u7167\u60ef\u4f8b\uff0c\u6240\u6709\u88ab\u7279\u6b8a\u5bf9\u5f85\u7684\u53d8\u91cf\u7684\u540d\u79f0\u7531\u5168\u90e8\u5927\u5199\u5f62\u5f0f\u7684 ASCII \u5b57\u6bcd\uff08\u8fd8\u6709\u53ef\u80fd\u662f\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\uff09\u7ec4\u6210\u3002\u4e3a\u4e86\u786e\u4fdd\u672a\u6765\u6700\u5927\u7684\u517c\u5bb9\u6027\uff0c\u6700\u597d\u907f\u514d\u628a\u8fd9\u7c7b\u53d8\u91cf\u540d\u7528\u4e8e\u81ea\u5df1\u7684\u76ee\u7684\u3002</p>\n<p lang=\"zh\">\u63a7\u5236<span class=\"application\">psql</span>\u884c\u4e3a\u7684\u53d8\u91cf\u901a\u5e38\u4e0d\u80fd\u88ab\u53d6\u6d88\u8bbe\u7f6e\u6216\u8005\u8bbe\u7f6e\u4e3a\u65e0\u6548\u503c\u3002\u5141\u8bb8<code class=\"literal\">\\unset</code>\u547d\u4ee4\uff0c\u4f46\u5b83\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u5b83\u7684\u9ed8\u8ba4\u503c\u3002\u6ca1\u6709\u7b2c\u4e8c\u53c2\u6570\u7684<code class=\"literal\">\\set</code>\u547d\u4ee4\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\uff08\u5bf9\u4e8e\u63a5\u53d7\u8be5\u503c\u7684\u63a7\u5236\u53d8\u91cf\uff09\uff0c\u5bf9\u4e0d\u63a5\u53d7\u8be5\u503c\u7684\u53d8\u91cf\u5219\u4f1a\u62d2\u7edd\u8fd9\u4e2a\u547d\u4ee4\u3002\u6b64\u5916\uff0c\u63a5\u53d7\u503c<code class=\"literal\">on</code>\u548c<code class=\"literal\">off</code>\u7684\u63a7\u5236\u53d8\u91cf\u4e5f\u80fd\u63a5\u53d7\u5176\u4ed6\u5e38\u89c1\u7684\u5e03\u5c14\u503c\u62fc\u5199\u65b9\u5f0f\uff0c\u4f8b\u5982<code class=\"literal\">true</code>\u548c<code class=\"literal\">false</code>\u3002</p>\n<p lang=\"zh\">\u88ab\u7279\u6b8a\u5bf9\u5f85\u7684\u53d8\u91cf\u662f\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"varname\">AUTOCOMMIT</code> </span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\uff08\u9ed8\u8ba4\uff09\u65f6\uff0c\u6bcf\u4e00\u4e2a SQL \u547d\u4ee4\u5728\u6210\u529f\u5b8c\u6210\u65f6\u4f1a\u88ab\u81ea\u52a8\u63d0\u4ea4\u3002\u5728\u8fd9\u79cd\u6a21\u5f0f\u4e2d\u8981\u63a8\u8fdf\u63d0\u4ea4\uff0c\u5fc5\u987b\u8f93\u5165\u4e00\u4e2a<code class=\"command\">BEGIN</code>\u6216\u8005<code class=\"command\">START TRANSACTION</code> SQL \u547d\u4ee4\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">off</code>\u6216\u8005\u88ab\u53d6\u6d88\u8bbe\u7f6e\u65f6\uff0c\u5728\u663e\u5f0f\u53d1\u51fa<code class=\"command\">COMMIT</code>\u6216\u8005<code class=\"command\">END</code>\u4e4b\u524d\uff0cSQL \u547d\u4ee4\u4e0d\u4f1a\u88ab\u63d0\u4ea4\u3002\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u4f1a\u4e3a\u4f60\u53d1\u51fa\u4e00\u4e2a\u9690\u5f0f\u7684<code class=\"command\">BEGIN</code>\uff0c\u8fd9\u4f1a\u53d1\u751f\u5728\u4efb\u4f55\u4e0d\u5728\u4e00\u4e2a\u4e8b\u52a1\u5757\u4e2d\u4e14\u672c\u8eab\u65e2\u4e0d\u662f<code class=\"command\">BEGIN</code>\u53ca\u5176\u4ed6\u4e8b\u52a1\u63a7\u5236\u547d\u4ee4\u4e14\u4e0d\u662f\u65e0\u6cd5\u5728\u4e8b\u52a1\u5757\u4e2d\u6267\u884c\u7684\u547d\u4ee4\uff08\u4f8b\u5982<code class=\"command\">VACUUM</code>\uff09\u4e4b\u524d\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u4e2d\uff0c\u5fc5\u987b\u901a\u8fc7<code class=\"command\">ABORT</code>\u6216\u8005<code class=\"command\">ROLLBACK</code>\u663e\u5f0f\u5730\u653e\u5f03\u4efb\u4f55\u5931\u8d25\u7684\u4e8b\u52a1\u3002\u8fd8\u8981\u8bb0\u4f4f\uff0c\u5982\u679c\u9000\u51fa\u4f1a\u8bdd\u65f6\u6ca1\u6709\u63d0\u4ea4\uff0c\u5219\u6240\u6709\u7684\u5de5\u4f5c\u90fd\u4f1a\u4e22\u5931\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u81ea\u52a8\u63d0\u4ea4\u6253\u5f00\u6a21\u5f0f\u662f<span class=\"productname\">PostgreSQL</span>\u7684\u4f20\u7edf\u884c\u4e3a\uff0c\u4f46\u662f\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u66f4\u63a5\u8fd1\u4e8e SQL \u7684\u89c4\u8303\u3002\u5982\u679c\u66f4\u559c\u6b22\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\uff0c\u53ef\u4ee5\u5728\u7cfb\u7edf\u7ea7\u7684<code class=\"filename\">psqlrc</code>\u6587\u4ef6\u6216\u8005\u4e2a\u4eba\u7684<code class=\"filename\">~/.psqlrc</code>\u6587\u4ef6\u4e2d\u8bbe\u7f6e\u5b83\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">COMP_KEYWORD_CASE</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u786e\u5b9a\u5728\u8865\u5168\u4e00\u4e2a SQL \u5173\u952e\u8bcd\u65f6\u8981\u4f7f\u7528\u7684\u5927\u5c0f\u5199\u5f62\u5f0f\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">lower</code>\u6216\u8005<code class=\"literal\">upper</code>\uff0c\u8865\u5168\u540e\u7684\u8bcd\u5c06\u5206\u522b\u662f\u5c0f\u5199\u6216\u8005\u5927\u5199\u5f62\u5f0f\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">preserve-lower</code>\u6216\u8005<code class=\"literal\">preserve-upper</code>\uff08\u9ed8\u8ba4\uff09\uff0c\u8865\u5168\u540e\u7684\u8bcd\u5c06\u4f1a\u4fdd\u6301\u8be5\u8bcd\u5df2\u8f93\u5165\u90e8\u5206\u7684\u5927\u5c0f\u5199\u5f62\u5f0f\uff0c\u4f46\u662f\u5982\u679c\u88ab\u8865\u5168\u7684\u8bcd\u8fd8\u6ca1\u6709\u88ab\u8f93\u5165\uff0c\u5219\u5b83\u4f1a\u88ab\u5206\u522b\u8865\u5168\u6210\u5c0f\u5199\u6216\u8005\u5927\u5199\u5f62\u5f0f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">DBNAME</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u5df2\u8fde\u63a5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u662f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ECHO</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">all</code>\uff0c\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u4f1a\u5728\u8bfb\u5165\u65f6\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u8bfb\u53d6\u7684\u884c\uff09\u3002\u8981\u5728\u7a0b\u5e8f\u5f00\u59cb\u65f6\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\uff0c\u53ef\u4ee5\u4f7f\u7528\u5f00\u5173<code class=\"option\">-a</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">queries</code>\uff0c<span class=\"application\">psql</span>\u4f1a\u5728\u53d1\u9001\u6bcf\u4e2a\u67e5\u8be2\u7ed9\u670d\u52a1\u5668\u65f6\u5c06\u5b83\u4eec\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\u3002\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\u7684\u5f00\u5173\u662f<code class=\"option\">-e</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">errors</code>\uff0c\u90a3\u4e48\u53ea\u6709\u5931\u8d25\u7684\u67e5\u8be2\u4f1a\u88ab\u663e\u793a\u5728\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u4e0a\u3002\u8fd9\u79cd\u884c\u4e3a\u7684\u5f00\u5173\u662f<code class=\"option\">-b</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">none</code>\uff08\u9ed8\u8ba4\u503c\uff09\u5219\u4e0d\u4f1a\u663e\u793a\u4efb\u4f55\u67e5\u8be2\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ECHO_HIDDEN</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u4e14\u4e00\u4e2a\u53cd\u659c\u7ebf\u547d\u4ee4\u67e5\u8be2\u6570\u636e\u5e93\u65f6\uff0c\u76f8\u5e94\u7684\u67e5\u8be2\u4f1a\u88ab\u5148\u663e\u793a\u3002\u8fd9\u79cd\u7279\u6027\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u5b66\u4e60<span class=\"productname\">PostgreSQL</span>\u7684\u5185\u90e8\u5e76\u4e14\u5728\u81ea\u5df1\u7684\u7a0b\u5e8f\u4e2d\u63d0\u4f9b\u7c7b\u4f3c\u7684\u529f\u80fd\uff08\u8981\u5728\u7a0b\u5e8f\u5f00\u59cb\u65f6\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\uff0c\u53ef\u4ee5\u4f7f\u7528\u5f00\u5173<code class=\"option\">-E</code>\uff09\u3002\u5982\u679c\u628a\u8fd9\u4e2a\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">noexec</code>\uff0c\u5219\u5bf9\u5e94\u7684\u67e5\u8be2\u53ea\u4f1a\u88ab\u663e\u793a\u800c\u5e76\u4e0d\u771f\u6b63\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u6267\u884c\u3002\u9ed8\u8ba4\u503c\u662f<code class=\"literal\">off</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ENCODING</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u7684\u5ba2\u6237\u7aef\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u6bcf\u4e00\u6b21\u4f60\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\uff09\u65f6\u4ee5\u53ca\u5f53\u4f60\u7528<code class=\"literal\">\\encoding</code>\u66f4\u6539\u7f16\u7801\u65f6\uff0c\u8fd9\u4e2a\u53d8\u91cf\u90fd\u4f1a\u88ab\u8bbe\u7f6e\uff0c\u4f46\u5b83\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ERROR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u4e0a\u4e00\u4e2aSQL\u67e5\u8be2\u5931\u8d25\u5219\u4e3a<code class=\"literal\">true</code>\uff0c\u5982\u679c\u6210\u529f\u5219\u662f<code class=\"literal\">false</code>\u3002\u53e6\u89c1<code class=\"varname\">SQLSTATE</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">FETCH_COUNT</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a\u4e00\u4e2a\u5927\u4e8e\u96f6\u7684\u6574\u6570\u503c\uff0c<code class=\"command\">SELECT</code>\u67e5\u8be2\u7684\u7ed3\u679c\u4f1a\u4ee5\u4e00\u7ec4\u4e00\u7ec4\u7684\u65b9\u5f0f\u53d6\u51fa\u5e76\u4e14\u663e\u793a\uff08\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u7684\u90a3\u6837\u628a\u6574\u4e2a\u7ed3\u679c\u96c6\u62ff\u5230\u4ee5\u540e\u518d\u663e\u793a\uff09\uff0c\u6bcf\u7ec4\u5305\u542b\u7684\u884c\u6570\u7b49\u4e8e\u8be5\u6574\u6570\u503c\u3002\u56e0\u6b64\uff0c\u8fd9\u79cd\u65b9\u5f0f\u53ea\u4f1a\u4f7f\u7528\u6709\u9650\u7684\u5185\u5b58\u91cf\uff0c\u800c\u4e0d\u7ba1\u6574\u4e2a\u7ed3\u679c\u96c6\u7684\u5927\u5c0f\u3002\u5728\u542f\u7528\u8fd9\u4e2a\u7279\u6027\u65f6\uff0c\u901a\u5e38\u4f1a\u4f7f\u7528 100 \u5230 1000 \u7684\u8bbe\u7f6e\u3002\u8bb0\u4f4f\u5728\u4f7f\u7528\u8fd9\u79cd\u7279\u6027\u65f6\uff0c\u4e00\u4e2a\u67e5\u8be2\u53ef\u80fd\u4f1a\u5728\u5df2\u7ecf\u663e\u793a\u4e86\u4e00\u4e9b\u884c\u4e4b\u540e\u5931\u8d25\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5c3d\u7ba1\u53ef\u4ee5\u628a\u8fd9\u79cd\u7279\u6027\u7528\u4e8e\u4efb\u4f55\u7684\u8f93\u51fa\u683c\u5f0f\uff0c\u4f46\u662f\u9ed8\u8ba4\u7684<code class=\"literal\">aligned</code>\u683c\u5f0f\u770b\u8d77\u6765\u4f1a\u6bd4\u8f83\u7cdf\u7cd5\uff0c\u56e0\u4e3a\u6bcf\u4e00\u7ec4\u7684<code class=\"varname\">FETCH_COUNT</code>\u884c\u5c06\u88ab\u5355\u72ec\u683c\u5f0f\u5316\uff0c\u8fd9\u5c31\u4f1a\u5bfc\u81f4\u4e0d\u540c\u7684\u884c\u7ec4\u7684\u5217\u5bbd\u4e0d\u540c\u3002\u5176\u4ed6\u7684\u8f93\u51fa\u683c\u5f0f\u4f1a\u66f4\u597d\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">HIDE_TABLEAM</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6b64\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">true</code>\uff0c\u5219\u4e0d\u663e\u793a\u8868\u7684\u8bbf\u95ee\u65b9\u6cd5\u7684\u8be6\u7ec6\u4fe1\u606f\u3002\u8fd9\u4e3b\u8981\u7528\u4e8e\u56de\u5f52\u6d4b\u8bd5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">HISTCONTROL</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">ignorespace</code>\uff0c\u5219\u4ee5\u4e00\u4e2a\u7a7a\u683c\u5f00\u59cb\u7684\u884c\u4e0d\u4f1a\u88ab\u653e\u5165\u5230\u5386\u53f2\u5217\u8868\u4e2d\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">ignoredups</code>\uff0c\u5219\u4e0e\u4e0a\u4e00\u6761\u5386\u53f2\u8bb0\u5f55\u76f8\u540c\u7684\u884c\u4e0d\u4f1a\u88ab\u653e\u5165\u3002\u503c<code class=\"literal\">ignoreboth</code>\u7ec4\u5408\u4e86\u4e0a\u8ff0\u4e24\u79cd\u503c\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">none</code>\uff08\u9ed8\u8ba4\u503c\uff09\uff0c\u6240\u6709\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e2d\u88ab\u8bfb\u5165\u7684\u884c\u90fd\u4f1a\u4fdd\u5b58\u5728\u5386\u53f2\u5217\u8868\u4e2d\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">HISTFILE</code></span></dt>\n<dd>\n<p lang=\"zh\">\u7528\u4e8e\u5b58\u50a8\u5386\u53f2\u8bb0\u5f55\u5217\u8868\u7684\u6587\u4ef6\u540d\u3002\u5982\u679c\u672a\u8bbe\u7f6e\uff0c\u5219\u4ece\u73af\u5883\u53d8\u91cf <code class=\"envar\">PSQL_HISTORY</code> \u4e2d\u83b7\u53d6\u6587\u4ef6\u540d\u3002\u5982\u679c\u8be5\u73af\u5883\u53d8\u91cf\u4e5f\u672a\u8bbe\u7f6e\uff0c\u5219\u9ed8\u8ba4\u4f7f\u7528 <code class=\"filename\">~/.psql_history</code>\uff0c\u5728 Windows \u4e0a\u5219\u4f7f\u7528 <code class=\"filename\">%APPDATA%\\postgresql\\psql_history</code>\u3002\u4f8b\u5982\uff0c\u5c06\u4ee5\u4e0b\u5185\u5bb9\uff1a</p>\n<pre class=\"programlisting\">\\set HISTFILE ~/.psql_history- :DBNAME\n</pre>\n<p lang=\"zh\">\u653e\u5165 <code class=\"filename\">~/.psqlrc</code> \u4f1a\u4f7f <span class=\"application\">psql</span> \u4e3a\u6bcf\u4e2a\u6570\u636e\u5e93\u7ef4\u62a4\u5355\u72ec\u7684\u5386\u53f2\u8bb0\u5f55\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">HISTSIZE</code></span></dt>\n<dd>\n<p lang=\"zh\">\u547d\u4ee4\u5386\u53f2\u4e2d\u6700\u591a\u4fdd\u5b58\u7684\u547d\u4ee4\u6570\uff08\u9ed8\u8ba4 500\uff09\u3002\u8bbe\u4e3a\u8d1f\u503c\u65f6\uff0c\u4e0d\u8bbe\u4e0a\u9650\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">HOST</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e3b\u673a\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u4e5f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">IGNOREEOF</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8bbe\u4e3a 1 \u6216\u66f4\u5c0f\u7684\u503c\uff0c\u5411 psql \u4ea4\u4e92\u4f1a\u8bdd\u53d1\u9001 EOF \u5b57\u7b26\uff08\u901a\u5e38\u4e3a Control + D\uff09\u5c31\u4f1a\u7ec8\u6b62\u5e94\u7528\u3002\u5982\u679c\u8bbe\u4e3a\u66f4\u5927\u7684\u6570\u503c\uff0c\u5219\u5fc5\u987b\u8fde\u7eed\u8f93\u5165\u76f8\u5e94\u6b21\u6570\u7684 EOF \u5b57\u7b26\u624d\u4f1a\u7ec8\u6b62\u4ea4\u4e92\u4f1a\u8bdd\u3002\u5982\u679c\u53d8\u91cf\u8bbe\u4e3a\u975e\u6570\u503c\uff0c\u4f1a\u88ab\u89e3\u91ca\u4e3a 10\u3002\u9ed8\u8ba4\u503c\u4e3a 0\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">LASTOID</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6700\u8fd1\u4e00\u6b21\u53d7\u5f71\u54cd\u7684 OID \u503c\uff0c\u7531 INSERT \u6216 \\lo_import \u547d\u4ee4\u8fd4\u56de\u3002\u6b64\u53d8\u91cf\u4ec5\u4fdd\u8bc1\u5728\u4e0b\u4e00\u6761 SQL \u547d\u4ee4\u7684\u7ed3\u679c\u663e\u793a\u4e4b\u524d\u6709\u6548\u3002\u4ece\u7248\u672c 12 \u8d77\uff0cPostgreSQL \u670d\u52a1\u5668\u4e0d\u518d\u652f\u6301 OID \u7cfb\u7edf\u5217\uff0c\u56e0\u6b64\u8fde\u63a5\u5230\u8fd9\u4e9b\u670d\u52a1\u5668\u65f6\uff0c\u6267\u884c INSERT \u540e LASTOID \u59cb\u7ec8\u4e3a 0\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">LAST_ERROR_MESSAGE</code><br/></span><span class=\"term\"><code class=\"varname\">LAST_ERROR_SQLSTATE</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d<span class=\"application\">psql</span>\u4f1a\u8bdd\u4e2d\u6700\u8fd1\u4e00\u4e2a\u5931\u8d25\u67e5\u8be2\u7684\u4e3b\u9519\u8bef\u6d88\u606f\u548c\u76f8\u5173\u7684SQLSTATE\u4ee3\u7801\uff0c\u5982\u679c\u5728\u5f53\u524d\u4f1a\u8bdd\u4e2d\u6ca1\u6709\u53d1\u751f\u9519\u8bef\uff0c\u5219\u662f\u4e00\u4e2a\u7a7a\u5b57\u7b26\u4e32\u548c<code class=\"literal\">00000</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ON_ERROR_ROLLBACK</code> </span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u65f6\uff0c\u5982\u679c\u4e8b\u52a1\u5757\u4e2d\u7684\u4e00\u4e2a\u8bed\u53e5\u4ea7\u751f\u4e00\u4e2a\u9519\u8bef\uff0c\u8be5\u9519\u8bef\u4f1a\u88ab\u5ffd\u7565\u5e76\u4e14\u8be5\u4e8b\u52a1\u4f1a\u7ee7\u7eed\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">interactive</code>\u65f6\uff0c\u53ea\u5728\u4ea4\u4e92\u5f0f\u4f1a\u8bdd\u4e2d\u5ffd\u7565\u8fd9\u7c7b\u9519\u8bef\uff0c\u800c\u8bfb\u53d6\u811a\u672c\u6587\u4ef6\u65f6\u5219\u4e0d\u4f1a\u5ffd\u7565\u9519\u8bef\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">off</code>\uff08\u9ed8\u8ba4\u503c\uff09\u65f6\uff0c\u4e8b\u52a1\u5757\u4e2d\u4ea7\u751f\u9519\u8bef\u7684\u4e00\u4e2a\u8bed\u53e5\u4f1a\u4e2d\u6b62\u6574\u4e2a\u4e8b\u52a1\u3002\u9519\u8bef\u56de\u6eda\u6a21\u5f0f\u7684\u5de5\u4f5c\u539f\u7406\u662f\u5728\u4e8b\u52a1\u5757\u7684\u6bcf\u4e2a\u547d\u4ee4\u4e4b\u524d\u90fd\u4e3a\u4f60\u53d1\u51fa\u4e00\u4e2a\u9690\u5f0f\u7684<code class=\"command\">SAVEPOINT</code>\uff0c\u7136\u540e\u5728\u8be5\u547d\u4ee4\u5931\u8d25\u65f6\u56de\u6eda\u5230\u8be5\u4fdd\u5b58\u70b9\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ON_ERROR_STOP</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u51fa\u9519\u540e\u4ecd\u4f1a\u7ee7\u7eed\u5904\u7406\u547d\u4ee4\u3002\u5c06\u6b64\u53d8\u91cf\u8bbe\u4e3a on \u540e\uff0c\u5904\u7406\u4f1a\u7acb\u5373\u505c\u6b62\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\uff0cpsql \u4f1a\u8fd4\u56de\u547d\u4ee4\u63d0\u793a\u7b26\uff1b\u5426\u5219\uff0cpsql \u4f1a\u9000\u51fa\u5e76\u8fd4\u56de\u9519\u8bef\u7801 3\uff0c\u4ee5\u533a\u522b\u4e8e\u9519\u8bef\u7801 1 \u6240\u8868\u793a\u7684\u81f4\u547d\u9519\u8bef\u3002\u65e0\u8bba\u54ea\u79cd\u60c5\u51b5\uff0c\u5f53\u524d\u6b63\u5728\u8fd0\u884c\u7684\u6240\u6709\u811a\u672c\uff08\u5982\u679c\u5b58\u5728\u9876\u5c42\u811a\u672c\uff0c\u5219\u5305\u62ec\u8be5\u811a\u672c\u53ca\u5176\u8c03\u7528\u7684\u5176\u4ed6\u811a\u672c\uff09\u90fd\u4f1a\u7acb\u5373\u7ec8\u6b62\u3002\u5982\u679c\u9876\u5c42\u547d\u4ee4\u5b57\u7b26\u4e32\u5305\u542b\u591a\u6761 SQL \u547d\u4ee4\uff0c\u5219\u4f1a\u5728\u5f53\u524d\u547d\u4ee4\u5904\u505c\u6b62\u5904\u7406\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">PORT</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u7aef\u53e3\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u4e5f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">PROMPT1</code><br/></span><span class=\"term\"><code class=\"varname\">PROMPT2</code><br/></span><span class=\"term\"><code class=\"varname\">PROMPT3</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e9b\u53d8\u91cf\u6307\u5b9a<span class=\"application\">psql</span>\u53d1\u51fa\u7684\u63d0\u793a\u7b26\u7684\u6a21\u6837\u3002\u89c1\u4e0b\u6587\u7684<a class=\"xref\" href=\"/docs/13/app-psql.html#APP-PSQL-PROMPTING\" title=\"\u63d0\u793a\u7b26\">\u63d0\u793a\u7b26</a>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">QUIET</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u8fd9\u4e2a\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-q</code>\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\u53ef\u80fd\u7528\u5904\u4e0d\u5927\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ROW_COUNT</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6700\u8fd1\u4e00\u6761 SQL \u67e5\u8be2\u8fd4\u56de\u6216\u5f71\u54cd\u7684\u884c\u6570\uff1b\u5982\u679c\u67e5\u8be2\u5931\u8d25\u6216\u6ca1\u6709\u62a5\u544a\u884c\u6570\uff0c\u5219\u4e3a 0\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">SERVER_VERSION_NAME</code><br/></span><span class=\"term\"><code class=\"varname\">SERVER_VERSION_NUM</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b57\u7b26\u4e32\u5f62\u5f0f\u7684\u670d\u52a1\u5668\u7248\u672c\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">9.6.2</code>\u3001<code class=\"literal\">10.1</code>\u6216\u8005<code class=\"literal\">11beta1</code>\uff0c\u4ee5\u53ca\u6570\u5b57\u5f62\u5f0f\u7684\u670d\u52a1\u5668\u7248\u672c\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">90602</code>\u6216\u8005<code class=\"literal\">100001</code>\u3002\u6bcf\u6b21\u4f60\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\uff09\u65f6\uff0c\u8fd9\u4e9b\u90fd\u4f1a\u88ab\u8bbe\u7f6e\uff0c\u4f46\u53ef\u4ee5\u88ab\u6539\u53d8\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">SHOW_CONTEXT</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u53d8\u91cf\u53ef\u4ee5\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">never</code>\u3001<code class=\"literal\">errors</code>\u6216\u8005<code class=\"literal\">always</code>\u6765\u63a7\u5236\u662f\u5426\u5728\u6765\u81ea\u670d\u52a1\u5668\u7684\u6d88\u606f\u4e2d\u663e\u793a<code class=\"literal\">CONTEXT</code>\u5b57\u6bb5\u3002\u9ed8\u8ba4\u662f<code class=\"literal\">errors</code>\uff08\u8868\u793a\u5728\u9519\u8bef\u6d88\u606f\u4e2d\u663e\u793a\u4e0a\u4e0b\u6587\uff0c\u4f46\u5728\u901a\u77e5\u548c\u8b66\u544a\u6d88\u606f\u4e2d\u4e0d\u663e\u793a\uff09\u3002\u5f53<code class=\"varname\">VERBOSITY</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">terse</code>\u6216<code class=\"literal\">sqlstate</code>\u65f6\uff0c\u8fd9\u4e2a\u8bbe\u7f6e\u65e0\u6548\uff08\u53e6\u89c1<code class=\"command\">\\errverbose</code>\uff0c\u5b83\u53ef\u4ee5\u7528\u6765\u5f97\u5230\u521a\u9047\u5230\u7684\u9519\u8bef\u7684\u8be6\u7ec6\u4fe1\u606f\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">SINGLELINE</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u8fd9\u4e2a\u53d8\u91cf\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-S</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">SINGLESTEP</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u8fd9\u4e2a\u53d8\u91cf\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-s</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">SQLSTATE</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0e\u4e0a\u4e00\u4e2aSQL\u67e5\u8be2\u7684\u5931\u8d25\u76f8\u5173\u7684\u9519\u8bef\u4ee3\u7801\uff08\u89c1<a class=\"xref\" href=\"/docs/13/errcodes-appendix.html\" title=\"\u9644\u5f55\u00a0A.\u00a0PostgreSQL\u9519\u8bef\u4ee3\u7801\">\u9644\u5f55\u00a0A</a>\uff09\uff0c\u5982\u679c\u4e0a\u4e00\u4e2a\u67e5\u8be2\u6210\u529f\u5219\u4e3a<code class=\"literal\">00000</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">USER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7528\u6237\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u662f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">VERBOSITY</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u53d8\u91cf\u53ef\u4ee5\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">default</code>\u3001<code class=\"literal\">verbose</code>\u3001<code class=\"literal\">terse</code>\u6216\u8005<code class=\"literal\">sqlstate</code>\u6765\u63a7\u5236\u9519\u8bef\u62a5\u544a\u7684\u8be6\u7ec6\u7a0b\u5ea6\uff08\u53e6\u89c1<code class=\"command\">\\errverbose</code>\uff0c\u5728\u60f3\u5f97\u5230\u521a\u9047\u5230\u7684\u9519\u8bef\u7684\u8be6\u7ec6\u4fe1\u606f\u65f6\u4f7f\u7528\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">VERSION</code><br/></span><span class=\"term\"><code class=\"varname\">VERSION_NAME</code><br/></span><span class=\"term\"><code class=\"varname\">VERSION_NUM</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e9b\u53d8\u91cf\u5728\u7a0b\u5e8f\u542f\u52a8\u65f6\u88ab\u8bbe\u7f6e\u4ee5\u53cd\u6620<span class=\"application\">psql</span>\u7684\u7248\u672c\uff0c\u5206\u522b\u662f\u4e00\u4e2a\u8be6\u7ec6\u7684\u5b57\u7b26\u4e32\u3001\u4e00\u4e2a\u77ed\u5b57\u7b26\u4e32\uff08\u4f8b\u5982<code class=\"literal\">9.6.2</code>\u3001<code class=\"literal\">10.1</code>\u6216\u8005<code class=\"literal\">11beta1</code>\uff09\u4ee5\u53ca\u4e00\u4e2a\u6570\u5b57\uff08\u4f8b\u5982<code class=\"literal\">90602</code>\u6216\u8005<code class=\"literal\">100001</code>\uff09\u3002\u5b83\u4eec\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-INTERPOLATION\">\n<h4 lang=\"zh\">SQL \u63d2\u503c</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u53d8\u91cf\u7684\u4e00\u4e2a\u5173\u952e\u7279\u6027\u662f\u53ef\u4ee5\u628a\u5b83\u4eec\u66ff\u6362\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u63d2\u503c</span>\u201d</span>\uff09\u5230\u5e38\u89c4<acronym class=\"acronym\">SQL</acronym>\u8bed\u53e5\u4e2d\uff0c\u4e5f\u53ef\u4ee5\u628a\u5b83\u4eec\u66ff\u6362\u5230\u5143\u547d\u4ee4\u7684\u53c2\u6570\u4e2d\u3002\u6b64\u5916\uff0c<span class=\"application\">psql</span>\u8fd8\u63d0\u4f9b\u4e86\u529f\u80fd\u6765\u786e\u4fdd\u88ab\u7528\u4f5c SQL \u5b57\u9762\u91cf\u548c\u6807\u8bc6\u7b26\u7684\u53d8\u91cf\u503c\u4f1a\u88ab\u6b63\u786e\u5730\u52a0\u5f15\u53f7\u3002\u4e0d\u52a0\u5f15\u53f7\u5730\u63d2\u503c\u4e00\u4e2a\u503c\u7684\u8bed\u6cd5\u662f\u5728\u53d8\u91cf\u540d\u524d\u9762\u52a0\u4e0a\u4e00\u4e2a\u5192\u53f7\uff08<code class=\"literal\">:</code>\uff09\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo 'my_table'</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM :foo;</code></strong>\n</pre>\n<p lang=\"zh\">\u5c06\u67e5\u8be2\u8868<code class=\"literal\">my_table</code>\u3002\u6ce8\u610f\u8fd9\u53ef\u80fd\u4f1a\u4e0d\u5b89\u5168\uff1a\u8be5\u53d8\u91cf\u7684\u503c\u4f1a\u88ab\u6309\u5b57\u9762\u62f7\u8d1d\uff0c\u56e0\u6b64\u5b83\u53ef\u80fd\u5305\u542b\u4e0d\u5e73\u8861\u7684\u5f15\u53f7\u751a\u81f3\u53cd\u659c\u7ebf\u547d\u4ee4\u3002\u5fc5\u987b\u786e\u4fdd\u628a\u5b83\u653e\u5728\u90a3\u91cc\u662f\u6709\u610f\u4e49\u7684\u3002</p>\n<p lang=\"zh\">\u5f53\u4e00\u4e2a\u503c\u8981\u7528\u4f5c SQL \u5b57\u9762\u91cf\u6216\u6807\u8bc6\u7b26\u65f6\uff0c\u6700\u5b89\u5168\u7684\u505a\u6cd5\u662f\u4e3a\u5b83\u52a0\u4e0a\u5f15\u53f7\u3002\u8981\u5c06\u53d8\u91cf\u503c\u4f5c\u4e3a SQL \u5b57\u9762\u91cf\u52a0\u5f15\u53f7\uff0c\u5e94\u5199\u4e00\u4e2a\u5192\u53f7\uff0c\u540e\u9762\u8ddf\u7528\u5355\u5f15\u53f7\u62ec\u8d77\u6765\u7684\u53d8\u91cf\u540d\u3002\u8981\u5c06\u53d8\u91cf\u503c\u4f5c\u4e3a SQL \u6807\u8bc6\u7b26\u52a0\u5f15\u53f7\uff0c\u5219\u5728\u5192\u53f7\u540e\u9762\u7528\u53cc\u5f15\u53f7\u62ec\u8d77\u53d8\u91cf\u540d\u3002\u8fd9\u4e9b\u5199\u6cd5\u80fd\u6b63\u786e\u5904\u7406\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165\u7684\u5f15\u53f7\u548c\u5176\u4ed6\u7279\u6b8a\u5b57\u7b26\u3002\u524d\u9762\u7684\u793a\u4f8b\u53ef\u7528\u4ee5\u4e0b\u66f4\u5b89\u5168\u7684\u5199\u6cd5\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo 'my_table'</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM :\"foo\";</code></strong>\n</pre>\n<p lang=\"zh\">\u5728\u52a0\u5f15\u53f7\u7684<acronym class=\"acronym\">SQL</acronym>\u5b57\u9762\u91cf\u548c\u6807\u8bc6\u7b26\u5185\u90e8\uff0c\u4e0d\u4f1a\u6267\u884c\u53d8\u91cf\u63d2\u503c\u3002\u56e0\u6b64\uff0c<code class=\"literal\">':foo'</code>\u8fd9\u6837\u7684\u5199\u6cd5\u4e0d\u80fd\u6839\u636e\u53d8\u91cf\u503c\u751f\u6210\u52a0\u5f15\u53f7\u7684\u5b57\u9762\u91cf\uff08\u5373\u4f7f\u80fd\u591f\u751f\u6548\uff0c\u4e5f\u4e0d\u5b89\u5168\uff0c\u56e0\u4e3a\u5b83\u65e0\u6cd5\u6b63\u786e\u5904\u7406\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165\u7684\u5f15\u53f7\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8fd9\u79cd\u673a\u5236\u7684\u4e00\u4e2a\u793a\u4f8b\u662f\u628a\u4e00\u4e2a\u6587\u4ef6\u7684\u5185\u5bb9\u62f7\u8d1d\u5230\u4e00\u4e2a\u8868\u5217\u4e2d\u3002\u9996\u5148\u628a\u8be5\u6587\u4ef6\u8f7d\u5165\u5230\u4e00\u4e2a\u53d8\u91cf\uff0c\u7136\u540e\u628a\u8be5\u53d8\u91cf\u7684\u503c\u4f5c\u4e3a\u4e00\u4e2a\u52a0\u5f15\u53f7\u7684\u5b57\u7b26\u4e32\u8fdb\u884c\u63d2\u503c\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set content `cat my_file.txt`</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>INSERT INTO my_table VALUES (:'content');</code></strong>\n</pre>\n<p lang=\"zh\">\uff08\u6ce8\u610f\u5982\u679c<code class=\"filename\">my_file.txt</code>\u5305\u542b NUL \u5b57\u8282\uff0c\u8fd9\u6837\u4e5f\u4e0d\u884c\u3002<span class=\"application\">psql</span>\u4e0d\u652f\u6301\u5728\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165 NUL \u5b57\u8282\uff09\u3002</p>\n<p lang=\"zh\">\u56e0\u4e3a\u5192\u53f7\u53ef\u4ee5\u5408\u6cd5\u5730\u51fa\u73b0\u5728 SQL \u547d\u4ee4\u4e2d\uff0c\u4e00\u6b21\u660e\u663e\u7684\u63d2\u503c\u5c1d\u8bd5\uff08\u5373<code class=\"literal\">:name</code>\u3001<code class=\"literal\">:'name'</code>\u6216\u8005<code class=\"literal\">:\"name\"</code>\uff09\u4e0d\u4f1a\u88ab\u66ff\u6362\uff0c\u9664\u975e\u6240\u6307\u7684\u53d8\u91cf\u5f53\u524d\u5df2\u8bbe\u7f6e\u3002\u5728\u4efb\u4f55\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u7528\u4e00\u4e2a\u53cd\u659c\u7ebf\u5bf9\u5192\u53f7\u8fdb\u884c\u8f6c\u4e49\u4ee5\u907f\u514d\u5b83\u88ab\u66ff\u6362\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">:{?<em class=\"replaceable\"><code>name</code></em>}</code>\u7279\u6b8a\u8bed\u6cd5\u4f1a\u6839\u636e\u8be5\u53d8\u91cf\u662f\u5426\u5b58\u5728\u8fd4\u56de TRUE \u6216 FALSE\uff0c\u56e0\u6b64\u603b\u662f\u4f1a\u88ab\u66ff\u6362\uff0c\u9664\u975e\u5192\u53f7\u88ab\u53cd\u659c\u7ebf\u8f6c\u4e49\u3002</p>\n<p lang=\"zh\">\u53d8\u91cf\u7684\u5192\u53f7\u8bed\u6cd5\u5bf9\u5d4c\u5165\u5f0f\u67e5\u8be2\u8bed\u8a00\uff08\u4f8b\u5982<span class=\"application\">ECPG</span>\uff09\u6765\u8bf4\u662f\u6807\u51c6\u7684<acronym class=\"acronym\">SQL</acronym>\u3002\u7528\u4e8e\u6570\u7ec4\u5207\u7247\u548c\u7c7b\u578b\u8f6c\u6362\u7684\u5192\u53f7\u8bed\u6cd5\u662f<span class=\"productname\">PostgreSQL</span>\u6269\u5c55\uff0c\u5b83\u6709\u65f6\u53ef\u80fd\u4f1a\u4e0e\u6807\u51c6\u7528\u6cd5\u51b2\u7a81\u3002\u628a\u4e00\u4e2a\u53d8\u91cf\u503c\u8f6c\u4e49\u6210 SQL \u5b57\u9762\u91cf\u6216\u8005\u6807\u8bc6\u7b26\u7684\u5192\u53f7\u52a0\u5f15\u53f7\u8bed\u6cd5\u662f\u4e00\u79cd<span class=\"application\">psql</span>\u6269\u5c55\u3002</p>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-PROMPTING\">\n<h4 lang=\"zh\">\u63d0\u793a\u7b26</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u53d1\u51fa\u7684\u63d0\u793a\u7b26\u53ef\u4ee5\u6309\u4f60\u7684\u559c\u597d\u8fdb\u884c\u5b9a\u5236\u3002<code class=\"varname\">PROMPT1</code>\u3001<code class=\"varname\">PROMPT2</code> \u548c <code class=\"varname\">PROMPT3</code> \u8fd9\u4e09\u4e2a\u53d8\u91cf\u5305\u542b\u63cf\u8ff0\u63d0\u793a\u7b26\u5916\u89c2\u7684\u5b57\u7b26\u4e32\u548c\u7279\u6b8a\u8f6c\u4e49\u5e8f\u5217\u3002\u63d0\u793a\u7b26 1 \u662f <span class=\"application\">psql</span> \u8bf7\u6c42\u65b0\u547d\u4ee4\u65f6\u53d1\u51fa\u7684\u5e38\u89c4\u63d0\u793a\u7b26\u3002\u63d0\u793a\u7b26 2 \u4f1a\u5728\u5f55\u5165\u547d\u4ee4\u671f\u95f4\u8fd8\u9700\u8981\u66f4\u591a\u8f93\u5165\u65f6\u53d1\u51fa\uff0c\u4f8b\u5982\u547d\u4ee4\u5c1a\u672a\u4ee5\u5206\u53f7\u7ed3\u675f\uff0c\u6216\u8005\u5f15\u53f7\u5c1a\u672a\u95ed\u5408\u65f6\u3002\u5728\u6267\u884c <acronym class=\"acronym\">SQL</acronym> <code class=\"command\">COPY FROM STDIN</code> \u547d\u4ee4\u5e76\u9700\u8981\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4e00\u884c\u503c\u65f6\uff0c\u4f1a\u53d1\u51fa\u63d0\u793a\u7b26 3\u3002</p>\n<p lang=\"zh\">\u9009\u4e2d\u7684\u63d0\u793a\u7b26\u53d8\u91cf\u503c\u4f1a\u6309\u5b57\u9762\u8f93\u51fa\uff0c\u9664\u975e\u9047\u5230\u767e\u5206\u53f7\uff08<code class=\"literal\">%</code>\uff09\u3002\u6839\u636e\u4e0b\u4e00\u4e2a\u5b57\u7b26\u7684\u4e0d\u540c\uff0c\u4f1a\u66ff\u6362\u6210\u67d0\u4e9b\u5176\u4ed6\u6587\u672c\u3002\u5df2\u5b9a\u4e49\u7684\u66ff\u6362\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">%M</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5b8c\u6574\u4e3b\u673a\u540d\uff08\u542b\u57df\u540d\uff09\uff1b\u5982\u679c\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\uff0c\u5219\u4e3a<code class=\"literal\">[local]</code>\uff1b\u5982\u679c Unix \u57df\u5957\u63a5\u5b57\u4e0d\u5728\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u9ed8\u8ba4\u4f4d\u7f6e\uff0c\u5219\u4e3a<code class=\"literal\">[local:<em class=\"replaceable\"><code>/dir/name</code></em>]</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%m</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\uff0c\u5728\u7b2c\u4e00\u4e2a\u70b9\u53f7\u5904\u622a\u65ad\uff1b\u5982\u679c\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\uff0c\u5219\u4e3a<code class=\"literal\">[local]</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%&gt;</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u76d1\u542c\u7684\u7aef\u53e3\u53f7\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%n</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u4f1a\u8bdd\u7528\u6237\u540d\u3002\uff08\u5728\u6570\u636e\u5e93\u4f1a\u8bdd\u671f\u95f4\uff0c<code class=\"command\">SET SESSION AUTHORIZATION</code>\u547d\u4ee4\u53ef\u80fd\u6539\u53d8\u8be5\u503c\u7684\u6269\u5c55\u7ed3\u679c\u3002\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%/</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%~</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7c7b\u4f3c <code class=\"literal\">%/</code>\uff0c\u4f46\u5982\u679c\u8be5\u6570\u636e\u5e93\u662f\u4f60\u7684\u9ed8\u8ba4\u6570\u636e\u5e93\uff0c\u5219\u8f93\u51fa <code class=\"literal\">~</code>\uff08\u6ce2\u6d6a\u53f7\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%#</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u4f1a\u8bdd\u7528\u6237\u662f\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\uff0c\u5219\u4e3a<code class=\"literal\">#</code>\uff0c\u5426\u5219\u4e3a<code class=\"literal\">&gt;</code>\u3002\uff08\u5728\u6570\u636e\u5e93\u4f1a\u8bdd\u671f\u95f4\uff0c<code class=\"command\">SET SESSION AUTHORIZATION</code>\u547d\u4ee4\u53ef\u80fd\u6539\u53d8\u8be5\u503c\u7684\u6269\u5c55\u7ed3\u679c\u3002\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%p</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u6240\u8fde\u63a5\u540e\u7aef\u7684\u8fdb\u7a0b ID\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%R</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u63d0\u793a\u7b26 1 \u4e2d\uff0c\u901a\u5e38\u663e\u793a =\uff1b\u4f46\u5982\u679c\u4f1a\u8bdd\u5904\u4e8e\u6761\u4ef6\u5757\u4e2d\u672a\u6fc0\u6d3b\u7684\u5206\u652f\uff0c\u5219\u663e\u793a @\uff1b\u5982\u679c\u5904\u4e8e\u5355\u884c\u6a21\u5f0f\uff0c\u5219\u663e\u793a ^\uff1b\u5982\u679c\u4f1a\u8bdd\u5df2\u65ad\u5f00\u6570\u636e\u5e93\u8fde\u63a5\uff08\u4f8b\u5982 \\connect \u5931\u8d25\u65f6\uff09\uff0c\u5219\u663e\u793a !\u3002\u5728\u63d0\u793a\u7b26 2 \u4e2d\uff0c%R \u4f1a\u66ff\u6362\u4e3a\u8868\u793a psql \u7b49\u5f85\u66f4\u591a\u8f93\u5165\u539f\u56e0\u7684\u5b57\u7b26\uff1a\u547d\u4ee4\u5c1a\u672a\u7ed3\u675f\u65f6\u4e3a -\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684 /* ... */ \u6ce8\u91ca\u65f6\u4e3a *\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u5e26\u5f15\u53f7\u5b57\u7b26\u4e32\u65f6\u4e3a\u5355\u5f15\u53f7\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u5e26\u5f15\u53f7\u6807\u8bc6\u7b26\u65f6\u4e3a\u53cc\u5f15\u53f7\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u7f8e\u5143\u5f15\u7528\u5b57\u7b26\u4e32\u65f6\u4e3a\u7f8e\u5143\u7b26\u53f7\uff1b\u5b58\u5728\u672a\u5339\u914d\u7684\u5de6\u62ec\u53f7\u65f6\u4e3a (\u3002\u5728\u63d0\u793a\u7b26 3 \u4e2d\uff0c%R \u4e0d\u4ea7\u751f\u4efb\u4f55\u5185\u5bb9\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%x</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u72b6\u6001\uff1a\u5982\u679c\u5f53\u524d\u4e0d\u5728\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff1b\u5982\u679c\u5904\u4e8e\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a <code class=\"literal\">*</code>\uff1b\u5982\u679c\u5904\u4e8e\u5931\u8d25\u7684\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a <code class=\"literal\">!</code>\uff1b\u5982\u679c\u4e8b\u52a1\u72b6\u6001\u4e0d\u786e\u5b9a\uff08\u4f8b\u5982\u56e0\u4e3a\u5f53\u524d\u6ca1\u6709\u8fde\u63a5\uff09\uff0c\u5219\u4e3a <code class=\"literal\">?</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%l</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8bed\u53e5\u4e2d\u7684\u884c\u53f7\uff0c\u4ece <code class=\"literal\">1</code> \u5f00\u59cb\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%</code><em class=\"replaceable\"><code>digits</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u66ff\u6362\u4e3a\u6307\u5b9a\u516b\u8fdb\u5236\u4ee3\u7801\u5bf9\u5e94\u7684\u5b57\u7b26\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%:</code><em class=\"replaceable\"><code>name</code></em><code class=\"literal\">:</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><span class=\"application\">psql</span> \u53d8\u91cf <em class=\"replaceable\"><code>name</code></em> \u7684\u503c\u3002\u8be6\u89c1\u4e0a\u9762\u7684<a class=\"xref\" href=\"/docs/13/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%`</code><em class=\"replaceable\"><code>command</code></em><code class=\"literal\">`</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><em class=\"replaceable\"><code>command</code></em> \u7684\u8f93\u51fa\uff0c\u7c7b\u4f3c\u666e\u901a\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u53cd\u5f15\u53f7</span>\u201d</span>\u66ff\u6362\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%[</code> ... <code class=\"literal\">%]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u63d0\u793a\u7b26\u4e2d\u53ef\u4ee5\u5305\u542b\u7ec8\u7aef\u63a7\u5236\u5b57\u7b26\uff0c\u4f8b\u5982\u6539\u53d8\u63d0\u793a\u6587\u672c\u7684\u989c\u8272\u3001\u80cc\u666f\u6216\u6837\u5f0f\uff0c\u6216\u8005\u6539\u53d8\u7ec8\u7aef\u7a97\u53e3\u6807\u9898\u3002\u4e3a\u4e86\u8ba9 <span class=\"application\">Readline</span> \u7684\u884c\u7f16\u8f91\u529f\u80fd\u6b63\u5e38\u5de5\u4f5c\uff0c\u8fd9\u4e9b\u4e0d\u53ef\u6253\u5370\u7684\u63a7\u5236\u5b57\u7b26\u5fc5\u987b\u7528 <code class=\"literal\">%[</code> \u548c <code class=\"literal\">%]</code> \u5305\u56f4\u8d77\u6765\uff0c\u4ee5\u6807\u8bb0\u4e3a\u4e0d\u53ef\u89c1\u5b57\u7b26\u3002\u63d0\u793a\u7b26\u4e2d\u53ef\u4ee5\u51fa\u73b0\u591a\u7ec4\u8fd9\u6837\u7684\u6807\u8bb0\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; \\set PROMPT1 '%[%033[1;33;40m%]%n@%/%R%[%033[0m%]%# '\n</pre>\n<p lang=\"zh\">\u5176\u6548\u679c\u662f\u5728\u517c\u5bb9 VT100 \u4e14\u652f\u6301\u989c\u8272\u7684\u7ec8\u7aef\u4e0a\uff0c\u751f\u6210\u4e00\u4e2a\u7c97\u4f53\uff08<code class=\"literal\">1;</code>\uff09\u7684\u9ed1\u5e95\u9ec4\u5b57\u63d0\u793a\u7b26\uff08<code class=\"literal\">33;40</code>\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%w</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0e\u6700\u8fd1\u4e00\u6b21\u8f93\u51fa\u7684 <code class=\"varname\">PROMPT1</code> \u5177\u6709\u76f8\u540c\u5bbd\u5ea6\u7684\u7a7a\u767d\u3002\u8fd9\u53ef\u7528\u4f5c <code class=\"varname\">PROMPT2</code> \u7684\u8bbe\u7f6e\uff0c\u4f7f\u591a\u884c\u8bed\u53e5\u4e0e\u7b2c\u4e00\u884c\u5bf9\u9f50\uff0c\u4f46\u4e0d\u663e\u793a\u53ef\u89c1\u7684\u4e8c\u7ea7\u63d0\u793a\u7b26\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8981\u5728\u63d0\u793a\u7b26\u4e2d\u63d2\u5165\u767e\u5206\u53f7\uff0c\u8bf7\u5199 %%\u3002\u63d0\u793a\u7b26 1 \u548c 2 \u7684\u9ed8\u8ba4\u503c\u4e3a '%/%R%x%# '\uff0c\u63d0\u793a\u7b26 3 \u7684\u9ed8\u8ba4\u503c\u4e3a '&gt;&gt; '\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">tcsh</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</div>\n<div class=\"refsect3\" id=\"id-1.9.4.19.8.5.5\">\n<h4 lang=\"zh\">\u547d\u4ee4\u884c\u7f16\u8f91</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u652f\u6301 <span class=\"application\">Readline</span> \u5e93\uff0c\u4fbf\u4e8e\u7f16\u8f91\u548c\u68c0\u7d22\u8f93\u5165\u884c\u3002\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\u4f1a\u5728 <span class=\"application\">psql</span> \u9000\u51fa\u65f6\u81ea\u52a8\u4fdd\u5b58\uff0c\u5e76\u5728 <span class=\"application\">psql</span> \u542f\u52a8\u65f6\u91cd\u65b0\u8f7d\u5165\u3002\u4e5f\u652f\u6301 Tab \u8865\u5168\uff0c\u4e0d\u8fc7\u5176\u8865\u5168\u903b\u8f91\u5e76\u4e0d\u58f0\u79f0\u81ea\u5df1\u662f <acronym class=\"acronym\">SQL</acronym> \u89e3\u6790\u5668\u3002Tab \u8865\u5168\u751f\u6210\u7684\u67e5\u8be2\u8fd8\u53ef\u80fd\u5e72\u6270\u5176\u4ed6 SQL \u547d\u4ee4\uff0c\u4f8b\u5982 <code class=\"literal\">SET TRANSACTION ISOLATION LEVEL</code>\u3002\u5982\u679c\u51fa\u4e8e\u67d0\u79cd\u539f\u56e0\u4f60\u4e0d\u559c\u6b22 Tab \u8865\u5168\uff0c\u53ef\u4ee5\u5c06\u4ee5\u4e0b\u5185\u5bb9\u653e\u5165\u4e3b\u76ee\u5f55\u4e0b\u540d\u4e3a <code class=\"filename\">.inputrc</code> \u7684\u6587\u4ef6\u4e2d\uff0c\u5c06\u5176\u5173\u95ed\uff1a</p>\n<pre class=\"programlisting\">$if psql\nset disable-completion on\n$endif\n</pre>\n<p lang=\"zh\">\uff08\u8fd9\u4e0d\u662f <span class=\"application\">psql</span> \u7684\u529f\u80fd\uff0c\u800c\u662f <span class=\"application\">Readline</span> \u7684\u529f\u80fd\u3002\u66f4\u591a\u7ec6\u8282\u8bf7\u9605\u8bfb\u5176\u6587\u6863\u3002\uff09</p>\n</div>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PSQL-ENVIRONMENT\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">COLUMNS</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c<code class=\"literal\">\\pset columns</code>\u4e3a\u96f6\uff0c\u8fd9\u4e2a\u73af\u5883\u53d8\u91cf\u63a7\u5236\u7528\u4e8e<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u5bbd\u5ea6\u4ee5\u53ca\u7528\u6765\u786e\u5b9a\u662f\u5426\u8f93\u51fa\u9700\u8981\u7528\u5230\u5206\u9875\u5668\u6216\u8005\u5207\u6362\u5230\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e2d\u7684\u5782\u76f4\u683c\u5f0f\u7684\u5bbd\u5ea6\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PGDATABASE</code><br/></span><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\uff08\u89c1<a class=\"xref\" href=\"/docs/13/libpq-envars.html\" title=\"33.14.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a033.14\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u89c4\u5b9a\u5728\u8bca\u65ad\u6d88\u606f\u4e2d\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u80fd\u7684\u503c\u4e3a<code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u3001<code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PSQL_EDITOR</code><br/></span><span class=\"term\"><code class=\"envar\">EDITOR</code><br/></span><span class=\"term\"><code class=\"envar\">VISUAL</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"command\">\\e</code>\u3001<code class=\"command\">\\ef</code>\u4ee5\u53ca<code class=\"command\">\\ev</code>\u547d\u4ee4\u6240\u4f7f\u7528\u7684\u7f16\u8f91\u5668\u3002\u4f1a\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u68c0\u67e5\u8fd9\u4e9b\u53d8\u91cf\uff0c\u7b2c\u4e00\u4e2a\u88ab\u8bbe\u7f6e\u7684\u5c06\u88ab\u4f7f\u7528\u3002\u5982\u679c\u90fd\u6ca1\u6709\u88ab\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u662f\u4f7f\u7528Unix\u7cfb\u7edf\u4e0a\u7684<code class=\"filename\">vi</code>\u6216\u8005Windows\u7cfb\u7edf\u4e0a\u7684<code class=\"filename\">notepad.exe</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PSQL_EDITOR_LINENUMBER_ARG</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f53 <code class=\"command\">\\e</code>\u3001<code class=\"command\">\\ef</code> \u6216 <code class=\"command\">\\ev</code> \u5e26\u6709\u884c\u53f7\u53c2\u6570\u4f7f\u7528\u65f6\uff0c\u6b64\u53d8\u91cf\u6307\u5b9a\u5c06\u8d77\u59cb\u884c\u53f7\u4f20\u7ed9\u7528\u6237\u7f16\u8f91\u5668\u65f6\u6240\u7528\u7684\u547d\u4ee4\u884c\u53c2\u6570\u3002\u5bf9\u4e8e <span class=\"productname\">Emacs</span> \u6216 <span class=\"productname\">vi</span> \u4e4b\u7c7b\u7684\u7f16\u8f91\u5668\uff0c\u8fd9\u4e2a\u53c2\u6570\u662f\u4e00\u4e2a\u52a0\u53f7\u3002\u5982\u679c\u9009\u9879\u540d\u548c\u884c\u53f7\u4e4b\u95f4\u9700\u8981\u7a7a\u683c\uff0c\u8bf7\u5728\u53d8\u91cf\u503c\u4e2d\u5305\u542b\u672b\u5c3e\u7a7a\u683c\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">PSQL_EDITOR_LINENUMBER_ARG='+'\nPSQL_EDITOR_LINENUMBER_ARG='--line '\n</pre>\n<p lang=\"zh\">\u5728 Unix \u7cfb\u7edf\u4e0a\u9ed8\u8ba4\u662f<code class=\"literal\">+</code>\uff08\u5bf9\u5e94\u4e8e\u9ed8\u8ba4\u7f16\u8f91\u5668<code class=\"filename\">vi</code>\uff0c\u4e14\u5bf9\u5f88\u591a\u5176\u4ed6\u5e38\u89c1\u7f16\u8f91\u5668\u53ef\u7528\uff09\u3002\u5728 Windows \u7cfb\u7edf\u4e0a\u6ca1\u6709\u9ed8\u8ba4\u503c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PSQL_HISTORY</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u547d\u4ee4\u5386\u53f2\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08<code class=\"literal\">~</code>\uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PSQL_PAGER</code><br/></span><span class=\"term\"><code class=\"envar\">PAGER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u67e5\u8be2\u7ed3\u679c\u65e0\u6cd5\u5728\u5c4f\u5e55\u4e0a\u663e\u793a\u5b8c\u6574\uff0c\u5b83\u4eec\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6b64\u547d\u4ee4\u3002\u5178\u578b\u7684\u503c\u662f<code class=\"literal\">more</code>\u6216<code class=\"literal\">less</code>\u3002\u53ef\u4ee5\u901a\u8fc7\u5c06<code class=\"envar\">PSQL_PAGER</code>\u6216<code class=\"envar\">PAGER</code>\u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u6216\u901a\u8fc7\u8c03\u6574<code class=\"command\">\\pset</code>\u547d\u4ee4\u7684\u4e0e\u5206\u9875\u76f8\u5173\u7684\u9009\u9879\u6765\u7981\u7528\u5206\u9875\u5668\u3002\u8fd9\u4e9b\u53d8\u91cf\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u8fdb\u884c\u68c0\u67e5\uff1b\u4f7f\u7528\u6309\u8be5\u987a\u5e8f\u627e\u5230\u7684\u7b2c\u4e00\u4e2a\u5df2\u8bbe\u7f6e\u7684\u53d8\u91cf\u3002\u5982\u679c\u5b83\u4eec\u90fd\u6ca1\u6709\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5728\u5927\u591a\u6570\u5e73\u53f0\u4e0a\u4f7f\u7528<code class=\"literal\">more</code>\uff0c\u4f46\u5728Cygwin\u4e0a\u4f7f\u7528<code class=\"literal\">less</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PSQLRC</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7528\u6237\u7684<code class=\"filename\">.psqlrc</code>\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08<code class=\"literal\">~</code>\uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">SHELL</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u88ab<code class=\"command\">\\!</code>\u547d\u4ee4\u6267\u884c\u7684\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">TMPDIR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b58\u50a8\u4e34\u65f6\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u662f<code class=\"filename\">/tmp</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6 <span class=\"productname\">PostgreSQL</span> \u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528 <span class=\"application\">libpq</span> \u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/13/libpq-envars.html\" title=\"33.14.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a033.14\u00a0\u8282</a>\uff09\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.19.10\">\n<h2 lang=\"zh\">\u6587\u4ef6</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt lang=\"zh\"><span class=\"term\"><code class=\"filename\">psqlrc</code> \u548c <code class=\"filename\">~/.psqlrc</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u6ca1\u6709<code class=\"option\">-X</code>\u9009\u9879\uff0c\u5728\u8fde\u63a5\u5230\u6570\u636e\u5e93\u540e\u4f46\u5728\u63a5\u6536\u6b63\u5e38\u7684\u547d\u4ee4\u4e4b\u524d\uff0c<span class=\"application\">psql</span>\u4f1a\u5c1d\u8bd5\u4f9d\u6b21\u4ece\u7cfb\u7edf\u7ea7\u7684\u542f\u52a8\u6587\u4ef6\uff08<code class=\"filename\">psqlrc</code>\uff09\u548c\u7528\u6237\u7684\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\uff08<code class=\"filename\">~/.psqlrc</code>\uff09\u4e2d\u8bfb\u53d6\u5e76\u4e14\u6267\u884c\u547d\u4ee4\u3002\u8fd9\u4e9b\u6587\u4ef6\u53ef\u4ee5\u88ab\u7528\u6765\u8bbe\u7f6e\u5ba2\u6237\u7aef\u6216\u8005\u670d\u52a1\u5668\uff0c\u901a\u5e38\u662f\u4e00\u4e9b<code class=\"command\">\\set</code>\u548c<code class=\"command\">SET</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u7cfb\u7edf\u8303\u56f4\u7684\u542f\u52a8\u6587\u4ef6\u540d\u4e3a <code class=\"filename\">psqlrc</code>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4f1a\u5728\u5b89\u88c5\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u7cfb\u7edf\u914d\u7f6e</span>\u201d</span>\u76ee\u5f55\u4e2d\u67e5\u627e\u5b83\uff0c\u6700\u53ef\u9760\u7684\u8bc6\u522b\u65b9\u5f0f\u662f\u8fd0\u884c <code class=\"literal\">pg_config --sysconfdir</code>\u3002\u901a\u5e38\u8fd9\u4e2a\u76ee\u5f55\u662f\u76f8\u5bf9\u4e8e\u5305\u542b <span class=\"productname\">PostgreSQL</span> \u53ef\u6267\u884c\u6587\u4ef6\u7684\u76ee\u5f55\u7684 <code class=\"filename\">../etc/</code>\u3002\u4e5f\u53ef\u4ee5\u901a\u8fc7 <code class=\"envar\">PGSYSCONFDIR</code> \u73af\u5883\u53d8\u91cf\u663e\u5f0f\u6307\u5b9a\u67e5\u627e\u76ee\u5f55\u3002</p>\n<p lang=\"zh\">\u7528\u6237\u7684\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\u540d\u4e3a<code class=\"filename\">.psqlrc</code>\uff0c\u5e76\u4e14\u5728\u8c03\u7528\u7528\u6237\u7684\u4e3b\u76ee\u5f55\u4e2d\u5bfb\u627e\u3002Windows \u6ca1\u6709\u4e3b\u76ee\u5f55\u8fd9\u4e00\u6982\u5ff5\uff0c\u5728 Windows \u4e0a\uff0c\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\u7684\u540d\u79f0\u4e3a<code class=\"filename\">%APPDATA%\\postgresql\\psqlrc.conf</code>\u3002\u5728\u4efb\u4f55\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e<code class=\"envar\">PSQLRC</code>\u73af\u5883\u53d8\u91cf\u6765\u8986\u76d6\u6b64\u9ed8\u8ba4\u6587\u4ef6\u8def\u5f84\u3002</p>\n<p lang=\"zh\">\u7cfb\u7edf\u8303\u56f4\u7684\u542f\u52a8\u6587\u4ef6\u548c\u7528\u6237\u4e2a\u4eba\u7684\u542f\u52a8\u6587\u4ef6\u90fd\u53ef\u4ee5\u901a\u8fc7\u5728\u6587\u4ef6\u540d\u540e\u9644\u52a0\u8fde\u5b57\u7b26\u548c<span class=\"productname\">PostgreSQL</span>\u7684\u5927\u7248\u672c\u6216\u5c0f\u7248\u672c\u53f7\u6765\u4f7f\u5176\u4e0e<span class=\"application\">psql</span>\u7248\u672c\u76f8\u5173\uff0c\u4f8b\u5982<code class=\"filename\">~/.psqlrc-9.2</code>\u6216<code class=\"filename\">~/.psqlrc-9.2.5</code>\u3002\u6700\u5177\u4f53\u7248\u672c\u5339\u914d\u7684\u6587\u4ef6\u5c06\u4f18\u5148\u8bfb\u53d6\uff0c\u800c\u4e0d\u662f\u975e\u7279\u5b9a\u7248\u672c\u7684\u6587\u4ef6\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"filename\">.psql_history</code></span></dt>\n<dd>\n<p lang=\"zh\">\u547d\u4ee4\u884c\u5386\u53f2\u88ab\u5b58\u50a8\u5728\u6587\u4ef6<code class=\"filename\">~/.psql_history</code>\u4e2d\uff0c\u6216\u8005\u662f Windows \u7684\u6587\u4ef6<code class=\"filename\">%APPDATA%\\postgresql\\psql_history</code>\u4e2d\u3002</p>\n<p lang=\"zh\">\u5386\u53f2\u6587\u4ef6\u7684\u4f4d\u7f6e\u53ef\u4ee5\u901a\u8fc7<code class=\"varname\">HISTFILE</code> <span class=\"application\">psql</span>\u53d8\u91cf\u6216\u8005<code class=\"envar\">PSQL_HISTORY</code>\u73af\u5883\u53d8\u91cf\u663e\u5f0f\u8bbe\u7f6e\u3002</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.19.11\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">psql</span>\u6700\u9002\u5408\u4e0e\u76f8\u540c\u6216\u8f83\u65e7\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\u914d\u5408\u4f7f\u7528\u3002\u5982\u679c\u670d\u52a1\u5668\u7684\u7248\u672c\u6bd4<span class=\"application\">psql</span>\u672c\u8eab\u66f4\u65b0\uff0c\u53cd\u659c\u7ebf\u547d\u4ee4\u7279\u522b\u5bb9\u6613\u5931\u8d25\u3002\u7136\u800c\uff0c<code class=\"literal\">\\d</code>\u7cfb\u5217\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u5e94\u8be5\u53ef\u4ee5\u5728\u6700\u4f4e\u81f3 7.4 \u7248\u672c\u7684\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\uff0c\u4f46\u4e0d\u4e00\u5b9a\u9002\u7528\u4e8e\u6bd4<span class=\"application\">psql</span>\u672c\u8eab\u66f4\u65b0\u7684\u670d\u52a1\u5668\u3002\u8fd0\u884cSQL\u547d\u4ee4\u548c\u663e\u793a\u67e5\u8be2\u7ed3\u679c\u7684\u4e00\u822c\u529f\u80fd\u4e5f\u5e94\u8be5\u53ef\u4ee5\u5728\u66f4\u65b0\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\uff0c\u4f46\u4e0d\u80fd\u4fdd\u8bc1\u5728\u6240\u6709\u60c5\u51b5\u4e0b\u90fd\u80fd\u5b9e\u73b0\u3002</p>\n<p>\u5982\u679c\u4f60\u60f3\u7528<span class=\"application\">psql</span>\u8fde\u63a5\u5230\u591a\u4e2a\u5177\u6709\u4e0d\u540c\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\uff0c\u63a8\u8350\u4f7f\u7528\u6700\u65b0\u7248\u672c\u7684<span class=\"application\">psql</span>\u3002\u6216\u8005\uff0c\u4f60\u53ef\u4ee5\u4e3a\u6bcf\u4e00\u4e2a\u5927\u7248\u672c\u4fdd\u7559\u4e00\u4efd<span class=\"application\">psql</span>\u62f7\u8d1d\uff0c\u5e76\u4e14\u9488\u5bf9\u76f8\u5e94\u7684\u670d\u52a1\u5668\u4f7f\u7528\u5339\u914d\u7684\u7248\u672c\u3002\u4f46\u5b9e\u9645\u4e0a\uff0c\u8fd9\u79cd\u989d\u5916\u7684\u9ebb\u70e6\u662f\u4e0d\u5fc5\u8981\u7684\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5728 <span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\uff0c<code class=\"option\">-c</code> \u9009\u9879\u610f\u5473\u7740 <code class=\"option\">-X</code>\uff08<code class=\"option\">--no-psqlrc</code>\uff09\uff1b\u73b0\u5728\u5df2\u7ecf\u4e0d\u662f\u8fd9\u6837\u4e86\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5728<span class=\"productname\">PostgreSQL</span> 8.4 \u4e4b\u524d\uff0c<span class=\"application\">psql</span>\u5141\u8bb8\u4e00\u4e2a\u5355\u5b57\u6bcd\u53cd\u659c\u7ebf\u547d\u4ee4\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u76f4\u63a5\u5199\u5728\u8be5\u547d\u4ee4\u540e\u9762\uff0c\u4e2d\u95f4\u4e0d\u9700\u8981\u7a7a\u767d\u3002\u73b0\u5728\u5219\u8981\u6c42\u7528\u7a7a\u767d\u5206\u9694\u3002</p>\n</li>\n</ul>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.19.12\">\n<h2 lang=\"zh\">\u7ed9 Windows \u7528\u6237\u7684\u6ce8\u89e3</h2>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u662f\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u63a7\u5236\u53f0\u5e94\u7528</span>\u201d</span>\u3002\u7531\u4e8e Windows \u7684\u63a7\u5236\u53f0\u7a97\u53e3\u4f7f\u7528\u7684\u662f\u4e00\u79cd\u548c\u7cfb\u7edf\u4e2d\u5176\u4ed6\u5e94\u7528\u4e0d\u540c\u7684\u7f16\u7801\uff0c\u5728<span class=\"application\">psql</span>\u4e2d\u4f7f\u7528 8 \u4f4d\u5b57\u7b26\u65f6\u8981\u7279\u522b\u6ce8\u610f\u3002\u5982\u679c<span class=\"application\">psql</span>\u68c0\u6d4b\u5230\u4e00\u4e2a\u6709\u95ee\u9898\u7684\u63a7\u5236\u53f0\u4ee3\u7801\u9875\uff0c\u5b83\u5c06\u4f1a\u5728\u542f\u52a8\u65f6\u8b66\u544a\u4f60\u3002\u8981\u66f4\u6539\u63a7\u5236\u53f0\u4ee3\u7801\u9875\uff0c\u6709\u4e24\u4ef6\u4e8b\u662f\u5fc5\u8981\u7684\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u8f93\u5165<strong class=\"userinput\"><code>cmd.exe /c chcp 1252</code></strong>\u53ef\u4ee5\u8bbe\u7f6e\u4ee3\u7801\u9875\uff081252 \u662f\u9002\u7528\u4e8e\u5fb7\u8bed\u7684\u4e00\u4e2a\u4ee3\u7801\u9875\uff0c\u8bf7\u5728\u8fd9\u91cc\u66ff\u6362\u6210\u4f60\u7684\u503c\uff09\u3002\u5982\u679c\u6b63\u5728\u4f7f\u7528 Cygwin\uff0c\u53ef\u4ee5\u628a\u8fd9\u4e2a\u547d\u4ee4\u653e\u5728<code class=\"filename\">/etc/profile</code>\u4e2d\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u628a\u63a7\u5236\u53f0\u5b57\u4f53\u8bbe\u7f6e\u4e3a<code class=\"literal\">Lucida Console</code>\uff0c\u56e0\u4e3a\u6805\u683c\u5b57\u4f53\u65e0\u6cd5\u4e0e ANSI \u4ee3\u7801\u9875\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</li>\n</ul>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PSQL-EXAMPLES\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u7b2c\u4e00\u4e2a\u793a\u4f8b\u5c55\u793a\u4e86\u5982\u4f55\u628a\u4e00\u6761\u547d\u4ee4\u5206\u6563\u5230\u591a\u884c\u8f93\u5165\u4e2d\u3002\u6ce8\u610f\u63d0\u793a\u7b26\u7684\u53d8\u5316\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>CREATE TABLE my_table (</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code> first integer not null default 0,</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code> second text)</code></strong>\ntestdb-&gt; <strong class=\"userinput\"><code>;</code></strong>\nCREATE TABLE\n</pre>\n<p lang=\"zh\">\u73b0\u5728\u518d\u6765\u770b\u4e00\u4e0b\u8fd9\u4e2a\u8868\u7684\u5b9a\u4e49\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\d my_table</code></strong>\n              Table \"public.my_table\"\n Column |  Type   | Collation | Nullable | Default\n--------+---------+-----------+----------+---------\n first  | integer |           | not null | 0\n second | text    |           |          | \n</pre>\n<p lang=\"zh\">\u73b0\u5728\u6211\u4eec\u628a\u63d0\u793a\u7b26\u6539\u6210\u66f4\u6709\u8da3\u7684\u5f62\u5f0f\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set PROMPT1 '%n@%m %~%R%# '</code></strong>\npeter@localhost testdb=&gt;\n</pre>\n<p lang=\"zh\">\u5047\u8bbe\u4f60\u5df2\u7ecf\u5411\u8868\u4e2d\u586b\u5165\u6570\u636e\uff0c\u5e76\u60f3\u770b\u4e00\u770b\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; SELECT * FROM my_table;\n first | second\n-------+--------\n     1 | one\n     2 | two\n     3 | three\n     4 | four\n(4 rows)\n</pre>\n<p lang=\"zh\">\u4f60\u53ef\u4ee5\u4f7f\u7528 <code class=\"command\">\\pset</code> \u547d\u4ee4\u4ee5\u4e0d\u540c\u65b9\u5f0f\u663e\u793a\u8868\u683c\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 2</code></strong>\nBorder style is 2.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\n+-------+--------+\n| first | second |\n+-------+--------+\n|     1 | one    |\n|     2 | two    |\n|     3 | three  |\n|     4 | four   |\n+-------+--------+\n(4 rows)\n\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 0</code></strong>\nBorder style is 0.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\nfirst second\n----- ------\n    1 one\n    2 two\n    3 three\n    4 four\n(4 rows)\n\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 1</code></strong>\nBorder style is 1.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset format csv</code></strong>\nOutput format is csv.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset tuples_only</code></strong>\nTuples only is on.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT second, first FROM my_table;</code></strong>\none,1\ntwo,2\nthree,3\nfour,4\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset format unaligned</code></strong>\nOutput format is unaligned.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset fieldsep '\\t'</code></strong>\nField separator is \"    \".\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT second, first FROM my_table;</code></strong>\none     1\ntwo     2\nthree   3\nfour    4\n</pre>\n<p lang=\"zh\">\u6216\u8005\u4f7f\u7528\u77ed\u547d\u4ee4\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\a \\t \\x</code></strong>\nOutput format is aligned.\nTuples only is off.\nExpanded display is on.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\n-[ RECORD 1 ]-\nfirst  | 1\nsecond | one\n-[ RECORD 2 ]-\nfirst  | 2\nsecond | two\n-[ RECORD 3 ]-\nfirst  | 3\nsecond | three\n-[ RECORD 4 ]-\nfirst  | 4\nsecond | four\n</pre>\n<p lang=\"zh\">\u6b64\u5916\uff0c\u53ef\u4ee5\u4f7f\u7528<code class=\"literal\">\\g</code>\u4e3a\u4e00\u4e2a\u67e5\u8be2\u8bbe\u7f6e\u8fd9\u4e9b\u8f93\u51fa\u683c\u5f0f\u9009\u9879\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table</code></strong>\npeter@localhost testdb-&gt; <strong class=\"userinput\"><code>\\g (format=aligned tuples_only=off expanded=on)</code></strong>\n-[ RECORD 1 ]-\nfirst  | 1\nsecond | one\n-[ RECORD 2 ]-\nfirst  | 2\nsecond | two\n-[ RECORD 3 ]-\nfirst  | 3\nsecond | three\n-[ RECORD 4 ]-\nfirst  | 4\nsecond | four\n</pre>\n<p lang=\"zh\">\u5728\u9002\u5408\u7684\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u4f7f\u7528 <code class=\"command\">\\crosstabview</code> \u547d\u4ee4\u5c06\u67e5\u8be2\u7ed3\u679c\u663e\u793a\u4e3a\u4ea4\u53c9\u8868\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>SELECT first, second, first &gt; 2 AS gt2 FROM my_table;</code></strong>\n first | second | gt2 \n-------+--------+-----\n     1 | one    | f\n     2 | two    | f\n     3 | three  | t\n     4 | four   | t\n(4 rows)\n\ntestdb=&gt; <strong class=\"userinput\"><code>\\crosstabview first second</code></strong>\n first | one | two | three | four \n-------+-----+-----+-------+------\n     1 | f   |     |       | \n     2 |     | f   |       | \n     3 |     |     | t     | \n     4 |     |     |       | t\n(4 rows)\n</pre>\n<p lang=\"zh\">\u7b2c\u4e8c\u4e2a\u793a\u4f8b\u5c55\u793a\u4e86\u4e00\u4e2a\u4e58\u6cd5\u8868\uff0c\u5176\u4e2d\u884c\u6309\u6570\u5b57\u5012\u5e8f\u6392\u5217\uff0c\u800c\u5217\u6309\u72ec\u7acb\u7684\u5347\u5e8f\u6570\u5b57\u6392\u5217\u3002</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>SELECT t1.first as \"A\", t2.first+100 AS \"B\", t1.first*(t2.first+100) as \"AxB\",</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code>row_number() over(order by t2.first) AS ord</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code>FROM my_table t1 CROSS JOIN my_table t2 ORDER BY 1 DESC</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code>\\crosstabview \"A\" \"B\" \"AxB\" ord</code></strong>\n A | 101 | 102 | 103 | 104 \n---+-----+-----+-----+-----\n 4 | 404 | 408 | 412 | 416\n 3 | 303 | 306 | 309 | 312\n 2 | 202 | 204 | 206 | 208\n 1 | 101 | 102 | 103 | 104\n(4 rows)\n</pre>\n</div>\n</div></div>", "manual_path": "app-psql.html", "localization": {"status": "complete", "sources": [{"url": "/docs/13/app-psql.html", "method": "same-major semantic node", "sha256": "dd2bf63d81b9a9d3fc69c646197cfdc14a0b1bab1c9f0b98608d66554da4a261", "language": "zh", "matched_nodes": ["#APP-PSQL/div[10]/div[1]/ul[0]/li[0]", "#APP-PSQL/div[10]/div[1]/ul[0]/li[1]", "#APP-PSQL/div[10]/div[1]/ul[0]/li[2]", "#APP-PSQL/div[10]/h2[0]", "#APP-PSQL/div[11]/div[2]/ul[0]/li[0]", "#APP-PSQL/div[11]/div[2]/ul[0]/li[1]", "#APP-PSQL/div[11]/h2[0]", "#APP-PSQL/div[11]/p[1]", "#APP-PSQL/div[12]/p[11]", "#APP-PSQL/div[12]/p[13]", "#APP-PSQL/div[12]/p[15]", "#APP-PSQL/div[12]/p[17]", "#APP-PSQL/div[12]/p[1]", "#APP-PSQL/div[12]/p[3]", "#APP-PSQL/div[12]/p[5]", "#APP-PSQL/div[12]/p[7]", "#APP-PSQL/div[12]/p[9]", "#APP-PSQL/div[2]/p[1]", "#APP-PSQL/div[3]/h2[0]", "#APP-PSQL/div[4]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[11]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[13]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[15]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]/p[2]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[19]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[21]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[23]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[25]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[25]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[27]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[29]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[31]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[35]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[37]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[39]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[3]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[41]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]/div[1]/h3[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]/div[1]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[45]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[47]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[49]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[51]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[53]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[55]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[55]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[57]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[57]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[59]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[5]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[61]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[63]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[65]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[67]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[67]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[69]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[3]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[5]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[6]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[7]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[9]", "#APP-PSQL/div[6]/h2[0]", "#APP-PSQL/div[6]/p[1]", "#APP-PSQL/div[7]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[1]/p[1]", "#APP-PSQL/div[7]/div[1]/p[2]", "#APP-PSQL/div[7]/div[1]/p[5]", "#APP-PSQL/div[7]/div[1]/p[6]", "#APP-PSQL/div[7]/div[1]/p[7]", "#APP-PSQL/div[7]/div[2]/h3[0]", "#APP-PSQL/div[7]/div[2]/p[1]", "#APP-PSQL/div[7]/div[2]/p[3]", "#APP-PSQL/div[7]/div[2]/p[4]", "#APP-PSQL/div[7]/div[2]/p[5]", "#APP-PSQL/div[7]/div[2]/p[6]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[101]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[103]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[103]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[103]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[103]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[105]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[107]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[107]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[107]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[107]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[107]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[109]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[109]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[111]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[113]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[113]/p[0]/a[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[113]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[113]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[113]/p[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[117]/div[2]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[117]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[117]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[119]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]/div[5]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[121]/div[2]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[121]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[121]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[123]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[123]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[123]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[123]/p[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[123]/p[6]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[125]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[127]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[129]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[131]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[131]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[131]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[139]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[141]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[143]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[143]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dd[15]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dd[15]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dd[15]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dd[15]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dd[17]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dd[17]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dd[17]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dd[17]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dd[21]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dd[23]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dd[29]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dd[31]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dd[31]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dd[37]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dd[41]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dt[30]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dt[32]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dt[34]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[3]/dl[0]/dt[6]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/div[5]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/p[4]/a[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[149]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[153]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[157]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[157]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[157]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[157]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[157]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[159]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[15]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[15]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[161]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[161]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[163]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[163]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[163]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[165]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[167]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[169]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[171]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[173]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[173]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[175]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[177]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[179]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[0]/a[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[181]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[183]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[183]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[185]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[185]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[187]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[189]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[189]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[189]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[189]/p[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[21]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[23]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[25]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[29]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[31]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[37]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[37]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[37]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[41]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[41]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[43]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[45]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[47]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[49]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[49]/div[1]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[49]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[51]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[53]/div[1]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[53]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[55]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[57]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[59]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[61]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[63]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[65]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[67]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[69]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[71]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[73]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[75]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[75]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[77]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[77]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[77]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[79]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[79]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[7]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[7]/div[1]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[7]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[81]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[83]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[85]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[87]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[89]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[91]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[93]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[93]/div[4]/p[1]/a[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[93]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[93]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[93]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[93]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[95]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[95]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[95]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[97]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[97]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[97]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[97]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[99]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[116]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[118]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[120]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[124]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[126]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[136]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[138]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[146]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[150]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[174]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[92]", "#APP-PSQL/div[7]/div[3]/div[11]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/p[6]", "#APP-PSQL/div[7]/div[3]/h3[0]", "#APP-PSQL/div[7]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/p[2]", "#APP-PSQL/div[7]/div[3]/p[3]", "#APP-PSQL/div[7]/div[3]/p[4]", "#APP-PSQL/div[7]/div[3]/p[4]/a[2]", "#APP-PSQL/div[7]/div[3]/p[5]", "#APP-PSQL/div[7]/div[3]/p[7]", "#APP-PSQL/div[7]/div[3]/p[8]", "#APP-PSQL/div[7]/div[3]/p[9]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[15]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[17]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[19]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[19]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/div[2]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[21]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[21]/p[2]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[25]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[31]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[37]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[39]/p[0]/a[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[41]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[45]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[47]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[49]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[51]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[53]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[55]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[57]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[59]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[4]/div[1]/div[8]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/p[10]", "#APP-PSQL/div[7]/div[4]/div[1]/p[11]", "#APP-PSQL/div[7]/div[4]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/p[2]", "#APP-PSQL/div[7]/div[4]/div[1]/p[4]", "#APP-PSQL/div[7]/div[4]/div[1]/p[6]", "#APP-PSQL/div[7]/div[4]/div[1]/p[7]", "#APP-PSQL/div[7]/div[4]/div[1]/p[9]", "#APP-PSQL/div[7]/div[4]/div[2]/p[10]", "#APP-PSQL/div[7]/div[4]/div[2]/p[11]", "#APP-PSQL/div[7]/div[4]/div[2]/p[12]", "#APP-PSQL/div[7]/div[4]/div[2]/p[1]", "#APP-PSQL/div[7]/div[4]/div[2]/p[3]", "#APP-PSQL/div[7]/div[4]/div[2]/p[4]", "#APP-PSQL/div[7]/div[4]/div[2]/p[6]", "#APP-PSQL/div[7]/div[4]/div[2]/p[7]", "#APP-PSQL/div[7]/div[4]/div[2]/p[9]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[15]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[21]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[23]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[25]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[29]/p[0]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[29]/p[2]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[31]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[4]/div[3]/div[5]/p[1]", "#APP-PSQL/div[7]/div[4]/div[3]/p[1]", "#APP-PSQL/div[7]/div[4]/div[3]/p[2]", "#APP-PSQL/div[7]/div[4]/div[4]/h4[0]", "#APP-PSQL/div[7]/div[4]/div[4]/p[1]", "#APP-PSQL/div[7]/div[4]/div[4]/p[3]", "#APP-PSQL/div[7]/div[4]/h3[0]", "#APP-PSQL/div[7]/h2[0]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[11]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[13]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[15]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[17]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[19]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[1]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[3]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[5]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[7]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]/p[0]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]/p[2]", "#APP-PSQL/div[8]/p[2]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[0]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[1]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[2]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[3]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[3]/p[0]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[3]/p[1]", "#APP-PSQL/div[9]/div[1]/dl[0]/dt[0]", "#APP-PSQL/div[9]/h2[0]"]}, {"url": "/docs/13/indexes-index-only-scans.html", "method": "same-major semantic node", "sha256": "a1ce660398700ab61d3500f999991a234be349e6f3942ba12344b1de30a4be6a", "language": "zh", "matched_nodes": ["#INDEXES-INDEX-ONLY-SCANS/p[25]/span[2]"]}], "language": "zh", "original_text": {"/versions/13/description/0": "psql \u2014 PostgreSQL interactive terminal", "/versions/13/facts/0/label": "Documented executable", "/versions/13/facts/1/label": "Executable version", "/versions/13/facts/2/label": "Reference inventory", "/versions/13/facts/2/value": "Client applications", "/versions/13/facts/3/label": "Option definition groups", "/versions/13/tables/0/title": "Documented options", "/versions/13/tables/1/title": "Environment variables", "/versions/13/related/0/label": "psql meta-commands", "/versions/13/related/1/label": "libpq connection parameters", "/versions/13/tables/0/rows/0/summary": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all .", "/versions/13/tables/0/rows/1/summary": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned .", "/versions/13/tables/0/rows/2/summary": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors .", "/versions/13/tables/0/rows/3/summary": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence.", "/versions/13/tables/0/rows/4/summary": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv .", "/versions/13/tables/0/rows/5/summary": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "/versions/13/tables/0/rows/6/summary": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries .", "/versions/13/tables/0/rows/7/summary": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on .", "/versions/13/tables/0/rows/8/summary": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i .", "/versions/13/tables/0/rows/9/summary": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f .", "/versions/13/tables/0/columns/0/label": "Option and arguments", "/versions/13/tables/0/columns/1/label": "Description", "/versions/13/tables/0/rows/10/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket.", "/versions/13/tables/0/rows/11/summary": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command.", "/versions/13/tables/0/rows/12/summary": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list .", "/versions/13/tables/0/rows/13/summary": "Write all query output into file filename , in addition to the normal output destination.", "/versions/13/tables/0/rows/14/summary": "Do not use Readline for line editing and do not use the command history. This can be useful to turn off tab expansion when cutting and pasting.", "/versions/13/tables/0/rows/15/summary": "Put all query output into file filename . This is equivalent to the command \\o .", "/versions/13/tables/0/rows/16/summary": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432.", "/versions/13/tables/0/rows/17/summary": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex .", "/versions/13/tables/0/rows/18/summary": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on .", "/versions/13/tables/0/rows/19/summary": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep .", "/versions/13/tables/0/rows/20/summary": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts.", "/versions/13/tables/0/rows/21/summary": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does.", "/versions/13/tables/0/rows/22/summary": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only .", "/versions/13/tables/0/rows/23/summary": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details.", "/versions/13/tables/0/rows/24/summary": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)", "/versions/13/tables/0/rows/25/summary": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later.", "/versions/13/tables/0/rows/26/summary": "Print the psql version and exit.", "/versions/13/tables/0/rows/27/summary": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/13/tables/0/rows/28/summary": "Force psql to prompt for a password before connecting to a database, even if the password will not be used.", "/versions/13/tables/0/rows/29/summary": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded .", "/versions/13/tables/0/rows/30/summary": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file).", "/versions/13/tables/0/rows/31/summary": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero .", "/versions/13/tables/0/rows/32/summary": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero .", "/versions/13/tables/0/rows/33/summary": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. This ensures that either all the commands complete successfully, or no changes are applied.", "/versions/13/tables/0/rows/34/summary": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables.", "/versions/13/tables/1/columns/0/label": "Variable", "/versions/13/tables/1/columns/1/label": "Meaning", "/versions/13/tables/1/rows/0/description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode.", "/versions/13/tables/1/rows/1/description": "Default connection parameters (see Section 33.14 ).", "/versions/13/tables/1/rows/2/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .", "/versions/13/tables/1/rows/3/description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems.", "/versions/13/tables/1/rows/4/description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems.", "/versions/13/tables/1/rows/5/description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed.", "/versions/13/tables/1/rows/6/description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use more on most platforms, but less on Cygwin.", "/versions/13/tables/1/rows/7/description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed.", "/versions/13/tables/1/rows/8/description": "Command executed by the \\! command.", "/versions/13/tables/1/rows/9/description": "Directory for storing temporary files. The default is /tmp ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "37d719492c0b0814ad9e5236a4d571b1fb393161dfa0afb374c111a6de0d3df7"}, "comparison_data": {"options": [{"names": ["-a", "--echo-all"], "signature": "-a --echo-all", "description": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all ."}, {"names": ["-A", "--no-align"], "signature": "-A --no-align", "description": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned ."}, {"names": ["-b", "--echo-errors"], "signature": "-b --echo-errors", "description": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors ."}, {"names": ["-c command", "--command= command"], "signature": "-c command --command= command", "description": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. command must be either a command string that is completely parsable by the server (i.e., it contains no psql -specific features), or a single backslash command. Thus you cannot mix SQL and psql meta-commands within a -c option. To achieve that, you could use repeated -c options or pipe the string into psql , for example: psql -c '\\x' -c 'SELECT * FROM foo;' or echo '\\x \\\\ SELECT * FROM foo;' | psql ( \\\\ is the separator meta-command.) Each SQL command string passed to -c is sent to the server as a single request. Because of this, the server executes it as a single transaction even if the string contains multiple SQL commands, unless there are explicit BEGIN / COMMIT commands included in the string to divide it into multiple transactions. (See Section 52.2.2.1 for more details about how the server handles multi-query strings.) Also, psql only prints the result of the last SQL command in the string. This is different from the behavior when the same string is read from a file or fed to psql 's standard input, because then psql sends each SQL command separately. Because of this behavior, putting more than one SQL command in a single -c string often has unexpected results. It's better to use repeated -c commands or feed multiple commands to psql 's standard input, either using echo as illustrated above, or via a shell here-document, for example: psql <<EOF \\x SELECT * FROM foo; EOF"}, {"names": ["--csv"], "signature": "--csv", "description": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv ."}, {"names": ["-d dbname", "--dbname= dbname"], "signature": "-d dbname --dbname= dbname", "description": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--echo-queries"], "signature": "-e --echo-queries", "description": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries ."}, {"names": ["-E", "--echo-hidden"], "signature": "-E --echo-hidden", "description": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on ."}, {"names": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i . If filename is - (hyphen), then standard input is read until an EOF indication or \\q meta-command. This can be used to intersperse interactive input with input from files. Note however that Readline is not used in this case (much as if -n had been specified). Using this option is subtly different from writing psql < filename . In general, both will do what you expect, but using -f enables some nice features such as error messages with line numbers. There is also a slight chance that using this option will reduce the start-up overhead. On the other hand, the variant using the shell's input redirection is (in theory) guaranteed to yield exactly the same output you would have received had you entered everything by hand."}, {"names": ["-F separator", "--field-separator= separator"], "signature": "-F separator --field-separator= separator", "description": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f ."}, {"names": ["-h hostname", "--host= hostname"], "signature": "-h hostname --host= hostname", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket."}, {"names": ["-H", "--html"], "signature": "-H --html", "description": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command."}, {"names": ["-l", "--list"], "signature": "-l --list", "description": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list . When this option is used, psql will connect to the database postgres , unless a different database is named on the command line (option -d or non-option argument, possibly via a service entry, but not via an environment variable)."}, {"names": ["-L filename", "--log-file= filename"], "signature": "-L filename --log-file= filename", "description": "Write all query output into file filename , in addition to the normal output destination."}, {"names": ["-n", "--no-readline"], "signature": "-n --no-readline", "description": "Do not use Readline for line editing and do not use the command history. This can be useful to turn off tab expansion when cutting and pasting."}, {"names": ["-o filename", "--output= filename"], "signature": "-o filename --output= filename", "description": "Put all query output into file filename . This is equivalent to the command \\o ."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432."}, {"names": ["-P assignment", "--pset= assignment"], "signature": "-P assignment --pset= assignment", "description": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex ."}, {"names": ["-q", "--quiet"], "signature": "-q --quiet", "description": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on ."}, {"names": ["-R separator", "--record-separator= separator"], "signature": "-R separator --record-separator= separator", "description": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep ."}, {"names": ["-s", "--single-step"], "signature": "-s --single-step", "description": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts."}, {"names": ["-S", "--single-line"], "signature": "-S --single-line", "description": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does. Note This mode is provided for those who insist on it, but you are not necessarily encouraged to use it. In particular, if you mix SQL and meta-commands on a line the order of execution might not always be clear to the inexperienced user."}, {"names": ["-t", "--tuples-only"], "signature": "-t --tuples-only", "description": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only ."}, {"names": ["-T table_options", "--table-attr= table_options"], "signature": "-T table_options --table-attr= table_options", "description": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)"}, {"names": ["-v assignment", "--set= assignment", "--variable= assignment"], "signature": "-v assignment --set= assignment --variable= assignment", "description": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the psql version and exit."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Force psql to prompt for a password before connecting to a database, even if the password will not be used. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, psql will prompt for a password in any case. However, psql will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-x", "--expanded"], "signature": "-x --expanded", "description": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded ."}, {"names": ["-X", "--no-psqlrc"], "signature": "-X --no-psqlrc", "description": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file)."}, {"names": ["-z", "--field-separator-zero"], "signature": "-z --field-separator-zero", "description": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero ."}, {"names": ["-0", "--record-separator-zero"], "signature": "-0 --record-separator-zero", "description": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero ."}, {"names": ["-1", "--single-transaction"], "signature": "-1 --single-transaction", "description": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. This ensures that either all the commands complete successfully, or no changes are applied. If the commands themselves contain BEGIN , COMMIT , or ROLLBACK , this option will not have the desired effects. Also, if an individual command cannot be executed inside a transaction block, specifying this option will cause the whole transaction to fail."}, {"names": ["-?", "--help[= topic ]"], "signature": "-? --help[= topic ]", "description": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables."}], "synopsis": ["psql [ option ...] [ dbname [ username ]]"], "environment": [{"name": "COLUMNS", "description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode."}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters (see Section 33.14 )."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems."}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems."}, {"name": "PSQL_HISTORY", "description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed."}, {"name": "PSQL_PAGER PAGER", "description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use more on most platforms, but less on Cygwin."}, {"name": "PSQLRC", "description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed."}, {"name": "SHELL", "description": "Command executed by the \\! command."}, {"name": "TMPDIR", "description": "Directory for storing temporary files. The default is /tmp ."}]}, "comparison_hash": "4a4dd0a7d0a689cfa3f6b44663814fe61d2b6de414e7e11e0e20923a28151f08", "manual_language": "zh"}, "14": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "psql"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "14.24"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "35"}], "tables": [{"key": "options", "rows": [{"summary": "\u5728\u8bfb\u5165\u65f6\u5c06\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u884c\u8bfb\u53d6\uff09\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a all \u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-a --echo-all"}}, {"summary": "\u5207\u6362\u5230\u975e\u5bf9\u9f50\u8f93\u51fa\u6a21\u5f0f\uff08\u9ed8\u8ba4\u8f93\u51fa\u6a21\u5f0f\u662f aligned \uff09\u3002\u8fd9\u7b49\u6548\u4e8e \\pset format unaligned \u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-A --no-align"}}, {"summary": "\u628a\u5931\u8d25\u7684 SQL \u547d\u4ee4\u6253\u5370\u5230\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a errors \u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-b --echo-errors"}}, {"summary": "\u6307\u5b9a psql \u6267\u884c\u4e00\u4e2a\u7ed9\u5b9a\u7684\u547d\u4ee4\u5b57\u7b26\u4e32 command \u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u591a\u6b21\u5e76\u4e14\u4ee5\u4efb\u4f55\u987a\u5e8f\u4e0e -f \u9009\u9879\u7ec4\u5408\u5728\u4e00\u8d77\u3002\u5f53 -c \u6216\u8005 -f \u88ab\u6307\u5b9a\u65f6\uff0c psql \u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709 -c \u548c -f \u9009\u9879\u540e\u7ec8\u6b62\u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-c command --command= command"}}, {"summary": "\u5207\u6362\u5230 CSV \uff08\u9017\u53f7\u5206\u9694\u503c\uff09\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u76f8\u5f53\u4e8e \\pset format csv \u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "--csv"}}, {"summary": "\u6307\u5b9a\u8981\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002\u8fd9\u7b49\u6548\u4e8e\u6307\u5b9a dbname \u4e3a\u547d\u4ee4\u884c\u4e0a\u7684\u7b2c\u4e00\u4e2a\u975e\u9009\u9879\u53c2\u6570\u3002 dbname \u53ef\u4ee5\u662f \u8fde\u63a5\u5b57\u7b26\u4e32 \u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u5c06\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-d dbname --dbname= dbname"}}, {"summary": "\u4e5f\u628a\u53d1\u9001\u5230\u670d\u52a1\u5668\u7684\u6240\u6709 SQL \u547d\u4ee4\u590d\u5236\u5230\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a queries \u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-e --echo-queries"}}, {"summary": "\u56de\u663e \\d \u4ee5\u53ca\u5176\u4ed6\u53cd\u659c\u7ebf\u547d\u4ee4\u751f\u6210\u7684\u5b9e\u9645\u67e5\u8be2\u3002\u53ef\u4ee5\u7528\u5b83\u6765\u5b66\u4e60 psql \u7684\u5185\u90e8\u64cd\u4f5c\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO_HIDDEN \u8bbe\u7f6e\u4e3a on \u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-E --echo-hidden"}}, {"summary": "\u4ece\u6587\u4ef6 filename \u800c\u4e0d\u662f\u6807\u51c6\u8f93\u5165\u4e2d\u8bfb\u53d6\u547d\u4ee4\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u6307\u5b9a\uff0c\u4e5f\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u4e0e -c \u9009\u9879\u7ec4\u5408\u4f7f\u7528\u3002\u5f53\u6307\u5b9a\u4e86 -c \u6216 -f \u65f6\uff0c psql \u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709 -c \u548c -f \u9009\u9879\u540e\u7ec8\u6b62\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u7b49\u4ef7\u4e8e\u5143\u547d\u4ee4 \\i \u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-f filename --file= filename"}}, {"summary": "\u4f7f\u7528 separator \u4f5c\u4e3a\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e \\pset fieldsep \u6216\u8005 \\f \u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-F separator --field-separator= separator"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-h hostname --host= hostname"}}, {"summary": "\u5207\u6362\u5230 HTML \u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e \\pset format html \u6216\u8005 \\H \u547d\u4ee4\u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-H --html"}}, {"summary": "\u5217\u51fa\u6240\u6709\u53ef\u7528\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u9000\u51fa\u3002\u5176\u4ed6\u975e\u8fde\u63a5\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002\u8fd9\u4e0e\u5143\u547d\u4ee4 \\list \u7c7b\u4f3c\u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-l --list"}}, {"summary": "\u9664\u4e86\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u5199\u5230\u666e\u901a\u8f93\u51fa\u76ee\u6807\u4e4b\u5916\uff0c\u8fd8\u5199\u5230\u6587\u4ef6 filename \u4e2d\u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-L filename --log-file= filename"}}, {"summary": "\u4e0d\u8981\u4f7f\u7528 Readline \u8fdb\u884c\u884c\u7f16\u8f91\uff0c\u4e5f\u4e0d\u8981\u4f7f\u7528\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\u3002\u8fd9\u6709\u52a9\u4e8e\u5728\u526a\u5207\u548c\u7c98\u8d34\u65f6\u5173\u95edTAB \u8865\u5168\u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-n --no-readline"}}, {"summary": "\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u653e\u5230\u6587\u4ef6 filename \u4e2d\u3002\u8fd9\u7b49\u6548\u4e8e\u547d\u4ee4 \\o \u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-o filename --output= filename"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u7684\u6587\u4ef6\u540d\u540e\u7f00\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u7684\u503c\uff1b\u672a\u8bbe\u7f6e\u65f6\uff0c\u4f7f\u7528\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u7aef\u53e3\uff0c\u901a\u5e38\u4e3a 5432\u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-p port --port= port"}}, {"summary": "\u4ee5 \\pset \u7684\u5f62\u5f0f\u6307\u5b9a\u6253\u5370\u9009\u9879\u3002\u6ce8\u610f\uff0c\u8fd9\u91cc\u4f60\u5fc5\u987b\u7528\u4e00\u4e2a\u7b49\u53f7\u800c\u4e0d\u662f\u7a7a\u683c\u6765\u5206\u9694\u540d\u79f0\u548c\u503c\u3002\u4f8b\u5982\uff0c\u8981\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a LaTeX \uff0c\u5e94\u8be5\u5199\u6210 -P format=latex \u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-P assignment --pset= assignment"}}, {"summary": "\u6307\u5b9a psql \u5e94\u8be5\u5b89\u9759\u5730\u5de5\u4f5c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4f1a\u6253\u5370\u51fa\u6b22\u8fce\u6d88\u606f\u548c\u5404\u79cd\u63d0\u793a\u4fe1\u606f\u3002\u5982\u679c\u4f7f\u7528\u4e86\u8fd9\u4e2a\u9009\u9879\uff0c\u4ee5\u4e0a\u90a3\u4e9b\u5c31\u90fd\u4e0d\u4f1a\u8f93\u51fa\u3002\u5728\u4f7f\u7528 -c \u9009\u9879\u65f6\uff0c\u914d\u5408\u8fd9\u4e2a\u9009\u9879\u5f88\u6709\u7528\u3002\u8fd9\u7b49\u6548\u4e8e\u8bbe\u7f6e\u53d8\u91cf QUIET \u4e3a on \u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-q --quiet"}}, {"summary": "\u628a separator \u7528\u4f5c\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e \\pset recordsep \u547d\u4ee4\u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-R separator --record-separator= separator"}}, {"summary": "\u8fd0\u884c\u5728\u5355\u6b65\u6a21\u5f0f\u4e2d\u3002\u8fd9\u610f\u5473\u7740\u5728\u6bcf\u4e2a\u547d\u4ee4\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u4e4b\u524d\u90fd\u4f1a\u63d0\u793a\u7528\u6237\uff0c\u5e76\u5141\u8bb8\u53d6\u6d88\u6267\u884c\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u8c03\u8bd5\u811a\u672c\u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-s --single-step"}}, {"summary": "\u8fd0\u884c\u5728\u5355\u884c\u6a21\u5f0f\u4e2d\uff0c\u5176\u4e2d\u6362\u884c\u7b26\u4f1a\u7ec8\u6b62\u4e00\u4e2a SQL \u547d\u4ee4\uff0c\u5c31\u50cf\u5206\u53f7\u7684\u4f5c\u7528\u4e00\u6837\u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-S --single-line"}}, {"summary": "\u5173\u95ed\u6253\u5370\u5217\u540d\u548c\u7ed3\u679c\u884c\u8ba1\u6570\u9875\u811a\u7b49\u3002\u8fd9\u7b49\u6548\u4e8e \\t \u6216\u8005 \\pset tuples_only \u547d\u4ee4\u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-t --tuples-only"}}, {"summary": "\u6307\u5b9a\u8981\u653e\u5728 HTML table \u6807\u7b7e\u5185\u7684\u9009\u9879\u3002\u8be6\u89c1 \\pset tableattr \u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-T table_options --table-attr= table_options"}}, {"summary": "\u4f5c\u4e3a\u7528\u6237 username \u800c\u4e0d\u662f\u9ed8\u8ba4\u7528\u6237\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff08\u5f53\u7136\uff0c\u4f60\u5fc5\u987b\u5177\u6709\u8fd9\u6837\u505a\u7684\u6743\u9650\uff09\u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-U username --username= username"}}, {"summary": "\u6267\u884c\u4e00\u6b21\u53d8\u91cf\u8d4b\u503c\uff0c\u548c \\set \u5143\u547d\u4ee4\u76f8\u4f3c\u3002\u6ce8\u610f\u4f60\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u7528\u7b49\u53f7\u5206\u9694\u540d\u5b57\u548c\u503c\uff08\u5982\u679c\u6709\uff09\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u7684\u8bbe\u7f6e\uff0c\u53bb\u6389\u7b49\u53f7\u5c31\u884c\u3002\u8981\u628a\u4e00\u4e2a\u53d8\u91cf\u8bbe\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u4f7f\u7528\u7b49\u53f7\u4f46\u662f\u53bb\u6389\u503c\u3002\u8fd9\u4e9b\u8d4b\u503c\u5728\u547d\u4ee4\u884c\u5904\u7406\u671f\u95f4\u88ab\u5b8c\u6210\uff0c\u56e0\u6b64\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u7684\u53d8\u91cf\u5c06\u5728\u7a0d\u540e\u88ab\u8986\u76d6\u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-v assignment --set= assignment --variable= assignment"}}, {"summary": "\u6253\u5370 psql \u7248\u672c\u5e76\u4e14\u9000\u51fa\u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-V --version"}}, {"summary": "\u6c38\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982 .pgpass \u6587\u4ef6\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u8fd9\u4e2a\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4efb\u52a1\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u65f6\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 psql \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\uff0c\u5373\u4f7f\u8be5\u5bc6\u7801\u5b9e\u9645\u4e0a\u4e0d\u4f1a\u88ab\u4f7f\u7528\u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-W --password"}}, {"summary": "\u6253\u5f00\u6269\u5c55\u8868\u683c\u5f0f\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e \\x \u6216\u8005 \\pset expanded \u547d\u4ee4\u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-x --expanded"}}, {"summary": "\u4e0d\u8bfb\u53d6\u542f\u52a8\u6587\u4ef6\uff08\u65e2\u4e0d\u8bfb\u53d6\u7cfb\u7edf\u8303\u56f4\u7684 psqlrc \u6587\u4ef6\uff0c\u4e5f\u4e0d\u8bfb\u53d6\u7528\u6237\u7684 ~/.psqlrc \u6587\u4ef6\uff09\u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-X --no-psqlrc"}}, {"summary": "\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u8fd9\u7b49\u6548\u4e8e \\pset fieldsep_zero \u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-z --field-separator-zero"}}, {"summary": "\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u4f8b\u5982\uff0c\u8fd9\u6709\u52a9\u4e8e\u4e0e xargs -0 \u914d\u5408\u4f7f\u7528\u3002\u8fd9\u7b49\u6548\u4e8e \\pset recordsep_zero \u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-0 --record-separator-zero"}}, {"summary": "\u8fd9\u4e2a\u9009\u9879\u53ea\u80fd\u4e0e\u4e00\u4e2a\u6216\u591a\u4e2a -c \u548c/\u6216 -f \u9009\u9879\u7ed3\u5408\u4f7f\u7528\u3002\u5b83\u4f1a\u5bfc\u81f4 psql \u5728\u7b2c\u4e00\u4e2a\u8fd9\u6837\u7684\u9009\u9879\u4e4b\u524d\u53d1\u51fa\u4e00\u4e2a BEGIN \u547d\u4ee4\uff0c\u5e76\u5728\u6700\u540e\u4e00\u4e2a\u9009\u9879\u4e4b\u540e\u53d1\u51fa\u4e00\u4e2a COMMIT \u547d\u4ee4\uff0c\u4ece\u800c\u5c06\u6240\u6709\u547d\u4ee4\u5305\u88c5\u6210\u4e00\u4e2a\u5355\u72ec\u7684\u4e8b\u52a1\u3002\u8fd9\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-1 --single-transaction"}}, {"summary": "\u663e\u793a\u6709\u5173 psql \u7684\u5e2e\u52a9\u5e76\u4e14\u9000\u51fa\u3002\u53ef\u9009\u7684 topic \u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a options \uff09\u9009\u62e9\u8981\u89e3\u91ca psql \u7684\u54ea\u4e00\u90e8\u5206\uff1a commands \u63cf\u8ff0 psql \u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b options \u63cf\u8ff0\u53ef\u4ee5\u88ab\u4f20\u9012\u7ed9 psql \u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c variables \u5219\u663e\u793a\u6709\u5173 psql \u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002", "signature": {"url": "/docs/14/app-psql.html", "text": "-? --help[= topic ]"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "COLUMNS", "description": "\u5982\u679c \\pset columns \u4e3a\u96f6\uff0c\u8fd9\u4e2a\u73af\u5883\u53d8\u91cf\u63a7\u5236\u7528\u4e8e wrapped \u683c\u5f0f\u7684\u5bbd\u5ea6\u4ee5\u53ca\u7528\u6765\u786e\u5b9a\u8f83\u5bbd\u7684\u8f93\u51fa\u662f\u5426\u9700\u8981\u5206\u9875\u5668\uff0c\u6216\u8005\u662f\u5426\u5e94\u5207\u6362\u5230\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e2d\u7684\u5782\u76f4\u683c\u5f0f\u7684\u5bbd\u5ea6\u3002"}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\uff08\u89c1 \u7b2c 34.15 \u8282 \uff09\u3002"}, {"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "\\e \u3001 \\ef \u4ee5\u53ca \\ev \u547d\u4ee4\u6240\u4f7f\u7528\u7684\u7f16\u8f91\u5668\u3002\u4f1a\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u68c0\u67e5\u8fd9\u4e9b\u53d8\u91cf\uff0c\u7b2c\u4e00\u4e2a\u88ab\u8bbe\u7f6e\u7684\u5c06\u88ab\u4f7f\u7528\u3002\u5982\u679c\u90fd\u6ca1\u6709\u88ab\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u662f\u4f7f\u7528Unix\u7cfb\u7edf\u4e0a\u7684 vi \u6216\u8005Windows\u7cfb\u7edf\u4e0a\u7684 notepad.exe \u3002"}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "\u5f53 \\e \u3001 \\ef \u6216 \\ev \u5e26\u6709\u884c\u53f7\u53c2\u6570\u4f7f\u7528\u65f6\uff0c\u6b64\u53d8\u91cf\u6307\u5b9a\u5c06\u8d77\u59cb\u884c\u53f7\u4f20\u7ed9\u7528\u6237\u7f16\u8f91\u5668\u65f6\u6240\u7528\u7684\u547d\u4ee4\u884c\u53c2\u6570\u3002\u5bf9\u4e8e Emacs \u6216 vi \u4e4b\u7c7b\u7684\u7f16\u8f91\u5668\uff0c\u8fd9\u4e2a\u53c2\u6570\u662f\u4e00\u4e2a\u52a0\u53f7\u3002\u5982\u679c\u9009\u9879\u540d\u548c\u884c\u53f7\u4e4b\u95f4\u9700\u8981\u7a7a\u683c\uff0c\u8bf7\u5728\u53d8\u91cf\u503c\u4e2d\u5305\u542b\u672b\u5c3e\u7a7a\u683c\u3002\u4f8b\u5982\uff1a PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' \u5728 Unix \u7cfb\u7edf\u4e0a\u9ed8\u8ba4\u662f + \uff08\u5bf9\u5e94\u4e8e\u9ed8\u8ba4\u7f16\u8f91\u5668 vi \uff0c\u4e14\u5bf9\u5f88\u591a\u5176\u4ed6\u5e38\u89c1\u7f16\u8f91\u5668\u53ef\u7528\uff09\u3002\u5728 Windows \u7cfb\u7edf\u4e0a\u6ca1\u6709\u9ed8\u8ba4\u503c\u3002"}, {"name": "PSQL_HISTORY", "description": "\u547d\u4ee4\u5386\u53f2\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08 ~ \uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002"}, {"name": "PSQL_PAGER PAGER", "description": "\u5982\u679c\u67e5\u8be2\u7ed3\u679c\u65e0\u6cd5\u5728\u5c4f\u5e55\u4e0a\u663e\u793a\u5b8c\u6574\uff0c\u5b83\u4eec\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6b64\u547d\u4ee4\u3002\u5178\u578b\u7684\u503c\u662f more \u6216 less \u3002\u53ef\u4ee5\u901a\u8fc7\u5c06 PSQL_PAGER \u6216 PAGER \u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u6216\u901a\u8fc7\u8c03\u6574 \\pset \u547d\u4ee4\u7684\u4e0e\u5206\u9875\u76f8\u5173\u7684\u9009\u9879\u6765\u7981\u7528\u5206\u9875\u5668\u3002\u8fd9\u4e9b\u53d8\u91cf\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u8fdb\u884c\u68c0\u67e5\uff1b\u4f7f\u7528\u6309\u8be5\u987a\u5e8f\u627e\u5230\u7684\u7b2c\u4e00\u4e2a\u5df2\u8bbe\u7f6e\u7684\u53d8\u91cf\u3002\u5982\u679c\u5b83\u4eec\u90fd\u6ca1\u6709\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5728\u5927\u591a\u6570\u5e73\u53f0\u4e0a\u4f7f\u7528 more \uff0c\u4f46\u5728Cygwin\u4e0a\u4f7f\u7528 less \u3002"}, {"name": "PSQLRC", "description": "\u7528\u6237\u7684 .psqlrc \u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08 ~ \uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002"}, {"name": "SHELL", "description": "\u88ab \\! \u547d\u4ee4\u6267\u884c\u7684\u547d\u4ee4\u3002"}, {"name": "TMPDIR", "description": "\u5b58\u50a8\u4e34\u65f6\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u662f /tmp \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-a", "--echo-all"], "summary": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all .", "signature": "-a --echo-all", "source_url": "/docs/14/app-psql.html", "description": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all ."}, {"names": ["-A", "--no-align"], "summary": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned .", "signature": "-A --no-align", "source_url": "/docs/14/app-psql.html", "description": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned ."}, {"names": ["-b", "--echo-errors"], "summary": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors .", "signature": "-b --echo-errors", "source_url": "/docs/14/app-psql.html", "description": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors ."}, {"names": ["-c command", "--command= command"], "summary": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence.", "signature": "-c command --command= command", "source_url": "/docs/14/app-psql.html", "description": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. command must be either a command string that is completely parsable by the server (i.e., it contains no psql -specific features), or a single backslash command. Thus you cannot mix SQL and psql meta-commands within a -c option. To achieve that, you could use repeated -c options or pipe the string into psql , for example: psql -c '\\x' -c 'SELECT * FROM foo;' or echo '\\x \\\\ SELECT * FROM foo;' | psql ( \\\\ is the separator meta-command.) Each SQL command string passed to -c is sent to the server as a single request. Because of this, the server executes it as a single transaction even if the string contains multiple SQL commands, unless there are explicit BEGIN / COMMIT commands included in the string to divide it into multiple transactions. (See Section 53.2.2.1 for more details about how the server handles multi-query strings.) Also, psql only prints the result of the last SQL command in the string. This is different from the behavior when the same string is read from a file or fed to psql 's standard input, because then psql sends each SQL command separately. Because of this behavior, putting more than one SQL command in a single -c string often has unexpected results. It's better to use repeated -c commands or feed multiple commands to psql 's standard input, either using echo as illustrated above, or via a shell here-document, for example: psql <<EOF \\x SELECT * FROM foo; EOF"}, {"names": ["--csv"], "summary": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv .", "signature": "--csv", "source_url": "/docs/14/app-psql.html", "description": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv ."}, {"names": ["-d dbname", "--dbname= dbname"], "summary": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "signature": "-d dbname --dbname= dbname", "source_url": "/docs/14/app-psql.html", "description": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--echo-queries"], "summary": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries .", "signature": "-e --echo-queries", "source_url": "/docs/14/app-psql.html", "description": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries ."}, {"names": ["-E", "--echo-hidden"], "summary": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on .", "signature": "-E --echo-hidden", "source_url": "/docs/14/app-psql.html", "description": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on ."}, {"names": ["-f filename", "--file= filename"], "summary": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i .", "signature": "-f filename --file= filename", "source_url": "/docs/14/app-psql.html", "description": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i . If filename is - (hyphen), then standard input is read until an EOF indication or \\q meta-command. This can be used to intersperse interactive input with input from files. Note however that Readline is not used in this case (much as if -n had been specified). Using this option is subtly different from writing psql < filename . In general, both will do what you expect, but using -f enables some nice features such as error messages with line numbers. There is also a slight chance that using this option will reduce the start-up overhead. On the other hand, the variant using the shell's input redirection is (in theory) guaranteed to yield exactly the same output you would have received had you entered everything by hand."}, {"names": ["-F separator", "--field-separator= separator"], "summary": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f .", "signature": "-F separator --field-separator= separator", "source_url": "/docs/14/app-psql.html", "description": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f ."}, {"names": ["-h hostname", "--host= hostname"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket.", "signature": "-h hostname --host= hostname", "source_url": "/docs/14/app-psql.html", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket."}, {"names": ["-H", "--html"], "summary": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command.", "signature": "-H --html", "source_url": "/docs/14/app-psql.html", "description": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command."}, {"names": ["-l", "--list"], "summary": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list .", "signature": "-l --list", "source_url": "/docs/14/app-psql.html", "description": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list . When this option is used, psql will connect to the database postgres , unless a different database is named on the command line (option -d or non-option argument, possibly via a service entry, but not via an environment variable)."}, {"names": ["-L filename", "--log-file= filename"], "summary": "Write all query output into file filename , in addition to the normal output destination.", "signature": "-L filename --log-file= filename", "source_url": "/docs/14/app-psql.html", "description": "Write all query output into file filename , in addition to the normal output destination."}, {"names": ["-n", "--no-readline"], "summary": "Do not use Readline for line editing and do not use the command history. This can be useful to turn off tab expansion when cutting and pasting.", "signature": "-n --no-readline", "source_url": "/docs/14/app-psql.html", "description": "Do not use Readline for line editing and do not use the command history. This can be useful to turn off tab expansion when cutting and pasting."}, {"names": ["-o filename", "--output= filename"], "summary": "Put all query output into file filename . This is equivalent to the command \\o .", "signature": "-o filename --output= filename", "source_url": "/docs/14/app-psql.html", "description": "Put all query output into file filename . This is equivalent to the command \\o ."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432.", "signature": "-p port --port= port", "source_url": "/docs/14/app-psql.html", "description": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432."}, {"names": ["-P assignment", "--pset= assignment"], "summary": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex .", "signature": "-P assignment --pset= assignment", "source_url": "/docs/14/app-psql.html", "description": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex ."}, {"names": ["-q", "--quiet"], "summary": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on .", "signature": "-q --quiet", "source_url": "/docs/14/app-psql.html", "description": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on ."}, {"names": ["-R separator", "--record-separator= separator"], "summary": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep .", "signature": "-R separator --record-separator= separator", "source_url": "/docs/14/app-psql.html", "description": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep ."}, {"names": ["-s", "--single-step"], "summary": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts.", "signature": "-s --single-step", "source_url": "/docs/14/app-psql.html", "description": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts."}, {"names": ["-S", "--single-line"], "summary": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does.", "signature": "-S --single-line", "source_url": "/docs/14/app-psql.html", "description": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does. Note This mode is provided for those who insist on it, but you are not necessarily encouraged to use it. In particular, if you mix SQL and meta-commands on a line the order of execution might not always be clear to the inexperienced user."}, {"names": ["-t", "--tuples-only"], "summary": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only .", "signature": "-t --tuples-only", "source_url": "/docs/14/app-psql.html", "description": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only ."}, {"names": ["-T table_options", "--table-attr= table_options"], "summary": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details.", "signature": "-T table_options --table-attr= table_options", "source_url": "/docs/14/app-psql.html", "description": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details."}, {"names": ["-U username", "--username= username"], "summary": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)", "signature": "-U username --username= username", "source_url": "/docs/14/app-psql.html", "description": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)"}, {"names": ["-v assignment", "--set= assignment", "--variable= assignment"], "summary": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later.", "signature": "-v assignment --set= assignment --variable= assignment", "source_url": "/docs/14/app-psql.html", "description": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later."}, {"names": ["-V", "--version"], "summary": "Print the psql version and exit.", "signature": "-V --version", "source_url": "/docs/14/app-psql.html", "description": "Print the psql version and exit."}, {"names": ["-w", "--no-password"], "summary": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/14/app-psql.html", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-W", "--password"], "summary": "Force psql to prompt for a password before connecting to a database, even if the password will not be used.", "signature": "-W --password", "source_url": "/docs/14/app-psql.html", "description": "Force psql to prompt for a password before connecting to a database, even if the password will not be used. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, psql will prompt for a password in any case. However, psql will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-x", "--expanded"], "summary": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded .", "signature": "-x --expanded", "source_url": "/docs/14/app-psql.html", "description": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded ."}, {"names": ["-X", "--no-psqlrc"], "summary": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file).", "signature": "-X --no-psqlrc", "source_url": "/docs/14/app-psql.html", "description": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file)."}, {"names": ["-z", "--field-separator-zero"], "summary": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero .", "signature": "-z --field-separator-zero", "source_url": "/docs/14/app-psql.html", "description": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero ."}, {"names": ["-0", "--record-separator-zero"], "summary": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero .", "signature": "-0 --record-separator-zero", "source_url": "/docs/14/app-psql.html", "description": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero ."}, {"names": ["-1", "--single-transaction"], "summary": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. This ensures that either all the commands complete successfully, or no changes are applied.", "signature": "-1 --single-transaction", "source_url": "/docs/14/app-psql.html", "description": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. This ensures that either all the commands complete successfully, or no changes are applied. If the commands themselves contain BEGIN , COMMIT , or ROLLBACK , this option will not have the desired effects. Also, if an individual command cannot be executed inside a transaction block, specifying this option will cause the whole transaction to fail."}, {"names": ["-?", "--help[= topic ]"], "summary": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables.", "signature": "-? --help[= topic ]", "source_url": "/docs/14/app-psql.html", "description": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables."}], "related": [{"url": "/wiki/psql/?v=14", "label": "psql \u5143\u547d\u4ee4"}, {"url": "/wiki/conn/?v=14", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v14.24/postgresql-14.24.tar.bz2", "label": "14.24", "major": "14", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/14/postgresql-14-A4.pdf", "bytes": 14354704, "pages": 2944, "sha256": "8bc6b9dd7b246888bb77f0a5e8c39a2eae52e9926569832669c7d1600becb27c", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/14/postgresql-14-US.pdf", "bytes": 14242178, "pages": 3102, "sha256": "b7ecb5a5f62d8b9f73a69e25a7d26ba285373bc53168a553bff7b77955506db4", "built_at": "2026-09-26"}}, "tree": "14", "index": "index.html", "major": "14", "pages": 1158, "release": "14.24", "source_url": "https://ftp.postgresql.org/pub/source/v14.24/postgresql-14.24.tar.bz2", "svg_assets": 3, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "a7fa7ed3d558172355f51406097a7bd4f6b473be80f311ef7cda96bf383d8897"}, "revision": "588700d46356d8837c77c7c0a4e71e645fe6535983b8f1830aa8f2e4e41c40ae", "evidence_kind": "English manual and source declarations", "source_sha256": "a7fa7ed3d558172355f51406097a7bd4f6b473be80f311ef7cda96bf383d8897"}, "sources": [{"url": "https://pg.center/docs/14/app-psql.html", "file": "app-psql.html", "label": "14.24 English manual \u00b7 app-psql.html", "anchor": "", "sha256": "8da20abaee171c53c05658cfb2580dea645070f40bad6b46a845d710ad74c3ae", "language": "en", "original_url": "/docs/14/app-psql.html"}, {"url": "https://pg.center/docs/14/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "5a13567a052954dfe494dfaab9f50919faa1ae56023930fdbb78d45e53feccde", "language": "en", "original_url": "/docs/14/reference-client.html"}], "sections": [], "synopsis": ["psql [ option ...] [ dbname [ username ]]"], "signature": "psql [ option ...] [ dbname [ username ]]", "description": ["psql \u2014 PostgreSQL \u7684\u4ea4\u4e92\u5f0f\u7ec8\u7aef"], "environment": [{"name": "COLUMNS", "description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode."}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters (see Section 34.15 )."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems."}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems."}, {"name": "PSQL_HISTORY", "description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed."}, {"name": "PSQL_PAGER PAGER", "description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use more on most platforms, but less on Cygwin."}, {"name": "PSQLRC", "description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed."}, {"name": "SHELL", "description": "Command executed by the \\! command."}, {"name": "TMPDIR", "description": "Directory for storing temporary files. The default is /tmp ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PSQL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></h2>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u2014 <span class=\"productname\">PostgreSQL</span>\u7684\u4ea4\u4e92\u5f0f\u7ec8\u7aef</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.20.4.1\"><code class=\"command\">psql</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em> [<em class=\"replaceable\"><code>username</code></em>]]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.20.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u662f<span class=\"productname\">PostgreSQL</span>\u7684\u4e00\u4e2a\u57fa\u4e8e\u7ec8\u7aef\u7684\u524d\u7aef\u3002\u5b83\u4f7f\u4f60\u80fd\u591f\u4ea4\u4e92\u5f0f\u5730\u8f93\u5165\u67e5\u8be2\uff0c\u5c06\u5176\u53d1\u9001\u7ed9<span class=\"productname\">PostgreSQL</span>\uff0c\u5e76\u67e5\u770b\u67e5\u8be2\u7ed3\u679c\u3002\u4e5f\u53ef\u4ee5\u4ece\u6587\u4ef6\u6216\u547d\u4ee4\u884c\u53c2\u6570\u63d0\u4f9b\u8f93\u5165\u3002\u6b64\u5916\uff0c<span class=\"application\">psql</span>\u8fd8\u63d0\u4f9b\u4e86\u82e5\u5e72\u5143\u547d\u4ee4\u548c\u591a\u79cd\u7c7b\u4f3c shell \u7684\u7279\u6027\uff0c\u4ee5\u4fbf\u4e8e\u7f16\u5199\u811a\u672c\u548c\u81ea\u52a8\u5316\u6267\u884c\u5404\u79cd\u4efb\u52a1\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-PSQL-3\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-a</code><br/></span><span class=\"term\"><code class=\"option\">--echo-all</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8bfb\u5165\u65f6\u5c06\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u884c\u8bfb\u53d6\uff09\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a <code class=\"literal\">all</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-A</code><br/></span><span class=\"term\"><code class=\"option\">--no-align</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230\u975e\u5bf9\u9f50\u8f93\u51fa\u6a21\u5f0f\uff08\u9ed8\u8ba4\u8f93\u51fa\u6a21\u5f0f\u662f<code class=\"literal\">aligned</code>\uff09\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset format unaligned</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-b</code><br/></span><span class=\"term\"><code class=\"option\">--echo-errors</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u5931\u8d25\u7684 SQL \u547d\u4ee4\u6253\u5370\u5230\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">errors</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>command</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--command=<em class=\"replaceable\"><code>command</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a<span class=\"application\">psql</span>\u6267\u884c\u4e00\u4e2a\u7ed9\u5b9a\u7684\u547d\u4ee4\u5b57\u7b26\u4e32<em class=\"replaceable\"><code>command</code></em>\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u591a\u6b21\u5e76\u4e14\u4ee5\u4efb\u4f55\u987a\u5e8f\u4e0e<code class=\"option\">-f</code>\u9009\u9879\u7ec4\u5408\u5728\u4e00\u8d77\u3002\u5f53<code class=\"option\">-c</code>\u6216\u8005<code class=\"option\">-f</code>\u88ab\u6307\u5b9a\u65f6\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709<code class=\"option\">-c</code>\u548c<code class=\"option\">-f</code>\u9009\u9879\u540e\u7ec8\u6b62\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>command</code></em>\u5fc5\u987b\u662f\u4e00\u4e2a\u670d\u52a1\u5668\u5b8c\u5168\u53ef\u89e3\u6790\u7684\u547d\u4ee4\u5b57\u7b26\u4e32\uff08\u5373\u4e0d\u5305\u542b<span class=\"application\">psql</span>\u4e13\u6709\u7684\u7279\u6027\uff09\u6216\u8005\u5355\u4e2a\u53cd\u659c\u7ebf\u547d\u4ee4\u3002\u56e0\u6b64\u4e0d\u80fd\u5728\u4e00\u4e2a<code class=\"option\">-c</code>\u9009\u9879\u4e2d\u6df7\u5408<acronym class=\"acronym\">SQL</acronym>\u548c<span class=\"application\">psql</span>\u5143\u547d\u4ee4\u3002\u8981\u90a3\u6837\u505a\uff0c\u53ef\u4ee5\u4f7f\u7528\u591a\u4e2a<code class=\"option\">-c</code>\u9009\u9879\u6216\u8005\u628a\u5b57\u7b26\u4e32\u7528\u7ba1\u9053\u8f93\u9001\u5230<span class=\"application\">psql</span>\u4e2d\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">psql -c '\\x' -c 'SELECT * FROM foo;'\n</pre>\n<p lang=\"zh\">\u6216\u8005</p>\n<pre class=\"programlisting\">echo '\\x \\\\ SELECT * FROM foo;' | psql\n</pre>\n<p lang=\"zh\">\uff08<code class=\"literal\">\\\\</code>\u662f\u5206\u9694\u7b26\u5143\u547d\u4ee4\uff09\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u5b57\u7b26\u4e32\u4f20\u9012\u7ed9<code class=\"option\">-c</code>\u90fd\u4f5c\u4e3a\u4e00\u4e2a\u5355\u72ec\u7684\u8bf7\u6c42\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u56e0\u6b64\uff0c\u5373\u4f7f\u5b57\u7b26\u4e32\u5305\u542b\u591a\u4e2a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\uff0c\u670d\u52a1\u5668\u4e5f\u4f1a\u5c06\u5176\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff0c\u9664\u975e\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u663e\u5f0f\u7684<code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code>\u547d\u4ee4\u5c06\u5176\u5206\u6210\u591a\u4e2a\u4e8b\u52a1\u3002\uff08\u6709\u5173\u670d\u52a1\u5668\u5982\u4f55\u5904\u7406\u591a\u67e5\u8be2\u5b57\u7b26\u4e32\u7684\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/14/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT\" title=\"53.2.2.1.\u00a0\u4e00\u4e2a\u7b80\u5355\u67e5\u8be2\u4e2d\u7684\u591a\u6761\u8bed\u53e5\">\u7b2c\u00a053.2.2.1\u00a0\u8282</a>\u3002\uff09\u6b64\u5916\uff0c<span class=\"application\">psql</span>\u53ea\u6253\u5370\u5b57\u7b26\u4e32\u4e2d\u6700\u540e\u4e00\u6761<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u7684\u7ed3\u679c\u3002\u8fd9\u4e0e\u4ece\u6587\u4ef6\u8bfb\u53d6\u540c\u4e00\u5b57\u7b26\u4e32\u6216\u5c06\u5176\u9001\u5165<span class=\"application\">psql</span>\u6807\u51c6\u8f93\u5165\u65f6\u7684\u884c\u4e3a\u4e0d\u540c\uff0c\u56e0\u4e3a\u5728\u8fd9\u4e9b\u60c5\u51b5\u4e0b\uff0c<span class=\"application\">psql</span>\u4f1a\u5206\u522b\u53d1\u9001\u6bcf\u6761<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u7531\u4e8e\u8fd9\u79cd\u884c\u4e3a\uff0c\u5728\u5355\u4e2a <code class=\"option\">-c</code> \u5b57\u7b26\u4e32\u4e2d\u653e\u5165\u591a\u6761 SQL \u547d\u4ee4\u5e38\u5e38\u4f1a\u4ea7\u751f\u610f\u5916\u7ed3\u679c\u3002\u6700\u597d\u91cd\u590d\u4f7f\u7528 <code class=\"option\">-c</code> \u547d\u4ee4\uff0c\u6216\u5c06\u591a\u6761\u547d\u4ee4\u9001\u5165 <span class=\"application\">psql</span> \u7684\u6807\u51c6\u8f93\u5165\uff0c\u53ef\u4ee5\u50cf\u4e0a\u9762\u6240\u793a\u4f7f\u7528 <span class=\"application\">echo</span>\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528 shell \u7684 here-document\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">psql &lt;&lt;EOF\n\\x\nSELECT * FROM foo;\nEOF\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--csv</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230<acronym class=\"acronym\">CSV</acronym>\uff08\u9017\u53f7\u5206\u9694\u503c\uff09\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u76f8\u5f53\u4e8e<code class=\"command\">\\pset format csv</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>dbname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>dbname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002\u8fd9\u7b49\u6548\u4e8e\u6307\u5b9a<em class=\"replaceable\"><code>dbname</code></em>\u4e3a\u547d\u4ee4\u884c\u4e0a\u7684\u7b2c\u4e00\u4e2a\u975e\u9009\u9879\u53c2\u6570\u3002<em class=\"replaceable\"><code>dbname</code></em> \u53ef\u4ee5\u662f<a class=\"link\" href=\"/docs/14/libpq.html#LIBPQ-CONNSTRING\" title=\"34.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u5c06\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-e</code><br/></span><span class=\"term\"><code class=\"option\">--echo-queries</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e5f\u628a\u53d1\u9001\u5230\u670d\u52a1\u5668\u7684\u6240\u6709 SQL \u547d\u4ee4\u590d\u5236\u5230\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">queries</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-E</code><br/></span><span class=\"term\"><code class=\"option\">--echo-hidden</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u56de\u663e<code class=\"command\">\\d</code>\u4ee5\u53ca\u5176\u4ed6\u53cd\u659c\u7ebf\u547d\u4ee4\u751f\u6210\u7684\u5b9e\u9645\u67e5\u8be2\u3002\u53ef\u4ee5\u7528\u5b83\u6765\u5b66\u4e60<span class=\"application\">psql</span>\u7684\u5185\u90e8\u64cd\u4f5c\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO_HIDDEN</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u800c\u4e0d\u662f\u6807\u51c6\u8f93\u5165\u4e2d\u8bfb\u53d6\u547d\u4ee4\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u6307\u5b9a\uff0c\u4e5f\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u4e0e<code class=\"option\">-c</code>\u9009\u9879\u7ec4\u5408\u4f7f\u7528\u3002\u5f53\u6307\u5b9a\u4e86<code class=\"option\">-c</code>\u6216<code class=\"option\">-f</code>\u65f6\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709<code class=\"option\">-c</code>\u548c<code class=\"option\">-f</code>\u9009\u9879\u540e\u7ec8\u6b62\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u7b49\u4ef7\u4e8e\u5143\u547d\u4ee4<code class=\"command\">\\i</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c<em class=\"replaceable\"><code>filename</code></em>\u662f<code class=\"literal\">-</code>\uff08\u8fde\u5b57\u7b26\uff09\uff0c\u5219\u4f1a\u8bfb\u53d6\u6807\u51c6\u8f93\u5165\uff0c\u76f4\u5230\u9047\u5230 <acronym class=\"acronym\">EOF</acronym> \u6307\u793a\u6216<code class=\"command\">\\q</code>\u5143\u547d\u4ee4\u3002\u8fd9\u53ef\u7528\u4e8e\u5c06\u4ea4\u4e92\u5f0f\u8f93\u5165\u4e0e\u6587\u4ef6\u8f93\u5165\u4ea4\u9519\u4f7f\u7528\u3002\u4e0d\u8fc7\u8bf7\u6ce8\u610f\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\u4e0d\u4f1a\u4f7f\u7528 <span class=\"application\">Readline</span>\uff08\u5f88\u50cf\u6307\u5b9a\u4e86<code class=\"option\">-n</code>\u65f6\u7684\u60c5\u51b5\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u4e0e\u5199\u6210<code class=\"literal\">psql &lt; <em class=\"replaceable\"><code>filename</code></em></code>\u6709\u7ec6\u5fae\u5dee\u522b\u3002\u901a\u5e38\u4e24\u79cd\u5f62\u5f0f\u90fd\u4f1a\u5f97\u5230\u4f60\u671f\u671b\u7684\u7ed3\u679c\uff0c\u4f46\u4f7f\u7528<code class=\"literal\">-f</code>\u53ef\u4ee5\u542f\u7528\u4e00\u4e9b\u6709\u7528\u7684\u7279\u6027\uff0c\u4f8b\u5982\u5e26\u884c\u53f7\u7684\u9519\u8bef\u6d88\u606f\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u4e5f\u8fd8\u6709\u4e00\u70b9\u673a\u4f1a\u964d\u4f4e\u542f\u52a8\u5f00\u9500\u3002\u53e6\u4e00\u65b9\u9762\uff0c\u4f7f\u7528 shell \u8f93\u5165\u91cd\u5b9a\u5411\u7684\u5f62\u5f0f\u5728\u7406\u8bba\u4e0a\u80fd\u4fdd\u8bc1\u5f97\u5230\u4e0e\u4f60\u624b\u5de5\u9010\u884c\u8f93\u5165\u65f6\u5b8c\u5168\u76f8\u540c\u7684\u8f93\u51fa\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>separator</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--field-separator=<em class=\"replaceable\"><code>separator</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f7f\u7528<em class=\"replaceable\"><code>separator</code></em>\u4f5c\u4e3a\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset fieldsep</code>\u6216\u8005<code class=\"command\">\\f</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>hostname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>hostname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-H</code><br/></span><span class=\"term\"><code class=\"option\">--html</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230<acronym class=\"acronym\">HTML</acronym>\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset format html</code>\u6216\u8005<code class=\"command\">\\H</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--list</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u6240\u6709\u53ef\u7528\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u9000\u51fa\u3002\u5176\u4ed6\u975e\u8fde\u63a5\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002\u8fd9\u4e0e\u5143\u547d\u4ee4<code class=\"command\">\\list</code>\u7c7b\u4f3c\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8be5\u9009\u9879\u65f6\uff0c<span class=\"application\">psql</span>\u5c06\u8fde\u63a5\u5230\u6570\u636e\u5e93<code class=\"literal\">postgres</code>\uff0c\u9664\u975e\u547d\u4ee4\u884c\u4e0a\u6307\u5b9a\u4e86\u5176\u4ed6\u6570\u636e\u5e93\uff08\u901a\u8fc7<code class=\"option\">-d</code>\u9009\u9879\u6216\u975e\u9009\u9879\u53c2\u6570\uff0c\u4e5f\u53ef\u80fd\u901a\u8fc7\u670d\u52a1\u9879\uff0c\u4f46\u4e0d\u80fd\u901a\u8fc7\u73af\u5883\u53d8\u91cf\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--log-file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9664\u4e86\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u5199\u5230\u666e\u901a\u8f93\u51fa\u76ee\u6807\u4e4b\u5916\uff0c\u8fd8\u5199\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-readline</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8981\u4f7f\u7528<span class=\"application\">Readline</span>\u8fdb\u884c\u884c\u7f16\u8f91\uff0c\u4e5f\u4e0d\u8981\u4f7f\u7528\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\u3002\u8fd9\u6709\u52a9\u4e8e\u5728\u526a\u5207\u548c\u7c98\u8d34\u65f6\u5173\u95edTAB \u8865\u5168\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-o <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--output=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u653e\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u3002\u8fd9\u7b49\u6548\u4e8e\u547d\u4ee4<code class=\"command\">\\o</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u7684\u6587\u4ef6\u540d\u540e\u7f00\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u7684\u503c\uff1b\u672a\u8bbe\u7f6e\u65f6\uff0c\u4f7f\u7528\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u7aef\u53e3\uff0c\u901a\u5e38\u4e3a 5432\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P <em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--pset=<em class=\"replaceable\"><code>assignment</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ee5<code class=\"command\">\\pset</code>\u7684\u5f62\u5f0f\u6307\u5b9a\u6253\u5370\u9009\u9879\u3002\u6ce8\u610f\uff0c\u8fd9\u91cc\u4f60\u5fc5\u987b\u7528\u4e00\u4e2a\u7b49\u53f7\u800c\u4e0d\u662f\u7a7a\u683c\u6765\u5206\u9694\u540d\u79f0\u548c\u503c\u3002\u4f8b\u5982\uff0c\u8981\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a<span class=\"application\">LaTeX</span>\uff0c\u5e94\u8be5\u5199\u6210<code class=\"literal\">-P format=latex</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-q</code><br/></span><span class=\"term\"><code class=\"option\">--quiet</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a<span class=\"application\">psql</span>\u5e94\u8be5\u5b89\u9759\u5730\u5de5\u4f5c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4f1a\u6253\u5370\u51fa\u6b22\u8fce\u6d88\u606f\u548c\u5404\u79cd\u63d0\u793a\u4fe1\u606f\u3002\u5982\u679c\u4f7f\u7528\u4e86\u8fd9\u4e2a\u9009\u9879\uff0c\u4ee5\u4e0a\u90a3\u4e9b\u5c31\u90fd\u4e0d\u4f1a\u8f93\u51fa\u3002\u5728\u4f7f\u7528<code class=\"option\">-c</code>\u9009\u9879\u65f6\uff0c\u914d\u5408\u8fd9\u4e2a\u9009\u9879\u5f88\u6709\u7528\u3002\u8fd9\u7b49\u6548\u4e8e\u8bbe\u7f6e\u53d8\u91cf<code class=\"varname\">QUIET</code>\u4e3a<code class=\"literal\">on</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R <em class=\"replaceable\"><code>separator</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--record-separator=<em class=\"replaceable\"><code>separator</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a<em class=\"replaceable\"><code>separator</code></em>\u7528\u4f5c\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset recordsep</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code><br/></span><span class=\"term\"><code class=\"option\">--single-step</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5728\u5355\u6b65\u6a21\u5f0f\u4e2d\u3002\u8fd9\u610f\u5473\u7740\u5728\u6bcf\u4e2a\u547d\u4ee4\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u4e4b\u524d\u90fd\u4f1a\u63d0\u793a\u7528\u6237\uff0c\u5e76\u5141\u8bb8\u53d6\u6d88\u6267\u884c\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u8c03\u8bd5\u811a\u672c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S</code><br/></span><span class=\"term\"><code class=\"option\">--single-line</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd0\u884c\u5728\u5355\u884c\u6a21\u5f0f\u4e2d\uff0c\u5176\u4e2d\u6362\u884c\u7b26\u4f1a\u7ec8\u6b62\u4e00\u4e2a SQL \u547d\u4ee4\uff0c\u5c31\u50cf\u5206\u53f7\u7684\u4f5c\u7528\u4e00\u6837\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u79cd\u6a21\u5f0f\u662f\u4e3a\u575a\u6301\u4f7f\u7528\u5b83\u7684\u7528\u6237\u63d0\u4f9b\u7684\uff0c\u4f46\u5e76\u4e0d\u4e00\u5b9a\u503c\u5f97\u63a8\u8350\u3002\u7279\u522b\u662f\uff0c\u5982\u679c\u5728\u4e00\u884c\u4e2d\u6df7\u5408\u4e86<acronym class=\"acronym\">SQL</acronym>\u548c\u5143\u547d\u4ee4\uff0c\u5bf9\u4e8e\u6ca1\u6709\u7ecf\u9a8c\u7684\u7528\u6237\u6765\u8bf4\uff0c\u5b83\u4eec\u7684\u6267\u884c\u987a\u5e8f\u672a\u5fc5\u603b\u662f\u6e05\u695a\u7684\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t</code><br/></span><span class=\"term\"><code class=\"option\">--tuples-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5173\u95ed\u6253\u5370\u5217\u540d\u548c\u7ed3\u679c\u884c\u8ba1\u6570\u9875\u811a\u7b49\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\t</code>\u6216\u8005<code class=\"command\">\\pset tuples_only</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>table_options</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--table-attr=<em class=\"replaceable\"><code>table_options</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u653e\u5728<acronym class=\"acronym\">HTML</acronym> <code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u9009\u9879\u3002\u8be6\u89c1<code class=\"command\">\\pset tableattr</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f5c\u4e3a\u7528\u6237<em class=\"replaceable\"><code>username</code></em>\u800c\u4e0d\u662f\u9ed8\u8ba4\u7528\u6237\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff08\u5f53\u7136\uff0c\u4f60\u5fc5\u987b\u5177\u6709\u8fd9\u6837\u505a\u7684\u6743\u9650\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v <em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--set=<em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--variable=<em class=\"replaceable\"><code>assignment</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6267\u884c\u4e00\u6b21\u53d8\u91cf\u8d4b\u503c\uff0c\u548c<code class=\"command\">\\set</code>\u5143\u547d\u4ee4\u76f8\u4f3c\u3002\u6ce8\u610f\u4f60\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u7528\u7b49\u53f7\u5206\u9694\u540d\u5b57\u548c\u503c\uff08\u5982\u679c\u6709\uff09\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u7684\u8bbe\u7f6e\uff0c\u53bb\u6389\u7b49\u53f7\u5c31\u884c\u3002\u8981\u628a\u4e00\u4e2a\u53d8\u91cf\u8bbe\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u4f7f\u7528\u7b49\u53f7\u4f46\u662f\u53bb\u6389\u503c\u3002\u8fd9\u4e9b\u8d4b\u503c\u5728\u547d\u4ee4\u884c\u5904\u7406\u671f\u95f4\u88ab\u5b8c\u6210\uff0c\u56e0\u6b64\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u7684\u53d8\u91cf\u5c06\u5728\u7a0d\u540e\u88ab\u8986\u76d6\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">psql</span>\u7248\u672c\u5e76\u4e14\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6c38\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u8fd9\u4e2a\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4efb\u52a1\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u65f6\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u6574\u4e2a\u4f1a\u8bdd\u671f\u95f4\u90fd\u4f1a\u4fdd\u6301\u751f\u6548\uff0c\u56e0\u6b64\u5b83\u4e0d\u4ec5\u5f71\u54cd\u521d\u59cb\u8fde\u63a5\u5c1d\u8bd5\uff0c\u4e5f\u4f1a\u5f71\u54cd\u5143\u547d\u4ee4<code class=\"command\">\\connect</code>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236<span class=\"application\">psql</span>\u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\uff0c\u5373\u4f7f\u8be5\u5bc6\u7801\u5b9e\u9645\u4e0a\u4e0d\u4f1a\u88ab\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff0c\u5219<span class=\"application\">psql</span>\u65e0\u8bba\u5982\u4f55\u90fd\u4f1a\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">psql</span>\u9700\u8981\u5148\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\uff0c\u624d\u80fd\u77e5\u9053\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u663e\u5f0f\u6307\u5b9a<code class=\"option\">-W</code>\u503c\u5f97\u7528\u6765\u907f\u514d\u8fd9\u6b21\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u6574\u4e2a\u4f1a\u8bdd\u671f\u95f4\u90fd\u4f1a\u4fdd\u6301\u751f\u6548\uff0c\u56e0\u6b64\u5b83\u4e0d\u4ec5\u5f71\u54cd\u521d\u59cb\u8fde\u63a5\u5c1d\u8bd5\uff0c\u4e5f\u4f1a\u5f71\u54cd\u5143\u547d\u4ee4<code class=\"command\">\\connect</code>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x</code><br/></span><span class=\"term\"><code class=\"option\">--expanded</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5f00\u6269\u5c55\u8868\u683c\u5f0f\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\x</code>\u6216\u8005<code class=\"command\">\\pset expanded</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-X</code><br/></span><span class=\"term\"><code class=\"option\">--no-psqlrc</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8bfb\u53d6\u542f\u52a8\u6587\u4ef6\uff08\u65e2\u4e0d\u8bfb\u53d6\u7cfb\u7edf\u8303\u56f4\u7684<code class=\"filename\">psqlrc</code>\u6587\u4ef6\uff0c\u4e5f\u4e0d\u8bfb\u53d6\u7528\u6237\u7684<code class=\"filename\">~/.psqlrc</code>\u6587\u4ef6\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-z</code><br/></span><span class=\"term\"><code class=\"option\">--field-separator-zero</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset fieldsep_zero</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-0</code><br/></span><span class=\"term\"><code class=\"option\">--record-separator-zero</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u4f8b\u5982\uff0c\u8fd9\u6709\u52a9\u4e8e\u4e0e<code class=\"literal\">xargs -0</code>\u914d\u5408\u4f7f\u7528\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset recordsep_zero</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-1</code><br/></span><span class=\"term\"><code class=\"option\">--single-transaction</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u9009\u9879\u53ea\u80fd\u4e0e\u4e00\u4e2a\u6216\u591a\u4e2a<code class=\"option\">-c</code>\u548c/\u6216<code class=\"option\">-f</code>\u9009\u9879\u7ed3\u5408\u4f7f\u7528\u3002\u5b83\u4f1a\u5bfc\u81f4<span class=\"application\">psql</span>\u5728\u7b2c\u4e00\u4e2a\u8fd9\u6837\u7684\u9009\u9879\u4e4b\u524d\u53d1\u51fa\u4e00\u4e2a<code class=\"command\">BEGIN</code>\u547d\u4ee4\uff0c\u5e76\u5728\u6700\u540e\u4e00\u4e2a\u9009\u9879\u4e4b\u540e\u53d1\u51fa\u4e00\u4e2a<code class=\"command\">COMMIT</code>\u547d\u4ee4\uff0c\u4ece\u800c\u5c06\u6240\u6709\u547d\u4ee4\u5305\u88c5\u6210\u4e00\u4e2a\u5355\u72ec\u7684\u4e8b\u52a1\u3002\u8fd9\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u547d\u4ee4\u672c\u8eab\u5305\u542b<code class=\"command\">BEGIN</code>\u3001<code class=\"command\">COMMIT</code>\u6216<code class=\"command\">ROLLBACK</code>\uff0c\u8fd9\u4e2a\u9009\u9879\u5c31\u4e0d\u4f1a\u4ea7\u751f\u671f\u671b\u7684\u6548\u679c\u3002\u53e6\u5916\uff0c\u5982\u679c\u67d0\u4e2a\u5355\u72ec\u547d\u4ee4\u4e0d\u80fd\u5728\u4e8b\u52a1\u5757\u4e2d\u6267\u884c\uff0c\u6307\u5b9a\u8fd9\u4e2a\u9009\u9879\u5c06\u5bfc\u81f4\u6574\u4e2a\u4e8b\u52a1\u5931\u8d25\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help[=<em class=\"replaceable\"><code>topic</code></em>]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u6709\u5173<span class=\"application\">psql</span>\u7684\u5e2e\u52a9\u5e76\u4e14\u9000\u51fa\u3002\u53ef\u9009\u7684<em class=\"replaceable\"><code>topic</code></em>\u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a<code class=\"literal\">options</code>\uff09\u9009\u62e9\u8981\u89e3\u91ca<span class=\"application\">psql</span>\u7684\u54ea\u4e00\u90e8\u5206\uff1a<code class=\"literal\">commands</code>\u63cf\u8ff0<span class=\"application\">psql</span>\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b<code class=\"literal\">options</code>\u63cf\u8ff0\u53ef\u4ee5\u88ab\u4f20\u9012\u7ed9<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c<code class=\"literal\">variables</code>\u5219\u663e\u793a\u6709\u5173<span class=\"application\">psql</span>\u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.20.7\">\n<h2 lang=\"zh\">\u9000\u51fa\u72b6\u6001</h2>\n<p lang=\"zh\">\u5982\u679c<span class=\"application\">psql</span>\u6b63\u5e38\u7ed3\u675f\uff0c\u5b83\u4f1a\u5411 shell \u8fd4\u56de 0\uff1b\u5982\u679c\u5b83\u81ea\u8eab\u53d1\u751f\u81f4\u547d\u9519\u8bef\uff08\u4f8b\u5982\u5185\u5b58\u8017\u5c3d\u3001\u627e\u4e0d\u5230\u6587\u4ef6\uff09\uff0c\u5219\u8fd4\u56de 1\uff1b\u5982\u679c\u5230\u670d\u52a1\u5668\u7684\u8fde\u63a5\u53d1\u751f\u6545\u969c\u4e14\u8be5\u4f1a\u8bdd\u4e0d\u662f\u4ea4\u4e92\u5f0f\u7684\uff0c\u5219\u8fd4\u56de 2\uff1b\u5982\u679c\u811a\u672c\u4e2d\u53d1\u751f\u9519\u8bef\u4e14\u53d8\u91cf<code class=\"varname\">ON_ERROR_STOP</code>\u5df2\u8bbe\u7f6e\uff0c\u5219\u8fd4\u56de 3\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.20.8\">\n<h2 lang=\"zh\">\u7528\u6cd5</h2>\n<div class=\"refsect2\" id=\"R2-APP-PSQL-CONNECTING\">\n<h3 lang=\"zh\">\u8fde\u63a5\u5230\u6570\u636e\u5e93</h3>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u662f\u5e38\u89c4\u7684 <span class=\"productname\">PostgreSQL</span> \u5ba2\u6237\u7aef\u5e94\u7528\u7a0b\u5e8f\u3002\u8981\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff0c\u4f60\u9700\u8981\u77e5\u9053\u76ee\u6807\u6570\u636e\u5e93\u540d\u79f0\u3001\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u548c\u7aef\u53e3\u53f7\uff0c\u4ee5\u53ca\u8981\u4ee5\u54ea\u4e2a\u6570\u636e\u5e93\u7528\u6237\u540d\u8fde\u63a5\u3002<span class=\"application\">psql</span> \u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u9009\u9879 <code class=\"option\">-d</code>\u3001<code class=\"option\">-h</code>\u3001<code class=\"option\">-p</code> \u548c <code class=\"option\">-U</code> \u5206\u522b\u6307\u5b9a\u8fd9\u4e9b\u53c2\u6570\u3002\u5982\u679c\u9047\u5230\u4e00\u4e2a\u4e0d\u5c5e\u4e8e\u4efb\u4f55\u9009\u9879\u7684\u53c2\u6570\uff0c\u5b83\u5c06\u88ab\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u540d\uff08\u5982\u679c\u6570\u636e\u5e93\u540d\u5df2\u7ecf\u7ed9\u51fa\uff0c\u5219\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u7528\u6237\u540d\uff09\u3002\u5e76\u975e\u6240\u6709\u8fd9\u4e9b\u9009\u9879\u90fd\u662f\u5fc5\u9700\u7684\uff1b\u5b83\u4eec\u90fd\u6709\u6709\u7528\u7684\u9ed8\u8ba4\u503c\u3002\u5982\u679c\u7701\u7565\u4e3b\u673a\u540d\uff0c<span class=\"application\">psql</span> \u5c06\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u5230\u672c\u5730\u4e3b\u673a\u4e0a\u7684\u670d\u52a1\u5668\uff0c\u800c\u5728\u6ca1\u6709 Unix \u57df\u5957\u63a5\u5b57\u7684\u673a\u5668\u4e0a\u5219\u901a\u8fc7 TCP/IP \u8fde\u63a5\u5230 <code class=\"literal\">localhost</code>\u3002\u9ed8\u8ba4\u7aef\u53e3\u53f7\u5728\u7f16\u8bd1\u65f6\u786e\u5b9a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u670d\u52a1\u5668\u4f7f\u7528\u76f8\u540c\u7684\u9ed8\u8ba4\u503c\uff0c\u56e0\u6b64\u5728\u5927\u591a\u6570\u60c5\u51b5\u4e0b\u4e0d\u5fc5\u6307\u5b9a\u7aef\u53e3\u3002\u9ed8\u8ba4\u7528\u6237\u540d\u662f\u4f60\u7684\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\uff0c\u9ed8\u8ba4\u6570\u636e\u5e93\u540d\u4e5f\u662f\u5982\u6b64\u3002\u8bf7\u6ce8\u610f\uff0c\u4f60\u4e0d\u80fd\u968f\u610f\u4ee5\u4efb\u610f\u6570\u636e\u5e93\u7528\u6237\u540d\u8fde\u63a5\u5230\u4efb\u610f\u6570\u636e\u5e93\u3002\u6570\u636e\u5e93\u7ba1\u7406\u5458\u5e94\u5f53\u5df2\u7ecf\u544a\u77e5\u4f60\u62e5\u6709\u7684\u8bbf\u95ee\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5f53\u9ed8\u8ba4\u503c\u4e0d\u5b8c\u5168\u5408\u9002\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7\u628a\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGDATABASE</code>\u3001<code class=\"envar\">PGHOST</code>\u3001<code class=\"envar\">PGPORT</code>\u548c<code class=\"envar\">PGUSER</code>\u8bbe\u7f6e\u4e3a\u9002\u5f53\u7684\u503c\u6765\u5c11\u6572\u4e00\u4e9b\u952e\u76d8\uff08\u989d\u5916\u7684\u73af\u5883\u53d8\u91cf\u89c1<a class=\"xref\" href=\"/docs/14/libpq-envars.html\" title=\"34.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a034.15\u00a0\u8282</a>\uff09\u3002\u53e6\u5916\uff0c\u51c6\u5907\u4e00\u4e2a<code class=\"filename\">~/.pgpass</code>\u6587\u4ef6\u4e5f\u5f88\u65b9\u4fbf\uff0c\u8fd9\u6837\u5c31\u4e0d\u5fc5\u7ecf\u5e38\u624b\u5de5\u8f93\u5165\u5bc6\u7801\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/14/libpq-pgpass.html\" title=\"34.16.\u00a0\u5bc6\u7801\u6587\u4ef6\">\u7b2c\u00a034.16\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u53e6\u4e00\u79cd\u6307\u5b9a\u8fde\u63a5\u53c2\u6570\u7684\u65b9\u6cd5\u662f\u4f7f\u7528 conninfo \u5b57\u7b26\u4e32\u6216 URI \u6765\u4ee3\u66ff\u6570\u636e\u5e93\u540d\u3002\u6b64\u673a\u5236\u5141\u8bb8\u5bf9\u8fde\u63a5\u8fdb\u884c\u975e\u5e38\u5e7f\u6cdb\u7684\u63a7\u5236\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">$ <strong class=\"userinput\"><code>psql \"service=myservice sslmode=require\"</code></strong>\n$ <strong class=\"userinput\"><code>psql postgresql://dbmaster:5433/mydb?sslmode=require</code></strong>\n</pre>\n<p lang=\"zh\">\u7528\u8fd9\u79cd\u65b9\u5f0f\uff0c\u4f60\u4e5f\u53ef\u4ee5\u628a<acronym class=\"acronym\">LDAP</acronym>\u7528\u4e8e<a class=\"xref\" href=\"/docs/14/libpq-ldap.html\" title=\"34.18.\u00a0\u8fde\u63a5\u53c2\u6570\u7684 LDAP \u67e5\u627e\">\u7b2c\u00a034.18\u00a0\u8282</a>\u4e2d\u63cf\u8ff0\u7684\u8fde\u63a5\u53c2\u6570\u67e5\u627e\u3002\u53ef\u7528\u8fde\u63a5\u9009\u9879\u7684\u66f4\u591a\u4fe1\u606f\u8bf7\u89c1<a class=\"xref\" href=\"/docs/14/libpq.html#LIBPQ-PARAMKEYWORDS\" title=\"34.1.2.\u00a0\u53c2\u6570\u5173\u952e\u8bcd\">\u7b2c\u00a034.1.2\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7531\u4e8e\u4efb\u4f55\u539f\u56e0\uff08\u4f8b\u5982\u6743\u9650\u4e0d\u8db3\u3001\u670d\u52a1\u5668\u6ca1\u6709\u5728\u76ee\u6807\u4e3b\u673a\u4e0a\u8fd0\u884c\u7b49\uff09\u5bfc\u81f4\u8fde\u63a5\u65e0\u6cd5\u5efa\u7acb\uff0c<span class=\"application\">psql</span>\u5c06\u8fd4\u56de\u4e00\u4e2a\u9519\u8bef\u5e76\u4e14\u7ec8\u6b62\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6807\u51c6\u8f93\u5165\u548c\u6807\u51c6\u8f93\u51fa\u90fd\u662f\u7ec8\u7aef\uff0c\u90a3\u4e48<span class=\"application\">psql</span>\u4f1a\u628a\u5ba2\u6237\u7aef\u7f16\u7801\u8bbe\u7f6e\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">auto</span>\u201d</span>\uff0c\u4ece\u533a\u57df\u8bbe\u7f6e\u4e2d\u68c0\u6d4b\u5408\u9002\u7684\u5ba2\u6237\u7aef\u7f16\u7801\uff08\u5728 Unix \u7cfb\u7edf\u4e0a\u662f<code class=\"envar\">LC_CTYPE</code>\u73af\u5883\u53d8\u91cf\uff09\u3002\u5982\u679c\u7ed3\u679c\u4e0d\u7b26\u5408\u9884\u671f\uff0c\u53ef\u4ee5\u4f7f\u7528\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGCLIENTENCODING</code>\u8986\u76d6\u5ba2\u6237\u7aef\u7f16\u7801\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"R2-APP-PSQL-4\">\n<h3 lang=\"zh\">\u8f93\u5165 SQL \u547d\u4ee4</h3>\n<p lang=\"zh\">\u5728\u6b63\u5e38\u64cd\u4f5c\u65f6\uff0c<span class=\"application\">psql</span>\u4f1a\u63d0\u4f9b\u4e00\u4e2a\u63d0\u793a\u7b26\uff0c\u8be5\u63d0\u793a\u7b26\u662f<span class=\"application\">psql</span>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u540d\u79f0\u540e\u9762\u8ddf\u4e0a\u5b57\u7b26\u4e32<code class=\"literal\">=&gt;</code>\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">$ <strong class=\"userinput\"><code>psql testdb</code></strong>\npsql (14.24)\nType \"help\" for help.\n\ntestdb=&gt;\n</pre>\n<p lang=\"zh\">\u5728\u63d0\u793a\u7b26\u4e0b\uff0c\u7528\u6237\u53ef\u4ee5\u8f93\u5165<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u3002\u901a\u5e38\uff0c\u5f53\u9047\u5230\u8868\u793a\u547d\u4ee4\u7ed3\u675f\u7684\u5206\u53f7\u65f6\uff0c\u8f93\u5165\u7684\u5185\u5bb9\u5c31\u4f1a\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u3002\u884c\u7ed3\u675f\u5e76\u4e0d\u4f1a\u7ec8\u6b62\u4e00\u6761\u547d\u4ee4\uff0c\u56e0\u6b64\u4e3a\u4e86\u63d0\u9ad8\u6e05\u6670\u5ea6\uff0c\u547d\u4ee4\u53ef\u4ee5\u5206\u5e03\u5728\u591a\u884c\u4e0a\u3002\u5982\u679c\u547d\u4ee4\u88ab\u53d1\u9001\u5e76\u6210\u529f\u6267\u884c\uff0c\u5176\u7ed3\u679c\u5c31\u4f1a\u663e\u793a\u5728\u5c4f\u5e55\u4e0a\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u53d7\u4fe1\u4efb\u7684\u7528\u6237\u80fd\u591f\u8bbf\u95ee\u5c1a\u672a\u91c7\u7528<a class=\"link\" href=\"/docs/14/ddl-schemas.html#DDL-SCHEMAS-PATTERNS\" title=\"5.9.6.\u00a0\u4f7f\u7528\u65b9\u5f0f\">\u6a21\u5f0f\u7684\u5b89\u5168\u4f7f\u7528\u65b9\u5f0f</a>\u7684\u6570\u636e\u5e93\uff0c\u8bf7\u5728\u4f1a\u8bdd\u5f00\u59cb\u65f6\u4ece<code class=\"varname\">search_path</code>\u4e2d\u79fb\u9664\u6240\u6709\u516c\u4f17\u53ef\u5199\u7684\u6a21\u5f0f\u3002\u53ef\u4ee5\u5728\u8fde\u63a5\u5b57\u7b26\u4e32\u4e2d\u52a0\u5165<code class=\"literal\">options=-csearch_path=</code>\uff0c\u6216\u8005\u5728\u6267\u884c\u5176\u4ed6 SQL \u547d\u4ee4\u4e4b\u524d\u53d1\u51fa<code class=\"literal\">SELECT pg_catalog.set_config('search_path', '', false)</code>\u3002\u8fd9\u79cd\u8003\u8651\u5e76\u975e<span class=\"application\">psql</span>\u7279\u6709\uff1b\u5b83\u9002\u7528\u4e8e\u4efb\u4f55\u6267\u884c\u4efb\u610f SQL \u547d\u4ee4\u7684\u63a5\u53e3\u3002</p>\n<p lang=\"zh\">\u6bcf\u5f53\u6267\u884c\u547d\u4ee4\u65f6\uff0c<span class=\"application\">psql</span>\u4e5f\u4f1a\u8f6e\u8be2\u7531<a class=\"link\" href=\"/docs/14/sql-listen.html\" title=\"LISTEN\"><code class=\"command\">LISTEN</code></a>\u548c<a class=\"link\" href=\"/docs/14/sql-notify.html\" title=\"NOTIFY\"><code class=\"command\">NOTIFY</code></a>\u751f\u6210\u7684\u5f02\u6b65\u901a\u77e5\u4e8b\u4ef6\u3002</p>\n<p lang=\"zh\">\u867d\u7136 C \u98ce\u683c\u7684\u5757\u6ce8\u91ca\u4f1a\u88ab\u4f20\u7ed9\u670d\u52a1\u5668\u5904\u7406\u5e76\u79fb\u9664\uff0c\u4f46 SQL \u6807\u51c6\u6ce8\u91ca\u4f1a\u7531<span class=\"application\">psql</span>\u81ea\u884c\u79fb\u9664\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"APP-PSQL-META-COMMANDS\">\n<h3 lang=\"zh\">\u5143\u547d\u4ee4</h3>\n<p lang=\"zh\">\u4f60\u8f93\u5165\u5230<span class=\"application\">psql</span>\u4e2d\u7684\u4efb\u4f55\u4ee5\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u5f00\u59cb\u7684\u4e1c\u897f\u90fd\u662f\u4e00\u4e2a<span class=\"application\">psql</span>\u5143\u547d\u4ee4\uff0c\u5b83\u4eec\u7531<span class=\"application\">psql</span>\u81ea\u884c\u5904\u7406\u3002\u8fd9\u4e9b\u547d\u4ee4\u8ba9<span class=\"application\">psql</span>\u5bf9\u7ba1\u7406\u548c\u7f16\u5199\u811a\u672c\u66f4\u6709\u7528\u3002\u5143\u547d\u4ee4\u5e38\u5e38\u88ab\u79f0\u4f5c\u659c\u7ebf\u6216\u8005\u53cd\u659c\u7ebf\u547d\u4ee4\u3002</p>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u547d\u4ee4\u7684\u683c\u5f0f\u662f\u7528\u53cd\u659c\u7ebf\u540e\u9762\u76f4\u63a5\u8ddf\u4e0a\u4e00\u4e2a\u547d\u4ee4\u52a8\u8bcd\uff0c\u7136\u540e\u662f\u4e00\u4e9b\u53c2\u6570\u3002\u53c2\u6570\u4e0e\u547d\u4ee4\u52a8\u8bcd\u548c\u5176\u4ed6\u53c2\u6570\u4e4b\u95f4\u7528\u4efb\u610f\u591a\u4e2a\u7a7a\u767d\u5b57\u7b26\u5206\u9694\u5f00\u3002</p>\n<p lang=\"zh\">\u8981\u5728\u53c2\u6570\u4e2d\u5305\u542b\u7a7a\u767d\uff0c\u53ef\u4ee5\u7528\u5355\u5f15\u53f7\u5c06\u5b83\u62ec\u8d77\u6765\u3002\u8981\u5728\u53c2\u6570\u4e2d\u5305\u542b\u4e00\u4e2a\u5355\u5f15\u53f7\uff0c\u53ef\u4ee5\u5728\u5355\u5f15\u53f7\u6587\u672c\u5185\u5199\u4e24\u4e2a\u5355\u5f15\u53f7\u3002\u5355\u5f15\u53f7\u4e2d\u7684\u5185\u5bb9\u8fd8\u4f1a\u63a5\u53d7\u7c7b\u4f3c C \u8bed\u8a00\u7684\u66ff\u6362\uff1a<code class=\"literal\">\\n</code>\uff08\u6362\u884c\uff09\u3001<code class=\"literal\">\\t</code>\uff08\u5236\u8868\u7b26\uff09\u3001<code class=\"literal\">\\b</code>\uff08\u9000\u683c\uff09\u3001<code class=\"literal\">\\r</code>\uff08\u56de\u8f66\uff09\u3001<code class=\"literal\">\\f</code>\uff08\u6362\u9875\uff09\u3001<code class=\"literal\">\\</code><em class=\"replaceable\"><code>digits</code></em>\uff08\u516b\u8fdb\u5236\uff09\u4ee5\u53ca<code class=\"literal\">\\x</code><em class=\"replaceable\"><code>digits</code></em>\uff08\u5341\u516d\u8fdb\u5236\uff09\u3002\u5728\u5355\u5f15\u53f7\u6587\u672c\u5185\uff0c\u53cd\u659c\u7ebf\u51fa\u73b0\u5728\u4efb\u4f55\u5176\u4ed6\u5b57\u7b26\u524d\u9762\u65f6\uff0c\u53ea\u662f\u5bf9\u8be5\u5355\u4e2a\u5b57\u7b26\u8fdb\u884c\u8f6c\u4e49\uff0c\u4e0d\u8bba\u5b83\u662f\u4ec0\u4e48\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u53c2\u6570\u4e2d\u51fa\u73b0\u4e00\u4e2a\u672a\u52a0\u5f15\u53f7\u7684\u5192\u53f7\uff08<code class=\"literal\">:</code>\uff09\uff0c\u540e\u9762\u7d27\u8ddf\u4e00\u4e2a<span class=\"application\">psql</span>\u53d8\u91cf\u540d\uff0c\u5b83\u5c31\u4f1a\u88ab\u8be5\u53d8\u91cf\u7684\u503c\u66ff\u6362\uff0c\u5982\u4e0b\u9762<a class=\"xref\" href=\"/docs/14/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL \u63d2\u503c\">SQL \u63d2\u503c</a>\u6240\u8ff0\u3002\u5176\u4e2d\u4ecb\u7ecd\u7684<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u548c<code class=\"literal\">:\"<em class=\"replaceable\"><code>variable_name</code></em>\"</code>\u5f62\u5f0f\u4e5f\u540c\u6837\u9002\u7528\u3002<code class=\"literal\">:{?<em class=\"replaceable\"><code>variable_name</code></em>}</code>\u8bed\u6cd5\u5141\u8bb8\u6d4b\u8bd5\u53d8\u91cf\u662f\u5426\u5df2\u5b9a\u4e49\uff1b\u5b83\u4f1a\u88ab TRUE \u6216 FALSE \u66ff\u6362\u3002\u7528\u53cd\u659c\u7ebf\u8f6c\u4e49\u8be5\u5192\u53f7\u53ef\u4ee5\u9632\u6b62\u66ff\u6362\u53d1\u751f\u3002</p>\n<p lang=\"zh\">\u5728\u53c2\u6570\u4e2d\uff0c\u7528\u53cd\u5f15\u53f7\uff08<code class=\"literal\">`</code>\uff09\u5305\u56f4\u7684\u6587\u672c\u4f1a\u88ab\u89c6\u4e3a\u4f20\u7ed9 shell \u7684\u547d\u4ee4\u884c\u3002\u8be5\u547d\u4ee4\u7684\u8f93\u51fa\uff08\u53bb\u6389\u672b\u5c3e\u7684\u6362\u884c\u7b26\uff09\u4f1a\u66ff\u6362\u53cd\u5f15\u53f7\u4e2d\u7684\u6587\u672c\u3002\u5728\u53cd\u5f15\u53f7\u5305\u56f4\u7684\u6587\u672c\u5185\u90e8\uff0c\u4e0d\u4f1a\u8fdb\u884c\u7279\u6b8a\u7684\u5f15\u53f7\u5904\u7406\u6216\u5176\u4ed6\u5904\u7406\uff0c\u4f46\u51fa\u73b0<code class=\"literal\">:<em class=\"replaceable\"><code>variable_name</code></em></code>\u65f6\uff0c\u5982\u679c<em class=\"replaceable\"><code>variable_name</code></em>\u662f<span class=\"application\">psql</span>\u53d8\u91cf\u540d\uff0c\u5c31\u4f1a\u88ab\u66ff\u6362\u4e3a\u8be5\u53d8\u91cf\u7684\u503c\u3002\u6b64\u5916\uff0c<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u4e5f\u4f1a\u88ab\u66ff\u6362\u4e3a\u8be5\u53d8\u91cf\u7684\u503c\uff0c\u5e76\u4f1a\u9002\u5f53\u5730\u52a0\u4e0a\u5f15\u53f7\uff0c\u4f7f\u5176\u6210\u4e3a\u5355\u4e2a shell \u547d\u4ee4\u53c2\u6570\u3002\uff08\u540e\u4e00\u79cd\u5f62\u5f0f\u51e0\u4e4e\u603b\u662f\u66f4\u53ef\u53d6\uff0c\u9664\u975e\u4f60\u975e\u5e38\u786e\u5b9a\u53d8\u91cf\u4e2d\u5305\u542b\u4ec0\u4e48\u3002\uff09\u7531\u4e8e\u65e0\u6cd5\u4fdd\u8bc1\u5728\u6240\u6709\u5e73\u53f0\u4e0a\u90fd\u80fd\u5bf9\u56de\u8f66\u548c\u6362\u884c\u5b57\u7b26\u5b89\u5168\u5730\u52a0\u5f15\u53f7\uff0c\u5f53\u53d8\u91cf\u503c\u4e2d\u51fa\u73b0\u8fd9\u7c7b\u5b57\u7b26\u65f6\uff0c<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u5f62\u5f0f\u4f1a\u6253\u5370\u9519\u8bef\u6d88\u606f\uff0c\u5e76\u4e14\u4e0d\u4f1a\u66ff\u6362\u53d8\u91cf\u503c\u3002</p>\n<p lang=\"zh\">\u4e00\u4e9b\u547d\u4ee4\u63a5\u53d7 SQL \u6807\u8bc6\u7b26\uff08\u4f8b\u5982\u8868\u540d\uff09\u4f5c\u4e3a\u53c2\u6570\u3002\u8fd9\u4e9b\u53c2\u6570\u9075\u5faa SQL \u8bed\u6cd5\u89c4\u5219\uff1a\u672a\u52a0\u5f15\u53f7\u7684\u5b57\u6bcd\u4f1a\u5f3a\u5236\u8f6c\u6362\u4e3a\u5c0f\u5199\uff0c\u800c\u53cc\u5f15\u53f7\uff08\"\uff09\u4f1a\u4fdd\u62a4\u5b57\u6bcd\u4e0d\u88ab\u8f6c\u6362\u5927\u5c0f\u5199\uff0c\u5e76\u5141\u8bb8\u6807\u8bc6\u7b26\u5305\u542b\u7a7a\u767d\u5b57\u7b26\u3002\u5728\u53cc\u5f15\u53f7\u5185\u90e8\uff0c\u8fde\u7eed\u4e24\u4e2a\u53cc\u5f15\u53f7\u4f1a\u5728\u6700\u7ec8\u540d\u79f0\u4e2d\u53d8\u4e3a\u4e00\u4e2a\u53cc\u5f15\u53f7\u3002\u4f8b\u5982\uff0cFOO\"BAR\"BAZ \u4f1a\u88ab\u89e3\u91ca\u4e3a fooBARbaz\uff0c\u800c \"A weird\"\" name\" \u4f1a\u53d8\u4e3a A weird\" name\u3002</p>\n<p lang=\"zh\">\u53c2\u6570\u89e3\u6790\u4f1a\u5728\u884c\u5c3e\u6216\u9047\u5230\u53e6\u4e00\u4e2a\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u65f6\u505c\u6b62\u3002\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u4f1a\u88ab\u89c6\u4e3a\u65b0\u5143\u547d\u4ee4\u7684\u5f00\u59cb\u3002\u7279\u6b8a\u5e8f\u5217<code class=\"literal\">\\\\</code>\uff08\u4e24\u4e2a\u53cd\u659c\u7ebf\uff09\u8868\u793a\u53c2\u6570\u7ed3\u675f\uff0c\u5e76\u7ee7\u7eed\u89e3\u6790<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\uff08\u5982\u679c\u8fd8\u6709\uff09\u3002\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u548c<span class=\"application\">psql</span>\u547d\u4ee4\u53ef\u4ee5\u81ea\u7531\u5730\u6df7\u5408\u5728\u540c\u4e00\u884c\u4e2d\u3002\u4f46\u65e0\u8bba\u5982\u4f55\uff0c\u5143\u547d\u4ee4\u7684\u53c2\u6570\u90fd\u4e0d\u80fd\u5ef6\u7eed\u5230\u4e0b\u4e00\u884c\u3002</p>\n<p lang=\"zh\">\u8bb8\u591a\u5143\u547d\u4ee4\u4f5c\u7528\u4e8e<em class=\"firstterm\">\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a</em>\u3002\u8fd9\u53ea\u662f\u4e00\u4e2a\u4fdd\u5b58\u5df2\u8f93\u5165\u4f46\u5c1a\u672a\u53d1\u9001\u5230\u670d\u52a1\u5668\u6267\u884c\u7684 SQL \u547d\u4ee4\u6587\u672c\u7684\u7f13\u51b2\u533a\u3002\u5176\u4e2d\u65e2\u5305\u62ec\u5148\u524d\u8f93\u5165\u7684\u884c\uff0c\u4e5f\u5305\u62ec\u540c\u4e00\u884c\u4e0a\u4f4d\u4e8e\u5143\u547d\u4ee4\u4e4b\u524d\u7684\u6587\u672c\u3002</p>\n<p lang=\"zh\">\u5b9a\u4e49\u4e86\u4ee5\u4e0b\u5143\u547d\u4ee4\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">\\a</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u5f53\u524d\u8868\u683c\u8f93\u51fa\u683c\u5f0f\u662f\u975e\u5bf9\u9f50\uff0c\u5219\u5207\u6362\u4e3a\u5bf9\u9f50\uff1b\u5426\u5219\u5207\u6362\u4e3a\u975e\u5bf9\u9f50\u3002\u4fdd\u7559\u6b64\u547d\u4ee4\u662f\u4e3a\u4e86\u5411\u540e\u517c\u5bb9\u3002\u66f4\u901a\u7528\u7684\u89e3\u51b3\u65b9\u6848\u8bf7\u53c2\u89c1<code class=\"command\">\\pset</code>\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\c</code> \u6216 <code class=\"literal\">\\connect [ -reuse-previous=<em class=\"replaceable\"><code>on|off</code></em> ] [ <em class=\"replaceable\"><code>dbname</code></em> [ <em class=\"replaceable\"><code>username</code></em> ] [ <em class=\"replaceable\"><code>host</code></em> ] [ <em class=\"replaceable\"><code>port</code></em> ] | <em class=\"replaceable\"><code>conninfo</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5efa\u7acb\u5230<span class=\"productname\">PostgreSQL</span>\u670d\u52a1\u5668\u7684\u65b0\u8fde\u63a5\u3002\u53ef\u4ee5\u4f7f\u7528\u4f4d\u7f6e\u8bed\u6cd5\uff08\u6570\u636e\u5e93\u540d\u79f0\u3001\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\u4e2d\u7684\u4e00\u4e2a\u6216\u591a\u4e2a\uff09\u6307\u5b9a\u8981\u4f7f\u7528\u7684\u8fde\u63a5\u53c2\u6570\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528<em class=\"replaceable\"><code>conninfo</code></em>\u8fde\u63a5\u5b57\u7b26\u4e32\uff0c\u8be6\u89c1<a class=\"xref\" href=\"/docs/14/libpq.html#LIBPQ-CONNSTRING\" title=\"34.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u7b2c\u00a034.1.1\u00a0\u8282</a>\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa\u53c2\u6570\uff0c\u5219\u4f7f\u7528\u4e0e\u4e4b\u524d\u76f8\u540c\u7684\u53c2\u6570\u5efa\u7acb\u65b0\u8fde\u63a5\u3002</p>\n<p lang=\"zh\">\u5c06<em class=\"replaceable\"><code>dbname</code></em>\u3001<em class=\"replaceable\"><code>username</code></em>\u3001<em class=\"replaceable\"><code>host</code></em>\u6216 <em class=\"replaceable\"><code>port</code></em>\u4e2d\u7684\u4efb\u610f\u4e00\u4e2a\u6307\u5b9a\u4e3a <code class=\"literal\">-</code>\uff0c\u7b49\u540c\u4e8e\u7701\u7565\u8be5\u53c2\u6570\u3002</p>\n<p lang=\"zh\">\u65b0\u8fde\u63a5\u53ef\u4ee5\u91cd\u7528\u524d\u4e00\u4e2a\u8fde\u63a5\u7684\u8fde\u63a5\u53c2\u6570\uff1b\u4e0d\u4ec5\u5305\u62ec\u6570\u636e\u5e93\u540d\u79f0\u3001\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\uff0c\u8fd8\u5305\u62ec\u5176\u4ed6\u8bbe\u7f6e\uff0c\u5982<em class=\"replaceable\"><code>sslmode</code></em>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53c2\u6570\u5728\u4f4d\u7f6e\u8bed\u6cd5\u4e2d\u88ab\u91cd\u7528\uff0c\u4f46\u5728\u7ed9\u5b9a<em class=\"replaceable\"><code>conninfo</code></em>\u5b57\u7b26\u4e32\u65f6\u4e0d\u4f1a\u88ab\u91cd\u7528\u3002\u4f20\u9012<code class=\"literal\">-reuse-previous=on</code>\u6216<code class=\"literal\">-reuse-previous=off</code>\u4f5c\u4e3a\u7b2c\u4e00\u4e2a\u53c2\u6570\u5c06\u8986\u76d6\u8be5\u9ed8\u8ba4\u8bbe\u7f6e\u3002\u5982\u679c\u53c2\u6570\u88ab\u91cd\u7528\uff0c\u5219\u4efb\u4f55\u672a\u660e\u786e\u6307\u5b9a\u4e3a\u4f4d\u7f6e\u53c2\u6570\u6216\u5728<em class=\"replaceable\"><code>conninfo</code></em>\u5b57\u7b26\u4e32\u4e2d\u7684\u53c2\u6570\u5c06\u4ece\u73b0\u6709\u8fde\u63a5\u7684\u53c2\u6570\u4e2d\u83b7\u53d6\u3002\u4e00\u4e2a\u4f8b\u5916\u662f\uff0c\u5982\u679c\u4f7f\u7528\u4f4d\u7f6e\u8bed\u6cd5\u66f4\u6539<em class=\"replaceable\"><code>host</code></em>\u8bbe\u7f6e\uff0c\u4f7f\u5176\u4e0d\u540c\u4e8e\u5148\u524d\u7684\u503c\uff0c\u5219\u73b0\u6709\u8fde\u63a5\u53c2\u6570\u4e2d\u5b58\u5728\u7684\u4efb\u4f55<em class=\"replaceable\"><code>hostaddr</code></em>\u8bbe\u7f6e\u5c06\u88ab\u5220\u9664\u3002\u6b64\u5916\uff0c\u4ec5\u5f53\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\u8bbe\u7f6e\u672a\u66f4\u6539\u65f6\uff0c\u624d\u4f1a\u91cd\u7528\u73b0\u6709\u8fde\u63a5\u4f7f\u7528\u7684\u4efb\u4f55\u5bc6\u7801\u3002\u5f53\u547d\u4ee4\u65e2\u4e0d\u6307\u5b9a\u4e5f\u4e0d\u91cd\u7528\u7279\u5b9a\u53c2\u6570\u65f6\uff0c\u5c06\u4f7f\u7528<span class=\"application\">libpq</span>\u7684\u9ed8\u8ba4\u503c\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u65b0\u8fde\u63a5\u6210\u529f\u5efa\u7acb\uff0c\u5219\u5173\u95ed\u5148\u524d\u7684\u8fde\u63a5\u3002\u5982\u679c\u8fde\u63a5\u5c1d\u8bd5\u5931\u8d25\uff08\u7528\u6237\u540d\u9519\u8bef\uff0c\u8bbf\u95ee\u88ab\u62d2\u7edd\u7b49\uff09\uff0c\u4e14<span class=\"application\">psql</span>\u5904\u4e8e\u4ea4\u4e92\u6a21\u5f0f\uff0c\u5219\u4fdd\u7559\u5148\u524d\u7684\u8fde\u63a5\u3002\u4f46\u5728\u6267\u884c\u975e\u4ea4\u4e92\u811a\u672c\u65f6\uff0c\u65e7\u8fde\u63a5\u5c06\u88ab\u5173\u95ed\u5e76\u62a5\u544a\u9519\u8bef\u3002\u8fd9\u53ef\u80fd\u4f1a\u6216\u53ef\u80fd\u4e0d\u4f1a\u7ec8\u6b62\u811a\u672c\uff1b\u5982\u679c\u6ca1\u6709\u7ec8\u6b62\uff0c\u76f4\u5230\u6210\u529f\u6267\u884c\u53e6\u4e00\u4e2a<code class=\"literal\">\\connect</code>\u547d\u4ee4\u4e4b\u524d\uff0c\u6240\u6709\u8bbf\u95ee\u6570\u636e\u5e93\u7684\u547d\u4ee4\u90fd\u5c06\u5931\u8d25\u3002\u91c7\u7528\u8fd9\u79cd\u533a\u522b\uff0c\u4e00\u65b9\u9762\u662f\u4e3a\u4e86\u65b9\u4fbf\u7528\u6237\u5e94\u5bf9\u8f93\u5165\u7b14\u8bef\uff0c\u53e6\u4e00\u65b9\u9762\u662f\u4e3a\u4e86\u9632\u6b62\u811a\u672c\u610f\u5916\u64cd\u4f5c\u9519\u8bef\u7684\u6570\u636e\u5e93\u3002\u8bf7\u6ce8\u610f\uff0c\u6bcf\u5f53<code class=\"literal\">\\connect</code>\u547d\u4ee4\u5c1d\u8bd5\u91cd\u65b0\u4f7f\u7528\u53c2\u6570\u65f6\uff0c\u91cd\u65b0\u4f7f\u7528\u7684\u503c\u662f\u6700\u540e\u4e00\u4e2a\u6210\u529f\u8fde\u63a5\u7684\u503c\uff0c\u800c\u4e0d\u662f\u968f\u540e\u7684\u4efb\u4f55\u5931\u8d25\u5c1d\u8bd5\u7684\u503c\u3002\u4f46\u662f\uff0c\u5728\u975e\u4ea4\u4e92<code class=\"literal\">\\connect</code>\u5931\u8d25\u7684\u60c5\u51b5\u4e0b\uff0c\u4e0d\u5141\u8bb8\u7a0d\u540e\u91cd\u65b0\u4f7f\u7528\u53c2\u6570\uff0c\u56e0\u4e3a\u811a\u672c\u53ef\u80fd\u671f\u671b\u4ece\u5931\u8d25\u7684<code class=\"literal\">\\connect</code>\u4e2d\u91cd\u65b0\u4f7f\u7528\u503c\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">=&gt; \\c mydb myuser host.dom 6432\n=&gt; \\c service=foo\n=&gt; \\c \"host=localhost port=5432 dbname=mydb connect_timeout=10 sslmode=disable\"\n=&gt; \\c -reuse-previous=on sslmode=require    -- changes only sslmode\n=&gt; \\c postgresql://tom@localhost/mydb?application_name=myapp\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\C [ <em class=\"replaceable\"><code>title</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u4f5c\u4e3a\u67e5\u8be2\u7ed3\u679c\u6253\u5370\u7684\u8868\u7684\u6807\u9898\uff0c\u6216\u53d6\u6d88\u6b64\u7c7b\u6807\u9898\u3002\u8be5\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset title <em class=\"replaceable\"><code>title</code></em></code>\u3002\uff08\u6b64\u547d\u4ee4\u7684\u540d\u79f0\u6e90\u81ea<span class=\"quote\">\u201c<span class=\"quote\">caption</span>\u201d</span>\uff0c\u56e0\u4e3a\u5b83\u8fc7\u53bb\u53ea\u7528\u4e8e\u8bbe\u7f6e<acronym class=\"acronym\">HTML</acronym>\u8868\u7684\u6807\u9898\u3002\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\cd [ <em class=\"replaceable\"><code>directory</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u66f4\u6539\u4e3a<em class=\"replaceable\"><code>directory</code></em>\u3002\u5982\u679c\u6ca1\u6709\u53c2\u6570\uff0c\u5219\u5207\u6362\u5230\u5f53\u524d\u7528\u6237\u7684\u4e3b\u76ee\u5f55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8981\u6253\u5370\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\uff0c\u8bf7\u4f7f\u7528<code class=\"literal\">\\! pwd</code>\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\conninfo</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa\u5f53\u524d\u6570\u636e\u5e93\u8fde\u63a5\u7684\u4fe1\u606f\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMANDS-COPY\"><span class=\"term\"><code class=\"literal\">\\copy { <em class=\"replaceable\"><code>table</code></em> [ ( <em class=\"replaceable\"><code>column_list</code></em> ) ] } <code class=\"literal\">from</code> { <em class=\"replaceable\"><code>'filename'</code></em> | program <em class=\"replaceable\"><code>'command'</code></em> | stdin | pstdin } [ [ with ] ( <em class=\"replaceable\"><code>option</code></em> [, ...] ) ] [ where <em class=\"replaceable\"><code>condition</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\copy { <em class=\"replaceable\"><code>table</code></em> [ ( <em class=\"replaceable\"><code>column_list</code></em> ) ] | ( <em class=\"replaceable\"><code>query</code></em> ) } <code class=\"literal\">to</code> { <em class=\"replaceable\"><code>'filename'</code></em> | program <em class=\"replaceable\"><code>'command'</code></em> | stdout | pstdout } [ [ with ] ( <em class=\"replaceable\"><code>option</code></em> [, ...] ) ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6267\u884c\u524d\u7aef\uff08\u5ba2\u6237\u7aef\uff09\u590d\u5236\u3002\u8be5\u64cd\u4f5c\u4f1a\u8fd0\u884c\u4e00\u4e2a<acronym class=\"acronym\">SQL</acronym> <a class=\"link\" href=\"/docs/14/sql-copy.html\" title=\"COPY\"><code class=\"command\">COPY</code></a>\u547d\u4ee4\uff0c\u4f46\u5e76\u4e0d\u662f\u7531\u670d\u52a1\u5668\u8bfb\u53d6\u6216\u5199\u5165\u6307\u5b9a\u6587\u4ef6\uff0c\u800c\u662f\u7531<span class=\"application\">psql</span>\u8bfb\u53d6\u6216\u5199\u5165\u6587\u4ef6\uff0c\u5e76\u5728\u670d\u52a1\u5668\u4e0e\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e4b\u95f4\u8f6c\u9001\u6570\u636e\u3002\u8fd9\u610f\u5473\u7740\u6587\u4ef6\u53ef\u8bbf\u95ee\u6027\u548c\u6743\u9650\u53d6\u51b3\u4e8e\u672c\u5730\u7528\u6237\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\uff0c\u4e5f\u4e0d\u9700\u8981 SQL \u8d85\u7ea7\u7528\u6237\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5f53\u6307\u5b9a<code class=\"literal\">program</code>\u65f6\uff0c<em class=\"replaceable\"><code>command</code></em> \u7531<span class=\"application\">psql</span>\u6267\u884c\uff0c\u4f20\u7ed9<em class=\"replaceable\"><code>command</code></em>\u7684\u6570\u636e\u6216\u4ece\u5176\u4e2d\u8bfb\u51fa\u7684\u6570\u636e\u90fd\u4f1a\u5728\u670d\u52a1\u5668\u4e0e\u5ba2\u6237\u7aef\u4e4b\u95f4\u8f6c\u9001\u3002\u518d\u6b21\u5f3a\u8c03\uff0c\u6267\u884c\u6743\u9650\u5c5e\u4e8e\u672c\u5730\u7528\u6237\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\uff0c\u4e5f\u4e0d\u9700\u8981 SQL \u8d85\u7ea7\u7528\u6237\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e \\copy ... from stdin\uff0c\u4ece\u53d1\u51fa\u547d\u4ee4\u7684\u540c\u4e00\u8f93\u5165\u6e90\u8bfb\u53d6\u6570\u636e\u884c\uff0c\u76f4\u5230\u8bfb\u53d6\u5230 \\.\u6216\u8f93\u5165\u6d41\u5230\u8fbe EOF\u3002\u8fd9\u9002\u5408\u5728 SQL \u811a\u672c\u4e2d\u5185\u8054\u586b\u5145\u8868\u3002\u5bf9\u4e8e \\copy ... to stdout\uff0c\u8f93\u51fa\u53d1\u5f80\u4e0e psql \u547d\u4ee4\u8f93\u51fa\u76f8\u540c\u7684\u4f4d\u7f6e\uff0c\u4e14\u4e0d\u6253\u5370 COPY count \u547d\u4ee4\u72b6\u6001\uff0c\u4ee5\u514d\u4e0e\u6570\u636e\u884c\u6df7\u6dc6\u3002\u82e5\u8981\u59cb\u7ec8\u8bfb\u5199 psql \u7684\u6807\u51c6\u8f93\u5165\u6216\u8f93\u51fa\uff0c\u800c\u4e0d\u53d7\u5f53\u524d\u547d\u4ee4\u6765\u6e90\u6216 \\o \u9009\u9879\u5f71\u54cd\uff0c\u8bf7\u4f7f\u7528 from pstdin \u6216 to pstdout\u3002</p>\n<p lang=\"zh\">\u8be5\u547d\u4ee4\u7684\u8bed\u6cd5\u4e0e<acronym class=\"acronym\">SQL</acronym> <a class=\"link\" href=\"/docs/14/sql-copy.html\" title=\"COPY\"><code class=\"command\">COPY</code></a>\u547d\u4ee4\u7c7b\u4f3c\u3002\u9664\u6570\u636e\u6e90\u6216\u76ee\u6807\u4e4b\u5916\uff0c\u5176\u4ed6\u6240\u6709\u9009\u9879\u90fd\u4e0e<code class=\"command\">COPY</code>\u547d\u4ee4\u4e2d\u7684\u6307\u5b9a\u76f8\u540c\u3002\u56e0\u6b64\uff0c\u7279\u6b8a\u7684\u89e3\u6790\u89c4\u5219\u9002\u7528\u4e8e<code class=\"command\">\\copy</code>\u5143\u547d\u4ee4\u3002\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u5269\u4f59\u884c\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\copy</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u6267\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u53e6\u4e00\u79cd\u83b7\u5f97\u4e0e<code class=\"literal\">\\copy ... to</code>\u76f8\u540c\u7ed3\u679c\u7684\u65b9\u6cd5\u662f\u4f7f\u7528<acronym class=\"acronym\">SQL</acronym> <code class=\"literal\">COPY ... TO STDOUT</code>\u547d\u4ee4\uff0c\u5e76\u4ee5<code class=\"literal\">\\g <em class=\"replaceable\"><code>filename</code></em></code> \u6216<code class=\"literal\">\\g |<em class=\"replaceable\"><code>program</code></em></code>\u7ed3\u675f\u3002\u4e0e<code class=\"literal\">\\copy</code>\u4e0d\u540c\uff0c\u8fd9\u79cd\u65b9\u6cd5\u5141\u8bb8\u547d\u4ee4\u8de8\u8d8a\u591a\u884c\uff1b\u6b64\u5916\uff0c\u53ef\u4ee5\u4f7f\u7528\u53d8\u91cf\u63d2\u503c\u548c\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</div>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8fd9\u4e9b\u64cd\u4f5c\u4e0d\u5982\u4ee5\u6587\u4ef6\u6216\u7a0b\u5e8f\u4f5c\u4e3a\u6570\u636e\u6e90\u6216\u76ee\u6807\u7684<acronym class=\"acronym\">SQL</acronym> <code class=\"command\">COPY</code>\u547d\u4ee4\u9ad8\u6548\uff0c\u56e0\u4e3a\u6240\u6709\u6570\u636e\u90fd\u5fc5\u987b\u901a\u8fc7\u5ba2\u6237\u7aef/\u670d\u52a1\u5668\u8fde\u63a5\u4f20\u8f93\u3002\u5bf9\u4e8e\u5927\u91cf\u6570\u636e\uff0c\u4f7f\u7528<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u53ef\u80fd\u66f4\u5408\u9002\u3002\u53e6\u5916\uff0c\u7531\u4e8e\u91c7\u7528\u8fd9\u79cd\u6570\u636e\u8f6c\u9001\u65b9\u5f0f\uff0c<acronym class=\"acronym\">CSV</acronym>\u6a21\u5f0f\u4e0b\u7684<code class=\"literal\">\\copy ... from</code>\u4f1a\u9519\u8bef\u5730\u628a\u5355\u72ec\u5360\u636e\u4e00\u884c\u7684<code class=\"literal\">\\.</code>\u6570\u636e\u503c\u5f53\u4f5c\u8f93\u5165\u7ed3\u675f\u6807\u8bb0\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\copyright</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"productname\">PostgreSQL</span>\u7684\u7248\u6743\u548c\u5206\u53d1\u6761\u6b3e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMANDS-CROSSTABVIEW\"><span class=\"term\"><code class=\"literal\">\\crosstabview [ <em class=\"replaceable\"><code>colV</code></em> [ <em class=\"replaceable\"><code>colH</code></em> [ <em class=\"replaceable\"><code>colD</code></em> [ <em class=\"replaceable\"><code>sortcolH</code></em> ] ] ] ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6267\u884c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\uff08\u4e0e<code class=\"literal\">\\g</code>\u7c7b\u4f3c\uff09\uff0c\u5e76\u4ee5\u4ea4\u53c9\u8868\u7f51\u683c\u663e\u793a\u7ed3\u679c\u3002\u67e5\u8be2\u5fc5\u987b\u8fd4\u56de\u81f3\u5c11\u4e09\u5217\u3002\u7531<em class=\"replaceable\"><code>colV</code></em>\u6807\u8bc6\u7684\u8f93\u51fa\u5217\u6210\u4e3a\u7eb5\u5411\u8868\u5934\uff0c\u7531<em class=\"replaceable\"><code>colH</code></em>\u6807\u8bc6\u7684\u8f93\u51fa\u5217\u6210\u4e3a\u6a2a\u5411\u8868\u5934\u3002<em class=\"replaceable\"><code>colD</code></em>\u6807\u8bc6\u8981\u5728\u7f51\u683c\u4e2d\u663e\u793a\u7684\u8f93\u51fa\u5217\u3002<em class=\"replaceable\"><code>sortcolH</code></em>\u6807\u8bc6\u6a2a\u5411\u8868\u5934\u7684\u53ef\u9009\u6392\u5e8f\u5217\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a\u5217\u6307\u5b9a\u9879\u53ef\u4ee5\u662f\u4ece 1 \u5f00\u59cb\u7684\u5217\u53f7\uff0c\u4e5f\u53ef\u4ee5\u662f\u5217\u540d\uff1b\u5217\u540d\u9075\u5faa\u5e38\u89c4 SQL \u5927\u5c0f\u5199\u6298\u53e0\u548c\u5f15\u53f7\u89c4\u5219\u3002\u7701\u7565\u65f6\uff0ccolV \u9ed8\u8ba4\u4e3a\u7b2c 1 \u5217\uff0ccolH \u9ed8\u8ba4\u4e3a\u7b2c 2 \u5217\u3002colH \u5fc5\u987b\u4e0e colV \u4e0d\u540c\u3002\u82e5\u4e0d\u6307\u5b9a colD\uff0c\u67e5\u8be2\u7ed3\u679c\u5fc5\u987b\u6070\u6709\u4e09\u5217\uff0c\u65e2\u975e colV \u4e5f\u975e colH \u7684\u90a3\u4e00\u5217\u4f5c\u4e3a colD\u3002</p>\n<p lang=\"zh\">\u7eb5\u5411\u8868\u5934\u663e\u793a\u4e3a\u6700\u5de6\u5217\uff0c\u5305\u542b<em class=\"replaceable\"><code>colV</code></em>\u5217\u4e2d\u7684\u503c\uff0c\u5176\u987a\u5e8f\u4e0e\u67e5\u8be2\u7ed3\u679c\u4e2d\u76f8\u540c\uff0c\u4f46\u4f1a\u79fb\u9664\u91cd\u590d\u503c\u3002</p>\n<p lang=\"zh\">\u6a2a\u5411\u8868\u5934\u663e\u793a\u4e3a\u7b2c\u4e00\u884c\uff0c\u5305\u542b<em class=\"replaceable\"><code>colH</code></em>\u5217\u4e2d\u7684\u503c\uff0c\u5e76\u79fb\u9664\u91cd\u590d\u503c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4eec\u6309\u67e5\u8be2\u7ed3\u679c\u4e2d\u7684\u76f8\u540c\u987a\u5e8f\u663e\u793a\u3002\u4f46\u5982\u679c\u7ed9\u51fa\u4e86\u53ef\u9009\u7684<em class=\"replaceable\"><code>sortcolH</code></em>\u53c2\u6570\uff0c\u5b83\u6240\u6807\u8bc6\u7684\u5217\u7684\u503c\u5fc5\u987b\u662f\u6574\u6570\uff0c\u800c<em class=\"replaceable\"><code>colH</code></em>\u4e2d\u7684\u503c\u4f1a\u6309\u7167\u5bf9\u5e94\u7684<em class=\"replaceable\"><code>sortcolH</code></em>\u503c\u6392\u5e8f\u540e\u663e\u793a\u5728\u6a2a\u5411\u8868\u5934\u4e2d\u3002</p>\n<p lang=\"zh\">\u4ea4\u53c9\u8868\u4e2d\uff0c\u5bf9\u4e8e colH \u7684\u6bcf\u4e2a\u4e0d\u540c\u503c x \u548c colV \u7684\u6bcf\u4e2a\u4e0d\u540c\u503c y\uff0c\u4ea4\u70b9 (x,y) \u7684\u5355\u5143\u683c\u4fdd\u5b58\u67e5\u8be2\u7ed3\u679c\u4e2d colH=x \u4e14 colV=y \u90a3\u4e00\u884c\u7684 colD \u503c\u3002\u6ca1\u6709\u5339\u914d\u884c\u65f6\u5355\u5143\u683c\u4e3a\u7a7a\uff1b\u5b58\u5728\u591a\u884c\u65f6\u4f1a\u62a5\u9519\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\d[S+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5bf9\u4e8e\u6bcf\u4e2a\u4e0e<em class=\"replaceable\"><code>pattern</code></em>\u5339\u914d\u7684\u5173\u7cfb\uff08\u8868\u3001\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u7d22\u5f15\u3001\u5e8f\u5217\u6216\u5916\u90e8\u8868\uff09\u6216\u590d\u5408\u7c7b\u578b\uff0c\u663e\u793a\u6240\u6709\u5217\u3001\u5b83\u4eec\u7684\u7c7b\u578b\u3001\u8868\u7a7a\u95f4\uff08\u5982\u679c\u4e0d\u662f\u9ed8\u8ba4\u7684\uff09\u4ee5\u53ca\u4efb\u4f55\u7279\u6b8a\u5c5e\u6027\uff0c\u5982<code class=\"literal\">NOT NULL</code>\u6216\u9ed8\u8ba4\u503c\u3002\u8fd8\u663e\u793a\u76f8\u5173\u7684\u7d22\u5f15\u3001\u7ea6\u675f\u3001\u89c4\u5219\u548c\u89e6\u53d1\u5668\u3002\u5bf9\u4e8e\u5916\u90e8\u8868\uff0c\u8fd8\u663e\u793a\u5173\u8054\u7684\u5916\u90e8\u670d\u52a1\u5668\u3002\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u5339\u914d\u6a21\u5f0f</span>\u201d</span>\u7684\u5b9a\u4e49\u5728\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"\u6a21\u5f0f\">\u6a21\u5f0f</a>\u4e2d\u3002\uff09</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u67d0\u4e9b\u7c7b\u578b\u7684\u5173\u7cfb\uff0c<code class=\"literal\">\\d</code>\u663e\u793a\u6bcf\u5217\u7684\u9644\u52a0\u4fe1\u606f\uff1a\u5e8f\u5217\u7684\u5217\u503c\uff0c\u7d22\u5f15\u7684\u7d22\u5f15\u8868\u8fbe\u5f0f\uff0c\u5916\u90e8\u8868\u7684\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u547d\u4ee4\u5f62\u5f0f<code class=\"literal\">\\d+</code>\u4e0e\u524d\u8005\u76f8\u540c\uff0c\u4f46\u4f1a\u663e\u793a\u66f4\u591a\u4fe1\u606f\uff1a\u8868\u5217\u5173\u8054\u7684\u6ce8\u91ca\u3001\u8868\u662f\u5426\u5305\u542b OID\u3001\u5f53\u5173\u7cfb\u4e3a\u89c6\u56fe\u65f6\u7684\u89c6\u56fe\u5b9a\u4e49\u3001\u975e\u9ed8\u8ba4\u7684<a class=\"link\" href=\"/docs/14/sql-altertable.html#SQL-ALTERTABLE-REPLICA-IDENTITY\">\u590d\u5236\u6807\u8bc6</a>\u8bbe\u7f6e\uff0c\u4ee5\u53ca\u5f53\u5173\u7cfb\u5177\u6709\u8bbf\u95ee\u65b9\u6cd5\u65f6\u7684<a class=\"link\" href=\"/docs/14/sql-create-access-method.html\" title=\"CREATE ACCESS METHOD\">\u8bbf\u95ee\u65b9\u6cd5</a>\u540d\u79f0\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u4e00\u4e2a\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u4ee5\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528<code class=\"command\">\\d</code>\u800c\u6ca1\u6709<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\uff0c\u5b83\u7b49\u540c\u4e8e<code class=\"command\">\\dtvmsE</code>\uff0c\u5b83\u5c06\u663e\u793a\u6240\u6709\u53ef\u89c1\u7684\u8868\u3001\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u7684\u5217\u8868\u3002\u8fd9\u7eaf\u7cb9\u662f\u4e00\u79cd\u4fbf\u5229\u63aa\u65bd\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\da[S] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u805a\u5408\u51fd\u6570\uff0c\u4ee5\u53ca\u5b83\u4eec\u7684\u8fd4\u56de\u7c7b\u578b\u548c\u6240\u4f5c\u7528\u7684\u6570\u636e\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u805a\u5408\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dA[+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8bbf\u95ee\u65b9\u6cd5\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bbf\u95ee\u65b9\u6cd5\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u8bbf\u95ee\u65b9\u6cd5\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u7684\u5904\u7406\u5668\u51fd\u6570\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dAc[+] [<a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>input-type-pattern</code></em></a>]]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u64cd\u4f5c\u7b26\u7c7b\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/14/xindex.html#XINDEX-OPCLASS\" title=\"38.16.1.\u00a0\u7d22\u5f15\u65b9\u6cd5\u548c\u64cd\u4f5c\u7b26\u7c7b\">\u7b2c\u00a038.16.1\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u7c7b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>input-type-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8f93\u5165\u7c7b\u578b\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u7c7b\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u7c7b\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u548c\u6240\u6709\u8005\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dAf[+] [<a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>input-type-pattern</code></em></a>]]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u64cd\u4f5c\u7b26\u65cf\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/14/xindex.html#XINDEX-OPFAMILY\" title=\"38.16.5.\u00a0\u64cd\u4f5c\u7b26\u7c7b\u548c\u64cd\u4f5c\u7b26\u65cf\">\u7b2c\u00a038.16.5\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>input-type-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8f93\u5165\u7c7b\u578b\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u65cf\u90fd\u4f1a\u8fde\u540c\u5176\u6240\u6709\u8005\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dAo[+] [<a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>operator-family-pattern</code></em></a>]]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u4e0e\u64cd\u4f5c\u7b26\u65cf\u5173\u8054\u7684\u64cd\u4f5c\u7b26\uff08\u89c1<a class=\"xref\" href=\"/docs/14/xindex.html#XINDEX-STRATEGIES\" title=\"38.16.2.\u00a0\u7d22\u5f15\u65b9\u6cd5\u7b56\u7565\">\u7b2c\u00a038.16.2\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u5173\u8054\u8bbf\u95ee\u65b9\u6cd5\u7684\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u64cd\u4f5c\u7b26\u65cf\u6210\u5458\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>operator-family-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u64cd\u4f5c\u7b26\u65cf\u6210\u5458\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u5217\u51fa\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u7684\u6392\u5e8f\u64cd\u4f5c\u7b26\u65cf\uff08\u5982\u679c\u5b83\u662f\u4e00\u4e2a\u6392\u5e8f\u64cd\u4f5c\u7b26\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dAp[+] [<a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>operator-family-pattern</code></em></a>]]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u4e0e\u64cd\u4f5c\u7b26\u65cf\u5173\u8054\u7684\u652f\u6301\u51fd\u6570\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/14/xindex.html#XINDEX-SUPPORT\" title=\"38.16.3.\u00a0\u7d22\u5f15\u65b9\u6cd5\u652f\u6301\u4f8b\u7a0b\">\u7b2c\u00a038.16.3\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u6240\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u51fd\u6570\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>operator-family-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u8be5\u6a21\u5f0f\u5339\u914d\u7684\u64cd\u4f5c\u7b26\u65cf\u51fd\u6570\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u51fd\u6570\u4f1a\u4ee5\u8be6\u7ec6\u5f62\u5f0f\u663e\u793a\uff0c\u5e76\u5e26\u6709\u5176\u5b9e\u9645\u53c2\u6570\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\db[+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8868\u7a7a\u95f4\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8868\u7a7a\u95f4\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u8868\u7a7a\u95f4\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u9009\u9879\u3001\u78c1\u76d8\u5927\u5c0f\u3001\u6743\u9650\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dc[S+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5b57\u7b26\u96c6\u7f16\u7801\u4e4b\u95f4\u7684\u8f6c\u6362\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8f6c\u6362\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dC[+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u7c7b\u578b\u8f6c\u6362\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u6e90\u7c7b\u578b\u6216\u76ee\u6807\u7c7b\u578b\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u7c7b\u578b\u8f6c\u6362\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u5217\u51fa\u6bcf\u4e2a\u5bf9\u8c61\u5173\u8054\u7684\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dd[S] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u663e\u793a<code class=\"literal\">constraint</code>\u3001<code class=\"literal\">operator class</code>\u3001<code class=\"literal\">operator family</code>\u3001<code class=\"literal\">rule</code>\u548c <code class=\"literal\">trigger</code>\u7c7b\u578b\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002\u5176\u4ed6\u6ce8\u91ca\u53ef\u901a\u8fc7\u5bf9\u5e94\u5bf9\u8c61\u7c7b\u578b\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u67e5\u770b\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">\\dd</code> \u663e\u793a\u4e0e <em class=\"replaceable\"><code>pattern</code></em> \u5339\u914d\u7684\u5bf9\u8c61\u63cf\u8ff0\uff1b\u5982\u679c\u6ca1\u6709\u7ed9\u51fa\u53c2\u6570\uff0c\u5219\u663e\u793a\u76f8\u5e94\u7c7b\u578b\u7684\u53ef\u89c1\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002\u4f46\u65e0\u8bba\u54ea\u79cd\u60c5\u51b5\uff0c\u53ea\u5217\u51fa\u90a3\u4e9b\u5df2\u6709\u63cf\u8ff0\u7684\u5bf9\u8c61\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528 <a class=\"link\" href=\"/docs/14/sql-comment.html\" title=\"COMMENT\"><code class=\"command\">COMMENT</code></a> <acronym class=\"acronym\">SQL</acronym> \u547d\u4ee4\u521b\u5efa\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dD[S+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u57df\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u57df\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u6743\u9650\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\ddp [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u9ed8\u8ba4\u8bbf\u95ee\u6743\u9650\u8bbe\u7f6e\u3002\u5bf9\u4e8e\u6bcf\u4e2a\u9ed8\u8ba4\u6743\u9650\u8bbe\u7f6e\u5df2\u504f\u79bb\u5185\u7f6e\u9ed8\u8ba4\u503c\u7684\u89d2\u8272\uff08\u4ee5\u53ca\u9002\u7528\u65f6\u7684\u6a21\u5f0f\uff09\uff0c\u90fd\u4f1a\u663e\u793a\u4e00\u6761\u8bb0\u5f55\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u89d2\u8272\u540d\u6216\u6a21\u5f0f\u540d\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bb0\u5f55\u3002</p>\n<p lang=\"zh\"><a class=\"link\" href=\"/docs/14/sql-alterdefaultprivileges.html\" title=\"ALTER DEFAULT PRIVILEGES\"><code class=\"command\">ALTER DEFAULT PRIVILEGES</code></a>\u547d\u4ee4\u7528\u4e8e\u8bbe\u7f6e\u9ed8\u8ba4\u8bbf\u95ee\u6743\u9650\u3002\u6743\u9650\u663e\u793a\u7684\u542b\u4e49\u5728<a class=\"xref\" href=\"/docs/14/ddl-priv.html\" title=\"5.7.\u00a0\u6743\u9650\">\u7b2c\u00a05.7\u00a0\u8282</a>\u4e2d\u6709\u89e3\u91ca\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dE[S+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\di[S+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dm[S+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\ds[S+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dt[S+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dv[S+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd9\u7ec4\u547d\u4ee4\u4e2d\uff0c\u5b57\u6bcd <code class=\"literal\">E</code>\u3001<code class=\"literal\">i</code>\u3001<code class=\"literal\">m</code>\u3001<code class=\"literal\">s</code>\u3001<code class=\"literal\">t</code> \u548c <code class=\"literal\">v</code> \u5206\u522b\u8868\u793a\u5916\u90e8\u8868\u3001\u7d22\u5f15\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u3001\u8868\u548c\u89c6\u56fe\u3002\u4f60\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u6307\u5b9a\u5176\u4e2d\u4efb\u610f\u4e00\u4e2a\u6216\u591a\u4e2a\u5b57\u6bcd\uff0c\u4ee5\u83b7\u53d6\u8fd9\u4e9b\u7c7b\u578b\u5bf9\u8c61\u7684\u5217\u8868\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dti</code> \u4f1a\u5217\u51fa\u8868\u548c\u7d22\u5f15\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u6301\u4e45\u6027\u72b6\u6001\uff08\u6c38\u4e45\u3001\u4e34\u65f6\u6216\u4e0d\u8bb0\u5f55 WAL\uff09\u3001\u78c1\u76d8\u4e0a\u7684\u7269\u7406\u5927\u5c0f\u4ee5\u53ca\u76f8\u5173\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u4e00\u8d77\u5217\u51fa\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u5bf9\u8c61\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\des[+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u670d\u52a1\u5668\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external servers</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u670d\u52a1\u5668\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\des+</code>\u5f62\u5f0f\uff0c\u5219\u663e\u793a\u6bcf\u4e2a\u670d\u52a1\u5668\u7684\u5b8c\u6574\u8bf4\u660e\uff0c\u5305\u62ec\u670d\u52a1\u5668\u7684\u8bbf\u95ee\u6743\u9650\u3001\u7c7b\u578b\u3001\u7248\u672c\u3001\u9009\u9879\u548c\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\det[+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u8868\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external tables</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u8868\u540d\u6216\u6a21\u5f0f\u540d\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6761\u76ee\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\det+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u901a\u7528\u9009\u9879\u548c\u5916\u90e8\u8868\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\deu[+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u7528\u6237\u6620\u5c04\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external users</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u7528\u6237\u540d\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6620\u5c04\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\deu+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u6620\u5c04\u7684\u9644\u52a0\u4fe1\u606f\u3002</p>\n<div class=\"caution\">\n<h3 class=\"title\" lang=\"zh\">\u5c0f\u5fc3</h3>\n<p lang=\"zh\"><code class=\"literal\">\\deu+</code>\u8fd8\u53ef\u80fd\u663e\u793a\u8fdc\u7a0b\u7528\u6237\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u56e0\u6b64\u5e94\u6ce8\u610f\u4e0d\u8981\u6cc4\u9732\u5b83\u4eec\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dew[+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external wrappers</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dew+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u7684\u8bbf\u95ee\u6743\u9650\u3001\u9009\u9879\u548c\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\df[anptwS+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> [ <em class=\"replaceable\"><code>arg_pattern</code></em> ... ] ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u51fd\u6570\uff0c\u4ee5\u53ca\u5b83\u4eec\u7684\u7ed3\u679c\u6570\u636e\u7c7b\u578b\u3001\u53c2\u6570\u6570\u636e\u7c7b\u578b\u548c\u51fd\u6570\u7c7b\u578b\uff0c\u51fd\u6570\u7c7b\u578b\u5206\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">agg</span>\u201d</span>\uff08\u805a\u5408\uff09\u3001<span class=\"quote\">\u201c<span class=\"quote\">normal</span>\u201d</span>\u3001<span class=\"quote\">\u201c<span class=\"quote\">procedure</span>\u201d</span>\u3001<span class=\"quote\">\u201c<span class=\"quote\">trigger</span>\u201d</span>\u6216<span class=\"quote\">\u201c<span class=\"quote\">window</span>\u201d</span>\u3002\u8981\u53ea\u663e\u793a\u7279\u5b9a\u7c7b\u578b\u7684\u51fd\u6570\uff0c\u8bf7\u5728\u547d\u4ee4\u540e\u6dfb\u52a0\u76f8\u5e94\u7684\u5b57\u6bcd <code class=\"literal\">a</code>\u3001<code class=\"literal\">n</code>\u3001<code class=\"literal\">p</code>\u3001<code class=\"literal\">t</code> \u6216 <code class=\"literal\">w</code>\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u51fd\u6570\u3002\u4efb\u4f55\u9644\u52a0\u53c2\u6570\u90fd\u662f\u7c7b\u578b\u540d\u6a21\u5f0f\uff0c\u5206\u522b\u4e0e\u51fd\u6570\u7b2c\u4e00\u3001\u7b2c\u4e8c\u7b49\u53c2\u6570\u7684\u7c7b\u578b\u540d\u5339\u914d\u3002\uff08\u5339\u914d\u5230\u7684\u51fd\u6570\u53ef\u4ee5\u6bd4\u4f60\u6307\u5b9a\u7684\u53c2\u6570\u66f4\u591a\uff1b\u82e5\u8981\u9632\u6b62\u8fd9\u79cd\u60c5\u51b5\uff0c\u53ef\u5c06\u8fde\u5b57\u7b26 <code class=\"literal\">-</code> \u5199\u6210\u6700\u540e\u4e00\u4e2a <em class=\"replaceable\"><code>arg_pattern</code></em>\u3002\uff09\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u4f7f\u7528 <code class=\"literal\">\\df+</code> \u5f62\u5f0f\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u51fd\u6570\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u6613\u53d8\u6027\u3001\u5e76\u884c\u5b89\u5168\u6027\u3001\u6240\u6709\u8005\u3001\u5b89\u5168\u5206\u7c7b\u3001\u8bbf\u95ee\u6743\u9650\u3001\u8bed\u8a00\u3001\u6e90\u4ee3\u7801\u548c\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dF[+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u914d\u7f6e\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u914d\u7f6e\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dF+</code>\u5f62\u5f0f\uff0c\u5219\u663e\u793a\u6bcf\u4e2a\u914d\u7f6e\u7684\u5b8c\u6574\u8bf4\u660e\uff0c\u5305\u62ec\u5e95\u5c42\u5168\u6587\u68c0\u7d22\u89e3\u6790\u5668\u548c\u6bcf\u79cd\u89e3\u6790\u5668\u8bcd\u5143\u7c7b\u578b\u7684\u8bcd\u5178\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dFd[+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u8bcd\u5178\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bcd\u5178\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dFd+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u9009\u4e2d\u8bcd\u5178\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5e95\u5c42\u5168\u6587\u68c0\u7d22\u6a21\u677f\u548c\u9009\u9879\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dFp[+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u89e3\u6790\u5668\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u89e3\u6790\u5668\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dFp+</code>\u5f62\u5f0f\uff0c\u5219\u663e\u793a\u6bcf\u4e2a\u89e3\u6790\u5668\u7684\u5b8c\u6574\u8bf4\u660e\uff0c\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u548c\u53ef\u8bc6\u522b\u7684\u8bcd\u5143\u7c7b\u578b\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dFt[+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u6a21\u677f\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6a21\u677f\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dFt+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u6a21\u677f\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dg[S+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u5e93\u89d2\u8272\u3002\uff08\u7531\u4e8e<span class=\"quote\">\u201c<span class=\"quote\">\u7528\u6237</span>\u201d</span>\u548c<span class=\"quote\">\u201c<span class=\"quote\">\u7ec4</span>\u201d</span>\u7684\u6982\u5ff5\u5df2\u7ecf\u7edf\u4e00\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">\u89d2\u8272</span>\u201d</span>\uff0c\u6b64\u547d\u4ee4\u73b0\u5728\u7b49\u4ef7\u4e8e<code class=\"literal\">\\du</code>\u3002\uff09\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u89d2\u8272\uff1b\u63d0\u4f9b<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u89d2\u8272\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u89d2\u8272\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dg+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u89d2\u8272\u7684\u9644\u52a0\u4fe1\u606f\uff1b\u76ee\u524d\u4f1a\u589e\u52a0\u6bcf\u4e2a\u89d2\u8272\u7684\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dl</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u662f<code class=\"command\">\\lo_list</code>\u7684\u522b\u540d\uff0c\u7528\u4e8e\u663e\u793a\u5927\u5bf9\u8c61\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dL[S+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8fc7\u7a0b\u8bed\u8a00\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bed\u8a00\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u8bed\u8a00\uff1b\u63d0\u4f9b <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u79cd\u8bed\u8a00\u90fd\u4f1a\u8fde\u540c\u5176\u8c03\u7528\u5904\u7406\u5668\u3001\u9a8c\u8bc1\u5668\u3001\u8bbf\u95ee\u6743\u9650\u4ee5\u53ca\u5b83\u662f\u5426\u4e3a\u7cfb\u7edf\u5bf9\u8c61\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dn[S+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6a21\u5f0f\uff08\u547d\u540d\u7a7a\u95f4\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6a21\u5f0f\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u6743\u9650\u548c\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\do[S+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> [ <em class=\"replaceable\"><code>arg_pattern</code></em> [ <em class=\"replaceable\"><code>arg_pattern</code></em> ] ] ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u64cd\u4f5c\u7b26\u53ca\u5176\u64cd\u4f5c\u6570\u7c7b\u578b\u548c\u7ed3\u679c\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u64cd\u4f5c\u7b26\u3002\u5982\u679c\u6307\u5b9a\u4e86\u4e00\u4e2a <em class=\"replaceable\"><code>arg_pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u5176\u53f3\u53c2\u6570\u7c7b\u578b\u540d\u79f0\u4e0e\u8be5\u6a21\u5f0f\u5339\u914d\u7684\u524d\u7f00\u64cd\u4f5c\u7b26\u3002\u5982\u679c\u6307\u5b9a\u4e86\u4e24\u4e2a <em class=\"replaceable\"><code>arg_pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u53c2\u6570\u7c7b\u578b\u540d\u79f0\u4e0e\u8fd9\u4e9b\u6a21\u5f0f\u5339\u914d\u7684\u4e8c\u5143\u64cd\u4f5c\u7b26\u3002\uff08\u5bf9\u4e8e\u4e00\u5143\u64cd\u4f5c\u7b26\u672a\u4f7f\u7528\u7684\u53c2\u6570\uff0c\u4e5f\u53ef\u4ee5\u5199\u6210 <code class=\"literal\">-</code>\u3002\uff09\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u76ee\u524d\u4ec5\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dO[S+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6392\u5e8f\u89c4\u5219\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6392\u5e8f\u89c4\u5219\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u6392\u5e8f\u89c4\u5219\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u4e00\u8d77\u5217\u51fa\u3002\u8bf7\u6ce8\u610f\uff0c\u53ea\u4f1a\u663e\u793a\u4e0e\u5f53\u524d\u6570\u636e\u5e93\u7f16\u7801\u517c\u5bb9\u7684\u6392\u5e8f\u89c4\u5219\uff0c\u56e0\u6b64\u5728\u540c\u4e00\u5b89\u88c5\u4e2d\u7684\u4e0d\u540c\u6570\u636e\u5e93\u91cc\u7ed3\u679c\u53ef\u80fd\u4e0d\u540c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dp [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u53ca\u5176\u76f8\u5173\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u3002</p>\n<p lang=\"zh\"><a class=\"link\" href=\"/docs/14/sql-grant.html\" title=\"GRANT\"><code class=\"command\">GRANT</code></a>\u548c <a class=\"link\" href=\"/docs/14/sql-revoke.html\" title=\"REVOKE\"><code class=\"command\">REVOKE</code></a> \u547d\u4ee4\u7528\u4e8e\u8bbe\u7f6e\u8bbf\u95ee\u6743\u9650\u3002\u6743\u9650\u663e\u793a\u7684\u542b\u4e49\u5728<a class=\"xref\" href=\"/docs/14/ddl-priv.html\" title=\"5.7.\u00a0\u6743\u9650\">\u7b2c\u00a05.7\u00a0\u8282</a>\u4e2d\u6709\u89e3\u91ca\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dP[itn+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5206\u533a\u5173\u7cfb\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6761\u76ee\u3002\u53ef\u4ee5\u5728\u547d\u4ee4\u540e\u9644\u52a0\u4fee\u9970\u7b26<code class=\"literal\">t</code>\uff08\u8868\uff09\u548c<code class=\"literal\">i</code>\uff08\u7d22\u5f15\uff09\uff0c\u7b5b\u9009\u8981\u5217\u51fa\u7684\u5173\u7cfb\u7c7b\u578b\u3002\u9ed8\u8ba4\u4f1a\u5217\u51fa\u5206\u533a\u8868\u548c\u5206\u533a\u7d22\u5f15\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528\u4e86\u4fee\u9970\u7b26<code class=\"literal\">n</code>\uff08<span class=\"quote\">\u201c<span class=\"quote\">nested</span>\u201d</span>\uff09\uff0c\u6216\u6307\u5b9a\u4e86\u6a21\u5f0f\uff0c\u5219\u4f1a\u5305\u542b\u975e\u6839\u5206\u533a\u5173\u7cfb\uff0c\u5e76\u663e\u793a\u4e00\u5217\uff0c\u5217\u51fa\u6bcf\u4e2a\u5206\u533a\u5173\u7cfb\u7684\u7236\u5173\u7cfb\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u5173\u7cfb\u7684\u5404\u4e2a\u5206\u533a\u7684\u5927\u5c0f\u4e4b\u548c\uff0c\u4ee5\u53ca\u8be5\u5173\u7cfb\u7684\u63cf\u8ff0\u3002\u5982\u679c\u5c06<code class=\"literal\">n</code>\u4e0e<code class=\"literal\">+</code>\u7ed3\u5408\u4f7f\u7528\uff0c\u5219\u663e\u793a\u4e24\u4e2a\u5927\u5c0f\uff1a\u4e00\u4e2a\u662f\u76f4\u63a5\u9644\u52a0\u7684\u53f6\u5b50\u5206\u533a\u7684\u603b\u5927\u5c0f\uff0c\u53e6\u4e00\u4e2a\u662f\u6240\u6709\u5206\u533a\u7684\u603b\u5927\u5c0f\uff0c\u5305\u62ec\u95f4\u63a5\u9644\u52a0\u7684\u5b50\u5206\u533a\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\drds [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>role-pattern</code></em></a> [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>database-pattern</code></em></a> ] ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5df2\u5b9a\u4e49\u7684\u914d\u7f6e\u8bbe\u7f6e\u3002\u8fd9\u4e9b\u8bbe\u7f6e\u53ef\u4ee5\u7279\u5b9a\u4e8e\u89d2\u8272\u3001\u7279\u5b9a\u4e8e\u6570\u636e\u5e93\uff0c\u6216\u540c\u65f6\u7279\u5b9a\u4e8e\u4e24\u8005\u3002<em class=\"replaceable\"><code>role-pattern</code></em>\u548c<em class=\"replaceable\"><code>database-pattern</code></em>\u5206\u522b\u7528\u4e8e\u9009\u62e9\u8981\u5217\u51fa\u7684\u89d2\u8272\u548c\u6570\u636e\u5e93\u3002\u7701\u7565\u67d0\u4e2a\u6a21\u5f0f\u53c2\u6570\u6216\u5c06\u5176\u6307\u5b9a\u4e3a<code class=\"literal\">*</code>\u65f6\uff0c\u4e0d\u4f1a\u6309\u8be5\u53c2\u6570\u7b5b\u9009\uff0c\u8fd8\u4f1a\u5206\u522b\u5305\u542b\u4e0d\u7279\u5b9a\u4e8e\u89d2\u8272\u6216\u4e0d\u7279\u5b9a\u4e8e\u6570\u636e\u5e93\u7684\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\"><a class=\"link\" href=\"/docs/14/sql-alterrole.html\" title=\"ALTER ROLE\"><code class=\"command\">ALTER ROLE</code></a>\u548c <a class=\"link\" href=\"/docs/14/sql-alterdatabase.html\" title=\"ALTER DATABASE\"><code class=\"command\">ALTER DATABASE</code></a> \u547d\u4ee4\u7528\u4e8e\u5b9a\u4e49\u6bcf\u4e2a\u89d2\u8272\u548c\u6bcf\u4e2a\u6570\u636e\u5e93\u7684\u914d\u7f6e\u8bbe\u7f6e\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dRp[+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u590d\u5236\u53d1\u5e03\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u53d1\u5e03\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u663e\u793a\u4e0e\u6bcf\u4e2a\u53d1\u5e03\u5173\u8054\u7684\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dRs[+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u903b\u8f91\u590d\u5236\u8ba2\u9605\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8ba2\u9605\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u8ba2\u9605\u7684\u5176\u4ed6\u5c5e\u6027\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dT[S+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u7c7b\u578b\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u7c7b\u578b\u90fd\u4f1a\u8fde\u540c\u5176\u5185\u90e8\u540d\u79f0\u3001\u5927\u5c0f\u4ee5\u53ca\u76f8\u5173\u6743\u9650\u4e00\u8d77\u5217\u51fa\uff1b\u5bf9\u4e8e <code class=\"type\">enum</code> \u7c7b\u578b\uff0c\u8fd8\u4f1a\u663e\u793a\u5176\u5141\u8bb8\u503c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\du[S+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u5e93\u89d2\u8272\u3002\uff08\u7531\u4e8e<span class=\"quote\">\u201c<span class=\"quote\">\u7528\u6237</span>\u201d</span>\u548c<span class=\"quote\">\u201c<span class=\"quote\">\u7ec4</span>\u201d</span>\u7684\u6982\u5ff5\u5df2\u7ecf\u7edf\u4e00\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">\u89d2\u8272</span>\u201d</span>\uff0c\u6b64\u547d\u4ee4\u73b0\u5728\u7b49\u4ef7\u4e8e<code class=\"literal\">\\dg</code>\u3002\uff09\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u89d2\u8272\uff1b\u63d0\u4f9b<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u89d2\u8272\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u89d2\u8272\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\du+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u89d2\u8272\u7684\u9644\u52a0\u4fe1\u606f\uff1b\u76ee\u524d\u4f1a\u589e\u52a0\u6bcf\u4e2a\u89d2\u8272\u7684\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dx[+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5df2\u5b89\u88c5\u7684\u6269\u5c55\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6269\u5c55\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dx+</code>\u5f62\u5f0f\uff0c\u5219\u5217\u51fa\u5c5e\u4e8e\u6bcf\u4e2a\u5339\u914d\u6269\u5c55\u7684\u6240\u6709\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dX [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u6269\u5c55\u7edf\u8ba1\u4fe1\u606f\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6269\u5c55\u7edf\u8ba1\u4fe1\u606f\u3002</p>\n<p lang=\"zh\">\u6bcf\u79cd\u6269\u5c55\u7edf\u8ba1\u7684\u72b6\u6001\u663e\u793a\u5728\u4ee5\u7edf\u8ba1\u79cd\u7c7b\u547d\u540d\u7684\u5217\u4e2d\uff0c\u4f8b\u5982 Ndistinct\u3002defined \u8868\u793a\u521b\u5efa\u7edf\u8ba1\u65f6\u8bf7\u6c42\u4e86\u8be5\u7edf\u8ba1\uff0cNULL \u8868\u793a\u672a\u8bf7\u6c42\u3002\u82e5\u8981\u5224\u65ad ANALYZE \u662f\u5426\u8fd0\u884c\u8fc7\u3001\u7edf\u8ba1\u662f\u5426\u53ef\u4f9b\u89c4\u5212\u5668\u4f7f\u7528\uff0c\u53ef\u67e5\u8be2 pg_stats_ext\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dy[+] [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u4e8b\u4ef6\u89e6\u53d1\u5668\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u4e8b\u4ef6\u89e6\u53d1\u5668\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\e</code> \u6216 <code class=\"literal\">\\edit</code> <code class=\"literal\">[ <span class=\"optional\"><em class=\"replaceable\"><code>filename</code></em></span> ] [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5219\u7f16\u8f91\u8be5\u6587\u4ef6\uff1b\u7f16\u8f91\u5668\u9000\u51fa\u540e\uff0c\u6587\u4ef6\u5185\u5bb9\u5c06\u88ab\u590d\u5236\u5230\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5219\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u590d\u5236\u5230\u4e34\u65f6\u6587\u4ef6\u4e2d\uff0c\u7136\u540e\u4ee5\u76f8\u540c\u65b9\u5f0f\u8fdb\u884c\u7f16\u8f91\u3002\u6216\u8005\uff0c\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u5c06\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u590d\u5236\u5230\u4e34\u65f6\u6587\u4ef6\u4e2d\uff0c\u5e76\u4ee5\u76f8\u540c\u65b9\u5f0f\u8fdb\u884c\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7f16\u8f91\u6587\u4ef6\u6216\u4e0a\u4e00\u4e2a\u67e5\u8be2\u540e\u5728\u672a\u4fee\u6539\u6587\u4ef6\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5219\u67e5\u8be2\u7f13\u51b2\u533a\u5c06\u88ab\u6e05\u9664\u3002\u5426\u5219\uff0c\u67e5\u8be2\u7f13\u51b2\u533a\u7684\u65b0\u5185\u5bb9\u5c06\u6839\u636e<span class=\"application\">psql</span>\u7684\u6b63\u5e38\u89c4\u5219\u91cd\u65b0\u89e3\u6790\uff0c\u5c06\u6574\u4e2a\u7f13\u51b2\u533a\u89c6\u4e3a\u5355\u884c\u3002\u4efb\u4f55\u5b8c\u6574\u7684\u67e5\u8be2\u5c06\u7acb\u5373\u6267\u884c\uff1b\u4e5f\u5c31\u662f\u8bf4\uff0c\u5982\u679c\u67e5\u8be2\u7f13\u51b2\u533a\u5305\u542b\u5206\u53f7\u6216\u4ee5\u5206\u53f7\u7ed3\u5c3e\uff0c\u5219\u6267\u884c\u5e76\u4ece\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u5220\u9664\u5230\u8be5\u70b9\u7684\u6240\u6709\u5185\u5bb9\u3002\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u5269\u4f59\u7684\u5185\u5bb9\u5c06\u91cd\u65b0\u663e\u793a\u3002\u8f93\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u8f93\u5165<code class=\"literal\">\\r</code>\u901a\u8fc7\u6e05\u9664\u67e5\u8be2\u7f13\u51b2\u533a\u6765\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u5c06\u7f13\u51b2\u533a\u89c6\u4e3a\u5355\u884c\u4e3b\u8981\u5f71\u54cd\u5143\u547d\u4ee4\uff1a\u5728\u5143\u547d\u4ee4\u540e\u7684\u7f13\u51b2\u533a\u5c06\u88ab\u89c6\u4e3a\u5143\u547d\u4ee4\u7684\u53c2\u6570\uff0c\u5373\u4f7f\u5b83\u8de8\u8d8a\u591a\u884c\u3002\uff08\u56e0\u6b64\uff0c\u4e0d\u80fd\u7528\u8fd9\u79cd\u65b9\u5f0f\u521b\u5efa\u4f7f\u7528\u5143\u547d\u4ee4\u7684\u811a\u672c\u3002\u8bf7\u4f7f\u7528<code class=\"command\">\\i</code>\u3002\uff09</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u5c06\u5149\u6807\u5b9a\u4f4d\u5728\u6587\u4ef6\u6216\u67e5\u8be2\u7f13\u51b2\u533a\u7684\u6307\u5b9a\u884c\u4e0a\u3002\u8bf7\u6ce8\u610f\uff0c\u5982\u679c\u53ea\u7ed9\u51fa\u4e00\u4e2a\u5168\u662f\u6570\u5b57\u7684\u53c2\u6570\uff0c<span class=\"application\">psql</span>\u4f1a\u5047\u5b9a\u5b83\u662f\u4e00\u4e2a\u884c\u53f7\uff0c\u800c\u4e0d\u662f\u6587\u4ef6\u540d\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5173\u4e8e\u5982\u4f55\u914d\u7f6e\u548c\u81ea\u5b9a\u4e49\u7f16\u8f91\u5668\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/14/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"\u73af\u5883\">\u73af\u5883</a>\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\echo <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6c42\u503c\u540e\u7684\u53c2\u6570\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff0c\u7528\u7a7a\u683c\u5206\u9694\uff0c\u5e76\u5728\u672b\u5c3e\u52a0\u4e0a\u6362\u884c\u7b26\u3002\u8fd9\u5bf9\u4e8e\u5728\u811a\u672c\u8f93\u51fa\u4e2d\u7a7f\u63d2\u4fe1\u606f\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>\\echo `date`</code></strong>\nTue Oct 26 21:40:57 CEST 1999\n</pre>\n<p lang=\"zh\">\u5982\u679c\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f\u672a\u52a0\u5f15\u53f7\u7684<code class=\"literal\">-n</code>\uff0c\u5219\u4e0d\u4f1a\u5199\u5165\u5c3e\u968f\u7684\u6362\u884c\u7b26\uff08\u4e5f\u4e0d\u4f1a\u5199\u5165\u7b2c\u4e00\u4e2a\u53c2\u6570\uff09\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528<code class=\"command\">\\o</code>\u547d\u4ee4\u91cd\u5b9a\u5411\u67e5\u8be2\u8f93\u51fa\uff0c\u53ef\u80fd\u4f1a\u60f3\u7528<code class=\"command\">\\qecho</code>\u4ee3\u66ff\u8fd9\u4e2a\u547d\u4ee4\u3002\u53e6\u8bf7\u53c2\u9605<code class=\"command\">\\warn</code>\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\ef [ <span class=\"optional\"><em class=\"replaceable\"><code>function_description</code></em> [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</span> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u7f16\u8f91\u6307\u5b9a\u51fd\u6570\u6216\u8fc7\u7a0b\u7684\u5b9a\u4e49\uff0c\u5f62\u5f0f\u4e3a<code class=\"command\">CREATE OR REPLACE FUNCTION</code>\u6216 <code class=\"command\">CREATE OR REPLACE PROCEDURE</code>\u547d\u4ee4\u3002\u7f16\u8f91\u65b9\u5f0f\u4e0e<code class=\"literal\">\\edit</code>\u76f8\u540c\u3002\u5982\u679c\u5728\u4e0d\u4fdd\u5b58\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5219\u8be5\u8bed\u53e5\u4f1a\u88ab\u4e22\u5f03\u3002\u5982\u679c\u4fdd\u5b58\u5e76\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5e76\u5728\u5176\u4e2d\u6dfb\u52a0\u4e86\u5206\u53f7\uff0c\u5219\u66f4\u65b0\u540e\u7684\u547d\u4ee4\u4f1a\u7acb\u5373\u6267\u884c\u3002\u5426\u5219\u5b83\u4f1a\u91cd\u65b0\u663e\u793a\uff1b\u952e\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u7528<code class=\"literal\">\\r</code>\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u76ee\u6807\u51fd\u6570\u53ef\u4ec5\u7528\u540d\u79f0\u6307\u5b9a\uff0c\u4e5f\u53ef\u7528\u540d\u79f0\u548c\u53c2\u6570\u6307\u5b9a\uff0c\u4f8b\u5982 foo(integer, text)\u3002\u82e5\u6709\u591a\u4e2a\u540c\u540d\u51fd\u6570\uff0c\u5219\u5fc5\u987b\u63d0\u4f9b\u53c2\u6570\u7c7b\u578b\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u51fd\u6570\uff0c\u5219\u4f1a\u5448\u73b0\u4e00\u4e2a\u7a7a\u7684<code class=\"command\">CREATE FUNCTION</code>\u6a21\u677f\u4f9b\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u5c06\u5149\u6807\u5b9a\u4f4d\u5728\u51fd\u6570\u4f53\u7684\u6307\u5b9a\u884c\u4e0a\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u51fd\u6570\u4f53\u901a\u5e38\u4e0d\u4f1a\u4ece\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u5f00\u59cb\u3002\uff09</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\ef</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5173\u4e8e\u5982\u4f55\u914d\u7f6e\u548c\u81ea\u5b9a\u4e49\u7f16\u8f91\u5668\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/14/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"\u73af\u5883\">\u73af\u5883</a>\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\encoding [ <em class=\"replaceable\"><code>encoding</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5ba2\u6237\u7aef\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u6ca1\u6709\u53c2\u6570\u65f6\uff0c\u6b64\u547d\u4ee4\u663e\u793a\u5f53\u524d\u7f16\u7801\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\errverbose</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ee5\u6700\u5927\u7684\u8be6\u7ec6\u7a0b\u5ea6\u91cd\u590d\u6700\u8fd1\u7684\u670d\u52a1\u5668\u9519\u8bef\u6d88\u606f\uff0c\u5c31\u597d\u50cf<code class=\"varname\">VERBOSITY</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">verbose</code>\uff0c<code class=\"varname\">SHOW_CONTEXT</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">always</code>\u4e00\u6837\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\ev [ <span class=\"optional\"><em class=\"replaceable\"><code>view_name</code></em> [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</span> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u7f16\u8f91\u6307\u5b9a\u89c6\u56fe\u7684\u5b9a\u4e49\uff0c\u5f62\u5f0f\u4e3a<code class=\"command\">CREATE OR REPLACE VIEW</code>\u547d\u4ee4\u3002\u7f16\u8f91\u65b9\u5f0f\u4e0e<code class=\"literal\">\\edit</code>\u76f8\u540c\u3002\u5982\u679c\u5728\u4e0d\u4fdd\u5b58\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5219\u8be5\u8bed\u53e5\u4f1a\u88ab\u4e22\u5f03\u3002\u5982\u679c\u4fdd\u5b58\u5e76\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5e76\u5728\u5176\u4e2d\u6dfb\u52a0\u4e86\u5206\u53f7\uff0c\u5219\u66f4\u65b0\u540e\u7684\u547d\u4ee4\u4f1a\u7acb\u5373\u6267\u884c\uff1b\u5426\u5219\u5c06\u91cd\u65b0\u663e\u793a\uff1b\u8f93\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u7528<code class=\"literal\">\\r</code>\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u89c6\u56fe\uff0c\u5219\u4f1a\u5448\u73b0\u4e00\u4e2a\u7a7a\u7684<code class=\"command\">CREATE VIEW</code>\u6a21\u677f\u4f9b\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u5c06\u5149\u6807\u5b9a\u4f4d\u5728\u89c6\u56fe\u5b9a\u4e49\u7684\u6307\u5b9a\u884c\u4e0a\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\ev</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\f [ <em class=\"replaceable\"><code>string</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u67e5\u8be2\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u9ed8\u8ba4\u503c\u662f\u7ad6\u7ebf\uff08<code class=\"literal\">|</code>\uff09\u3002\u5b83\u7b49\u540c\u4e8e<code class=\"command\">\\pset fieldsep</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\g [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\g [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u6267\u884c\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728<code class=\"literal\">\\g</code>\u540e\u9762\u51fa\u73b0\u62ec\u53f7\uff0c\u5219\u62ec\u53f7\u4e2d\u662f\u7528\u7a7a\u683c\u5206\u9694\u7684<em class=\"replaceable\"><code>option</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em>\u683c\u5f0f\u9009\u9879\u5b50\u53e5\u5217\u8868\u3002\u8fd9\u4e9b\u5b50\u53e5\u7684\u89e3\u91ca\u65b9\u5f0f\u4e0e<code class=\"literal\">\\pset</code> <em class=\"replaceable\"><code>option</code></em> <em class=\"replaceable\"><code>value</code></em>\u547d\u4ee4\u76f8\u540c\uff0c\u4f46\u4ec5\u5728\u6b64\u67e5\u8be2\u6267\u884c\u671f\u95f4\u751f\u6548\u3002\u5728\u6b64\u5217\u8868\u4e2d\uff0c<code class=\"literal\">=</code>\u7b26\u53f7\u5468\u56f4\u4e0d\u5141\u8bb8\u6709\u7a7a\u683c\uff0c\u4f46\u9009\u9879\u5b50\u53e5\u4e4b\u95f4\u5fc5\u987b\u6709\u7a7a\u683c\u3002\u5982\u679c<code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em>\u88ab\u7701\u7565\uff0c\u5219\u6307\u5b9a\u7684<em class=\"replaceable\"><code>option</code></em>\u4f1a\u6309\u4ee5\u4e0b\u547d\u4ee4\u7684\u65b9\u5f0f\u66f4\u6539\uff1a<code class=\"literal\">\\pset</code> <em class=\"replaceable\"><code>option</code></em>\uff0c\u5176\u4e2d\u4e0d\u663e\u5f0f\u6307\u5b9a<em class=\"replaceable\"><code>value</code></em>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7ed9\u51fa\u4e86<em class=\"replaceable\"><code>filename</code></em>\u6216<code class=\"literal\">|</code><em class=\"replaceable\"><code>command</code></em>\u53c2\u6570\uff0c\u67e5\u8be2\u8f93\u51fa\u5c31\u4f1a\u5199\u5165\u6307\u5b9a\u6587\u4ef6\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6307\u5b9a\u7684 shell \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u7167\u5e38\u663e\u793a\u3002\u53ea\u6709\u5f53\u67e5\u8be2\u6210\u529f\u8fd4\u56de\u96f6\u4e2a\u6216\u591a\u4e2a\u5143\u7ec4\u65f6\uff0c\u624d\u4f1a\u5411\u6587\u4ef6\u6216\u547d\u4ee4\u5199\u5165\uff1b\u5982\u679c\u67e5\u8be2\u5931\u8d25\uff0c\u6216\u6267\u884c\u7684\u662f\u4e0d\u8fd4\u56de\u6570\u636e\u7684 SQL \u547d\u4ee4\uff0c\u5219\u4e0d\u4f1a\u5199\u5165\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u5c06\u88ab\u91cd\u65b0\u6267\u884c\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u6ca1\u6709\u4efb\u4f55\u53c2\u6570\u7684<code class=\"literal\">\\g</code>\u57fa\u672c\u4e0a\u7b49\u540c\u4e8e\u4e00\u4e2a\u5206\u53f7\u3002\u5e26\u6709\u53c2\u6570\u7684<code class=\"literal\">\\g</code>\u63d0\u4f9b\u4e86\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u4e00\u6b21\u6027</span>\u201d</span>\u66ff\u4ee3<code class=\"command\">\\o</code>\u547d\u4ee4\u7684\u9009\u62e9\uff0c\u5e76\u4e14\u8fd8\u5141\u8bb8\u4e00\u6b21\u6027\u8c03\u6574\u901a\u5e38\u7531<code class=\"literal\">\\pset</code>\u8bbe\u7f6e\u7684\u8f93\u51fa\u683c\u5f0f\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u5f53\u6700\u540e\u4e00\u4e2a\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\u65f6\uff0c\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u90fd\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u65e2\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\uff0c\u4e5f\u4e0d\u8fdb\u884c\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u90e8\u5206\u4f1a\u76f4\u63a5\u6309\u5b57\u9762\u4f20\u7ed9 shell\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\gdesc</code></span></dt>\n<dd>\n<p lang=\"zh\">\u663e\u793a\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u67e5\u8be2\u7ed3\u679c\u7684\u63cf\u8ff0\uff08\u5373\u5217\u540d\u548c\u6570\u636e\u7c7b\u578b\uff09\u3002\u67e5\u8be2\u5e76\u4e0d\u4f1a\u5b9e\u9645\u6267\u884c\uff1b\u4e0d\u8fc7\uff0c\u5982\u679c\u5176\u4e2d\u5b58\u5728\u8bed\u6cd5\u9519\u8bef\uff0c\u4f1a\u6309\u901a\u5e38\u7684\u65b9\u5f0f\u62a5\u544a\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6539\u4e3a\u63cf\u8ff0\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\gexec</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u7136\u540e\u5c06\u67e5\u8be2\u8f93\u51fa\u7684\u6bcf\u884c\u6bcf\u5217\u89c6\u4e3a\u8981\u6267\u884c\u7684SQL\u8bed\u53e5\u3002\u4f8b\u5982\uff0c\u8981\u5728<code class=\"structname\">my_table</code>\u7684\u6bcf\u4e00\u5217\u4e0a\u521b\u5efa\u7d22\u5f15\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT format('create index on my_table(%I)', attname)</code></strong>\n-&gt; <strong class=\"userinput\"><code>FROM pg_attribute</code></strong>\n-&gt; <strong class=\"userinput\"><code>WHERE attrelid = 'my_table'::regclass AND attnum &gt; 0</code></strong>\n-&gt; <strong class=\"userinput\"><code>ORDER BY attnum</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gexec</code></strong>\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\n</pre>\n<p lang=\"zh\">\u751f\u6210\u7684\u67e5\u8be2\u6309\u8fd4\u56de\u884c\u7684\u987a\u5e8f\u6267\u884c\uff1b\u540c\u4e00\u884c\u6709\u591a\u5217\u65f6\u4ece\u5de6\u5230\u53f3\u6267\u884c\uff0c\u5ffd\u7565 NULL \u5b57\u6bb5\u3002\u67e5\u8be2\u539f\u6837\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u56e0\u6b64\u4e0d\u80fd\u662f psql \u5143\u547d\u4ee4\uff0c\u4e5f\u4e0d\u80fd\u5305\u542b psql \u53d8\u91cf\u5f15\u7528\u3002\u9664\u975e\u8bbe\u7f6e ON_ERROR_STOP\uff0c\u67d0\u6761\u67e5\u8be2\u5931\u8d25\u540e\u4ecd\u7ee7\u7eed\u6267\u884c\u5176\u4f59\u67e5\u8be2\u3002\u6bcf\u6761\u67e5\u8be2\u5747\u9075\u5faa ECHO \u8bbe\u7f6e\uff08\u4f7f\u7528 \\gexec \u65f6\uff0c\u901a\u5e38\u5efa\u8bae\u5c06 ECHO \u8bbe\u4e3a all \u6216 queries\uff09\uff0c\u67e5\u8be2\u65e5\u5fd7\u3001\u5355\u6b65\u6a21\u5f0f\u3001\u8ba1\u65f6\u7b49\u6267\u884c\u529f\u80fd\u4e5f\u5206\u522b\u5e94\u7528\u4e8e\u6bcf\u6761\u751f\u6210\u7684\u67e5\u8be2\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\gset [ <em class=\"replaceable\"><code>prefix</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u5e76\u5c06\u67e5\u8be2\u8f93\u51fa\u5b58\u5165 <span class=\"application\">psql</span> \u53d8\u91cf\uff08\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/14/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\uff09\u3002\u8981\u6267\u884c\u7684\u67e5\u8be2\u5fc5\u987b\u6070\u597d\u8fd4\u56de\u4e00\u884c\u3002\u8be5\u884c\u7684\u6bcf\u4e00\u5217\u5206\u522b\u5b58\u5165\u4e00\u4e2a\u53d8\u91cf\uff0c\u53d8\u91cf\u540d\u4e0e\u5217\u540d\u76f8\u540c\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT 'hello' AS var1, 10 AS var2</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gset</code></strong>\n=&gt; <strong class=\"userinput\"><code>\\echo :var1 :var2</code></strong>\nhello 10\n</pre>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>prefix</code></em>\uff0c\u5219\u4f1a\u5c06\u8be5\u5b57\u7b26\u4e32\u52a0\u5230\u67e5\u8be2\u7684\u5217\u540d\u524d\u9762\uff0c\u4ee5\u6784\u6210\u8981\u4f7f\u7528\u7684\u53d8\u91cf\u540d\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT 'hello' AS var1, 10 AS var2</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gset result_</code></strong>\n=&gt; <strong class=\"userinput\"><code>\\echo :result_var1 :result_var2</code></strong>\nhello 10\n</pre>\n<p lang=\"zh\">\u5982\u679c\u67d0\u4e00\u5217\u7684\u7ed3\u679c\u4e3a NULL\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u5bf9\u5e94\u7684\u53d8\u91cf\uff0c\u800c\u4e0d\u662f\u8bbe\u7f6e\u5b83\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u67e5\u8be2\u5931\u8d25\u6216\u6ca1\u6709\u6070\u597d\u8fd4\u56de\u4e00\u884c\uff0c\u5219\u4e0d\u4f1a\u66f4\u6539\u4efb\u4f55\u53d8\u91cf\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\gx [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\gx [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\\gx \u4e0e \\g \u7b49\u4ef7\uff0c\u4f46\u4f1a\u5f3a\u5236\u6b64\u67e5\u8be2\u4f7f\u7528\u6269\u5c55\u8f93\u51fa\u6a21\u5f0f\uff0c\u76f8\u5f53\u4e8e\u5728 \\pset \u9009\u9879\u5217\u8868\u4e2d\u6307\u5b9a expanded=on\u3002\u53e6\u89c1 \\x\u3002</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\h</code>\u6216<code class=\"literal\">\\help</code> <code class=\"literal\">[ <em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u7ed9\u51fa\u6307\u5b9a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u7684\u8bed\u6cd5\u5e2e\u52a9\u3002\u5982\u679c\u672a\u6307\u5b9a<em class=\"replaceable\"><code>command</code></em>\uff0c\u5219<span class=\"application\">psql</span>\u5c06\u5217\u51fa\u6240\u6709\u53ef\u7528\u8bed\u6cd5\u5e2e\u52a9\u7684\u547d\u4ee4\u3002\u5982\u679c<em class=\"replaceable\"><code>command</code></em>\u662f\u661f\u53f7\uff08<code class=\"literal\">*</code>\uff09\uff0c\u5219\u663e\u793a\u6240\u6709<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u7684\u8bed\u6cd5\u5e2e\u52a9\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\help</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u4e3a\u4e86\u7b80\u5316\u8f93\u5165\uff0c\u7531\u591a\u4e2a\u5355\u8bcd\u7ec4\u6210\u7684\u547d\u4ee4\u4e0d\u9700\u8981\u52a0\u5f15\u53f7\u3002\u56e0\u6b64\uff0c\u53ef\u4ee5\u76f4\u63a5\u8f93\u5165<strong class=\"userinput\"><code>\\help alter table</code></strong>\u3002</p>\n</div>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\H</code> \u6216 <code class=\"literal\">\\html</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5f00<acronym class=\"acronym\">HTML</acronym>\u67e5\u8be2\u8f93\u51fa\u683c\u5f0f\u3002\u5982\u679c<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u5df2\u7ecf\u6253\u5f00\uff0c\u5219\u5207\u6362\u56de\u9ed8\u8ba4\u7684\u5bf9\u9f50\u6587\u672c\u683c\u5f0f\u3002\u6b64\u547d\u4ee4\u662f\u4e3a\u517c\u5bb9\u6027\u548c\u4fbf\u5229\u6027\u800c\u4fdd\u7559\u7684\uff1b\u8bbe\u7f6e\u5176\u4ed6\u8f93\u51fa\u9009\u9879\u7684\u65b9\u6cd5\u89c1<code class=\"command\">\\pset</code>\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\i</code> \u6216 <code class=\"literal\">\\include</code> <em class=\"replaceable\"><code>filename</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u8bfb\u53d6\u8f93\u5165\uff0c\u5e76\u50cf\u5728\u952e\u76d8\u4e0a\u8f93\u5165\u4e00\u6837\u6267\u884c\u5b83\u3002</p>\n<p lang=\"zh\">\u5982\u679c<em class=\"replaceable\"><code>filename</code></em>\u662f<code class=\"literal\">-</code>\uff08\u8fde\u5b57\u7b26\uff09\uff0c\u5219\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\uff0c\u76f4\u5230\u9047\u5230 EOF \u6307\u793a\u6216<code class=\"command\">\\q</code>\u5143\u547d\u4ee4\u3002\u8fd9\u53ef\u7528\u4e8e\u5c06\u4ea4\u4e92\u5f0f\u8f93\u5165\u4e0e\u6587\u4ef6\u8f93\u5165\u4ea4\u9519\u4f7f\u7528\u3002\u8bf7\u6ce8\u610f\uff0c\u53ea\u6709\u5728\u6700\u5916\u5c42\u542f\u7528\u4e86 Readline\uff0c\u6b64\u5904\u624d\u4f1a\u4f7f\u7528 Readline \u529f\u80fd\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5982\u679c\u60f3\u5728\u5c4f\u5e55\u4e0a\u770b\u5230\u88ab\u8bfb\u5165\u7684\u5404\u884c\uff0c\u8bf7\u5c06\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">all</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"PSQL-METACOMMAND-IF\"><span class=\"term\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\elif</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\else</code><br/></span><span class=\"term\"><code class=\"literal\">\\endif</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u7ec4\u547d\u4ee4\u5b9e\u73b0\u4e86\u53ef\u5d4c\u5957\u7684\u6761\u4ef6\u5757\u3002\u6761\u4ef6\u5757\u5fc5\u987b\u4ee5<code class=\"command\">\\if</code>\u5f00\u59cb\uff0c\u5e76\u4ee5<code class=\"command\">\\endif</code>\u7ed3\u675f\u3002\u5728\u4e24\u8005\u4e4b\u95f4\u53ef\u4ee5\u6709\u4efb\u610f\u6570\u91cf\u7684<code class=\"command\">\\elif</code>\u5b50\u53e5\uff0c\u540e\u9762\u53ef\u4ee5\u9009\u62e9\u6027\u5730\u8ddf\u7740\u4e00\u4e2a<code class=\"command\">\\else</code>\u5b50\u53e5\u3002\u5728\u5f62\u6210\u6761\u4ef6\u5757\u7684\u547d\u4ee4\u4e4b\u95f4\u901a\u5e38\u4f1a\u51fa\u73b0\u666e\u901a\u67e5\u8be2\u548c\u5176\u4ed6\u7c7b\u578b\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\\if \u548c \\elif \u8bfb\u53d6\u53c2\u6570\u5e76\u5c06\u5176\u4f5c\u4e3a\u5e03\u5c14\u8868\u8fbe\u5f0f\u6c42\u503c\u3002\u7ed3\u679c\u4e3a\u771f\u65f6\u7ee7\u7eed\u6b63\u5e38\u5904\u7406\uff0c\u5426\u5219\u8df3\u8fc7\u540e\u7eed\u884c\uff0c\u76f4\u5230\u9047\u5230\u5339\u914d\u7684 \\elif\u3001\\else \u6216 \\endif\u3002\u67d0\u4e2a \\if \u6216 \\elif \u6761\u4ef6\u6210\u7acb\u540e\uff0c\u540c\u4e00\u5757\u4e2d\u540e\u7eed \\elif \u7684\u53c2\u6570\u4e0d\u518d\u6c42\u503c\uff0c\u76f4\u63a5\u89c6\u4e3a\u5047\u3002\u53ea\u6709\u4e4b\u524d\u5339\u914d\u7684 \\if \u548c \\elif \u5747\u672a\u6210\u7acb\uff0c\u624d\u5904\u7406 \\else \u540e\u7684\u884c\u3002</p>\n<p lang=\"zh\">\u4e0e\u5176\u4ed6\u53cd\u659c\u6760\u547d\u4ee4\u53c2\u6570\u4e00\u6837\uff0c\\if \u6216 \\elif \u7684\u8868\u8fbe\u5f0f\u53c2\u6570\u5148\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u548c\u53cd\u5f15\u53f7\u5c55\u5f00\uff0c\u7136\u540e\u50cf\u5f00\u5173\u9009\u9879\u53d8\u91cf\u4e00\u6837\u6c42\u503c\u3002\u6709\u6548\u503c\u4e3a true\u3001false\u30011\u30010\u3001on\u3001off\u3001yes\u3001no \u7684\u4efb\u610f\u65e0\u6b67\u4e49\u3001\u4e0d\u533a\u5206\u5927\u5c0f\u5199\u7684\u5339\u914d\u3002\u4f8b\u5982 t\u3001T \u548c tR \u90fd\u4f1a\u89c6\u4e3a\u771f\u3002</p>\n<p lang=\"zh\">\u4e0d\u80fd\u6b63\u786e\u6c42\u503c\u4e3a\u771f\u6216\u5047\u7684\u8868\u8fbe\u5f0f\u4f1a\u4ea7\u751f\u8b66\u544a\uff0c\u5e76\u88ab\u89c6\u4e3a\u5047\u3002</p>\n<p lang=\"zh\">\u88ab\u8df3\u8fc7\u7684\u884c\u4f1a\u88ab\u6b63\u5e38\u89e3\u6790\u4ee5\u8bc6\u522b\u67e5\u8be2\u548c\u53cd\u659c\u7ebf\u547d\u4ee4\uff0c\u4f46\u67e5\u8be2\u4e0d\u4f1a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u4e14\u9664\u4e86\u6761\u4ef6\u547d\u4ee4\uff08<code class=\"command\">\\if</code>\u3001<code class=\"command\">\\elif</code>\u3001<code class=\"command\">\\else</code>\u3001<code class=\"command\">\\endif</code>\uff09\u4e4b\u5916\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u4f1a\u88ab\u5ffd\u7565\u3002\u4ec5\u68c0\u67e5\u8df3\u8fc7\u884c\u4e2d\u6761\u4ef6\u547d\u4ee4\u7684\u6709\u6548\u5d4c\u5957\u3002\u8df3\u8fc7\u884c\u4e2d\u7684\u53d8\u91cf\u5f15\u7528\u4e0d\u4f1a\u88ab\u5c55\u5f00\uff0c\u4e5f\u4e0d\u4f1a\u6267\u884c\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<p lang=\"zh\">\u540c\u4e00\u4e2a\u6761\u4ef6\u5757\u7684\u6240\u6709\u53cd\u659c\u7ebf\u547d\u4ee4\u5fc5\u987b\u51fa\u73b0\u5728\u540c\u4e00\u4e2a\u6e90\u6587\u4ef6\u4e2d\u3002\u5982\u679c\u4e3b\u8f93\u5165\u6587\u4ef6\u6216\u901a\u8fc7<code class=\"command\">\\include</code>\u5f15\u5165\u7684\u6587\u4ef6\u5230\u8fbe EOF \u65f6\uff0c\u4ecd\u6709\u672c\u5730<code class=\"command\">\\if</code>\u5757\u672a\u5173\u95ed\uff0c<span class=\"application\">psql</span>\u5c31\u4f1a\u62a5\u9519\u3002</p>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4e00\u4e2a\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">-- check for the existence of two separate records in the database and store\n-- the results in separate psql variables\nSELECT\n    EXISTS(SELECT 1 FROM customer WHERE customer_id = 123) as is_customer,\n    EXISTS(SELECT 1 FROM employee WHERE employee_id = 456) as is_employee\n\\gset\n\\if :is_customer\n    SELECT * FROM customer WHERE customer_id = 123;\n\\elif :is_employee\n    \\echo 'is not a customer but is an employee'\n    SELECT * FROM employee WHERE employee_id = 456;\n\\else\n    \\if yes\n        \\echo 'not a customer or employee'\n    \\else\n        \\echo 'this will never print'\n    \\endif\n\\endif\n</pre>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\ir</code> \u6216 <code class=\"literal\">\\include_relative</code> <em class=\"replaceable\"><code>filename</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"literal\">\\ir</code>\u547d\u4ee4\u4e0e<code class=\"literal\">\\i</code>\u76f8\u4f3c\uff0c\u4f46\u89e3\u6790\u76f8\u5bf9\u6587\u4ef6\u540d\u7684\u65b9\u5f0f\u4e0d\u540c\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\u6267\u884c\u65f6\uff0c\u8fd9\u4e24\u4e2a\u547d\u4ee4\u7684\u884c\u4e3a\u76f8\u540c\u3002\u4e0d\u8fc7\uff0c\u5728\u811a\u672c\u4e2d\u8c03\u7528\u65f6\uff0c<code class=\"literal\">\\ir</code>\u4f1a\u76f8\u5bf9\u4e8e\u811a\u672c\u6240\u5728\u7684\u76ee\u5f55\u6765\u89e3\u91ca\u6587\u4ef6\u540d\uff0c\u800c\u4e0d\u662f\u76f8\u5bf9\u4e8e\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\l[+]</code>\u6216<code class=\"literal\">\\list[+] [ <a class=\"link\" href=\"/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"\u6a21\u5f0f\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u670d\u52a1\u5668\u4e2d\u7684\u6570\u636e\u5e93\uff0c\u5e76\u663e\u793a\u5176\u540d\u79f0\u3001\u6240\u6709\u8005\u3001\u5b57\u7b26\u96c6\u7f16\u7801\u548c\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6570\u636e\u5e93\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u8fd8\u4f1a\u663e\u793a\u6570\u636e\u5e93\u5927\u5c0f\u3001\u9ed8\u8ba4\u8868\u7a7a\u95f4\u548c\u63cf\u8ff0\u3002\u5f53\u524d\u7528\u6237\u5bf9\u5176\u62e5\u6709 <code class=\"literal\">CONNECT</code> \u6743\u9650\u7684\u6570\u636e\u5e93\u53ef\u4ee5\u663e\u793a\u5927\u5c0f\u4fe1\u606f\uff1b\u5982\u679c\u5f53\u524d\u7528\u6237\u662f\u8d85\u7ea7\u7528\u6237\u6216\u5177\u6709 <code class=\"literal\">pg_read_all_stats</code> \u89d2\u8272\u7684\u6743\u9650\uff0c\u4e5f\u53ef\u4ee5\u663e\u793a\u5927\u5c0f\u4fe1\u606f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\lo_export <em class=\"replaceable\"><code>loid</code></em> <em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6570\u636e\u5e93\u4e2d\u8bfb\u53d6\u5177\u6709<acronym class=\"acronym\">OID</acronym><em class=\"replaceable\"><code>loid</code></em>\u7684\u5927\u5bf9\u8c61\uff0c\u5e76\u5c06\u5176\u5199\u5165<em class=\"replaceable\"><code>filename</code></em>\u3002\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e0e\u670d\u52a1\u5668\u51fd\u6570 <code class=\"function\">lo_export</code>\u7565\u6709\u4e0d\u540c\uff0c\u540e\u8005\u4f7f\u7528\u8fd0\u884c\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7528\u6237\u7684\u6743\u9650\uff0c\u5e76\u5728\u670d\u52a1\u5668\u7684\u6587\u4ef6\u7cfb\u7edf\u4e0a\u64cd\u4f5c\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u4f7f\u7528 \\lo_list \u67e5\u627e\u5927\u5bf9\u8c61\u7684 OID\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\lo_import <em class=\"replaceable\"><code>filename</code></em> [ <em class=\"replaceable\"><code>comment</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6587\u4ef6\u5b58\u50a8\u5230\u4e00\u4e2a<span class=\"productname\">PostgreSQL</span>\u5927\u5bf9\u8c61\u4e2d\u3002\u53ef\u9009\u5730\uff0c\u5b83\u5c06\u7ed9\u5b9a\u7684\u6ce8\u91ca\u4e0e\u5bf9\u8c61\u5173\u8054\u8d77\u6765\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">foo=&gt; <strong class=\"userinput\"><code>\\lo_import '/home/peter/pictures/photo.xcf' 'a picture of me'</code></strong>\nlo_import 152801\n</pre>\n<p lang=\"zh\">\u54cd\u5e94\u8868\u660e\u5927\u5bf9\u8c61\u83b7\u5f97\u4e86\u5bf9\u8c61 ID 152801\uff0c\u8fd9\u4e2a ID \u53ef\u4ee5\u7528\u6765\u5728\u5c06\u6765\u8bbf\u95ee\u65b0\u521b\u5efa\u7684\u5927\u5bf9\u8c61\u3002\u4e3a\u4fbf\u4e8e\u9605\u8bfb\uff0c\u5efa\u8bae\u59cb\u7ec8\u4e3a\u6bcf\u4e2a\u5bf9\u8c61\u5173\u8054\u4e00\u6761\u4fbf\u4e8e\u4eba\u9605\u8bfb\u7684\u6ce8\u91ca\u3002\u67e5\u770b OID \u548c\u6ce8\u91ca\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528<code class=\"command\">\\lo_list</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u6b64\u547d\u4ee4\u4e0e\u670d\u52a1\u5668\u7aef\u7684<code class=\"function\">lo_import</code>\u7565\u6709\u4e0d\u540c\uff0c\u56e0\u4e3a\u5b83\u4f5c\u4e3a\u672c\u5730\u7528\u6237\u5728\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e0a\u64cd\u4f5c\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\u7684\u7528\u6237\u548c\u6587\u4ef6\u7cfb\u7edf\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\lo_list</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5f53\u524d\u5b58\u50a8\u5728\u6570\u636e\u5e93\u4e2d\u7684\u6240\u6709<span class=\"productname\">PostgreSQL</span>\u5927\u5bf9\u8c61\uff0c\u4ee5\u53ca\u4e3a\u5b83\u4eec\u63d0\u4f9b\u7684\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\lo_unlink <em class=\"replaceable\"><code>loid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6570\u636e\u5e93\u4e2d\u5220\u9664<acronym class=\"acronym\">OID</acronym> \u4e3a <em class=\"replaceable\"><code>loid</code></em>\u7684\u5927\u5bf9\u8c61\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u4f7f\u7528 \\lo_list \u67e5\u627e\u5927\u5bf9\u8c61\u7684 OID\u3002</p>\n</div>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\o</code> \u6216 <code class=\"literal\">\\out [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\o</code> \u6216 <code class=\"literal\">\\out [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u540e\u7eed\u67e5\u8be2\u7ed3\u679c\u4fdd\u5b58\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9 shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002\u5982\u679c\u6ca1\u6709\u6307\u5b9a\u53c2\u6570\uff0c\u67e5\u8be2\u8f93\u51fa\u5c06\u6062\u590d\u4e3a\u6807\u51c6\u8f93\u51fa\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\uff0c\u5219\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u7684\u5185\u5bb9\u53ea\u4f1a\u539f\u6837\u4f20\u9012\u7ed9 shell\u3002</p>\n<p lang=\"zh\"><span class=\"quote\">\u201c<span class=\"quote\">\u67e5\u8be2\u7ed3\u679c</span>\u201d</span>\u5305\u62ec\u4ece\u6570\u636e\u5e93\u670d\u52a1\u5668\u83b7\u53d6\u7684\u6240\u6709\u8868\u683c\u3001\u547d\u4ee4\u54cd\u5e94\u548c\u901a\u77e5\uff0c\u4ee5\u53ca\u67e5\u8be2\u6570\u636e\u5e93\u7684\u5404\u79cd\u53cd\u659c\u6760\u547d\u4ee4\u7684\u8f93\u51fa\uff08\u4f8b\u5982<code class=\"command\">\\d</code>\uff09\uff1b\u4f46\u4e0d\u5305\u62ec\u9519\u8bef\u6d88\u606f\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8981\u5728\u67e5\u8be2\u7ed3\u679c\u4e4b\u95f4\u63d2\u5165\u6587\u672c\u8f93\u51fa\uff0c\u4f7f\u7528<code class=\"command\">\\qecho</code>\u3002</p>\n</div>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\p</code>\u6216<code class=\"literal\">\\print</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\u3002\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6253\u5370\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\password [ <em class=\"replaceable\"><code>username</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u66f4\u6539\u6307\u5b9a\u7528\u6237\uff08\u9ed8\u8ba4\u4e3a\u5f53\u524d\u7528\u6237\uff09\u7684\u5bc6\u7801\u3002\u6b64\u547d\u4ee4\u63d0\u793a\u8f93\u5165\u65b0\u5bc6\u7801\uff0c\u5bf9\u5176\u8fdb\u884c\u52a0\u5bc6\uff0c\u5e76\u5c06\u5176\u4f5c\u4e3a<code class=\"command\">ALTER ROLE</code>\u547d\u4ee4\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u65b0\u5bc6\u7801\u4e0d\u4f1a\u4ee5\u660e\u6587\u5f62\u5f0f\u51fa\u73b0\u5728\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\u3001\u670d\u52a1\u5668\u65e5\u5fd7\u6216\u5176\u4ed6\u5730\u65b9\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\prompt [ <em class=\"replaceable\"><code>text</code></em> ] <em class=\"replaceable\"><code>name</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u63d0\u793a\u7528\u6237\u63d0\u4f9b\u6587\u672c\uff0c\u5c06\u5176\u8d4b\u503c\u7ed9\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u3002\u53ef\u4ee5\u6307\u5b9a\u4e00\u4e2a\u53ef\u9009\u7684\u63d0\u793a\u5b57\u7b26\u4e32<em class=\"replaceable\"><code>text</code></em>\u3002\uff08\u5bf9\u4e8e\u591a\u4e2a\u5355\u8bcd\u7684\u63d0\u793a\uff0c\u7528\u5355\u5f15\u53f7\u62ec\u8d77\u6587\u672c\u3002\uff09</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"literal\">\\prompt</code> \u4f7f\u7528\u7ec8\u7aef\u8fdb\u884c\u8f93\u5165\u548c\u8f93\u51fa\u3002\u7136\u800c\uff0c\u5982\u679c\u4f7f\u7528\u4e86 <code class=\"option\">-f</code> \u547d\u4ee4\u884c\u5f00\u5173\uff0c<code class=\"literal\">\\prompt</code> \u5c06\u4f7f\u7528\u6807\u51c6\u8f93\u5165\u548c\u6807\u51c6\u8f93\u51fa\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\pset [ <em class=\"replaceable\"><code>option</code></em> [ <em class=\"replaceable\"><code>value</code></em> ] ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u8bbe\u7f6e\u5f71\u54cd\u67e5\u8be2\u7ed3\u679c\u8868\u8f93\u51fa\u7684\u9009\u9879\u3002<em class=\"replaceable\"><code>option</code></em>\u6307\u5b9a\u8981\u8bbe\u7f6e\u54ea\u4e2a\u9009\u9879\u3002<em class=\"replaceable\"><code>value</code></em>\u7684\u542b\u4e49\u53d6\u51b3\u4e8e\u6240\u9009\u7684\u9009\u9879\u3002\u5bf9\u4e8e\u67d0\u4e9b\u9009\u9879\uff0c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\u4f1a\u5207\u6362\u6216\u53d6\u6d88\u8bbe\u7f6e\u8be5\u9009\u9879\uff0c\u5177\u4f53\u89c1\u5404\u9009\u9879\u7684\u8bf4\u660e\u3002\u5982\u679c\u6ca1\u6709\u63d0\u53ca\u8fd9\u7c7b\u884c\u4e3a\uff0c\u90a3\u4e48\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\u53ea\u4f1a\u663e\u793a\u5f53\u524d\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\">\u4e0d\u5e26\u4efb\u4f55\u53c2\u6570\u7684<code class=\"command\">\\pset</code>\u4f1a\u663e\u793a\u6240\u6709\u6253\u5370\u9009\u9879\u7684\u5f53\u524d\u72b6\u6001\u3002</p>\n<p lang=\"zh\">\u53ef\u8c03\u6574\u7684\u6253\u5370\u9009\u9879\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">border</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><em class=\"replaceable\"><code>value</code></em>\u5fc5\u987b\u662f\u6570\u5b57\u3002\u4e00\u822c\u6765\u8bf4\uff0c\u6570\u5b57\u8d8a\u5927\uff0c\u8868\u683c\u7684\u8fb9\u6846\u548c\u5206\u9694\u7ebf\u5c31\u8d8a\u591a\uff0c\u4f46\u7ec6\u8282\u53d6\u51b3\u4e8e\u5177\u4f53\u683c\u5f0f\u3002\u5728<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u4e2d\uff0c\u5b83\u4f1a\u76f4\u63a5\u8f6c\u6362\u4e3a<code class=\"literal\">border=...</code>\u5c5e\u6027\u3002\u5728\u5927\u591a\u6570\u5176\u4ed6\u683c\u5f0f\u4e2d\uff0c\u53ea\u6709\u503c 0\uff08\u65e0\u8fb9\u6846\uff09\u30011\uff08\u5185\u90e8\u5206\u9694\u7ebf\uff09\u548c 2\uff08\u8868\u683c\u5916\u6846\uff09\u6709\u610f\u4e49\uff0c\u5927\u4e8e 2 \u7684\u503c\u4f1a\u4e0e<code class=\"literal\">border = 2</code>\u4f5c\u76f8\u540c\u5904\u7406\u3002<code class=\"literal\">latex</code>\u548c<code class=\"literal\">latex-longtable</code>\u683c\u5f0f\u8fd8\u5141\u8bb8\u4f7f\u7528\u503c 3\uff0c\u4ee5\u5728\u6570\u636e\u884c\u4e4b\u95f4\u6dfb\u52a0\u5206\u9694\u7ebf\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><em>\u5217</em></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u76ee\u6807\u5bbd\u5ea6\uff0c\u540c\u65f6\u4e5f\u662f\u786e\u5b9a\u8f93\u51fa\u662f\u5426\u8db3\u591f\u5bbd\u4ee5\u9700\u8981\u5206\u9875\u5668\u6216\u5728\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e0b\u5207\u6362\u5230\u5782\u76f4\u663e\u793a\u7684\u5bbd\u5ea6\u9650\u5236\u3002\u96f6\uff08\u9ed8\u8ba4\u503c\uff09\u4f1a\u5bfc\u81f4\u76ee\u6807\u5bbd\u5ea6\u7531\u73af\u5883\u53d8\u91cf<code class=\"envar\">COLUMNS</code>\u63a7\u5236\uff0c\u6216\u8005\u5982\u679c\u672a\u8bbe\u7f6e <code class=\"envar\">COLUMNS</code>\u5219\u7531\u68c0\u6d4b\u5230\u7684\u5c4f\u5e55\u5bbd\u5ea6\u63a7\u5236\u3002\u53e6\u5916\uff0c\u5982\u679c<code class=\"literal\">columns</code>\u4e3a\u96f6\uff0c\u5219<code class=\"literal\">wrapped</code>\u683c\u5f0f\u4ec5\u5f71\u54cd\u5c4f\u5e55\u8f93\u51fa\u3002\u5982\u679c<code class=\"literal\">columns</code>\u4e3a\u975e\u96f6\uff0c\u5219\u6587\u4ef6\u548c\u7ba1\u9053\u8f93\u51fa\u4e5f\u4f1a\u6309\u8be5\u5bbd\u5ea6\u6298\u884c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">csv_fieldsep</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728<acronym class=\"acronym\">CSV</acronym>\u8f93\u51fa\u683c\u5f0f\u4e2d\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u5982\u679c\u5206\u9694\u7b26\u5b57\u7b26\u51fa\u73b0\u5728\u5b57\u6bb5\u7684\u503c\u4e2d\uff0c\u5219\u8be5\u5b57\u6bb5\u5c06\u6839\u636e\u6807\u51c6<acronym class=\"acronym\">CSV</acronym>\u89c4\u5219\u5728\u53cc\u5f15\u53f7\u5185\u8f93\u51fa\u3002\u9ed8\u8ba4\u503c\u662f\u9017\u53f7\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">expanded</code>\uff08\u6216<code class=\"literal\">x</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff08\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u6269\u5c55\u6a21\u5f0f\uff09\uff0c\u6216\u8005\u662f<code class=\"literal\">auto</code>\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5f00\u542f\u548c\u5173\u95ed\u8bbe\u7f6e\u4e4b\u95f4\u5207\u6362\u3002\u542f\u7528\u6269\u5c55\u6a21\u5f0f\u65f6\uff0c\u67e5\u8be2\u7ed3\u679c\u4ee5\u4e24\u5217\u663e\u793a\uff0c\u5de6\u4fa7\u4e3a\u5217\u540d\uff0c\u53f3\u4fa7\u4e3a\u6570\u636e\u3002\u5982\u679c\u6570\u636e\u5728\u901a\u5e38\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u6a2a\u5411</span>\u201d</span>\u6a21\u5f0f\u4e0b\u65e0\u6cd5\u9002\u5e94\u5c4f\u5e55\uff0c\u8fd9\u79cd\u6a21\u5f0f\u5c31\u5f88\u6709\u7528\u3002\u5728\u81ea\u52a8\u8bbe\u7f6e\u4e0b\uff0c\u5f53\u67e5\u8be2\u8f93\u51fa\u5305\u542b\u591a\u5217\u4e14\u5bbd\u5ea6\u8d85\u8fc7\u5c4f\u5e55\u65f6\uff0c\u4f1a\u4f7f\u7528\u6269\u5c55\u6a21\u5f0f\uff1b\u5426\u5219\u4f7f\u7528\u5e38\u89c4\u6a21\u5f0f\u3002\u81ea\u52a8\u8bbe\u7f6e\u53ea\u5728\u5bf9\u9f50\u548c\u6298\u884c\u683c\u5f0f\u4e2d\u6709\u6548\u3002\u5728\u5176\u4ed6\u683c\u5f0f\u4e2d\uff0c\u5b83\u7684\u884c\u4e3a\u59cb\u7ec8\u4e0e\u5173\u95ed\u6269\u5c55\u6a21\u5f0f\u76f8\u540c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">fieldsep</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u6837\u53ef\u4ee5\u521b\u5efa\u4f8b\u5982\u5236\u8868\u7b26\u5206\u9694\u7684\u8f93\u51fa\uff0c\u8fd9\u53ef\u80fd\u66f4\u7b26\u5408\u5176\u4ed6\u7a0b\u5e8f\u7684\u9700\u8981\u3002\u8981\u5c06\u5236\u8868\u7b26\u8bbe\u7f6e\u4e3a\u5b57\u6bb5\u5206\u9694\u7b26\uff0c\u8bf7\u8f93\u5165<code class=\"literal\">\\pset fieldsep '\\t'</code>\u3002\u9ed8\u8ba4\u5b57\u6bb5\u5206\u9694\u7b26\u662f<code class=\"literal\">'|'</code>\uff08\u7ad6\u7ebf\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">fieldsep_zero</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u8bbe\u7f6e\u4e3a\u96f6\u5b57\u8282\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">footer</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u8868\u683c\u9875\u811a\uff08<code class=\"literal\">(<em class=\"replaceable\"><code>n</code></em> rows)</code>\u8ba1\u6570\uff09\u7684\u663e\u793a\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5207\u6362\u9875\u811a\u663e\u793a\u7684\u5f00\u5173\u72b6\u6001\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">format</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a<code class=\"literal\">aligned</code>\u3001<code class=\"literal\">asciidoc</code>\u3001<code class=\"literal\">csv</code>\u3001<code class=\"literal\">html</code>\u3001<code class=\"literal\">latex</code>\u3001<code class=\"literal\">latex-longtable</code>\u3001<code class=\"literal\">troff-ms</code>\u3001<code class=\"literal\">unaligned</code>\u6216<code class=\"literal\">wrapped</code>\u3002\u5141\u8bb8\u4f7f\u7528\u552f\u4e00\u7f29\u5199\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">aligned</code>\u683c\u5f0f\u662f\u6807\u51c6\u7684\u3001\u9002\u5408\u4eba\u9605\u8bfb\u4e14\u6392\u7248\u6574\u9f50\u7684\u6587\u672c\u8f93\u51fa\uff1b\u8fd9\u662f\u9ed8\u8ba4\u683c\u5f0f\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">unaligned</code>\u683c\u5f0f\u5c06\u4e00\u884c\u4e2d\u7684\u6240\u6709\u5217\u5199\u5728\u4e00\u884c\u4e0a\uff0c\u7531\u5f53\u524d\u6d3b\u52a8\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u5206\u9694\u3002\u8fd9\u5bf9\u4e8e\u521b\u5efa\u53ef\u80fd\u88ab\u5176\u4ed6\u7a0b\u5e8f\u8bfb\u53d6\u7684\u8f93\u51fa\u5f88\u6709\u7528\uff0c\u4f8b\u5982\uff0c\u5236\u8868\u7b26\u5206\u9694\u6216\u9017\u53f7\u5206\u9694\u683c\u5f0f\u3002\u7136\u800c\uff0c\u5982\u679c\u5b57\u6bb5\u5206\u9694\u7b26\u5b57\u7b26\u51fa\u73b0\u5728\u5217\u7684\u503c\u4e2d\uff0c\u5219\u4e0d\u4f1a\u88ab\u7279\u6b8a\u5904\u7406\uff1b\u56e0\u6b64\uff0c<acronym class=\"acronym\">CSV</acronym>\u683c\u5f0f\u53ef\u80fd\u66f4\u9002\u5408\u8fd9\u4e9b\u76ee\u7684\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">csv</code>\u683c\u5f0f<a class=\"indexterm\" id=\"id-1.9.4.20.8.4.10.1.74.2.3.1.8.2.4.2\" name=\"id-1.9.4.20.8.4.10.1.74.2.3.1.8.2.4.2\"></a>\u6309\u9017\u53f7\u5206\u9694\u7684\u5217\u503c\u8f93\u51fa\uff0c\u5e76\u5e94\u7528 <a class=\"ulink\" href=\"https://datatracker.ietf.org/doc/html/rfc4180\" target=\"_top\">RFC 4180</a> \u4e2d\u63cf\u8ff0\u7684\u52a0\u5f15\u53f7\u89c4\u5219\u3002\u6b64\u8f93\u51fa\u4e0e\u670d\u52a1\u5668\u7684CSV\u683c\u5f0f\u7684 <code class=\"command\">COPY</code>\u547d\u4ee4\u517c\u5bb9\u3002\u751f\u6210\u5305\u542b\u5217\u540d\u7684\u8868\u5934\u884c\uff0c\u9664\u975e <code class=\"literal\">tuples_only</code>\u53c2\u6570\u8bbe\u7f6e\u4e3a <code class=\"literal\">on</code>\u3002\u4e0d\u6253\u5370\u8868\u683c\u6807\u9898\u548c\u9875\u811a\u3002\u6bcf\u884c\u4ee5\u7cfb\u7edf\u76f8\u5173\u7684\u884c\u7ed3\u675f\u5b57\u7b26\u7ed3\u675f\uff0c\u5bf9\u4e8e\u7c7bUnix\u7cfb\u7edf\u901a\u5e38\u662f\u5355\u4e2a\u6362\u884c\u7b26\uff08<code class=\"literal\">\\n</code>\uff09\uff0c\u5bf9\u4e8eMicrosoft Windows\u5219\u662f\u56de\u8f66\u548c\u6362\u884c\u5e8f\u5217\uff08<code class=\"literal\">\\r\\n</code>\uff09\u3002\u53ef\u4ee5\u7528<code class=\"command\">\\pset csv_fieldsep</code>\u9009\u62e9\u9017\u53f7\u4ee5\u5916\u7684\u5b57\u6bb5\u5206\u9694\u5b57\u7b26\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">wrapped</code>\u683c\u5f0f\u4e0e<code class=\"literal\">aligned</code>\u76f8\u4f3c\uff0c\u4f46\u4f1a\u5c06\u8f83\u5bbd\u7684\u6570\u636e\u503c\u6298\u6210\u591a\u884c\uff0c\u4f7f\u8f93\u51fa\u9002\u5e94\u76ee\u6807\u5217\u5bbd\u3002\u76ee\u6807\u5bbd\u5ea6\u7684\u786e\u5b9a\u65b9\u5f0f\u89c1<code class=\"literal\">columns</code>\u9009\u9879\u7684\u8bf4\u660e\u3002\u8bf7\u6ce8\u610f\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u5c1d\u8bd5\u5bf9\u5217\u6807\u9898\u6298\u884c\uff1b\u56e0\u6b64\uff0c\u5982\u679c\u5217\u6807\u9898\u6240\u9700\u7684\u603b\u5bbd\u5ea6\u8d85\u8fc7\u76ee\u6807\u5bbd\u5ea6\uff0c<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u884c\u4e3a\u5c31\u4e0e<code class=\"literal\">aligned</code>\u76f8\u540c\u3002</p>\n<p lang=\"zh\">asciidoc\u3001html\u3001latex\u3001latex-longtable \u548c troff-ms \u683c\u5f0f\u8f93\u51fa\u7684\u662f\u53ef\u5d4c\u5165\u76f8\u5e94\u6807\u8bb0\u8bed\u8a00\u6587\u6863\u7684\u8868\u683c\uff0c\u5e76\u975e\u5b8c\u6574\u6587\u6863\u3002HTML \u53ef\u80fd\u4e0d\u8981\u6c42\u5b8c\u6574\u5c01\u88c5\uff0c\u4f46 LaTeX \u5fc5\u987b\u6709\u5b8c\u6574\u6587\u6863\u7ed3\u6784\u3002latex \u4f7f\u7528 LaTeX \u7684 tabular \u73af\u5883\uff1blatex-longtable \u9700\u8981 LaTeX \u7684 longtable \u548c booktabs \u5b8f\u5305\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">linestyle</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u8fb9\u6846\u7ebf\u7ed8\u5236\u6837\u5f0f\u4e3a<code class=\"literal\">ascii</code>\u3001<code class=\"literal\">old-ascii</code>\u6216<code class=\"literal\">unicode</code>\u4e4b\u4e00\u3002\u5141\u8bb8\u4f7f\u7528\u552f\u4e00\u7f29\u5199\u3002\uff08\u8fd9\u610f\u5473\u7740\u4e00\u4e2a\u5b57\u6bcd\u5c31\u8db3\u591f\u4e86\u3002\uff09\u9ed8\u8ba4\u8bbe\u7f6e\u4e3a<code class=\"literal\">ascii</code>\u3002\u6b64\u9009\u9879\u4ec5\u5f71\u54cd<code class=\"literal\">aligned</code>\u548c<code class=\"literal\">wrapped</code>\u8f93\u51fa\u683c\u5f0f\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">ascii</code>\u6837\u5f0f\u4f7f\u7528\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u53f3\u8fb9\u7f18\u7684<code class=\"literal\">+</code>\u7b26\u53f7\u8868\u793a\u3002\u5f53<code class=\"literal\">wrapped</code>\u683c\u5f0f\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u628a\u6570\u636e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u4f1a\u5728\u7b2c\u4e00\u884c\u7684\u53f3\u8fb9\u7f18\u663e\u793a\u4e00\u4e2a\u70b9\uff08<code class=\"literal\">.</code>\uff09\uff0c\u5e76\u5728\u4e0b\u4e00\u884c\u7684\u5de6\u8fb9\u7f18\u518d\u6b21\u663e\u793a\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">old-ascii</code>\u6837\u5f0f\u4f7f\u7528\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\uff0c\u91c7\u7528<span class=\"productname\">PostgreSQL</span> 8.4 \u53ca\u66f4\u65e9\u7248\u672c\u7684\u683c\u5f0f\u6837\u5f0f\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u66ff\u4ee3\u5de6\u4fa7\u5217\u5206\u9694\u7b26\u7684<code class=\"literal\">:</code>\u7b26\u53f7\u8868\u793a\u3002\u5f53\u6570\u636e\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u5219\u7528<code class=\"literal\">;</code>\u7b26\u53f7\u66ff\u4ee3\u5de6\u4fa7\u5217\u5206\u9694\u7b26\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">unicode</code>\u6837\u5f0f\u4f7f\u7528 Unicode \u6846\u7ebf\u7ed8\u5236\u5b57\u7b26\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u53f3\u8fb9\u7f18\u7684\u56de\u8f66\u7b26\u53f7\u8868\u793a\u3002\u5f53\u6570\u636e\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u4f1a\u5728\u7b2c\u4e00\u884c\u7684\u53f3\u8fb9\u7f18\u663e\u793a\u7701\u7565\u53f7\u7b26\u53f7\uff0c\u5e76\u5728\u4e0b\u4e00\u884c\u7684\u5de6\u8fb9\u7f18\u518d\u6b21\u663e\u793a\u3002</p>\n<p lang=\"zh\">\u5f53<code class=\"literal\">border</code>\u8bbe\u7f6e\u5927\u4e8e\u96f6\u65f6\uff0c<code class=\"literal\">linestyle</code>\u9009\u9879\u8fd8\u51b3\u5b9a\u7528\u54ea\u4e9b\u5b57\u7b26\u7ed8\u5236\u8fb9\u6846\u7ebf\u3002\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\u5728\u4efb\u4f55\u73af\u5883\u4e2d\u90fd\u53ef\u7528\uff0c\u4f46\u5728\u652f\u6301 Unicode \u7684\u663e\u793a\u8bbe\u5907\u4e0a\uff0cUnicode \u5b57\u7b26\u66f4\u7f8e\u89c2\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">null</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u7528\u4e8e\u4ee3\u66ff\u7a7a\u503c\u6253\u5370\u7684\u5b57\u7b26\u4e32\u3002\u9ed8\u8ba4\u4e0d\u6253\u5370\u4efb\u4f55\u5185\u5bb9\uff0c\u8fd9\u5f88\u5bb9\u6613\u88ab\u8bef\u8ba4\u4e3a\u7a7a\u5b57\u7b26\u4e32\u3002\u4f8b\u5982\uff0c\u4f60\u53ef\u80fd\u66f4\u559c\u6b22\u4f7f\u7528<code class=\"literal\">\\pset null '(null)'</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">numericlocale</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u4f7f\u7528\u533a\u57df\u8bbe\u7f6e\u7279\u5b9a\u7684\u5b57\u7b26\u6765\u5206\u9694\u5c0f\u6570\u70b9\u5de6\u4fa7\u7684\u6570\u5b57\u7ec4\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5e38\u89c4\u6570\u5b57\u8f93\u51fa\u548c\u533a\u57df\u8bbe\u7f6e\u7279\u5b9a\u7684\u6570\u5b57\u8f93\u51fa\u4e4b\u95f4\u5207\u6362\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">pager</code></span></dt>\n<dd>\n<p lang=\"zh\">\u63a7\u5236\u67e5\u8be2\u548c<span class=\"application\">psql</span>\u5e2e\u52a9\u8f93\u51fa\u662f\u5426\u4f7f\u7528\u5206\u9875\u5668\u7a0b\u5e8f\u3002\u5982\u679c\u8bbe\u7f6e\u4e86\u73af\u5883\u53d8\u91cf<code class=\"envar\">PSQL_PAGER</code>\u6216<code class=\"envar\">PAGER</code>\uff0c\u8f93\u51fa\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u9012\u7ed9\u6307\u5b9a\u7684\u7a0b\u5e8f\u3002\u5426\u5219\uff0c\u4f7f\u7528\u4e0e\u5e73\u53f0\u6709\u5173\u7684\u9ed8\u8ba4\u7a0b\u5e8f\uff08\u5982<code class=\"filename\">more</code>\uff09\u3002</p>\n<p lang=\"zh\">\u5f53 pager \u4e3a off \u65f6\uff0c\u4e0d\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\uff1b\u4e3a on \u65f6\uff0c\u5728\u9002\u5f53\u60c5\u51b5\u4e0b\u4f7f\u7528\uff0c\u5373\u8f93\u51fa\u76ee\u6807\u662f\u7ec8\u7aef\u4e14\u5185\u5bb9\u65e0\u6cd5\u5728\u5c4f\u5e55\u5185\u663e\u793a\u5b8c\u3002\u8bbe\u4e3a always \u65f6\uff0c\u6240\u6709\u7ec8\u7aef\u8f93\u51fa\u5747\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\uff0c\u65e0\u8bba\u662f\u5426\u80fd\u5728\u5c4f\u5e55\u5185\u663e\u793a\u5b8c\u3002\u4e0d\u5e26\u503c\u7684 \\pset pager \u4f1a\u5207\u6362\u5206\u9875\u7684\u5f00\u5173\u72b6\u6001\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">pager_min_lines</code></span></dt>\n<dd>\n<p lang=\"zh\">\u82e5 pager_min_lines \u5927\u4e8e\u5c4f\u5e55\u9875\u9ad8\uff0c\u53ea\u6709\u8f93\u51fa\u884c\u6570\u8fbe\u5230\u8be5\u503c\u65f6\u624d\u8c03\u7528\u5206\u9875\u7a0b\u5e8f\u3002\u9ed8\u8ba4\u503c\u4e3a 0\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">recordsep</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u8bb0\u5f55\uff08\u884c\uff09\u5206\u9694\u7b26\u3002\u9ed8\u8ba4\u4e3a\u6362\u884c\u7b26\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">recordsep_zero</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u8bbe\u7f6e\u4e3a\u96f6\u5b57\u8282\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">tableattr</code>\uff08\u6216<code class=\"literal\">T</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\u5728<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u4e2d\uff0c\u8fd9\u6307\u5b9a\u8981\u653e\u5728<code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u5c5e\u6027\uff0c\u4f8b\u5982<code class=\"literal\">cellpadding</code>\u6216<code class=\"literal\">bgcolor</code>\u3002\u8bf7\u6ce8\u610f\uff0c\u4f60\u53ef\u80fd\u4e0d\u9700\u8981\u5728\u8fd9\u91cc\u6307\u5b9a<code class=\"literal\">border</code>\uff0c\u56e0\u4e3a<code class=\"literal\">\\pset border</code>\u5df2\u7ecf\u8d1f\u8d23\u5904\u7406\u5b83\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u8868\u683c\u5c5e\u6027\u3002</p>\n<p lang=\"zh\">\u5728<code class=\"literal\">latex-longtable</code>\u683c\u5f0f\u4e2d\uff0c\u8fd9\u63a7\u5236\u6bcf\u4e2a\u5305\u542b\u5de6\u5bf9\u9f50\u6570\u636e\u7c7b\u578b\u7684\u5217\u7684\u5bbd\u5ea6\u6bd4\u4f8b\u3002\u5b83\u4ee5\u7a7a\u767d\u5206\u9694\u7684\u503c\u5217\u8868\u6307\u5b9a\uff0c\u4f8b\u5982<code class=\"literal\">'0.2 0.2 0.6'</code>\u3002\u672a\u6307\u5b9a\u7684\u8f93\u51fa\u5217\u4f7f\u7528\u6700\u540e\u6307\u5b9a\u7684\u503c\u3002</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">title</code>\uff08\u6216<code class=\"literal\">C</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u968f\u540e\u6253\u5370\u7684\u6240\u6709\u8868\u683c\u7684\u6807\u9898\u3002\u8fd9\u53ef\u4ee5\u4e3a\u8f93\u51fa\u63d0\u4f9b\u63cf\u8ff0\u6027\u6807\u7b7e\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u6807\u9898\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">tuples_only</code>\uff08\u6216<code class=\"literal\">t</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u4ec5\u5143\u7ec4\u6a21\u5f0f\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5e38\u89c4\u8f93\u51fa\u548c\u4ec5\u5143\u7ec4\u8f93\u51fa\u4e4b\u95f4\u5207\u6362\u3002\u5e38\u89c4\u8f93\u51fa\u5305\u542b\u5217\u6807\u9898\u3001\u8868\u683c\u6807\u9898\u548c\u5404\u79cd\u9875\u811a\u7b49\u9644\u52a0\u4fe1\u606f\u3002\u5728\u4ec5\u5143\u7ec4\u6a21\u5f0f\u4e0b\uff0c\u53ea\u663e\u793a\u5b9e\u9645\u7684\u8868\u683c\u6570\u636e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">unicode_border_linestyle</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u8fb9\u6846\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">unicode_column_linestyle</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u5217\u5206\u9694\u7ebf\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">unicode_header_linestyle</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u8868\u5934\u5206\u9694\u7ebf\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8fd9\u4e9b\u4e0d\u540c\u683c\u5f0f\u7684\u5916\u89c2\u793a\u4f8b\u53ef\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/14/app-psql.html#APP-PSQL-EXAMPLES\" title=\"\u793a\u4f8b\">\u793a\u4f8b</a>\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u6709\u5404\u79cd\u5feb\u6377\u547d\u4ee4\u7528\u4e8e<code class=\"command\">\\pset</code>\u3002\u8bf7\u53c2\u89c1<code class=\"command\">\\a</code>\u3001<code class=\"command\">\\C</code>\u3001<code class=\"command\">\\f</code>\u3001<code class=\"command\">\\H</code>\u3001<code class=\"command\">\\t</code>\u3001<code class=\"command\">\\T</code>\u548c<code class=\"command\">\\x</code>\u3002</p>\n</div>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\q</code>\u6216<code class=\"literal\">\\quit</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9000\u51fa<span class=\"application\">psql</span>\u7a0b\u5e8f\u3002\u5728\u811a\u672c\u6587\u4ef6\u4e2d\uff0c\u53ea\u4f1a\u7ec8\u6b62\u8be5\u811a\u672c\u7684\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\qecho <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u547d\u4ee4\u4e0e<code class=\"command\">\\echo</code>\u76f8\u540c\uff0c\u53ea\u662f\u8f93\u51fa\u4f1a\u5199\u5165\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u7684\u67e5\u8be2\u8f93\u51fa\u901a\u9053\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\r</code>\u6216<code class=\"literal\">\\reset</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u91cd\u7f6e\uff08\u6e05\u7a7a\uff09\u67e5\u8be2\u7f13\u51b2\u533a\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\restrict <em class=\"replaceable\"><code>restrict_key</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528\u7ed9\u5b9a\u7684\u5bc6\u94a5\u8fdb\u5165<span class=\"quote\">\u201c<span class=\"quote\">\u53d7\u9650</span>\u201d</span>\u6a21\u5f0f\u3002\u5728\u8be5\u6a21\u5f0f\u4e0b\uff0c\u552f\u4e00\u5141\u8bb8\u7684\u5143\u547d\u4ee4\u662f\u7528\u4e8e\u9000\u51fa\u53d7\u9650\u6a21\u5f0f\u7684<code class=\"command\">\\unrestrict</code>\u3002\u5bc6\u94a5\u53ea\u80fd\u5305\u542b\u5b57\u6bcd\u6570\u5b57\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4e3b\u8981\u7528\u4e8e pg_dump\u3001pg_dumpall \u548c pg_restore \u751f\u6210\u7684\u7eaf\u6587\u672c\u8f6c\u50a8\uff0c\u4e5f\u53ef\u80fd\u9002\u7528\u4e8e\u5176\u4ed6\u573a\u666f\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\s [ <em class=\"replaceable\"><code>filename</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u5386\u53f2\u8bb0\u5f55\u5230<em class=\"replaceable\"><code>filename</code></em>\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5386\u53f2\u8bb0\u5f55\u5c06\u88ab\u5199\u5165\u6807\u51c6\u8f93\u51fa\uff08\u5982\u679c\u9002\u7528\uff0c\u5c06\u4f7f\u7528\u5206\u9875\u5668\uff09\u3002\u5982\u679c<span class=\"application\">psql</span>\u5728\u6784\u5efa\u65f6\u6ca1\u6709\u4f7f\u7528<span class=\"application\">Readline</span>\u652f\u6301\uff0c\u5219\u6b64\u547d\u4ee4\u4e0d\u53ef\u7528\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\set [ <em class=\"replaceable\"><code>name</code></em> [ <em class=\"replaceable\"><code>value</code></em> [ ... ] ] ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e<span class=\"application\">psql</span>\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u4e3a<em class=\"replaceable\"><code>value</code></em>\uff0c\u5982\u679c\u7ed9\u51fa\u591a\u4e2a\u503c\uff0c\u5219\u8bbe\u7f6e\u4e3a\u6240\u6709\u503c\u7684\u8fde\u63a5\u3002\u5982\u679c\u53ea\u7ed9\u51fa\u4e00\u4e2a\u53c2\u6570\uff0c\u5219\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\u503c\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u8bbe\u7f6e\uff0c\u8bf7\u4f7f\u7528<code class=\"command\">\\unset</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\"><code class=\"command\">\\set</code>\u6ca1\u6709\u4efb\u4f55\u53c2\u6570\u65f6\uff0c\u663e\u793a\u5f53\u524d\u8bbe\u7f6e\u7684\u6240\u6709<span class=\"application\">psql</span>\u53d8\u91cf\u7684\u540d\u79f0\u548c\u503c\u3002</p>\n<p lang=\"zh\">\u6709\u6548\u7684\u53d8\u91cf\u540d\u53ef\u4ee5\u5305\u542b\u5b57\u6bcd\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u3002\u6709\u5173\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/14/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002\u53d8\u91cf\u540d\u533a\u5206\u5927\u5c0f\u5199\u3002</p>\n<p lang=\"zh\">\u67d0\u4e9b\u53d8\u91cf\u662f\u7279\u6b8a\u7684\uff0c\u5b83\u4eec\u63a7\u5236<span class=\"application\">psql</span>\u7684\u884c\u4e3a\u6216\u8005\u81ea\u52a8\u8bbe\u7f6e\u4ee5\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u3002\u8fd9\u4e9b\u53d8\u91cf\u5728\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/14/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u4e2d\u6709\u6587\u6863\u8bb0\u5f55\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u4e0e<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4<a class=\"link\" href=\"/docs/14/sql-set.html\" title=\"SET\"><code class=\"command\">SET</code></a>\u65e0\u5173\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\setenv <em class=\"replaceable\"><code>name</code></em> [ <em class=\"replaceable\"><code>value</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u4e3a<em class=\"replaceable\"><code>value</code></em>\uff0c\u6216\u8005\u5982\u679c\u672a\u63d0\u4f9b<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3002\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\setenv PAGER less</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>\\setenv LESS -imx4F</code></strong>\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\sf[+] <em class=\"replaceable\"><code>function_description</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u663e\u793a\u6307\u5b9a\u51fd\u6570\u6216\u8fc7\u7a0b\u7684\u5b9a\u4e49\uff0c\u4ee5<code class=\"command\">CREATE OR REPLACE FUNCTION</code>\u6216 <code class=\"command\">CREATE OR REPLACE PROCEDURE</code>\u547d\u4ee4\u7684\u5f62\u5f0f\u5448\u73b0\u3002\u5b9a\u4e49\u5c06\u6253\u5370\u5230\u5f53\u524d\u67e5\u8be2\u8f93\u51fa\u901a\u9053\uff0c\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\">\u76ee\u6807\u51fd\u6570\u53ef\u4ec5\u7528\u540d\u79f0\u6307\u5b9a\uff0c\u4e5f\u53ef\u7528\u540d\u79f0\u548c\u53c2\u6570\u6307\u5b9a\uff0c\u4f8b\u5982 foo(integer, text)\u3002\u82e5\u6709\u591a\u4e2a\u540c\u540d\u51fd\u6570\uff0c\u5219\u5fc5\u987b\u63d0\u4f9b\u53c2\u6570\u7c7b\u578b\u3002</p>\n<p lang=\"zh\">\u5728\u547d\u4ee4\u540d\u540e\u6dfb\u52a0 +\uff0c\u4f1a\u4e3a\u8f93\u51fa\u884c\u7f16\u53f7\uff0c\u51fd\u6570\u4f53\u7b2c\u4e00\u884c\u4e3a\u7b2c 1 \u884c\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\sf</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\sv[+] <em class=\"replaceable\"><code>view_name</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u6307\u5b9a\u89c6\u56fe\u7684\u5b9a\u4e49\uff0c\u5e76\u4ee5<code class=\"command\">CREATE OR REPLACE VIEW</code>\u547d\u4ee4\u7684\u5f62\u5f0f\u663e\u793a\u3002\u5b9a\u4e49\u4f1a\u6253\u5370\u5230\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u7684\u5f53\u524d\u67e5\u8be2\u8f93\u51fa\u901a\u9053\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u547d\u4ee4\u540d\u79f0\u540e\u6dfb\u52a0<code class=\"literal\">+</code>\uff0c\u90a3\u4e48\u8f93\u51fa\u884c\u5c06\u4ece1\u5f00\u59cb\u7f16\u53f7\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\sv</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\t</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u8f93\u51fa\u4e2d\u7684\u5217\u540d\u6807\u9898\u548c\u884c\u6570\u9875\u811a\u7684\u663e\u793a\u72b6\u6001\u3002\u8fd9\u4e2a\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset tuples_only</code>\uff0c\u63d0\u4f9b\u5b83\u662f\u4e3a\u4e86\u4f7f\u7528\u65b9\u4fbf\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\T <em class=\"replaceable\"><code>table_options</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728<acronym class=\"acronym\">HTML</acronym>\u8f93\u51fa\u683c\u5f0f\u4e2d\u653e\u5728<code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u5c5e\u6027\u3002\u8fd9\u4e2a\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset tableattr <em class=\"replaceable\"><code>table_options</code></em></code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\timing [ <em class=\"replaceable\"><code>on</code></em> | <em class=\"replaceable\"><code>off</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5e26\u53c2\u6570\u65f6\uff0c\u5f00\u542f\u6216\u5173\u95ed\u6bcf\u6761 SQL \u8bed\u53e5\u6267\u884c\u8017\u65f6\u7684\u663e\u793a\u3002\u4e0d\u5e26\u53c2\u6570\u65f6\uff0c\u5207\u6362\u663e\u793a\u7684\u5f00\u5173\u72b6\u6001\u3002\u8017\u65f6\u4ee5\u6beb\u79d2\u663e\u793a\uff1b\u8d85\u8fc7 1 \u79d2\u7684\u65f6\u95f4\u95f4\u9694\u8fd8\u4f1a\u4ee5\u5206\u949f:\u79d2\u7684\u683c\u5f0f\u663e\u793a\uff0c\u5fc5\u8981\u65f6\u6dfb\u52a0\u5c0f\u65f6\u548c\u5929\u5b57\u6bb5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\unrestrict <em class=\"replaceable\"><code>restrict_key</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u9000\u51fa<span class=\"quote\">\u201c<span class=\"quote\">\u53d7\u9650</span>\u201d</span>\u6a21\u5f0f\uff08\u5373\u6240\u6709\u5176\u4ed6\u5143\u547d\u4ee4\u90fd\u88ab\u963b\u6b62\u7684\u6a21\u5f0f\uff09\uff0c\u524d\u63d0\u662f\u6307\u5b9a\u7684\u5bc6\u94a5\u4e0e\u8fdb\u5165\u53d7\u9650\u6a21\u5f0f\u65f6\u4f20\u7ed9<code class=\"command\">\\restrict</code>\u7684\u5bc6\u94a5\u5339\u914d\u3002</p>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4e3b\u8981\u7528\u4e8e pg_dump\u3001pg_dumpall \u548c pg_restore \u751f\u6210\u7684\u7eaf\u6587\u672c\u8f6c\u50a8\uff0c\u4e5f\u53ef\u80fd\u9002\u7528\u4e8e\u5176\u4ed6\u573a\u666f\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u5269\u4f59\u884c\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\unrestrict</code>\u7684\u53c2\u6570\uff0c\u5e76\u4e14\u4e0d\u4f1a\u6267\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\unset <em class=\"replaceable\"><code>name</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u53d6\u6d88\u8bbe\u7f6e\uff08\u5220\u9664\uff09<span class=\"application\">psql</span>\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u3002</p>\n<p lang=\"zh\">\u5927\u591a\u6570\u63a7\u5236<span class=\"application\">psql</span>\u884c\u4e3a\u7684\u53d8\u91cf\u4e0d\u80fd\u53d6\u6d88\u8bbe\u7f6e\uff1b\u5bf9\u4e8e\u8fd9\u4e9b\u53d8\u91cf\uff0c<code class=\"literal\">\\unset</code>\u547d\u4ee4\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u5176\u8bbe\u7f6e\u4e3a\u9ed8\u8ba4\u503c\u3002\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/14/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\w</code> \u6216 <code class=\"literal\">\\write</code> <em class=\"replaceable\"><code>filename</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\w</code> \u6216 <code class=\"literal\">\\write</code> <code class=\"literal\">|</code><em class=\"replaceable\"><code>command</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u5199\u5165\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u9012\u7ed9 shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6539\u4e3a\u5199\u5165\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\uff0c\u5219\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u7684\u5185\u5bb9\u53ea\u4f1a\u539f\u6837\u4f20\u9012\u7ed9 shell\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\warn <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u547d\u4ee4\u4e0e<code class=\"command\">\\echo</code>\u547d\u4ee4\u76f8\u540c\uff0c\u53ea\u662f\u8f93\u51fa\u5c06\u88ab\u5199\u5165<span class=\"application\">psql</span>\u7684\u6807\u51c6\u9519\u8bef\u901a\u9053\uff0c\u800c\u4e0d\u662f\u6807\u51c6\u8f93\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\watch [ <em class=\"replaceable\"><code>seconds</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u91cd\u590d\u6267\u884c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\uff08\u5982\u540c <code class=\"literal\">\\g</code> \u4e00\u6837\uff09\uff0c\u76f4\u5230\u88ab\u4e2d\u65ad\u6216\u67e5\u8be2\u5931\u8d25\u3002\u4e24\u6b21\u6267\u884c\u4e4b\u95f4\u7b49\u5f85\u6307\u5b9a\u7684\u79d2\u6570\uff08\u9ed8\u8ba4 2 \u79d2\uff09\u3002\u6bcf\u6b21\u67e5\u8be2\u7ed3\u679c\u90fd\u4f1a\u5e26\u6709\u4e00\u4e2a\u5934\u90e8\uff0c\u5176\u4e2d\u5305\u542b <code class=\"literal\">\\pset title</code> \u5b57\u7b26\u4e32\uff08\u5982\u679c\u6709\uff09\u3001\u67e5\u8be2\u5f00\u59cb\u65f6\u7684\u65f6\u95f4\u4ee5\u53ca\u5ef6\u8fdf\u95f4\u9694\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\x [ <em class=\"replaceable\"><code>on</code></em> | <em class=\"replaceable\"><code>off</code></em> | <em class=\"replaceable\"><code>auto</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u6216\u5207\u6362\u6269\u5c55\u8868\u683c\u683c\u5f0f\u6a21\u5f0f\u3002\u5b83\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset expanded</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\z [ <a class=\"link\" href=\"https://pg.center/docs/14/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u53ca\u5176\u5173\u8054\u7684\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u3002</p>\n<p lang=\"zh\">\u8fd9\u662f<code class=\"command\">\\dp</code>\u7684\u522b\u540d\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u663e\u793a\u6743\u9650</span>\u201d</span>\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\! [ <em class=\"replaceable\"><code>command</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u5e26\u53c2\u6570\u65f6\uff0c\u8fdb\u5165\u4e00\u4e2a\u5b50 shell\uff1b\u5b50 shell \u9000\u51fa\u540e\uff0c<span class=\"application\">psql</span>\u6062\u590d\u8fd0\u884c\u3002\u5e26\u53c2\u6570\u65f6\uff0c\u6267\u884c shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\!</code>\u7684\u53c2\u6570\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u5185\u5bb9\u4f1a\u539f\u6837\u4f20\u7ed9 shell\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\? [ <em class=\"replaceable\"><code>topic</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5e2e\u52a9\u4fe1\u606f\u3002\u53ef\u9009\u7684<em class=\"replaceable\"><code>topic</code></em>\u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a<code class=\"literal\">commands</code>\uff09\u9009\u62e9\u8981\u89e3\u91ca\u7684<span class=\"application\">psql</span>\u7684\u54ea\u4e2a\u90e8\u5206\uff1a<code class=\"literal\">commands</code>\u63cf\u8ff0<span class=\"application\">psql</span>\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b<code class=\"literal\">options</code>\u63cf\u8ff0\u53ef\u4ee5\u4f20\u9012\u7ed9<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c<code class=\"literal\">variables</code>\u663e\u793a\u5173\u4e8e<span class=\"application\">psql</span>\u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\;</code></span></dt>\n<dd>\n<p lang=\"zh\">\u53cd\u659c\u7ebf\u52a0\u5206\u53f7\u5e76\u4e0d\u662f\u4e0e\u524d\u8ff0\u547d\u4ee4\u76f8\u540c\u7684\u5143\u547d\u4ee4\uff1b\u5b83\u53ea\u662f\u5c06\u4e00\u4e2a\u5206\u53f7\u6dfb\u52a0\u5230\u67e5\u8be2\u7f13\u51b2\u533a\uff0c\u800c\u4e0d\u8fdb\u884c\u4efb\u4f55\u8fdb\u4e00\u6b65\u5904\u7406\u3002</p>\n<p lang=\"zh\">\u901a\u5e38\uff0c<span class=\"application\">psql</span>\u4e00\u9047\u5230\u7ed3\u675f\u547d\u4ee4\u7684\u5206\u53f7\uff0c\u5c31\u4f1a\u5c06 SQL \u547d\u4ee4\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u5373\u4f7f\u5f53\u524d\u884c\u4ecd\u6709\u66f4\u591a\u8f93\u5165\u4e5f\u662f\u5982\u6b64\u3002\u4f8b\u5982\uff0c\u8f93\u5165</p>\n<pre class=\"programlisting\">select 1; select 2; select 3;\n</pre>\n<p lang=\"zh\">\u4f1a\u5c06\u8fd9\u4e09\u6761 SQL \u547d\u4ee4\u5206\u522b\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u6bcf\u6761\u547d\u4ee4\u7684\u7ed3\u679c\u4f1a\u5728\u7ee7\u7eed\u5904\u7406\u4e0b\u4e00\u6761\u547d\u4ee4\u4e4b\u524d\u663e\u793a\u3002\u4e0d\u8fc7\uff0c\u4ee5\u4ee5\u4e0b\u5f62\u5f0f\u8f93\u5165\u7684\u5206\u53f7\uff1a<code class=\"literal\">\\;</code>\uff0c\u4e0d\u4f1a\u89e6\u53d1\u547d\u4ee4\u5904\u7406\uff0c\u56e0\u6b64\u5b83\u524d\u540e\u7684\u547d\u4ee4\u5b9e\u9645\u4e0a\u4f1a\u5408\u5e76\u5230\u4e00\u4e2a\u8bf7\u6c42\u4e2d\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u3002\u4f8b\u5982\uff0c\u8f93\u5165</p>\n<pre class=\"programlisting\">select 1\\; select 2\\; select 3;\n</pre>\n<p lang=\"zh\">\u4f1a\u5728\u9047\u5230\u672a\u52a0\u53cd\u659c\u7ebf\u7684\u5206\u53f7\u65f6\uff0c\u5c06\u8fd9\u4e09\u6761 SQL \u547d\u4ee4\u4f5c\u4e3a\u4e00\u4e2a\u8bf7\u6c42\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u3002\u670d\u52a1\u5668\u4f1a\u5c06\u8fd9\u6837\u7684\u8bf7\u6c42\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff0c\u9664\u975e\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u663e\u5f0f\u7684<code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code>\u547d\u4ee4\uff0c\u5c06\u5176\u5212\u5206\u4e3a\u591a\u4e2a\u4e8b\u52a1\u3002\uff08\u6709\u5173\u670d\u52a1\u5668\u5982\u4f55\u5904\u7406\u591a\u67e5\u8be2\u5b57\u7b26\u4e32\u7684\u66f4\u591a\u7ec6\u8282\uff0c\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/14/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT\" title=\"53.2.2.1.\u00a0\u4e00\u4e2a\u7b80\u5355\u67e5\u8be2\u4e2d\u7684\u591a\u6761\u8bed\u53e5\">\u7b2c\u00a053.2.2.1\u00a0\u8282</a>\u3002\uff09<span class=\"application\">psql</span>\u5bf9\u6bcf\u4e2a\u8bf7\u6c42\u53ea\u6253\u5370\u6536\u5230\u7684\u6700\u540e\u4e00\u4e2a\u67e5\u8be2\u7ed3\u679c\uff1b\u5728\u8fd9\u4e2a\u793a\u4f8b\u4e2d\uff0c\u867d\u7136\u4e09\u6761<code class=\"command\">SELECT</code>\u547d\u4ee4\u786e\u5b9e\u90fd\u4f1a\u6267\u884c\uff0c\u4f46<span class=\"application\">psql</span>\u53ea\u6253\u5370<code class=\"literal\">3</code>\u3002</p>\n</dd>\n</dl>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-PATTERNS\">\n<h4 lang=\"zh\">\u6a21\u5f0f</h4>\n<p lang=\"zh\">\u5f88\u591a<code class=\"literal\">\\d</code>\u547d\u4ee4\u90fd\u53ef\u4ee5\u7528\u4e00\u4e2a<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\u6765\u6307\u5b9a\u8981\u88ab\u663e\u793a\u7684\u5bf9\u8c61\u540d\u79f0\u3002\u5728\u6700\u7b80\u5355\u7684\u60c5\u51b5\u4e0b\uff0c\u6a21\u5f0f\u6b63\u597d\u5c31\u662f\u8be5\u5bf9\u8c61\u7684\u51c6\u786e\u540d\u79f0\u3002\u5728\u6a21\u5f0f\u4e2d\u7684\u5b57\u7b26\u901a\u5e38\u4f1a\u88ab\u53d8\u6210\u5c0f\u5199\u5f62\u5f0f\uff08\u5c31\u50cf\u5728 SQL \u540d\u79f0\u4e2d\u90a3\u6837\uff09\uff0c\u4f8b\u5982<code class=\"literal\">\\dt FOO</code>\u5c06\u4f1a\u663e\u793a\u540d\u4e3a<code class=\"literal\">foo</code>\u7684\u8868\u3002\u5c31\u50cf\u5728 SQL \u540d\u79f0\u4e2d\u90a3\u6837\uff0c\u628a\u6a21\u5f0f\u653e\u5728\u53cc\u5f15\u53f7\u4e2d\u53ef\u4ee5\u963b\u6b62\u5b83\u88ab\u8f6c\u6362\u6210\u5c0f\u5199\u5f62\u5f0f\u3002\u5982\u679c\u9700\u8981\u5728\u4e00\u4e2a\u6a21\u5f0f\u4e2d\u5305\u62ec\u4e00\u4e2a\u771f\u6b63\u7684\u53cc\u5f15\u53f7\u5b57\u7b26\uff0c\u5219\u9700\u8981\u5728\u53cc\u5f15\u53f7\u5305\u56f4\u7684\u6587\u672c\u5185\u628a\u5b83\u5199\u6210\u4e24\u4e2a\u76f8\u90bb\u7684\u53cc\u5f15\u53f7\uff0c\u8fd9\u540c\u6837\u662f\u7b26\u5408 SQL \u52a0\u5f15\u53f7\u6807\u8bc6\u7b26\u7684\u89c4\u5219\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dt \"FOO\"\"BAR\"</code>\u5c06\u663e\u793a\u540d\u4e3a<code class=\"literal\">FOO\"BAR</code>\uff08\u4e0d\u662f<code class=\"literal\">foo\"bar</code>\uff09\u7684\u8868\u3002\u548c\u666e\u901a\u7684 SQL \u540d\u79f0\u89c4\u5219\u4e0d\u540c\uff0c\u4f60\u53ef\u4ee5\u53ea\u5728\u6a21\u5f0f\u7684\u4e00\u90e8\u5206\u5468\u56f4\u653e\u4e0a\u53cc\u5f15\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">\\dt FOO\"FOO\"BAR</code>\u5c06\u4f1a\u663e\u793a\u540d\u4e3a<code class=\"literal\">fooFOObar</code>\u7684\u8868\u3002</p>\n<p lang=\"zh\">\u53ea\u8981\u5b8c\u5168\u7701\u7565<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\uff0c<code class=\"literal\">\\d</code>\u547d\u4ee4\u5c31\u4f1a\u663e\u793a\u5f53\u524d\u6a21\u5f0f\u641c\u7d22\u8def\u5f84\u4e2d\u53ef\u89c1\u7684\u5168\u90e8\u5bf9\u8c61 \u2014 \u8fd9\u7b49\u4ef7\u4e8e\u7528<code class=\"literal\">*</code>\u4f5c\u4e3a\u6a21\u5f0f\uff08\u5982\u679c\u4e00\u4e2a\u5bf9\u8c61\u6240\u5728\u7684\u6a21\u5f0f\u4f4d\u4e8e\u641c\u7d22\u8def\u5f84\u4e2d\uff0c\u5e76\u4e14\u5728\u641c\u7d22\u8def\u5f84\u4e2d\u8be5\u6a21\u5f0f\u4e4b\u524d\u6ca1\u6709\u540c\u7c7b\u4e14\u540c\u540d\u7684\u5bf9\u8c61\uff0c\u5219\u8be5\u5bf9\u8c61\u5c31\u662f<em class=\"firstterm\">\u53ef\u89c1</em>\u7684\u3002\u8fd9\u8868\u793a\u53ef\u4ee5\u76f4\u63a5\u7528\u540d\u79f0\u5f15\u7528\u8be5\u5bf9\u8c61\uff0c\u800c\u4e0d\u9700\u8981\u7528\u6a21\u5f0f\u6765\u9650\u5b9a\uff09\u3002\u8981\u67e5\u770b\u6570\u636e\u5e93\u4e2d\u6240\u6709\u5bf9\u8c61\u800c\u4e0d\u8003\u8651\u5176\u53ef\u89c1\u6027\uff0c\u53ef\u4ee5\u628a<code class=\"literal\">*.*</code>\u7528\u4f5c\u6a21\u5f0f\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u653e\u5728\u4e00\u4e2a\u6a21\u5f0f\u4e2d\uff0c<code class=\"literal\">*</code>\u5c06\u5339\u914d\u4efb\u610f\u5b57\u7b26\u5e8f\u5217\uff08\u5305\u62ec\u7a7a\u5e8f\u5217\uff09\uff0c\u800c<code class=\"literal\">?</code>\u4f1a\u5339\u914d\u4efb\u610f\u7684\u5355\u4e2a\u5b57\u7b26\uff08\u8fd9\u79cd\u8bb0\u53f7\u65b9\u6cd5\u5c31\u50cf Unix shell \u7684\u6587\u4ef6\u540d\u6a21\u5f0f\u4e00\u6837\uff09\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dt int*</code>\u4f1a\u663e\u793a\u540d\u79f0\u4ee5<code class=\"literal\">int</code>\u5f00\u59cb\u7684\u8868\u3002\u4f46\u662f\u5982\u679c\u88ab\u653e\u5728\u53cc\u5f15\u53f7\u5185\uff0c<code class=\"literal\">*</code>\u548c<code class=\"literal\">?</code>\u5c31\u4f1a\u5931\u53bb\u8fd9\u4e9b\u7279\u6b8a\u542b\u4e49\u800c\u53d8\u6210\u666e\u901a\u7684\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u5305\u542b\u70b9\u53f7\uff08.\uff09\u7684\u5173\u7cfb\u540d\u6a21\u5f0f\u4f1a\u88ab\u89e3\u91ca\u4e3a\u6a21\u5f0f\u540d\u5339\u914d\u6a21\u5f0f\uff0c\u540e\u63a5\u5bf9\u8c61\u540d\u5339\u914d\u6a21\u5f0f\u3002\u4f8b\u5982\uff0c\\dt foo*.*bar* \u4f1a\u663e\u793a\u6240\u6709\u6a21\u5f0f\u540d\u4ee5 foo \u5f00\u5934\u3001\u8868\u540d\u5305\u542b bar \u7684\u8868\u3002\u6ca1\u6709\u70b9\u53f7\u65f6\uff0c\u53ea\u5339\u914d\u5f53\u524d\u6a21\u5f0f\u641c\u7d22\u8def\u5f84\u4e2d\u53ef\u89c1\u7684\u5bf9\u8c61\u3002\u540c\u6837\uff0c\u53cc\u5f15\u53f7\u5185\u7684\u70b9\u53f7\u4e0d\u5177\u6709\u7279\u6b8a\u542b\u4e49\uff0c\u6309\u5b57\u9762\u5339\u914d\u3002\u5305\u542b\u4e24\u4e2a\u70b9\u53f7\uff08.\uff09\u7684\u5173\u7cfb\u540d\u6a21\u5f0f\u4f1a\u88ab\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u540d\uff0c\u540e\u63a5\u6a21\u5f0f\u540d\u5339\u914d\u6a21\u5f0f\uff0c\u518d\u63a5\u5bf9\u8c61\u540d\u5339\u914d\u6a21\u5f0f\u3002\u6570\u636e\u5e93\u540d\u90e8\u5206\u4e0d\u4f5c\u4e3a\u5339\u914d\u6a21\u5f0f\uff0c\u5fc5\u987b\u4e0e\u5f53\u524d\u8fde\u63a5\u7684\u6570\u636e\u5e93\u540d\u79f0\u76f8\u540c\uff0c\u5426\u5219\u4f1a\u62a5\u9519\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7528\u4e8e\u5339\u914d\u6a21\u5f0f\u540d\u7684\u6a21\u5f0f\u5305\u542b\u4e00\u4e2a\u70b9\uff08<code class=\"literal\">.</code>\uff09\uff0c\u5219\u4f1a\u88ab\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u540d\uff0c\u540e\u63a5\u6a21\u5f0f\u540d\u7684\u5339\u914d\u6a21\u5f0f\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dn mydb.*foo*</code>\u4f1a\u663e\u793a\u540d\u79f0\u4e2d\u5305\u542b<code class=\"literal\">foo</code>\u7684\u6240\u6709\u6a21\u5f0f\u3002\u6570\u636e\u5e93\u540d\u90e8\u5206\u4e0d\u4f1a\u88ab\u5f53\u4f5c\u5339\u914d\u6a21\u5f0f\uff0c\u5fc5\u987b\u4e0e\u5f53\u524d\u8fde\u63a5\u7684\u6570\u636e\u5e93\u540d\u76f8\u540c\uff0c\u5426\u5219\u4f1a\u62a5\u9519\u3002</p>\n<p lang=\"zh\">\u9ad8\u7ea7\u7528\u6237\u53ef\u4ee5\u4f7f\u7528\u5b57\u7b26\u7c7b\u7b49\u6b63\u5219\u8868\u8fbe\u5f0f\u8bb0\u6cd5\uff0c\u5982<code class=\"literal\">[0-9]</code>\u53ef\u4ee5\u5339\u914d\u4efb\u610f\u6570\u5b57\u3002\u6240\u6709\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u90fd\u6309\u7167<a class=\"xref\" href=\"/docs/14/functions-matching.html#FUNCTIONS-POSIX-REGEXP\" title=\"9.7.3.\u00a0POSIX\u6b63\u5219\u8868\u8fbe\u5f0f\">\u7b2c\u00a09.7.3\u00a0\u8282</a>\u6240\u8bf4\u7684\u5de5\u4f5c\uff0c\u4ee5\u4e0b\u5b57\u7b26\u9664\u5916\uff1a<code class=\"literal\">.</code>\u4f1a\u6309\u7167\u4e0a\u9762\u6240\u8bf4\u7684\u4f5c\u4e3a\u4e00\u79cd\u5206\u9694\u7b26\uff0c<code class=\"literal\">*</code>\u4f1a\u88ab\u7ffb\u8bd1\u6210\u6b63\u5219\u8868\u8fbe\u5f0f\u8bb0\u53f7<code class=\"literal\">.*</code>\uff0c<code class=\"literal\">?</code>\u4f1a\u88ab\u7ffb\u8bd1\u6210<code class=\"literal\">.</code>\uff0c\u800c<code class=\"literal\">$</code>\u5219\u6309\u5b57\u9762\u610f\u601d\u5339\u914d\u3002\u6839\u636e\u9700\u8981\uff0c\u53ef\u4ee5\u7528<code class=\"literal\">?</code>\u6a21\u62df<code class=\"literal\">.</code>\uff0c\u7528<code class=\"literal\">(<em class=\"replaceable\"><code>R</code></em>+|)</code>\u6a21\u62df<code class=\"literal\"><em class=\"replaceable\"><code>R</code></em>*</code>\uff0c\u6216\u7528<code class=\"literal\">(<em class=\"replaceable\"><code>R</code></em>|)</code>\u6a21\u62df<code class=\"literal\"><em class=\"replaceable\"><code>R</code></em>?</code>\u3002<code class=\"literal\">$</code>\u4e0d\u9700\u8981\u4f5c\u4e3a\u4e00\u4e2a\u6b63\u5219\u8868\u8fbe\u5f0f\u5b57\u7b26\uff0c\u56e0\u4e3a\u6a21\u5f0f\u5fc5\u987b\u5339\u914d\u6574\u4e2a\u540d\u79f0\uff0c\u800c\u4e0d\u662f\u50cf\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5e38\u89c4\u7528\u6cd5\u90a3\u6837\u89e3\u91ca\uff08\u6362\u53e5\u8bdd\u8bf4\uff0c<code class=\"literal\">$</code>\u4f1a\u88ab\u81ea\u52a8\u5730\u8ffd\u52a0\u5230\u6a21\u5f0f\u4e0a\uff09\u3002\u5982\u679c\u4e0d\u5e0c\u671b\u8be5\u6a21\u5f0f\u7684\u5339\u914d\u4f4d\u7f6e\u88ab\u56fa\u5b9a\uff0c\u53ef\u4ee5\u5728\u5f00\u5934\u6216\u8005\u7ed3\u5c3e\u5199\u4e0a<code class=\"literal\">*</code>\u3002\u6ce8\u610f\u5728\u53cc\u5f15\u53f7\u5185\uff0c\u6240\u6709\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u4f1a\u5931\u53bb\u5176\u7279\u6b8a\u542b\u4e49\u5e76\u4e14\u6309\u7167\u5176\u5b57\u9762\u610f\u601d\u8fdb\u884c\u5339\u914d\u3002\u8fd8\u6709\uff0c\u5728\u64cd\u4f5c\u7b26\u540d\u79f0\u6a21\u5f0f\u4e2d\uff08\u5373\u4f5c\u4e3a<code class=\"literal\">\\do</code>\u7684\u53c2\u6570\uff09\uff0c\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u4e5f\u6309\u7167\u5b57\u9762\u610f\u601d\u8fdb\u884c\u5339\u914d\u3002</p>\n</div>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.20.8.5\">\n<h3 lang=\"zh\">\u9ad8\u7ea7\u7279\u6027</h3>\n<div class=\"refsect3\" id=\"APP-PSQL-VARIABLES\">\n<h4 lang=\"zh\">\u53d8\u91cf</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u63d0\u4f9b\u4e86\u548c\u666e\u901a Unix \u547d\u4ee4 shell \u76f8\u4f3c\u7684\u53d8\u91cf\u66ff\u6362\u7279\u6027\u3002\u53d8\u91cf\u7b80\u5355\u6765\u8bf4\u5c31\u662f\u4e00\u5bf9\u540d\u79f0/\u503c\uff0c\u5176\u4e2d\u503c\u53ef\u4ee5\u662f\u4efb\u610f\u957f\u5ea6\u7684\u4efb\u610f\u5b57\u7b26\u4e32\u3002\u540d\u79f0\u5fc5\u987b\u7531\u5b57\u6bcd\uff08\u5305\u62ec\u975e\u62c9\u4e01\u5b57\u6bcd\uff09\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u6784\u6210\u3002</p>\n<p lang=\"zh\">\u8981\u8bbe\u7f6e\u4e00\u4e2a\u53d8\u91cf\uff0c\u53ef\u4ee5\u4f7f\u7528<span class=\"application\">psql</span>\u7684\u5143\u547d\u4ee4<code class=\"command\">\\set</code>\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo bar</code></strong>\n</pre>\n<p lang=\"zh\">\u4f1a\u5c06<code class=\"literal\">foo</code>\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">bar</code>\u3002\u8981\u68c0\u7d22\u8be5\u53d8\u91cf\u7684\u5185\u5bb9\uff0c\u53ef\u4ee5\u5728\u540d\u79f0\u524d\u653e\u4e00\u4e2a\u5192\u53f7\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\echo :foo</code></strong>\nbar\n</pre>\n<p lang=\"zh\">\u8fd9\u5728\u5e38\u89c4 SQL \u547d\u4ee4\u548c\u5143\u547d\u4ee4\u4e2d\u5747\u6709\u6548\uff0c\u4e0b\u6587\u7684<a class=\"xref\" href=\"/docs/14/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL \u63d2\u503c\">SQL \u63d2\u503c</a>\u4e2d\u6709\u66f4\u591a\u7ec6\u8282\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u8c03\u7528<code class=\"command\">\\set</code>\u65f6\u6ca1\u6709\u7b2c\u4e8c\u4e2a\u53c2\u6570\uff0c\u8be5\u53d8\u91cf\u4f1a\u88ab\u8bbe\u7f6e\u4e3a\u4e00\u4e2a\u7a7a\u5b57\u7b26\u4e32\u503c\u3002\u8981\u53d6\u6d88\u8bbe\u7f6e\uff08\u5373\u5220\u9664\uff09\u4e00\u4e2a\u53d8\u91cf\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4<code class=\"command\">\\unset</code>\u3002\u8981\u663e\u793a\u6240\u6709\u53d8\u91cf\u7684\u503c\uff0c\u5728\u8c03\u7528<code class=\"command\">\\set</code>\u65f6\u4e0d\u5e26\u4efb\u4f55\u53c2\u6570\u5373\u53ef\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\"><code class=\"command\">\\set</code>\u7684\u53c2\u6570\u670d\u4ece\u4e0e\u5176\u4ed6\u547d\u4ee4\u76f8\u540c\u7684\u66ff\u6362\u89c4\u5219\u3002\u56e0\u6b64\u53ef\u4ee5\u6784\u9020\u6709\u8da3\u7684\u5f15\u7528\uff0c\u4f8b\u5982<code class=\"literal\">\\set :foo 'something'</code>\u4ee5\u53ca\u5206\u522b\u5f97\u5230<span class=\"productname\">Perl</span>\u6216\u8005<span class=\"productname\"><acronym class=\"acronym\">PHP</acronym></span>\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u8f6f\u94fe\u63a5</span>\u201d</span>\u6216\u8005<span class=\"quote\">\u201c<span class=\"quote\">\u53ef\u53d8\u53d8\u91cf</span>\u201d</span>\u3002\u4e0d\u5e78\u7684\u662f\uff08\u6216\u8005\u5e78\u8fd0\u7684\u662f\uff1f\uff09\uff0c\u8fd9\u4e9b\u6784\u9020\u51fa\u6765\u7684\u4e1c\u897f\u5e76\u6ca1\u6709\u4ec0\u4e48\u7528\u5904\u3002\u5728\u53e6\u4e00\u65b9\u9762\uff0c<code class=\"literal\">\\set bar :foo</code>\u662f\u4e00\u79cd\u5f88\u597d\u7684\u62f7\u8d1d\u53d8\u91cf\u7684\u65b9\u6cd5\u3002</p>\n</div>\n<p lang=\"zh\">\u6709\u4e00\u4e9b\u53d8\u91cf\u4f1a\u88ab<span class=\"application\">psql</span>\u7279\u6b8a\u5bf9\u5f85\u3002\u5b83\u4eec\u8868\u793a\u7279\u5b9a\u7684\u9009\u9879\u8bbe\u7f6e\uff0c\u8fd0\u884c\u65f6\u8fd9\u7c7b\u9009\u9879\u8bbe\u7f6e\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539\u8be5\u53d8\u91cf\u7684\u503c\u6765\u6539\u53d8\uff0c\u6216\u8005\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u5b83\u4eec\u8868\u793a<span class=\"application\">psql</span>\u7684\u53ef\u66f4\u6539\u7684\u72b6\u6001\u3002\u6309\u7167\u60ef\u4f8b\uff0c\u6240\u6709\u88ab\u7279\u6b8a\u5bf9\u5f85\u7684\u53d8\u91cf\u7684\u540d\u79f0\u7531\u5168\u90e8\u5927\u5199\u5f62\u5f0f\u7684 ASCII \u5b57\u6bcd\uff08\u8fd8\u6709\u53ef\u80fd\u662f\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\uff09\u7ec4\u6210\u3002\u4e3a\u4e86\u786e\u4fdd\u672a\u6765\u6700\u5927\u7684\u517c\u5bb9\u6027\uff0c\u6700\u597d\u907f\u514d\u628a\u8fd9\u7c7b\u53d8\u91cf\u540d\u7528\u4e8e\u81ea\u5df1\u7684\u76ee\u7684\u3002</p>\n<p lang=\"zh\">\u63a7\u5236<span class=\"application\">psql</span>\u884c\u4e3a\u7684\u53d8\u91cf\u901a\u5e38\u4e0d\u80fd\u88ab\u53d6\u6d88\u8bbe\u7f6e\u6216\u8005\u8bbe\u7f6e\u4e3a\u65e0\u6548\u503c\u3002\u5141\u8bb8<code class=\"literal\">\\unset</code>\u547d\u4ee4\uff0c\u4f46\u5b83\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u5b83\u7684\u9ed8\u8ba4\u503c\u3002\u6ca1\u6709\u7b2c\u4e8c\u53c2\u6570\u7684<code class=\"literal\">\\set</code>\u547d\u4ee4\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\uff08\u5bf9\u4e8e\u63a5\u53d7\u8be5\u503c\u7684\u63a7\u5236\u53d8\u91cf\uff09\uff0c\u5bf9\u4e0d\u63a5\u53d7\u8be5\u503c\u7684\u53d8\u91cf\u5219\u4f1a\u62d2\u7edd\u8fd9\u4e2a\u547d\u4ee4\u3002\u6b64\u5916\uff0c\u63a5\u53d7\u503c<code class=\"literal\">on</code>\u548c<code class=\"literal\">off</code>\u7684\u63a7\u5236\u53d8\u91cf\u4e5f\u80fd\u63a5\u53d7\u5176\u4ed6\u5e38\u89c1\u7684\u5e03\u5c14\u503c\u62fc\u5199\u65b9\u5f0f\uff0c\u4f8b\u5982<code class=\"literal\">true</code>\u548c<code class=\"literal\">false</code>\u3002</p>\n<p lang=\"zh\">\u88ab\u7279\u6b8a\u5bf9\u5f85\u7684\u53d8\u91cf\u662f\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"varname\">AUTOCOMMIT</code> </span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\uff08\u9ed8\u8ba4\uff09\u65f6\uff0c\u6bcf\u4e00\u4e2a SQL \u547d\u4ee4\u5728\u6210\u529f\u5b8c\u6210\u65f6\u4f1a\u88ab\u81ea\u52a8\u63d0\u4ea4\u3002\u5728\u8fd9\u79cd\u6a21\u5f0f\u4e2d\u8981\u63a8\u8fdf\u63d0\u4ea4\uff0c\u5fc5\u987b\u8f93\u5165\u4e00\u4e2a<code class=\"command\">BEGIN</code>\u6216\u8005<code class=\"command\">START TRANSACTION</code> SQL \u547d\u4ee4\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">off</code>\u6216\u8005\u88ab\u53d6\u6d88\u8bbe\u7f6e\u65f6\uff0c\u5728\u663e\u5f0f\u53d1\u51fa<code class=\"command\">COMMIT</code>\u6216\u8005<code class=\"command\">END</code>\u4e4b\u524d\uff0cSQL \u547d\u4ee4\u4e0d\u4f1a\u88ab\u63d0\u4ea4\u3002\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u4f1a\u4e3a\u4f60\u53d1\u51fa\u4e00\u4e2a\u9690\u5f0f\u7684<code class=\"command\">BEGIN</code>\uff0c\u8fd9\u4f1a\u53d1\u751f\u5728\u547d\u4ee4\u6267\u884c\u4e4b\u524d\uff0c\u524d\u63d0\u662f\u8be5\u547d\u4ee4\u4e0d\u5728\u4e8b\u52a1\u5757\u4e2d\uff0c\u4e14\u5176\u672c\u8eab\u65e2\u4e0d\u662f<code class=\"command\">BEGIN</code>\u6216\u5176\u4ed6\u4e8b\u52a1\u63a7\u5236\u547d\u4ee4\uff0c\u4e5f\u4e0d\u662f\u65e0\u6cd5\u5728\u4e8b\u52a1\u5757\u4e2d\u6267\u884c\u7684\u547d\u4ee4\uff08\u4f8b\u5982<code class=\"command\">VACUUM</code>\uff09\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u4e2d\uff0c\u5fc5\u987b\u901a\u8fc7<code class=\"command\">ABORT</code>\u6216\u8005<code class=\"command\">ROLLBACK</code>\u663e\u5f0f\u5730\u653e\u5f03\u4efb\u4f55\u5931\u8d25\u7684\u4e8b\u52a1\u3002\u8fd8\u8981\u8bb0\u4f4f\uff0c\u5982\u679c\u9000\u51fa\u4f1a\u8bdd\u65f6\u6ca1\u6709\u63d0\u4ea4\uff0c\u5219\u6240\u6709\u7684\u5de5\u4f5c\u90fd\u4f1a\u4e22\u5931\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u81ea\u52a8\u63d0\u4ea4\u6253\u5f00\u6a21\u5f0f\u662f<span class=\"productname\">PostgreSQL</span>\u7684\u4f20\u7edf\u884c\u4e3a\uff0c\u4f46\u662f\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u66f4\u63a5\u8fd1\u4e8e SQL \u7684\u89c4\u8303\u3002\u5982\u679c\u66f4\u559c\u6b22\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\uff0c\u53ef\u4ee5\u5728\u7cfb\u7edf\u7ea7\u7684<code class=\"filename\">psqlrc</code>\u6587\u4ef6\u6216\u8005\u4e2a\u4eba\u7684<code class=\"filename\">~/.psqlrc</code>\u6587\u4ef6\u4e2d\u8bbe\u7f6e\u5b83\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">COMP_KEYWORD_CASE</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u786e\u5b9a\u5728\u8865\u5168\u4e00\u4e2a SQL \u5173\u952e\u8bcd\u65f6\u8981\u4f7f\u7528\u7684\u5927\u5c0f\u5199\u5f62\u5f0f\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">lower</code>\u6216\u8005<code class=\"literal\">upper</code>\uff0c\u8865\u5168\u540e\u7684\u8bcd\u5c06\u5206\u522b\u662f\u5c0f\u5199\u6216\u8005\u5927\u5199\u5f62\u5f0f\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">preserve-lower</code>\u6216\u8005<code class=\"literal\">preserve-upper</code>\uff08\u9ed8\u8ba4\uff09\uff0c\u8865\u5168\u540e\u7684\u8bcd\u5c06\u4f1a\u4fdd\u6301\u8be5\u8bcd\u5df2\u8f93\u5165\u90e8\u5206\u7684\u5927\u5c0f\u5199\u5f62\u5f0f\uff0c\u4f46\u662f\u5982\u679c\u88ab\u8865\u5168\u7684\u8bcd\u8fd8\u6ca1\u6709\u88ab\u8f93\u5165\uff0c\u5219\u5b83\u4f1a\u88ab\u5206\u522b\u8865\u5168\u6210\u5c0f\u5199\u6216\u8005\u5927\u5199\u5f62\u5f0f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">DBNAME</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u5df2\u8fde\u63a5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u662f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ECHO</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">all</code>\uff0c\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u4f1a\u5728\u8bfb\u5165\u65f6\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u8bfb\u53d6\u7684\u884c\uff09\u3002\u8981\u5728\u7a0b\u5e8f\u5f00\u59cb\u65f6\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\uff0c\u53ef\u4ee5\u4f7f\u7528\u5f00\u5173<code class=\"option\">-a</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">queries</code>\uff0c<span class=\"application\">psql</span>\u4f1a\u5728\u53d1\u9001\u6bcf\u4e2a\u67e5\u8be2\u7ed9\u670d\u52a1\u5668\u65f6\u5c06\u5b83\u4eec\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\u3002\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\u7684\u5f00\u5173\u662f<code class=\"option\">-e</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">errors</code>\uff0c\u90a3\u4e48\u53ea\u6709\u5931\u8d25\u7684\u67e5\u8be2\u4f1a\u88ab\u663e\u793a\u5728\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u4e0a\u3002\u8fd9\u79cd\u884c\u4e3a\u7684\u5f00\u5173\u662f<code class=\"option\">-b</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">none</code>\uff08\u9ed8\u8ba4\u503c\uff09\u5219\u4e0d\u4f1a\u663e\u793a\u4efb\u4f55\u67e5\u8be2\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ECHO_HIDDEN</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u4e14\u4e00\u4e2a\u53cd\u659c\u7ebf\u547d\u4ee4\u67e5\u8be2\u6570\u636e\u5e93\u65f6\uff0c\u76f8\u5e94\u7684\u67e5\u8be2\u4f1a\u88ab\u5148\u663e\u793a\u3002\u8fd9\u79cd\u7279\u6027\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u5b66\u4e60<span class=\"productname\">PostgreSQL</span>\u7684\u5185\u90e8\u5e76\u4e14\u5728\u81ea\u5df1\u7684\u7a0b\u5e8f\u4e2d\u63d0\u4f9b\u7c7b\u4f3c\u7684\u529f\u80fd\uff08\u8981\u5728\u7a0b\u5e8f\u5f00\u59cb\u65f6\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\uff0c\u53ef\u4ee5\u4f7f\u7528\u5f00\u5173<code class=\"option\">-E</code>\uff09\u3002\u5982\u679c\u628a\u8fd9\u4e2a\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">noexec</code>\uff0c\u5219\u5bf9\u5e94\u7684\u67e5\u8be2\u53ea\u4f1a\u88ab\u663e\u793a\u800c\u5e76\u4e0d\u771f\u6b63\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u6267\u884c\u3002\u9ed8\u8ba4\u503c\u662f<code class=\"literal\">off</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ENCODING</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u7684\u5ba2\u6237\u7aef\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u6bcf\u4e00\u6b21\u4f60\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\uff09\u65f6\u4ee5\u53ca\u5f53\u4f60\u7528<code class=\"literal\">\\encoding</code>\u66f4\u6539\u7f16\u7801\u65f6\uff0c\u8fd9\u4e2a\u53d8\u91cf\u90fd\u4f1a\u88ab\u8bbe\u7f6e\uff0c\u4f46\u5b83\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ERROR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u4e0a\u4e00\u4e2aSQL\u67e5\u8be2\u5931\u8d25\u5219\u4e3a<code class=\"literal\">true</code>\uff0c\u5982\u679c\u6210\u529f\u5219\u662f<code class=\"literal\">false</code>\u3002\u53e6\u89c1<code class=\"varname\">SQLSTATE</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">FETCH_COUNT</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a\u4e00\u4e2a\u5927\u4e8e\u96f6\u7684\u6574\u6570\u503c\uff0c<code class=\"command\">SELECT</code>\u67e5\u8be2\u7684\u7ed3\u679c\u4f1a\u4ee5\u4e00\u7ec4\u4e00\u7ec4\u7684\u65b9\u5f0f\u53d6\u51fa\u5e76\u4e14\u663e\u793a\uff08\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u7684\u90a3\u6837\u628a\u6574\u4e2a\u7ed3\u679c\u96c6\u62ff\u5230\u4ee5\u540e\u518d\u663e\u793a\uff09\uff0c\u6bcf\u7ec4\u5305\u542b\u7684\u884c\u6570\u7b49\u4e8e\u8be5\u6574\u6570\u503c\u3002\u56e0\u6b64\uff0c\u8fd9\u79cd\u65b9\u5f0f\u53ea\u4f1a\u4f7f\u7528\u6709\u9650\u7684\u5185\u5b58\u91cf\uff0c\u800c\u4e0d\u7ba1\u6574\u4e2a\u7ed3\u679c\u96c6\u7684\u5927\u5c0f\u3002\u5728\u542f\u7528\u8fd9\u4e2a\u7279\u6027\u65f6\uff0c\u901a\u5e38\u4f1a\u4f7f\u7528 100 \u5230 1000 \u7684\u8bbe\u7f6e\u3002\u8bb0\u4f4f\u5728\u4f7f\u7528\u8fd9\u79cd\u7279\u6027\u65f6\uff0c\u4e00\u4e2a\u67e5\u8be2\u53ef\u80fd\u4f1a\u5728\u5df2\u7ecf\u663e\u793a\u4e86\u4e00\u4e9b\u884c\u4e4b\u540e\u5931\u8d25\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5c3d\u7ba1\u53ef\u4ee5\u628a\u8fd9\u79cd\u7279\u6027\u7528\u4e8e\u4efb\u4f55\u7684\u8f93\u51fa\u683c\u5f0f\uff0c\u4f46\u662f\u9ed8\u8ba4\u7684<code class=\"literal\">aligned</code>\u683c\u5f0f\u770b\u8d77\u6765\u4f1a\u6bd4\u8f83\u7cdf\u7cd5\uff0c\u56e0\u4e3a\u6bcf\u4e00\u7ec4\u7684<code class=\"varname\">FETCH_COUNT</code>\u884c\u5c06\u88ab\u5355\u72ec\u683c\u5f0f\u5316\uff0c\u8fd9\u5c31\u4f1a\u5bfc\u81f4\u4e0d\u540c\u7684\u884c\u7ec4\u7684\u5217\u5bbd\u4e0d\u540c\u3002\u5176\u4ed6\u7684\u8f93\u51fa\u683c\u5f0f\u4f1a\u66f4\u597d\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">HIDE_TABLEAM</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6b64\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">true</code>\uff0c\u5219\u4e0d\u663e\u793a\u8868\u7684\u8bbf\u95ee\u65b9\u6cd5\u7684\u8be6\u7ec6\u4fe1\u606f\u3002\u8fd9\u4e3b\u8981\u7528\u4e8e\u56de\u5f52\u6d4b\u8bd5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">HIDE_TOAST_COMPRESSION</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">true</code>\uff0c\u4e0d\u663e\u793a\u5217\u538b\u7f29\u65b9\u6cd5\u7684\u7ec6\u8282\u3002\u8fd9\u4e3b\u8981\u7528\u4e8e\u56de\u5f52\u6d4b\u8bd5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">HISTCONTROL</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">ignorespace</code>\uff0c\u5219\u4ee5\u4e00\u4e2a\u7a7a\u683c\u5f00\u59cb\u7684\u884c\u4e0d\u4f1a\u88ab\u653e\u5165\u5230\u5386\u53f2\u5217\u8868\u4e2d\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">ignoredups</code>\uff0c\u5219\u4e0e\u4e0a\u4e00\u6761\u5386\u53f2\u8bb0\u5f55\u76f8\u540c\u7684\u884c\u4e0d\u4f1a\u88ab\u653e\u5165\u3002\u503c<code class=\"literal\">ignoreboth</code>\u7ec4\u5408\u4e86\u4e0a\u8ff0\u4e24\u79cd\u503c\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">none</code>\uff08\u9ed8\u8ba4\u503c\uff09\uff0c\u6240\u6709\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e2d\u88ab\u8bfb\u5165\u7684\u884c\u90fd\u4f1a\u4fdd\u5b58\u5728\u5386\u53f2\u5217\u8868\u4e2d\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">HISTFILE</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8be5\u6587\u4ef6\u540d\u5c06\u88ab\u7528\u4e8e\u5b58\u50a8\u5386\u53f2\u5217\u8868\u3002\u5982\u679c\u672a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff0c\u6587\u4ef6\u540d\u5c06\u4ece<code class=\"envar\">PSQL_HISTORY</code>\u73af\u5883\u53d8\u91cf\u4e2d\u53d6\u5f97\u3002\u5982\u679c\u8be5\u73af\u5883\u53d8\u91cf\u4e5f\u6ca1\u6709\u88ab\u8bbe\u7f6e\uff0c\u5219\u9ed8\u8ba4\u503c\u662f<code class=\"filename\">~/.psql_history</code>\uff0c\u5728Windows\u4e0a\u662f<code class=\"filename\">%APPDATA%\\postgresql\\psql_history</code>\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">\\set HISTFILE ~/.psql_history-:DBNAME\n</pre>\n<p lang=\"zh\">\u653e\u5728<code class=\"filename\">~/.psqlrc</code>\u4e2d\u5c06\u4f1a\u5bfc\u81f4<span class=\"application\">psql</span>\u4e3a\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u7ef4\u62a4\u4e00\u4e2a\u5355\u72ec\u7684\u5386\u53f2\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">HISTSIZE</code></span></dt>\n<dd>\n<p lang=\"zh\">\u547d\u4ee4\u5386\u53f2\u4e2d\u6700\u591a\u4fdd\u5b58\u7684\u547d\u4ee4\u6570\uff08\u9ed8\u8ba4 500\uff09\u3002\u8bbe\u4e3a\u8d1f\u503c\u65f6\uff0c\u4e0d\u8bbe\u4e0a\u9650\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">HOST</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e3b\u673a\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u4e5f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">IGNOREEOF</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8bbe\u4e3a 1 \u6216\u66f4\u5c0f\u7684\u503c\uff0c\u5411 psql \u4ea4\u4e92\u4f1a\u8bdd\u53d1\u9001 EOF \u5b57\u7b26\uff08\u901a\u5e38\u4e3a Control + D\uff09\u5c31\u4f1a\u7ec8\u6b62\u5e94\u7528\u3002\u5982\u679c\u8bbe\u4e3a\u66f4\u5927\u7684\u6570\u503c\uff0c\u5219\u5fc5\u987b\u8fde\u7eed\u8f93\u5165\u76f8\u5e94\u6b21\u6570\u7684 EOF \u5b57\u7b26\u624d\u4f1a\u7ec8\u6b62\u4ea4\u4e92\u4f1a\u8bdd\u3002\u5982\u679c\u53d8\u91cf\u8bbe\u4e3a\u975e\u6570\u503c\uff0c\u4f1a\u88ab\u89e3\u91ca\u4e3a 10\u3002\u9ed8\u8ba4\u503c\u4e3a 0\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">LASTOID</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6700\u8fd1\u4e00\u6b21\u53d7\u5f71\u54cd\u7684 OID \u503c\uff0c\u7531 INSERT \u6216 \\lo_import \u547d\u4ee4\u8fd4\u56de\u3002\u6b64\u53d8\u91cf\u4ec5\u4fdd\u8bc1\u5728\u4e0b\u4e00\u6761 SQL \u547d\u4ee4\u7684\u7ed3\u679c\u663e\u793a\u4e4b\u524d\u6709\u6548\u3002\u4ece\u7248\u672c 12 \u8d77\uff0cPostgreSQL \u670d\u52a1\u5668\u4e0d\u518d\u652f\u6301 OID \u7cfb\u7edf\u5217\uff0c\u56e0\u6b64\u8fde\u63a5\u5230\u8fd9\u4e9b\u670d\u52a1\u5668\u65f6\uff0c\u6267\u884c INSERT \u540e LASTOID \u59cb\u7ec8\u4e3a 0\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">LAST_ERROR_MESSAGE</code><br/></span><span class=\"term\"><code class=\"varname\">LAST_ERROR_SQLSTATE</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d<span class=\"application\">psql</span>\u4f1a\u8bdd\u4e2d\u6700\u8fd1\u4e00\u4e2a\u5931\u8d25\u67e5\u8be2\u7684\u4e3b\u9519\u8bef\u6d88\u606f\u548c\u76f8\u5173\u7684SQLSTATE\u4ee3\u7801\uff0c\u5982\u679c\u5728\u5f53\u524d\u4f1a\u8bdd\u4e2d\u6ca1\u6709\u53d1\u751f\u9519\u8bef\uff0c\u5219\u662f\u4e00\u4e2a\u7a7a\u5b57\u7b26\u4e32\u548c<code class=\"literal\">00000</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ON_ERROR_ROLLBACK</code> </span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u65f6\uff0c\u5982\u679c\u4e8b\u52a1\u5757\u4e2d\u7684\u4e00\u4e2a\u8bed\u53e5\u4ea7\u751f\u4e00\u4e2a\u9519\u8bef\uff0c\u8be5\u9519\u8bef\u4f1a\u88ab\u5ffd\u7565\u5e76\u4e14\u8be5\u4e8b\u52a1\u4f1a\u7ee7\u7eed\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">interactive</code>\u65f6\uff0c\u53ea\u5728\u4ea4\u4e92\u5f0f\u4f1a\u8bdd\u4e2d\u5ffd\u7565\u8fd9\u7c7b\u9519\u8bef\uff0c\u800c\u8bfb\u53d6\u811a\u672c\u6587\u4ef6\u65f6\u5219\u4e0d\u4f1a\u5ffd\u7565\u9519\u8bef\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">off</code>\uff08\u9ed8\u8ba4\u503c\uff09\u65f6\uff0c\u4e8b\u52a1\u5757\u4e2d\u4ea7\u751f\u9519\u8bef\u7684\u4e00\u4e2a\u8bed\u53e5\u4f1a\u4e2d\u6b62\u6574\u4e2a\u4e8b\u52a1\u3002\u9519\u8bef\u56de\u6eda\u6a21\u5f0f\u7684\u5de5\u4f5c\u539f\u7406\u662f\u5728\u4e8b\u52a1\u5757\u7684\u6bcf\u4e2a\u547d\u4ee4\u4e4b\u524d\u90fd\u4e3a\u4f60\u53d1\u51fa\u4e00\u4e2a\u9690\u5f0f\u7684<code class=\"command\">SAVEPOINT</code>\uff0c\u7136\u540e\u5728\u8be5\u547d\u4ee4\u5931\u8d25\u65f6\u56de\u6eda\u5230\u8be5\u4fdd\u5b58\u70b9\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ON_ERROR_STOP</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u51fa\u9519\u540e\u4ecd\u4f1a\u7ee7\u7eed\u5904\u7406\u547d\u4ee4\u3002\u5c06\u6b64\u53d8\u91cf\u8bbe\u4e3a on \u540e\uff0c\u5904\u7406\u4f1a\u7acb\u5373\u505c\u6b62\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\uff0cpsql \u4f1a\u8fd4\u56de\u547d\u4ee4\u63d0\u793a\u7b26\uff1b\u5426\u5219\uff0cpsql \u4f1a\u9000\u51fa\u5e76\u8fd4\u56de\u9519\u8bef\u7801 3\uff0c\u4ee5\u533a\u522b\u4e8e\u9519\u8bef\u7801 1 \u6240\u8868\u793a\u7684\u81f4\u547d\u9519\u8bef\u3002\u65e0\u8bba\u54ea\u79cd\u60c5\u51b5\uff0c\u5f53\u524d\u6b63\u5728\u8fd0\u884c\u7684\u6240\u6709\u811a\u672c\uff08\u5982\u679c\u5b58\u5728\u9876\u5c42\u811a\u672c\uff0c\u5219\u5305\u62ec\u8be5\u811a\u672c\u53ca\u5176\u8c03\u7528\u7684\u5176\u4ed6\u811a\u672c\uff09\u90fd\u4f1a\u7acb\u5373\u7ec8\u6b62\u3002\u5982\u679c\u9876\u5c42\u547d\u4ee4\u5b57\u7b26\u4e32\u5305\u542b\u591a\u6761 SQL \u547d\u4ee4\uff0c\u5219\u4f1a\u5728\u5f53\u524d\u547d\u4ee4\u5904\u505c\u6b62\u5904\u7406\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">PORT</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u7aef\u53e3\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u4e5f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">PROMPT1</code><br/></span><span class=\"term\"><code class=\"varname\">PROMPT2</code><br/></span><span class=\"term\"><code class=\"varname\">PROMPT3</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e9b\u53d8\u91cf\u6307\u5b9a<span class=\"application\">psql</span>\u53d1\u51fa\u7684\u63d0\u793a\u7b26\u7684\u6a21\u6837\u3002\u89c1\u4e0b\u6587\u7684<a class=\"xref\" href=\"/docs/14/app-psql.html#APP-PSQL-PROMPTING\" title=\"\u63d0\u793a\u7b26\">\u63d0\u793a\u7b26</a>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">QUIET</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u8fd9\u4e2a\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-q</code>\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\u53ef\u80fd\u7528\u5904\u4e0d\u5927\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ROW_COUNT</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6700\u8fd1\u4e00\u6761 SQL \u67e5\u8be2\u8fd4\u56de\u6216\u5f71\u54cd\u7684\u884c\u6570\uff1b\u5982\u679c\u67e5\u8be2\u5931\u8d25\u6216\u6ca1\u6709\u62a5\u544a\u884c\u6570\uff0c\u5219\u4e3a 0\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">SERVER_VERSION_NAME</code><br/></span><span class=\"term\"><code class=\"varname\">SERVER_VERSION_NUM</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b57\u7b26\u4e32\u5f62\u5f0f\u7684\u670d\u52a1\u5668\u7248\u672c\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">9.6.2</code>\u3001<code class=\"literal\">10.1</code>\u6216\u8005<code class=\"literal\">11beta1</code>\uff0c\u4ee5\u53ca\u6570\u5b57\u5f62\u5f0f\u7684\u670d\u52a1\u5668\u7248\u672c\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">90602</code>\u6216\u8005<code class=\"literal\">100001</code>\u3002\u6bcf\u6b21\u4f60\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\uff09\u65f6\uff0c\u8fd9\u4e9b\u90fd\u4f1a\u88ab\u8bbe\u7f6e\uff0c\u4f46\u53ef\u4ee5\u88ab\u6539\u53d8\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">SHOW_CONTEXT</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u53d8\u91cf\u53ef\u4ee5\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">never</code>\u3001<code class=\"literal\">errors</code>\u6216\u8005<code class=\"literal\">always</code>\u6765\u63a7\u5236\u662f\u5426\u5728\u6765\u81ea\u670d\u52a1\u5668\u7684\u6d88\u606f\u4e2d\u663e\u793a<code class=\"literal\">CONTEXT</code>\u5b57\u6bb5\u3002\u9ed8\u8ba4\u662f<code class=\"literal\">errors</code>\uff08\u8868\u793a\u5728\u9519\u8bef\u6d88\u606f\u4e2d\u663e\u793a\u4e0a\u4e0b\u6587\uff0c\u4f46\u5728\u901a\u77e5\u548c\u8b66\u544a\u6d88\u606f\u4e2d\u4e0d\u663e\u793a\uff09\u3002\u5f53<code class=\"varname\">VERBOSITY</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">terse</code>\u6216<code class=\"literal\">sqlstate</code>\u65f6\uff0c\u8fd9\u4e2a\u8bbe\u7f6e\u65e0\u6548\uff08\u53e6\u89c1<code class=\"command\">\\errverbose</code>\uff0c\u5b83\u53ef\u4ee5\u7528\u6765\u5f97\u5230\u521a\u9047\u5230\u7684\u9519\u8bef\u7684\u8be6\u7ec6\u4fe1\u606f\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">SINGLELINE</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u8fd9\u4e2a\u53d8\u91cf\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-S</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">SINGLESTEP</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u8fd9\u4e2a\u53d8\u91cf\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-s</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">SQLSTATE</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0e\u4e0a\u4e00\u4e2aSQL\u67e5\u8be2\u7684\u5931\u8d25\u76f8\u5173\u7684\u9519\u8bef\u4ee3\u7801\uff08\u89c1<a class=\"xref\" href=\"/docs/14/errcodes-appendix.html\" title=\"\u9644\u5f55\u00a0A.\u00a0PostgreSQL\u9519\u8bef\u4ee3\u7801\">\u9644\u5f55\u00a0A</a>\uff09\uff0c\u5982\u679c\u4e0a\u4e00\u4e2a\u67e5\u8be2\u6210\u529f\u5219\u4e3a<code class=\"literal\">00000</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">USER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7528\u6237\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u662f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">VERBOSITY</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u53d8\u91cf\u53ef\u4ee5\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">default</code>\u3001<code class=\"literal\">verbose</code>\u3001<code class=\"literal\">terse</code>\u6216\u8005<code class=\"literal\">sqlstate</code>\u6765\u63a7\u5236\u9519\u8bef\u62a5\u544a\u7684\u8be6\u7ec6\u7a0b\u5ea6\uff08\u53e6\u89c1<code class=\"command\">\\errverbose</code>\uff0c\u5728\u60f3\u5f97\u5230\u521a\u9047\u5230\u7684\u9519\u8bef\u7684\u8be6\u7ec6\u4fe1\u606f\u65f6\u4f7f\u7528\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">VERSION</code><br/></span><span class=\"term\"><code class=\"varname\">VERSION_NAME</code><br/></span><span class=\"term\"><code class=\"varname\">VERSION_NUM</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e9b\u53d8\u91cf\u5728\u7a0b\u5e8f\u542f\u52a8\u65f6\u88ab\u8bbe\u7f6e\u4ee5\u53cd\u6620<span class=\"application\">psql</span>\u7684\u7248\u672c\uff0c\u5206\u522b\u662f\u4e00\u4e2a\u8be6\u7ec6\u7684\u5b57\u7b26\u4e32\u3001\u4e00\u4e2a\u77ed\u5b57\u7b26\u4e32\uff08\u4f8b\u5982<code class=\"literal\">9.6.2</code>\u3001<code class=\"literal\">10.1</code>\u6216\u8005<code class=\"literal\">11beta1</code>\uff09\u4ee5\u53ca\u4e00\u4e2a\u6570\u5b57\uff08\u4f8b\u5982<code class=\"literal\">90602</code>\u6216\u8005<code class=\"literal\">100001</code>\uff09\u3002\u5b83\u4eec\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-INTERPOLATION\">\n<h4 lang=\"zh\">SQL \u63d2\u503c</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u53d8\u91cf\u7684\u4e00\u4e2a\u5173\u952e\u7279\u6027\u662f\u53ef\u4ee5\u628a\u5b83\u4eec\u66ff\u6362\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u63d2\u503c</span>\u201d</span>\uff09\u5230\u5e38\u89c4<acronym class=\"acronym\">SQL</acronym>\u8bed\u53e5\u4e2d\uff0c\u4e5f\u53ef\u4ee5\u628a\u5b83\u4eec\u66ff\u6362\u5230\u5143\u547d\u4ee4\u7684\u53c2\u6570\u4e2d\u3002\u6b64\u5916\uff0c<span class=\"application\">psql</span>\u8fd8\u63d0\u4f9b\u4e86\u529f\u80fd\u6765\u786e\u4fdd\u88ab\u7528\u4f5c SQL \u5b57\u9762\u91cf\u548c\u6807\u8bc6\u7b26\u7684\u53d8\u91cf\u503c\u4f1a\u88ab\u6b63\u786e\u5730\u52a0\u5f15\u53f7\u3002\u4e0d\u52a0\u5f15\u53f7\u5730\u63d2\u503c\u4e00\u4e2a\u503c\u7684\u8bed\u6cd5\u662f\u5728\u53d8\u91cf\u540d\u524d\u9762\u52a0\u4e0a\u4e00\u4e2a\u5192\u53f7\uff08<code class=\"literal\">:</code>\uff09\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo 'my_table'</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM :foo;</code></strong>\n</pre>\n<p lang=\"zh\">\u5c06\u67e5\u8be2\u8868<code class=\"literal\">my_table</code>\u3002\u6ce8\u610f\u8fd9\u53ef\u80fd\u4f1a\u4e0d\u5b89\u5168\uff1a\u8be5\u53d8\u91cf\u7684\u503c\u4f1a\u88ab\u6309\u5b57\u9762\u62f7\u8d1d\uff0c\u56e0\u6b64\u5b83\u53ef\u80fd\u5305\u542b\u4e0d\u5e73\u8861\u7684\u5f15\u53f7\u751a\u81f3\u53cd\u659c\u7ebf\u547d\u4ee4\u3002\u5fc5\u987b\u786e\u4fdd\u628a\u5b83\u653e\u5728\u90a3\u91cc\u662f\u6709\u610f\u4e49\u7684\u3002</p>\n<p lang=\"zh\">\u5f53\u4e00\u4e2a\u503c\u8981\u7528\u4f5c SQL \u5b57\u9762\u91cf\u6216\u6807\u8bc6\u7b26\u65f6\uff0c\u6700\u5b89\u5168\u7684\u505a\u6cd5\u662f\u4e3a\u5b83\u52a0\u4e0a\u5f15\u53f7\u3002\u8981\u5c06\u53d8\u91cf\u503c\u4f5c\u4e3a SQL \u5b57\u9762\u91cf\u52a0\u5f15\u53f7\uff0c\u5e94\u5199\u4e00\u4e2a\u5192\u53f7\uff0c\u540e\u9762\u8ddf\u7528\u5355\u5f15\u53f7\u62ec\u8d77\u6765\u7684\u53d8\u91cf\u540d\u3002\u8981\u5c06\u53d8\u91cf\u503c\u4f5c\u4e3a SQL \u6807\u8bc6\u7b26\u52a0\u5f15\u53f7\uff0c\u5219\u5728\u5192\u53f7\u540e\u9762\u7528\u53cc\u5f15\u53f7\u62ec\u8d77\u53d8\u91cf\u540d\u3002\u8fd9\u4e9b\u5199\u6cd5\u80fd\u6b63\u786e\u5904\u7406\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165\u7684\u5f15\u53f7\u548c\u5176\u4ed6\u7279\u6b8a\u5b57\u7b26\u3002\u524d\u9762\u7684\u793a\u4f8b\u53ef\u7528\u4ee5\u4e0b\u66f4\u5b89\u5168\u7684\u5199\u6cd5\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo 'my_table'</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM :\"foo\";</code></strong>\n</pre>\n<p lang=\"zh\">\u5728\u52a0\u5f15\u53f7\u7684<acronym class=\"acronym\">SQL</acronym>\u5b57\u9762\u91cf\u548c\u6807\u8bc6\u7b26\u5185\u90e8\uff0c\u4e0d\u4f1a\u6267\u884c\u53d8\u91cf\u63d2\u503c\u3002\u56e0\u6b64\uff0c<code class=\"literal\">':foo'</code>\u8fd9\u6837\u7684\u5199\u6cd5\u4e0d\u80fd\u6839\u636e\u53d8\u91cf\u503c\u751f\u6210\u52a0\u5f15\u53f7\u7684\u5b57\u9762\u91cf\uff08\u5373\u4f7f\u80fd\u591f\u751f\u6548\uff0c\u4e5f\u4e0d\u5b89\u5168\uff0c\u56e0\u4e3a\u5b83\u65e0\u6cd5\u6b63\u786e\u5904\u7406\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165\u7684\u5f15\u53f7\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8fd9\u79cd\u673a\u5236\u7684\u4e00\u4e2a\u793a\u4f8b\u662f\u628a\u4e00\u4e2a\u6587\u4ef6\u7684\u5185\u5bb9\u62f7\u8d1d\u5230\u4e00\u4e2a\u8868\u5217\u4e2d\u3002\u9996\u5148\u628a\u8be5\u6587\u4ef6\u8f7d\u5165\u5230\u4e00\u4e2a\u53d8\u91cf\uff0c\u7136\u540e\u628a\u8be5\u53d8\u91cf\u7684\u503c\u4f5c\u4e3a\u4e00\u4e2a\u52a0\u5f15\u53f7\u7684\u5b57\u7b26\u4e32\u8fdb\u884c\u63d2\u503c\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set content `cat my_file.txt`</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>INSERT INTO my_table VALUES (:'content');</code></strong>\n</pre>\n<p lang=\"zh\">\uff08\u6ce8\u610f\u5982\u679c<code class=\"filename\">my_file.txt</code>\u5305\u542b NUL \u5b57\u8282\uff0c\u8fd9\u6837\u4e5f\u4e0d\u884c\u3002<span class=\"application\">psql</span>\u4e0d\u652f\u6301\u5728\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165 NUL \u5b57\u8282\uff09\u3002</p>\n<p lang=\"zh\">\u56e0\u4e3a\u5192\u53f7\u53ef\u4ee5\u5408\u6cd5\u5730\u51fa\u73b0\u5728 SQL \u547d\u4ee4\u4e2d\uff0c\u770b\u4f3c\u63d2\u503c\u7684\u5199\u6cd5\uff08\u5373<code class=\"literal\">:name</code>\u3001<code class=\"literal\">:'name'</code>\u6216\u8005<code class=\"literal\">:\"name\"</code>\uff09\u4e0d\u4f1a\u88ab\u66ff\u6362\uff0c\u9664\u975e\u6240\u6307\u7684\u53d8\u91cf\u5f53\u524d\u5df2\u8bbe\u7f6e\u3002\u5728\u4efb\u4f55\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u7528\u4e00\u4e2a\u53cd\u659c\u7ebf\u5bf9\u5192\u53f7\u8fdb\u884c\u8f6c\u4e49\u4ee5\u907f\u514d\u5b83\u88ab\u66ff\u6362\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">:{?<em class=\"replaceable\"><code>name</code></em>}</code>\u7279\u6b8a\u8bed\u6cd5\u4f1a\u6839\u636e\u8be5\u53d8\u91cf\u662f\u5426\u5b58\u5728\u8fd4\u56de TRUE \u6216 FALSE\uff0c\u56e0\u6b64\u603b\u662f\u4f1a\u88ab\u66ff\u6362\uff0c\u9664\u975e\u5192\u53f7\u88ab\u53cd\u659c\u7ebf\u8f6c\u4e49\u3002</p>\n<p lang=\"zh\">\u53d8\u91cf\u7684\u5192\u53f7\u8bed\u6cd5\u5bf9\u5d4c\u5165\u5f0f\u67e5\u8be2\u8bed\u8a00\uff08\u4f8b\u5982<span class=\"application\">ECPG</span>\uff09\u6765\u8bf4\u662f\u6807\u51c6\u7684<acronym class=\"acronym\">SQL</acronym>\u3002\u7528\u4e8e\u6570\u7ec4\u5207\u7247\u548c\u7c7b\u578b\u8f6c\u6362\u7684\u5192\u53f7\u8bed\u6cd5\u662f<span class=\"productname\">PostgreSQL</span>\u6269\u5c55\uff0c\u5b83\u6709\u65f6\u53ef\u80fd\u4f1a\u4e0e\u6807\u51c6\u7528\u6cd5\u51b2\u7a81\u3002\u628a\u4e00\u4e2a\u53d8\u91cf\u503c\u8f6c\u4e49\u6210 SQL \u5b57\u9762\u91cf\u6216\u8005\u6807\u8bc6\u7b26\u7684\u5192\u53f7\u52a0\u5f15\u53f7\u8bed\u6cd5\u662f\u4e00\u79cd<span class=\"application\">psql</span>\u6269\u5c55\u3002</p>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-PROMPTING\">\n<h4 lang=\"zh\">\u63d0\u793a\u7b26</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u53d1\u51fa\u7684\u63d0\u793a\u7b26\u53ef\u4ee5\u6309\u4f60\u7684\u559c\u597d\u8fdb\u884c\u5b9a\u5236\u3002<code class=\"varname\">PROMPT1</code>\u3001<code class=\"varname\">PROMPT2</code> \u548c <code class=\"varname\">PROMPT3</code> \u8fd9\u4e09\u4e2a\u53d8\u91cf\u5305\u542b\u63cf\u8ff0\u63d0\u793a\u7b26\u5916\u89c2\u7684\u5b57\u7b26\u4e32\u548c\u7279\u6b8a\u8f6c\u4e49\u5e8f\u5217\u3002\u63d0\u793a\u7b26 1 \u662f <span class=\"application\">psql</span> \u8bf7\u6c42\u65b0\u547d\u4ee4\u65f6\u53d1\u51fa\u7684\u5e38\u89c4\u63d0\u793a\u7b26\u3002\u63d0\u793a\u7b26 2 \u4f1a\u5728\u5f55\u5165\u547d\u4ee4\u671f\u95f4\u8fd8\u9700\u8981\u66f4\u591a\u8f93\u5165\u65f6\u53d1\u51fa\uff0c\u4f8b\u5982\u547d\u4ee4\u5c1a\u672a\u4ee5\u5206\u53f7\u7ed3\u675f\uff0c\u6216\u8005\u5f15\u53f7\u5c1a\u672a\u95ed\u5408\u65f6\u3002\u5728\u6267\u884c <acronym class=\"acronym\">SQL</acronym> <code class=\"command\">COPY FROM STDIN</code> \u547d\u4ee4\u5e76\u9700\u8981\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4e00\u884c\u503c\u65f6\uff0c\u4f1a\u53d1\u51fa\u63d0\u793a\u7b26 3\u3002</p>\n<p lang=\"zh\">\u9009\u4e2d\u7684\u63d0\u793a\u7b26\u53d8\u91cf\u503c\u4f1a\u6309\u5b57\u9762\u8f93\u51fa\uff0c\u9664\u975e\u9047\u5230\u767e\u5206\u53f7\uff08<code class=\"literal\">%</code>\uff09\u3002\u6839\u636e\u4e0b\u4e00\u4e2a\u5b57\u7b26\u7684\u4e0d\u540c\uff0c\u4f1a\u66ff\u6362\u6210\u67d0\u4e9b\u5176\u4ed6\u6587\u672c\u3002\u5df2\u5b9a\u4e49\u7684\u66ff\u6362\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">%M</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5b8c\u6574\u4e3b\u673a\u540d\uff08\u542b\u57df\u540d\uff09\uff1b\u5982\u679c\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\uff0c\u5219\u4e3a<code class=\"literal\">[local]</code>\uff1b\u5982\u679c Unix \u57df\u5957\u63a5\u5b57\u4e0d\u5728\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u9ed8\u8ba4\u4f4d\u7f6e\uff0c\u5219\u4e3a<code class=\"literal\">[local:<em class=\"replaceable\"><code>/dir/name</code></em>]</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%m</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\uff0c\u5728\u7b2c\u4e00\u4e2a\u70b9\u53f7\u5904\u622a\u65ad\uff1b\u5982\u679c\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\uff0c\u5219\u4e3a<code class=\"literal\">[local]</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%&gt;</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u76d1\u542c\u7684\u7aef\u53e3\u53f7\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%n</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u4f1a\u8bdd\u7528\u6237\u540d\u3002\uff08\u5728\u6570\u636e\u5e93\u4f1a\u8bdd\u671f\u95f4\uff0c<code class=\"command\">SET SESSION AUTHORIZATION</code>\u547d\u4ee4\u53ef\u80fd\u6539\u53d8\u8be5\u503c\u7684\u6269\u5c55\u7ed3\u679c\u3002\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%/</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%~</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7c7b\u4f3c <code class=\"literal\">%/</code>\uff0c\u4f46\u5982\u679c\u8be5\u6570\u636e\u5e93\u662f\u4f60\u7684\u9ed8\u8ba4\u6570\u636e\u5e93\uff0c\u5219\u8f93\u51fa <code class=\"literal\">~</code>\uff08\u6ce2\u6d6a\u53f7\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%#</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u4f1a\u8bdd\u7528\u6237\u662f\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\uff0c\u5219\u4e3a<code class=\"literal\">#</code>\uff0c\u5426\u5219\u4e3a<code class=\"literal\">&gt;</code>\u3002\uff08\u5728\u6570\u636e\u5e93\u4f1a\u8bdd\u671f\u95f4\uff0c<code class=\"command\">SET SESSION AUTHORIZATION</code>\u547d\u4ee4\u53ef\u80fd\u6539\u53d8\u8be5\u503c\u7684\u6269\u5c55\u7ed3\u679c\u3002\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%p</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u6240\u8fde\u63a5\u540e\u7aef\u7684\u8fdb\u7a0b ID\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%R</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u63d0\u793a\u7b26 1 \u4e2d\uff0c\u901a\u5e38\u663e\u793a =\uff1b\u4f46\u5982\u679c\u4f1a\u8bdd\u5904\u4e8e\u6761\u4ef6\u5757\u4e2d\u672a\u6fc0\u6d3b\u7684\u5206\u652f\uff0c\u5219\u663e\u793a @\uff1b\u5982\u679c\u5904\u4e8e\u5355\u884c\u6a21\u5f0f\uff0c\u5219\u663e\u793a ^\uff1b\u5982\u679c\u4f1a\u8bdd\u5df2\u65ad\u5f00\u6570\u636e\u5e93\u8fde\u63a5\uff08\u4f8b\u5982 \\connect \u5931\u8d25\u65f6\uff09\uff0c\u5219\u663e\u793a !\u3002\u5728\u63d0\u793a\u7b26 2 \u4e2d\uff0c%R \u4f1a\u66ff\u6362\u4e3a\u8868\u793a psql \u7b49\u5f85\u66f4\u591a\u8f93\u5165\u539f\u56e0\u7684\u5b57\u7b26\uff1a\u547d\u4ee4\u5c1a\u672a\u7ed3\u675f\u65f6\u4e3a -\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684 /* ... */ \u6ce8\u91ca\u65f6\u4e3a *\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u5e26\u5f15\u53f7\u5b57\u7b26\u4e32\u65f6\u4e3a\u5355\u5f15\u53f7\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u5e26\u5f15\u53f7\u6807\u8bc6\u7b26\u65f6\u4e3a\u53cc\u5f15\u53f7\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u7f8e\u5143\u5f15\u7528\u5b57\u7b26\u4e32\u65f6\u4e3a\u7f8e\u5143\u7b26\u53f7\uff1b\u5b58\u5728\u672a\u5339\u914d\u7684\u5de6\u62ec\u53f7\u65f6\u4e3a (\u3002\u5728\u63d0\u793a\u7b26 3 \u4e2d\uff0c%R \u4e0d\u4ea7\u751f\u4efb\u4f55\u5185\u5bb9\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%x</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u72b6\u6001\uff1a\u5982\u679c\u5f53\u524d\u4e0d\u5728\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff1b\u5982\u679c\u5904\u4e8e\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a <code class=\"literal\">*</code>\uff1b\u5982\u679c\u5904\u4e8e\u5931\u8d25\u7684\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a <code class=\"literal\">!</code>\uff1b\u5982\u679c\u4e8b\u52a1\u72b6\u6001\u4e0d\u786e\u5b9a\uff08\u4f8b\u5982\u56e0\u4e3a\u5f53\u524d\u6ca1\u6709\u8fde\u63a5\uff09\uff0c\u5219\u4e3a <code class=\"literal\">?</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%l</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8bed\u53e5\u4e2d\u7684\u884c\u53f7\uff0c\u4ece <code class=\"literal\">1</code> \u5f00\u59cb\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%</code><em class=\"replaceable\"><code>digits</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u66ff\u6362\u4e3a\u6307\u5b9a\u516b\u8fdb\u5236\u4ee3\u7801\u5bf9\u5e94\u7684\u5b57\u7b26\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%:</code><em class=\"replaceable\"><code>name</code></em><code class=\"literal\">:</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><span class=\"application\">psql</span> \u53d8\u91cf <em class=\"replaceable\"><code>name</code></em> \u7684\u503c\u3002\u8be6\u89c1\u4e0a\u9762\u7684<a class=\"xref\" href=\"/docs/14/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%`</code><em class=\"replaceable\"><code>command</code></em><code class=\"literal\">`</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><em class=\"replaceable\"><code>command</code></em> \u7684\u8f93\u51fa\uff0c\u7c7b\u4f3c\u666e\u901a\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u53cd\u5f15\u53f7</span>\u201d</span>\u66ff\u6362\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%[</code> ... <code class=\"literal\">%]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u63d0\u793a\u7b26\u4e2d\u53ef\u4ee5\u5305\u542b\u7ec8\u7aef\u63a7\u5236\u5b57\u7b26\uff0c\u4f8b\u5982\u6539\u53d8\u63d0\u793a\u6587\u672c\u7684\u989c\u8272\u3001\u80cc\u666f\u6216\u6837\u5f0f\uff0c\u6216\u8005\u6539\u53d8\u7ec8\u7aef\u7a97\u53e3\u6807\u9898\u3002\u4e3a\u4e86\u8ba9 <span class=\"application\">Readline</span> \u7684\u884c\u7f16\u8f91\u529f\u80fd\u6b63\u5e38\u5de5\u4f5c\uff0c\u8fd9\u4e9b\u4e0d\u53ef\u6253\u5370\u7684\u63a7\u5236\u5b57\u7b26\u5fc5\u987b\u7528 <code class=\"literal\">%[</code> \u548c <code class=\"literal\">%]</code> \u5305\u56f4\u8d77\u6765\uff0c\u4ee5\u6807\u8bb0\u4e3a\u4e0d\u53ef\u89c1\u5b57\u7b26\u3002\u63d0\u793a\u7b26\u4e2d\u53ef\u4ee5\u51fa\u73b0\u591a\u7ec4\u8fd9\u6837\u7684\u6807\u8bb0\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; \\set PROMPT1 '%[%033[1;33;40m%]%n@%/%R%[%033[0m%]%# '\n</pre>\n<p lang=\"zh\">\u5176\u6548\u679c\u662f\u5728\u517c\u5bb9 VT100 \u4e14\u652f\u6301\u989c\u8272\u7684\u7ec8\u7aef\u4e0a\uff0c\u751f\u6210\u4e00\u4e2a\u7c97\u4f53\uff08<code class=\"literal\">1;</code>\uff09\u7684\u9ed1\u5e95\u9ec4\u5b57\u63d0\u793a\u7b26\uff08<code class=\"literal\">33;40</code>\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%w</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0e\u6700\u8fd1\u4e00\u6b21\u8f93\u51fa\u7684 <code class=\"varname\">PROMPT1</code> \u5177\u6709\u76f8\u540c\u5bbd\u5ea6\u7684\u7a7a\u767d\u3002\u8fd9\u53ef\u7528\u4f5c <code class=\"varname\">PROMPT2</code> \u7684\u8bbe\u7f6e\uff0c\u4f7f\u591a\u884c\u8bed\u53e5\u4e0e\u7b2c\u4e00\u884c\u5bf9\u9f50\uff0c\u4f46\u4e0d\u663e\u793a\u53ef\u89c1\u7684\u4e8c\u7ea7\u63d0\u793a\u7b26\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8981\u5728\u63d0\u793a\u7b26\u4e2d\u63d2\u5165\u767e\u5206\u53f7\uff0c\u8bf7\u5199 %%\u3002\u63d0\u793a\u7b26 1 \u548c 2 \u7684\u9ed8\u8ba4\u503c\u4e3a '%/%R%x%# '\uff0c\u63d0\u793a\u7b26 3 \u7684\u9ed8\u8ba4\u503c\u4e3a '&gt;&gt; '\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">tcsh</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</div>\n<div class=\"refsect3\" id=\"id-1.9.4.20.8.5.5\">\n<h4 lang=\"zh\">\u547d\u4ee4\u884c\u7f16\u8f91</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u652f\u6301 <span class=\"application\">Readline</span> \u5e93\uff0c\u4fbf\u4e8e\u7f16\u8f91\u548c\u68c0\u7d22\u8f93\u5165\u884c\u3002\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\u4f1a\u5728 <span class=\"application\">psql</span> \u9000\u51fa\u65f6\u81ea\u52a8\u4fdd\u5b58\uff0c\u5e76\u5728 <span class=\"application\">psql</span> \u542f\u52a8\u65f6\u91cd\u65b0\u8f7d\u5165\u3002\u4e5f\u652f\u6301 Tab \u8865\u5168\uff0c\u4e0d\u8fc7\u5176\u8865\u5168\u903b\u8f91\u5e76\u4e0d\u58f0\u79f0\u81ea\u5df1\u662f <acronym class=\"acronym\">SQL</acronym> \u89e3\u6790\u5668\u3002Tab \u8865\u5168\u751f\u6210\u7684\u67e5\u8be2\u8fd8\u53ef\u80fd\u5e72\u6270\u5176\u4ed6 SQL \u547d\u4ee4\uff0c\u4f8b\u5982 <code class=\"literal\">SET TRANSACTION ISOLATION LEVEL</code>\u3002\u5982\u679c\u51fa\u4e8e\u67d0\u79cd\u539f\u56e0\u4f60\u4e0d\u559c\u6b22 Tab \u8865\u5168\uff0c\u53ef\u4ee5\u5c06\u4ee5\u4e0b\u5185\u5bb9\u653e\u5165\u4e3b\u76ee\u5f55\u4e0b\u540d\u4e3a <code class=\"filename\">.inputrc</code> \u7684\u6587\u4ef6\u4e2d\uff0c\u5c06\u5176\u5173\u95ed\uff1a</p>\n<pre class=\"programlisting\">$if psql\nset disable-completion on\n$endif\n</pre>\n<p lang=\"zh\">\uff08\u8fd9\u4e0d\u662f <span class=\"application\">psql</span> \u7684\u529f\u80fd\uff0c\u800c\u662f <span class=\"application\">Readline</span> \u7684\u529f\u80fd\u3002\u66f4\u591a\u7ec6\u8282\u8bf7\u9605\u8bfb\u5176\u6587\u6863\u3002\uff09</p>\n</div>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PSQL-ENVIRONMENT\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">COLUMNS</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c<code class=\"literal\">\\pset columns</code>\u4e3a\u96f6\uff0c\u8fd9\u4e2a\u73af\u5883\u53d8\u91cf\u63a7\u5236\u7528\u4e8e<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u5bbd\u5ea6\u4ee5\u53ca\u7528\u6765\u786e\u5b9a\u8f83\u5bbd\u7684\u8f93\u51fa\u662f\u5426\u9700\u8981\u5206\u9875\u5668\uff0c\u6216\u8005\u662f\u5426\u5e94\u5207\u6362\u5230\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e2d\u7684\u5782\u76f4\u683c\u5f0f\u7684\u5bbd\u5ea6\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PGDATABASE</code><br/></span><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\uff08\u89c1<a class=\"xref\" href=\"/docs/14/libpq-envars.html\" title=\"34.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a034.15\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PSQL_EDITOR</code><br/></span><span class=\"term\"><code class=\"envar\">EDITOR</code><br/></span><span class=\"term\"><code class=\"envar\">VISUAL</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"command\">\\e</code>\u3001<code class=\"command\">\\ef</code>\u4ee5\u53ca<code class=\"command\">\\ev</code>\u547d\u4ee4\u6240\u4f7f\u7528\u7684\u7f16\u8f91\u5668\u3002\u4f1a\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u68c0\u67e5\u8fd9\u4e9b\u53d8\u91cf\uff0c\u7b2c\u4e00\u4e2a\u88ab\u8bbe\u7f6e\u7684\u5c06\u88ab\u4f7f\u7528\u3002\u5982\u679c\u90fd\u6ca1\u6709\u88ab\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u662f\u4f7f\u7528Unix\u7cfb\u7edf\u4e0a\u7684<code class=\"filename\">vi</code>\u6216\u8005Windows\u7cfb\u7edf\u4e0a\u7684<code class=\"filename\">notepad.exe</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PSQL_EDITOR_LINENUMBER_ARG</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f53 <code class=\"command\">\\e</code>\u3001<code class=\"command\">\\ef</code> \u6216 <code class=\"command\">\\ev</code> \u5e26\u6709\u884c\u53f7\u53c2\u6570\u4f7f\u7528\u65f6\uff0c\u6b64\u53d8\u91cf\u6307\u5b9a\u5c06\u8d77\u59cb\u884c\u53f7\u4f20\u7ed9\u7528\u6237\u7f16\u8f91\u5668\u65f6\u6240\u7528\u7684\u547d\u4ee4\u884c\u53c2\u6570\u3002\u5bf9\u4e8e <span class=\"productname\">Emacs</span> \u6216 <span class=\"productname\">vi</span> \u4e4b\u7c7b\u7684\u7f16\u8f91\u5668\uff0c\u8fd9\u4e2a\u53c2\u6570\u662f\u4e00\u4e2a\u52a0\u53f7\u3002\u5982\u679c\u9009\u9879\u540d\u548c\u884c\u53f7\u4e4b\u95f4\u9700\u8981\u7a7a\u683c\uff0c\u8bf7\u5728\u53d8\u91cf\u503c\u4e2d\u5305\u542b\u672b\u5c3e\u7a7a\u683c\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">PSQL_EDITOR_LINENUMBER_ARG='+'\nPSQL_EDITOR_LINENUMBER_ARG='--line '\n</pre>\n<p lang=\"zh\">\u5728 Unix \u7cfb\u7edf\u4e0a\u9ed8\u8ba4\u662f<code class=\"literal\">+</code>\uff08\u5bf9\u5e94\u4e8e\u9ed8\u8ba4\u7f16\u8f91\u5668<code class=\"filename\">vi</code>\uff0c\u4e14\u5bf9\u5f88\u591a\u5176\u4ed6\u5e38\u89c1\u7f16\u8f91\u5668\u53ef\u7528\uff09\u3002\u5728 Windows \u7cfb\u7edf\u4e0a\u6ca1\u6709\u9ed8\u8ba4\u503c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PSQL_HISTORY</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u547d\u4ee4\u5386\u53f2\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08<code class=\"literal\">~</code>\uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PSQL_PAGER</code><br/></span><span class=\"term\"><code class=\"envar\">PAGER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u67e5\u8be2\u7ed3\u679c\u65e0\u6cd5\u5728\u5c4f\u5e55\u4e0a\u663e\u793a\u5b8c\u6574\uff0c\u5b83\u4eec\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6b64\u547d\u4ee4\u3002\u5178\u578b\u7684\u503c\u662f<code class=\"literal\">more</code>\u6216<code class=\"literal\">less</code>\u3002\u53ef\u4ee5\u901a\u8fc7\u5c06<code class=\"envar\">PSQL_PAGER</code>\u6216<code class=\"envar\">PAGER</code>\u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u6216\u901a\u8fc7\u8c03\u6574<code class=\"command\">\\pset</code>\u547d\u4ee4\u7684\u4e0e\u5206\u9875\u76f8\u5173\u7684\u9009\u9879\u6765\u7981\u7528\u5206\u9875\u5668\u3002\u8fd9\u4e9b\u53d8\u91cf\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u8fdb\u884c\u68c0\u67e5\uff1b\u4f7f\u7528\u6309\u8be5\u987a\u5e8f\u627e\u5230\u7684\u7b2c\u4e00\u4e2a\u5df2\u8bbe\u7f6e\u7684\u53d8\u91cf\u3002\u5982\u679c\u5b83\u4eec\u90fd\u6ca1\u6709\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5728\u5927\u591a\u6570\u5e73\u53f0\u4e0a\u4f7f\u7528<code class=\"literal\">more</code>\uff0c\u4f46\u5728Cygwin\u4e0a\u4f7f\u7528<code class=\"literal\">less</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PSQLRC</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7528\u6237\u7684<code class=\"filename\">.psqlrc</code>\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08<code class=\"literal\">~</code>\uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">SHELL</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u88ab<code class=\"command\">\\!</code>\u547d\u4ee4\u6267\u884c\u7684\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">TMPDIR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b58\u50a8\u4e34\u65f6\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u662f<code class=\"filename\">/tmp</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6 <span class=\"productname\">PostgreSQL</span> \u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528 <span class=\"application\">libpq</span> \u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/14/libpq-envars.html\" title=\"34.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a034.15\u00a0\u8282</a>\uff09\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.20.10\">\n<h2 lang=\"zh\">\u6587\u4ef6</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt lang=\"zh\"><span class=\"term\"><code class=\"filename\">psqlrc</code> \u548c <code class=\"filename\">~/.psqlrc</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u6ca1\u6709<code class=\"option\">-X</code>\u9009\u9879\uff0c\u5728\u8fde\u63a5\u5230\u6570\u636e\u5e93\u540e\u4f46\u5728\u63a5\u6536\u6b63\u5e38\u7684\u547d\u4ee4\u4e4b\u524d\uff0c<span class=\"application\">psql</span>\u4f1a\u5c1d\u8bd5\u4f9d\u6b21\u4ece\u7cfb\u7edf\u7ea7\u7684\u542f\u52a8\u6587\u4ef6\uff08<code class=\"filename\">psqlrc</code>\uff09\u548c\u7528\u6237\u7684\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\uff08<code class=\"filename\">~/.psqlrc</code>\uff09\u4e2d\u8bfb\u53d6\u5e76\u4e14\u6267\u884c\u547d\u4ee4\u3002\u8fd9\u4e9b\u6587\u4ef6\u53ef\u4ee5\u88ab\u7528\u6765\u8bbe\u7f6e\u5ba2\u6237\u7aef\u6216\u8005\u670d\u52a1\u5668\uff0c\u901a\u5e38\u662f\u4e00\u4e9b<code class=\"command\">\\set</code>\u548c<code class=\"command\">SET</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u7cfb\u7edf\u8303\u56f4\u7684\u542f\u52a8\u6587\u4ef6\u540d\u4e3a <code class=\"filename\">psqlrc</code>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4f1a\u5728\u5b89\u88c5\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u7cfb\u7edf\u914d\u7f6e</span>\u201d</span>\u76ee\u5f55\u4e2d\u67e5\u627e\u5b83\uff0c\u6700\u53ef\u9760\u7684\u8bc6\u522b\u65b9\u5f0f\u662f\u8fd0\u884c <code class=\"literal\">pg_config --sysconfdir</code>\u3002\u901a\u5e38\u8fd9\u4e2a\u76ee\u5f55\u662f\u76f8\u5bf9\u4e8e\u5305\u542b <span class=\"productname\">PostgreSQL</span> \u53ef\u6267\u884c\u6587\u4ef6\u7684\u76ee\u5f55\u7684 <code class=\"filename\">../etc/</code>\u3002\u4e5f\u53ef\u4ee5\u901a\u8fc7 <code class=\"envar\">PGSYSCONFDIR</code> \u73af\u5883\u53d8\u91cf\u663e\u5f0f\u6307\u5b9a\u67e5\u627e\u76ee\u5f55\u3002</p>\n<p lang=\"zh\">\u7528\u6237\u7684\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\u540d\u4e3a<code class=\"filename\">.psqlrc</code>\uff0c\u5e76\u4e14\u5728\u8c03\u7528\u7528\u6237\u7684\u4e3b\u76ee\u5f55\u4e2d\u5bfb\u627e\u3002Windows \u6ca1\u6709\u4e3b\u76ee\u5f55\u8fd9\u4e00\u6982\u5ff5\uff0c\u5728 Windows \u4e0a\uff0c\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\u7684\u540d\u79f0\u4e3a<code class=\"filename\">%APPDATA%\\postgresql\\psqlrc.conf</code>\u3002\u5728\u4efb\u4f55\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e<code class=\"envar\">PSQLRC</code>\u73af\u5883\u53d8\u91cf\u6765\u8986\u76d6\u6b64\u9ed8\u8ba4\u6587\u4ef6\u8def\u5f84\u3002</p>\n<p lang=\"zh\">\u7cfb\u7edf\u8303\u56f4\u7684\u542f\u52a8\u6587\u4ef6\u548c\u7528\u6237\u4e2a\u4eba\u7684\u542f\u52a8\u6587\u4ef6\u90fd\u53ef\u4ee5\u901a\u8fc7\u5728\u6587\u4ef6\u540d\u540e\u9644\u52a0\u8fde\u5b57\u7b26\u548c<span class=\"productname\">PostgreSQL</span>\u7684\u5927\u7248\u672c\u6216\u5c0f\u7248\u672c\u53f7\u6765\u4f7f\u5176\u4e0e<span class=\"application\">psql</span>\u7248\u672c\u76f8\u5173\uff0c\u4f8b\u5982<code class=\"filename\">~/.psqlrc-9.2</code>\u6216<code class=\"filename\">~/.psqlrc-9.2.5</code>\u3002\u6700\u5177\u4f53\u7248\u672c\u5339\u914d\u7684\u6587\u4ef6\u5c06\u4f18\u5148\u8bfb\u53d6\uff0c\u800c\u4e0d\u662f\u975e\u7279\u5b9a\u7248\u672c\u7684\u6587\u4ef6\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"filename\">.psql_history</code></span></dt>\n<dd>\n<p lang=\"zh\">\u547d\u4ee4\u884c\u5386\u53f2\u88ab\u5b58\u50a8\u5728\u6587\u4ef6<code class=\"filename\">~/.psql_history</code>\u4e2d\uff0c\u5728 Windows \u4e0a\u5219\u5b58\u50a8\u5728\u6587\u4ef6<code class=\"filename\">%APPDATA%\\postgresql\\psql_history</code>\u4e2d\u3002</p>\n<p lang=\"zh\">\u5386\u53f2\u6587\u4ef6\u7684\u4f4d\u7f6e\u53ef\u4ee5\u901a\u8fc7<code class=\"varname\">HISTFILE</code> <span class=\"application\">psql</span>\u53d8\u91cf\u6216\u8005<code class=\"envar\">PSQL_HISTORY</code>\u73af\u5883\u53d8\u91cf\u663e\u5f0f\u8bbe\u7f6e\u3002</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.20.11\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">psql</span>\u6700\u9002\u5408\u4e0e\u76f8\u540c\u6216\u8f83\u65e7\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\u914d\u5408\u4f7f\u7528\u3002\u5982\u679c\u670d\u52a1\u5668\u7684\u7248\u672c\u6bd4<span class=\"application\">psql</span>\u672c\u8eab\u66f4\u65b0\uff0c\u53cd\u659c\u7ebf\u547d\u4ee4\u7279\u522b\u5bb9\u6613\u5931\u8d25\u3002\u7136\u800c\uff0c<code class=\"literal\">\\d</code>\u7cfb\u5217\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u5e94\u8be5\u53ef\u4ee5\u5728\u6700\u4f4e\u81f3 7.4 \u7248\u672c\u7684\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\uff0c\u4f46\u4e0d\u4e00\u5b9a\u9002\u7528\u4e8e\u6bd4<span class=\"application\">psql</span>\u672c\u8eab\u66f4\u65b0\u7684\u670d\u52a1\u5668\u3002\u8fd0\u884cSQL\u547d\u4ee4\u548c\u663e\u793a\u67e5\u8be2\u7ed3\u679c\u7684\u4e00\u822c\u529f\u80fd\u4e5f\u5e94\u8be5\u53ef\u4ee5\u5728\u66f4\u65b0\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\uff0c\u4f46\u4e0d\u80fd\u4fdd\u8bc1\u5728\u6240\u6709\u60c5\u51b5\u4e0b\u90fd\u80fd\u5b9e\u73b0\u3002</p>\n<p>\u5982\u679c\u4f60\u60f3\u7528<span class=\"application\">psql</span>\u8fde\u63a5\u5230\u591a\u4e2a\u5177\u6709\u4e0d\u540c\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\uff0c\u63a8\u8350\u4f7f\u7528\u6700\u65b0\u7248\u672c\u7684<span class=\"application\">psql</span>\u3002\u6216\u8005\uff0c\u4f60\u53ef\u4ee5\u4e3a\u6bcf\u4e00\u4e2a\u5927\u7248\u672c\u4fdd\u7559\u4e00\u4efd<span class=\"application\">psql</span>\u62f7\u8d1d\uff0c\u5e76\u4e14\u9488\u5bf9\u76f8\u5e94\u7684\u670d\u52a1\u5668\u4f7f\u7528\u5339\u914d\u7684\u7248\u672c\u3002\u4f46\u5b9e\u9645\u4e0a\uff0c\u8fd9\u79cd\u989d\u5916\u7684\u9ebb\u70e6\u662f\u4e0d\u5fc5\u8981\u7684\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5728 <span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\uff0c<code class=\"option\">-c</code> \u9009\u9879\u610f\u5473\u7740 <code class=\"option\">-X</code>\uff08<code class=\"option\">--no-psqlrc</code>\uff09\uff1b\u73b0\u5728\u5df2\u7ecf\u4e0d\u662f\u8fd9\u6837\u4e86\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5728<span class=\"productname\">PostgreSQL</span> 8.4 \u4e4b\u524d\uff0c<span class=\"application\">psql</span>\u5141\u8bb8\u4e00\u4e2a\u5355\u5b57\u6bcd\u53cd\u659c\u7ebf\u547d\u4ee4\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u76f4\u63a5\u5199\u5728\u8be5\u547d\u4ee4\u540e\u9762\uff0c\u4e2d\u95f4\u4e0d\u9700\u8981\u7a7a\u767d\u3002\u73b0\u5728\u5219\u8981\u6c42\u7528\u7a7a\u767d\u5206\u9694\u3002</p>\n</li>\n</ul>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.20.12\">\n<h2 lang=\"zh\">\u7ed9 Windows \u7528\u6237\u7684\u6ce8\u89e3</h2>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u662f\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u63a7\u5236\u53f0\u5e94\u7528</span>\u201d</span>\u3002\u7531\u4e8e Windows \u7684\u63a7\u5236\u53f0\u7a97\u53e3\u4f7f\u7528\u7684\u662f\u4e00\u79cd\u548c\u7cfb\u7edf\u4e2d\u5176\u4ed6\u5e94\u7528\u4e0d\u540c\u7684\u7f16\u7801\uff0c\u5728<span class=\"application\">psql</span>\u4e2d\u4f7f\u7528 8 \u4f4d\u5b57\u7b26\u65f6\u8981\u7279\u522b\u6ce8\u610f\u3002\u5982\u679c<span class=\"application\">psql</span>\u68c0\u6d4b\u5230\u4e00\u4e2a\u6709\u95ee\u9898\u7684\u63a7\u5236\u53f0\u4ee3\u7801\u9875\uff0c\u5b83\u5c06\u4f1a\u5728\u542f\u52a8\u65f6\u8b66\u544a\u4f60\u3002\u8981\u66f4\u6539\u63a7\u5236\u53f0\u4ee3\u7801\u9875\uff0c\u6709\u4e24\u4ef6\u4e8b\u662f\u5fc5\u8981\u7684\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u8f93\u5165<strong class=\"userinput\"><code>cmd.exe /c chcp 1252</code></strong>\u53ef\u4ee5\u8bbe\u7f6e\u4ee3\u7801\u9875\uff081252 \u662f\u9002\u7528\u4e8e\u5fb7\u8bed\u7684\u4e00\u4e2a\u4ee3\u7801\u9875\uff0c\u8bf7\u5728\u8fd9\u91cc\u66ff\u6362\u6210\u4f60\u7684\u503c\uff09\u3002\u5982\u679c\u6b63\u5728\u4f7f\u7528 Cygwin\uff0c\u53ef\u4ee5\u628a\u8fd9\u4e2a\u547d\u4ee4\u653e\u5728<code class=\"filename\">/etc/profile</code>\u4e2d\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u628a\u63a7\u5236\u53f0\u5b57\u4f53\u8bbe\u7f6e\u4e3a<code class=\"literal\">Lucida Console</code>\uff0c\u56e0\u4e3a\u6805\u683c\u5b57\u4f53\u65e0\u6cd5\u4e0e ANSI \u4ee3\u7801\u9875\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</li>\n</ul>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PSQL-EXAMPLES\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u7b2c\u4e00\u4e2a\u793a\u4f8b\u5c55\u793a\u4e86\u5982\u4f55\u628a\u4e00\u6761\u547d\u4ee4\u5206\u6563\u5230\u591a\u884c\u8f93\u5165\u4e2d\u3002\u6ce8\u610f\u63d0\u793a\u7b26\u7684\u53d8\u5316\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>CREATE TABLE my_table (</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code> first integer not null default 0,</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code> second text)</code></strong>\ntestdb-&gt; <strong class=\"userinput\"><code>;</code></strong>\nCREATE TABLE\n</pre>\n<p lang=\"zh\">\u73b0\u5728\u518d\u6765\u770b\u4e00\u4e0b\u8fd9\u4e2a\u8868\u7684\u5b9a\u4e49\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\d my_table</code></strong>\n              Table \"public.my_table\"\n Column |  Type   | Collation | Nullable | Default\n--------+---------+-----------+----------+---------\n first  | integer |           | not null | 0\n second | text    |           |          | \n</pre>\n<p lang=\"zh\">\u73b0\u5728\u6211\u4eec\u628a\u63d0\u793a\u7b26\u6539\u6210\u66f4\u6709\u8da3\u7684\u5f62\u5f0f\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set PROMPT1 '%n@%m %~%R%# '</code></strong>\npeter@localhost testdb=&gt;\n</pre>\n<p lang=\"zh\">\u5047\u8bbe\u4f60\u5df2\u7ecf\u5411\u8868\u4e2d\u586b\u5165\u6570\u636e\uff0c\u5e76\u60f3\u770b\u4e00\u770b\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; SELECT * FROM my_table;\n first | second\n-------+--------\n     1 | one\n     2 | two\n     3 | three\n     4 | four\n(4 rows)\n</pre>\n<p lang=\"zh\">\u4f60\u53ef\u4ee5\u4f7f\u7528 <code class=\"command\">\\pset</code> \u547d\u4ee4\u4ee5\u4e0d\u540c\u65b9\u5f0f\u663e\u793a\u8868\u683c\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 2</code></strong>\nBorder style is 2.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\n+-------+--------+\n| first | second |\n+-------+--------+\n|     1 | one    |\n|     2 | two    |\n|     3 | three  |\n|     4 | four   |\n+-------+--------+\n(4 rows)\n\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 0</code></strong>\nBorder style is 0.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\nfirst second\n----- ------\n    1 one\n    2 two\n    3 three\n    4 four\n(4 rows)\n\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 1</code></strong>\nBorder style is 1.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset format csv</code></strong>\nOutput format is csv.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset tuples_only</code></strong>\nTuples only is on.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT second, first FROM my_table;</code></strong>\none,1\ntwo,2\nthree,3\nfour,4\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset format unaligned</code></strong>\nOutput format is unaligned.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset fieldsep '\\t'</code></strong>\nField separator is \"    \".\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT second, first FROM my_table;</code></strong>\none     1\ntwo     2\nthree   3\nfour    4\n</pre>\n<p lang=\"zh\">\u6216\u8005\u4f7f\u7528\u77ed\u547d\u4ee4\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\a \\t \\x</code></strong>\nOutput format is aligned.\nTuples only is off.\nExpanded display is on.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\n-[ RECORD 1 ]-\nfirst  | 1\nsecond | one\n-[ RECORD 2 ]-\nfirst  | 2\nsecond | two\n-[ RECORD 3 ]-\nfirst  | 3\nsecond | three\n-[ RECORD 4 ]-\nfirst  | 4\nsecond | four\n</pre>\n<p lang=\"zh\">\u6b64\u5916\uff0c\u53ef\u4ee5\u4f7f\u7528<code class=\"literal\">\\g</code>\u4e3a\u4e00\u4e2a\u67e5\u8be2\u8bbe\u7f6e\u8fd9\u4e9b\u8f93\u51fa\u683c\u5f0f\u9009\u9879\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table</code></strong>\npeter@localhost testdb-&gt; <strong class=\"userinput\"><code>\\g (format=aligned tuples_only=off expanded=on)</code></strong>\n-[ RECORD 1 ]-\nfirst  | 1\nsecond | one\n-[ RECORD 2 ]-\nfirst  | 2\nsecond | two\n-[ RECORD 3 ]-\nfirst  | 3\nsecond | three\n-[ RECORD 4 ]-\nfirst  | 4\nsecond | four\n</pre>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4e00\u4e2a\u4f7f\u7528 <code class=\"command\">\\df</code> \u547d\u4ee4\u53ea\u67e5\u627e\u540d\u79f0\u5339\u914d <code class=\"literal\">int*pl</code> \u4e14\u7b2c\u4e8c\u4e2a\u53c2\u6570\u7c7b\u578b\u4e3a <code class=\"type\">bigint</code> \u7684\u51fd\u6570\u7684\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\df int*pl * bigint</code></strong>\n                          List of functions\n   Schema   |  Name   | Result data type | Argument data types | Type\n------------+---------+------------------+---------------------+------\n pg_catalog | int28pl | bigint           | smallint, bigint    | func\n pg_catalog | int48pl | bigint           | integer, bigint     | func\n pg_catalog | int8pl  | bigint           | bigint, bigint      | func\n(3 rows)\n</pre>\n<p lang=\"zh\">\u5728\u9002\u5408\u7684\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u4f7f\u7528 <code class=\"command\">\\crosstabview</code> \u547d\u4ee4\u5c06\u67e5\u8be2\u7ed3\u679c\u663e\u793a\u4e3a\u4ea4\u53c9\u8868\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>SELECT first, second, first &gt; 2 AS gt2 FROM my_table;</code></strong>\n first | second | gt2 \n-------+--------+-----\n     1 | one    | f\n     2 | two    | f\n     3 | three  | t\n     4 | four   | t\n(4 rows)\n\ntestdb=&gt; <strong class=\"userinput\"><code>\\crosstabview first second</code></strong>\n first | one | two | three | four \n-------+-----+-----+-------+------\n     1 | f   |     |       | \n     2 |     | f   |       | \n     3 |     |     | t     | \n     4 |     |     |       | t\n(4 rows)\n</pre>\n<p lang=\"zh\">\u7b2c\u4e8c\u4e2a\u793a\u4f8b\u5c55\u793a\u4e86\u4e00\u4e2a\u4e58\u6cd5\u8868\uff0c\u5176\u4e2d\u884c\u6309\u6570\u5b57\u5012\u5e8f\u6392\u5217\uff0c\u800c\u5217\u6309\u72ec\u7acb\u7684\u5347\u5e8f\u6570\u5b57\u6392\u5217\u3002</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>SELECT t1.first as \"A\", t2.first+100 AS \"B\", t1.first*(t2.first+100) as \"AxB\",</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code>row_number() over(order by t2.first) AS ord</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code>FROM my_table t1 CROSS JOIN my_table t2 ORDER BY 1 DESC</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code>\\crosstabview \"A\" \"B\" \"AxB\" ord</code></strong>\n A | 101 | 102 | 103 | 104 \n---+-----+-----+-----+-----\n 4 | 404 | 408 | 412 | 416\n 3 | 303 | 306 | 309 | 312\n 2 | 202 | 204 | 206 | 208\n 1 | 101 | 102 | 103 | 104\n(4 rows)\n</pre>\n</div>\n</div></div>", "manual_path": "app-psql.html", "localization": {"status": "complete", "sources": [{"url": "/docs/14/app-psql.html", "method": "same-major semantic node", "sha256": "11c74f85ef9d2c9b3921e0c622d69dd3f1b3ed0c916197a94ddab5540153e310", "language": "zh", "matched_nodes": ["#APP-PSQL/div[10]/div[1]/ul[0]/li[0]", "#APP-PSQL/div[10]/div[1]/ul[0]/li[1]", "#APP-PSQL/div[10]/div[1]/ul[0]/li[2]", "#APP-PSQL/div[10]/h2[0]", "#APP-PSQL/div[11]/div[2]/ul[0]/li[0]", "#APP-PSQL/div[11]/div[2]/ul[0]/li[1]", "#APP-PSQL/div[11]/h2[0]", "#APP-PSQL/div[11]/p[1]", "#APP-PSQL/div[12]/p[11]", "#APP-PSQL/div[12]/p[13]", "#APP-PSQL/div[12]/p[15]", "#APP-PSQL/div[12]/p[17]", "#APP-PSQL/div[12]/p[19]", "#APP-PSQL/div[12]/p[1]", "#APP-PSQL/div[12]/p[3]", "#APP-PSQL/div[12]/p[5]", "#APP-PSQL/div[12]/p[7]", "#APP-PSQL/div[12]/p[9]", "#APP-PSQL/div[2]/p[1]", "#APP-PSQL/div[3]/h2[0]", "#APP-PSQL/div[4]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[11]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[13]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[15]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]/p[2]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[19]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[21]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[23]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[25]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[25]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[27]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[29]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[31]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[35]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[37]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[39]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[3]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[41]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]/div[1]/h3[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]/div[1]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[45]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[47]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[49]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[51]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[53]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[55]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[55]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[57]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[57]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[59]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[5]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[61]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[63]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[65]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[67]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[67]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[69]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[3]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[5]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[6]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[7]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[9]", "#APP-PSQL/div[6]/h2[0]", "#APP-PSQL/div[6]/p[1]", "#APP-PSQL/div[7]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[1]/p[1]", "#APP-PSQL/div[7]/div[1]/p[2]", "#APP-PSQL/div[7]/div[1]/p[5]", "#APP-PSQL/div[7]/div[1]/p[6]", "#APP-PSQL/div[7]/div[1]/p[7]", "#APP-PSQL/div[7]/div[2]/h3[0]", "#APP-PSQL/div[7]/div[2]/p[1]", "#APP-PSQL/div[7]/div[2]/p[3]", "#APP-PSQL/div[7]/div[2]/p[4]", "#APP-PSQL/div[7]/div[2]/p[5]", "#APP-PSQL/div[7]/div[2]/p[6]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[101]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[103]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[105]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[105]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[105]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[105]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[107]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[109]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[109]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[109]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[109]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[109]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[111]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[111]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[113]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[115]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[115]/p[0]/a[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[115]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[115]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[115]/p[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[119]/div[2]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[119]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[119]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]/div[5]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[121]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[123]/div[2]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[123]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[123]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[125]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[125]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[125]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[125]/p[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[125]/p[6]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[127]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[129]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[131]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[139]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[139]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[139]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[139]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[141]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[143]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dd[15]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dd[15]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dd[15]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dd[15]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dd[17]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dd[17]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dd[17]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dd[17]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dd[21]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dd[23]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dd[29]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dd[31]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dd[31]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dd[37]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dd[41]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dt[30]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dt[32]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dt[34]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/dl[0]/dt[6]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[5]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/p[4]/a[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[149]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[153]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[157]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[159]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[159]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[159]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[159]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[159]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[15]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[15]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[161]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[163]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[163]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[165]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[165]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[165]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[167]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[169]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[171]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[173]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[173]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[175]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[175]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[177]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[179]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[0]/a[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[181]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[183]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[185]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[185]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[187]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[187]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[189]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[191]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[191]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[191]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[191]/p[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[21]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[23]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[25]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[29]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[31]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[37]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[37]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[37]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[41]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[41]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[43]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[45]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[47]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[49]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[49]/div[1]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[49]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[51]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[53]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[55]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[57]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[59]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[61]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[63]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[65]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[67]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[69]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[71]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[73]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[75]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[75]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[77]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[77]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[77]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[79]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[79]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[7]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[7]/div[1]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[7]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[81]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[83]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[85]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[87]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[89]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[91]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[93]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[95]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[95]/div[4]/p[1]/a[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[95]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[95]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[95]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[95]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[97]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[97]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[97]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[99]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[99]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[99]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[99]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[118]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[120]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[122]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[126]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[128]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[138]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[140]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[148]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[152]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[176]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[94]", "#APP-PSQL/div[7]/div[3]/div[11]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/p[6]", "#APP-PSQL/div[7]/div[3]/div[11]/p[7]", "#APP-PSQL/div[7]/div[3]/h3[0]", "#APP-PSQL/div[7]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/p[2]", "#APP-PSQL/div[7]/div[3]/p[3]", "#APP-PSQL/div[7]/div[3]/p[4]", "#APP-PSQL/div[7]/div[3]/p[4]/a[2]", "#APP-PSQL/div[7]/div[3]/p[5]", "#APP-PSQL/div[7]/div[3]/p[7]", "#APP-PSQL/div[7]/div[3]/p[8]", "#APP-PSQL/div[7]/div[3]/p[9]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[15]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[17]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/div[2]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[21]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[21]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[23]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[23]/p[2]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[41]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[41]/p[0]/a[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[43]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[47]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[49]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[51]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[53]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[55]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[57]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[59]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[61]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[4]/div[1]/div[8]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/p[10]", "#APP-PSQL/div[7]/div[4]/div[1]/p[11]", "#APP-PSQL/div[7]/div[4]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/p[2]", "#APP-PSQL/div[7]/div[4]/div[1]/p[4]", "#APP-PSQL/div[7]/div[4]/div[1]/p[6]", "#APP-PSQL/div[7]/div[4]/div[1]/p[7]", "#APP-PSQL/div[7]/div[4]/div[1]/p[9]", "#APP-PSQL/div[7]/div[4]/div[2]/p[10]", "#APP-PSQL/div[7]/div[4]/div[2]/p[11]", "#APP-PSQL/div[7]/div[4]/div[2]/p[12]", "#APP-PSQL/div[7]/div[4]/div[2]/p[1]", "#APP-PSQL/div[7]/div[4]/div[2]/p[3]", "#APP-PSQL/div[7]/div[4]/div[2]/p[4]", "#APP-PSQL/div[7]/div[4]/div[2]/p[6]", "#APP-PSQL/div[7]/div[4]/div[2]/p[7]", "#APP-PSQL/div[7]/div[4]/div[2]/p[9]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[15]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[21]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[23]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[25]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[29]/p[0]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[29]/p[2]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[31]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[4]/div[3]/div[5]/p[1]", "#APP-PSQL/div[7]/div[4]/div[3]/p[1]", "#APP-PSQL/div[7]/div[4]/div[3]/p[2]", "#APP-PSQL/div[7]/div[4]/div[4]/h4[0]", "#APP-PSQL/div[7]/div[4]/div[4]/p[1]", "#APP-PSQL/div[7]/div[4]/div[4]/p[3]", "#APP-PSQL/div[7]/div[4]/h3[0]", "#APP-PSQL/div[7]/h2[0]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[11]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[13]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[15]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[17]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[19]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[1]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[3]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[5]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[7]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]/p[0]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]/p[2]", "#APP-PSQL/div[8]/p[2]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[0]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[1]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[2]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[3]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[3]/p[0]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[3]/p[1]", "#APP-PSQL/div[9]/div[1]/dl[0]/dt[0]", "#APP-PSQL/div[9]/h2[0]"]}, {"url": "/docs/14/indexes-index-only-scans.html", "method": "same-major semantic node", "sha256": "f8a46b9c0d2bd9c364ec919e232d76d416b80205b7dd773ee8224048dea4d53a", "language": "zh", "matched_nodes": ["#INDEXES-INDEX-ONLY-SCANS/p[25]/span[2]"]}], "language": "zh", "original_text": {"/versions/14/description/0": "psql \u2014 PostgreSQL interactive terminal", "/versions/14/facts/0/label": "Documented executable", "/versions/14/facts/1/label": "Executable version", "/versions/14/facts/2/label": "Reference inventory", "/versions/14/facts/2/value": "Client applications", "/versions/14/facts/3/label": "Option definition groups", "/versions/14/tables/0/title": "Documented options", "/versions/14/tables/1/title": "Environment variables", "/versions/14/related/0/label": "psql meta-commands", "/versions/14/related/1/label": "libpq connection parameters", "/versions/14/tables/0/rows/0/summary": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all .", "/versions/14/tables/0/rows/1/summary": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned .", "/versions/14/tables/0/rows/2/summary": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors .", "/versions/14/tables/0/rows/3/summary": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence.", "/versions/14/tables/0/rows/4/summary": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv .", "/versions/14/tables/0/rows/5/summary": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "/versions/14/tables/0/rows/6/summary": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries .", "/versions/14/tables/0/rows/7/summary": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on .", "/versions/14/tables/0/rows/8/summary": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i .", "/versions/14/tables/0/rows/9/summary": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f .", "/versions/14/tables/0/columns/0/label": "Option and arguments", "/versions/14/tables/0/columns/1/label": "Description", "/versions/14/tables/0/rows/10/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket.", "/versions/14/tables/0/rows/11/summary": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command.", "/versions/14/tables/0/rows/12/summary": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list .", "/versions/14/tables/0/rows/13/summary": "Write all query output into file filename , in addition to the normal output destination.", "/versions/14/tables/0/rows/14/summary": "Do not use Readline for line editing and do not use the command history. This can be useful to turn off tab expansion when cutting and pasting.", "/versions/14/tables/0/rows/15/summary": "Put all query output into file filename . This is equivalent to the command \\o .", "/versions/14/tables/0/rows/16/summary": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432.", "/versions/14/tables/0/rows/17/summary": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex .", "/versions/14/tables/0/rows/18/summary": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on .", "/versions/14/tables/0/rows/19/summary": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep .", "/versions/14/tables/0/rows/20/summary": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts.", "/versions/14/tables/0/rows/21/summary": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does.", "/versions/14/tables/0/rows/22/summary": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only .", "/versions/14/tables/0/rows/23/summary": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details.", "/versions/14/tables/0/rows/24/summary": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)", "/versions/14/tables/0/rows/25/summary": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later.", "/versions/14/tables/0/rows/26/summary": "Print the psql version and exit.", "/versions/14/tables/0/rows/27/summary": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/14/tables/0/rows/28/summary": "Force psql to prompt for a password before connecting to a database, even if the password will not be used.", "/versions/14/tables/0/rows/29/summary": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded .", "/versions/14/tables/0/rows/30/summary": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file).", "/versions/14/tables/0/rows/31/summary": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero .", "/versions/14/tables/0/rows/32/summary": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero .", "/versions/14/tables/0/rows/33/summary": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. This ensures that either all the commands complete successfully, or no changes are applied.", "/versions/14/tables/0/rows/34/summary": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables.", "/versions/14/tables/1/columns/0/label": "Variable", "/versions/14/tables/1/columns/1/label": "Meaning", "/versions/14/tables/1/rows/0/description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode.", "/versions/14/tables/1/rows/1/description": "Default connection parameters (see Section 34.15 ).", "/versions/14/tables/1/rows/2/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .", "/versions/14/tables/1/rows/3/description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems.", "/versions/14/tables/1/rows/4/description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems.", "/versions/14/tables/1/rows/5/description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed.", "/versions/14/tables/1/rows/6/description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use more on most platforms, but less on Cygwin.", "/versions/14/tables/1/rows/7/description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed.", "/versions/14/tables/1/rows/8/description": "Command executed by the \\! command.", "/versions/14/tables/1/rows/9/description": "Directory for storing temporary files. The default is /tmp ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "94a92a58fa760d003bc1821d87cea1ef30058d6322c5eb41b1f21b7408426e06"}, "comparison_data": {"options": [{"names": ["-a", "--echo-all"], "signature": "-a --echo-all", "description": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all ."}, {"names": ["-A", "--no-align"], "signature": "-A --no-align", "description": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned ."}, {"names": ["-b", "--echo-errors"], "signature": "-b --echo-errors", "description": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors ."}, {"names": ["-c command", "--command= command"], "signature": "-c command --command= command", "description": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. command must be either a command string that is completely parsable by the server (i.e., it contains no psql -specific features), or a single backslash command. Thus you cannot mix SQL and psql meta-commands within a -c option. To achieve that, you could use repeated -c options or pipe the string into psql , for example: psql -c '\\x' -c 'SELECT * FROM foo;' or echo '\\x \\\\ SELECT * FROM foo;' | psql ( \\\\ is the separator meta-command.) Each SQL command string passed to -c is sent to the server as a single request. Because of this, the server executes it as a single transaction even if the string contains multiple SQL commands, unless there are explicit BEGIN / COMMIT commands included in the string to divide it into multiple transactions. (See Section 53.2.2.1 for more details about how the server handles multi-query strings.) Also, psql only prints the result of the last SQL command in the string. This is different from the behavior when the same string is read from a file or fed to psql 's standard input, because then psql sends each SQL command separately. Because of this behavior, putting more than one SQL command in a single -c string often has unexpected results. It's better to use repeated -c commands or feed multiple commands to psql 's standard input, either using echo as illustrated above, or via a shell here-document, for example: psql <<EOF \\x SELECT * FROM foo; EOF"}, {"names": ["--csv"], "signature": "--csv", "description": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv ."}, {"names": ["-d dbname", "--dbname= dbname"], "signature": "-d dbname --dbname= dbname", "description": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--echo-queries"], "signature": "-e --echo-queries", "description": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries ."}, {"names": ["-E", "--echo-hidden"], "signature": "-E --echo-hidden", "description": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on ."}, {"names": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i . If filename is - (hyphen), then standard input is read until an EOF indication or \\q meta-command. This can be used to intersperse interactive input with input from files. Note however that Readline is not used in this case (much as if -n had been specified). Using this option is subtly different from writing psql < filename . In general, both will do what you expect, but using -f enables some nice features such as error messages with line numbers. There is also a slight chance that using this option will reduce the start-up overhead. On the other hand, the variant using the shell's input redirection is (in theory) guaranteed to yield exactly the same output you would have received had you entered everything by hand."}, {"names": ["-F separator", "--field-separator= separator"], "signature": "-F separator --field-separator= separator", "description": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f ."}, {"names": ["-h hostname", "--host= hostname"], "signature": "-h hostname --host= hostname", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket."}, {"names": ["-H", "--html"], "signature": "-H --html", "description": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command."}, {"names": ["-l", "--list"], "signature": "-l --list", "description": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list . When this option is used, psql will connect to the database postgres , unless a different database is named on the command line (option -d or non-option argument, possibly via a service entry, but not via an environment variable)."}, {"names": ["-L filename", "--log-file= filename"], "signature": "-L filename --log-file= filename", "description": "Write all query output into file filename , in addition to the normal output destination."}, {"names": ["-n", "--no-readline"], "signature": "-n --no-readline", "description": "Do not use Readline for line editing and do not use the command history. This can be useful to turn off tab expansion when cutting and pasting."}, {"names": ["-o filename", "--output= filename"], "signature": "-o filename --output= filename", "description": "Put all query output into file filename . This is equivalent to the command \\o ."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432."}, {"names": ["-P assignment", "--pset= assignment"], "signature": "-P assignment --pset= assignment", "description": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex ."}, {"names": ["-q", "--quiet"], "signature": "-q --quiet", "description": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on ."}, {"names": ["-R separator", "--record-separator= separator"], "signature": "-R separator --record-separator= separator", "description": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep ."}, {"names": ["-s", "--single-step"], "signature": "-s --single-step", "description": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts."}, {"names": ["-S", "--single-line"], "signature": "-S --single-line", "description": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does. Note This mode is provided for those who insist on it, but you are not necessarily encouraged to use it. In particular, if you mix SQL and meta-commands on a line the order of execution might not always be clear to the inexperienced user."}, {"names": ["-t", "--tuples-only"], "signature": "-t --tuples-only", "description": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only ."}, {"names": ["-T table_options", "--table-attr= table_options"], "signature": "-T table_options --table-attr= table_options", "description": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)"}, {"names": ["-v assignment", "--set= assignment", "--variable= assignment"], "signature": "-v assignment --set= assignment --variable= assignment", "description": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the psql version and exit."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Force psql to prompt for a password before connecting to a database, even if the password will not be used. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, psql will prompt for a password in any case. However, psql will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-x", "--expanded"], "signature": "-x --expanded", "description": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded ."}, {"names": ["-X", "--no-psqlrc"], "signature": "-X --no-psqlrc", "description": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file)."}, {"names": ["-z", "--field-separator-zero"], "signature": "-z --field-separator-zero", "description": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero ."}, {"names": ["-0", "--record-separator-zero"], "signature": "-0 --record-separator-zero", "description": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero ."}, {"names": ["-1", "--single-transaction"], "signature": "-1 --single-transaction", "description": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. This ensures that either all the commands complete successfully, or no changes are applied. If the commands themselves contain BEGIN , COMMIT , or ROLLBACK , this option will not have the desired effects. Also, if an individual command cannot be executed inside a transaction block, specifying this option will cause the whole transaction to fail."}, {"names": ["-?", "--help[= topic ]"], "signature": "-? --help[= topic ]", "description": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables."}], "synopsis": ["psql [ option ...] [ dbname [ username ]]"], "environment": [{"name": "COLUMNS", "description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode."}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters (see Section 34.15 )."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems."}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems."}, {"name": "PSQL_HISTORY", "description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed."}, {"name": "PSQL_PAGER PAGER", "description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use more on most platforms, but less on Cygwin."}, {"name": "PSQLRC", "description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed."}, {"name": "SHELL", "description": "Command executed by the \\! command."}, {"name": "TMPDIR", "description": "Directory for storing temporary files. The default is /tmp ."}]}, "comparison_hash": "a7a7eaae77ee600210e73e0976533ca493dd8e8d667f2da2f915d6b14fa1ca6c", "manual_language": "zh"}, "15": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "psql"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "15.19"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "35"}], "tables": [{"key": "options", "rows": [{"summary": "\u5728\u8bfb\u5165\u65f6\u5c06\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u884c\u8bfb\u53d6\uff09\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a all \u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-a --echo-all"}}, {"summary": "\u5207\u6362\u5230\u975e\u5bf9\u9f50\u8f93\u51fa\u6a21\u5f0f\uff08\u9ed8\u8ba4\u8f93\u51fa\u6a21\u5f0f\u662f aligned \uff09\u3002\u8fd9\u7b49\u6548\u4e8e \\pset format unaligned \u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-A --no-align"}}, {"summary": "\u628a\u5931\u8d25\u7684 SQL \u547d\u4ee4\u6253\u5370\u5230\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a errors \u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-b --echo-errors"}}, {"summary": "\u6307\u5b9a psql \u6267\u884c\u4e00\u4e2a\u7ed9\u5b9a\u7684\u547d\u4ee4\u5b57\u7b26\u4e32 command \u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u591a\u6b21\u5e76\u4e14\u4ee5\u4efb\u4f55\u987a\u5e8f\u4e0e -f \u9009\u9879\u7ec4\u5408\u5728\u4e00\u8d77\u3002\u5f53 -c \u6216\u8005 -f \u88ab\u6307\u5b9a\u65f6\uff0c psql \u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709 -c \u548c -f \u9009\u9879\u540e\u7ec8\u6b62\u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-c command --command= command"}}, {"summary": "\u5207\u6362\u5230 CSV \uff08\u9017\u53f7\u5206\u9694\u503c\uff09\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u76f8\u5f53\u4e8e \\pset format csv \u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "--csv"}}, {"summary": "\u6307\u5b9a\u8981\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002\u8fd9\u7b49\u6548\u4e8e\u6307\u5b9a dbname \u4e3a\u547d\u4ee4\u884c\u4e0a\u7684\u7b2c\u4e00\u4e2a\u975e\u9009\u9879\u53c2\u6570\u3002 dbname \u53ef\u4ee5\u662f \u8fde\u63a5\u5b57\u7b26\u4e32 \u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u5c06\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-d dbname --dbname= dbname"}}, {"summary": "\u4e5f\u628a\u53d1\u9001\u5230\u670d\u52a1\u5668\u7684\u6240\u6709 SQL \u547d\u4ee4\u590d\u5236\u5230\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a queries \u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-e --echo-queries"}}, {"summary": "\u56de\u663e \\d \u4ee5\u53ca\u5176\u4ed6\u53cd\u659c\u7ebf\u547d\u4ee4\u751f\u6210\u7684\u5b9e\u9645\u67e5\u8be2\u3002\u53ef\u4ee5\u7528\u5b83\u6765\u5b66\u4e60 psql \u7684\u5185\u90e8\u64cd\u4f5c\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO_HIDDEN \u8bbe\u7f6e\u4e3a on \u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-E --echo-hidden"}}, {"summary": "\u4ece\u6587\u4ef6 filename \u800c\u4e0d\u662f\u6807\u51c6\u8f93\u5165\u4e2d\u8bfb\u53d6\u547d\u4ee4\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u6307\u5b9a\uff0c\u4e5f\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u4e0e -c \u9009\u9879\u7ec4\u5408\u4f7f\u7528\u3002\u5f53\u6307\u5b9a\u4e86 -c \u6216 -f \u65f6\uff0c psql \u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709 -c \u548c -f \u9009\u9879\u540e\u7ec8\u6b62\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u7b49\u4ef7\u4e8e\u5143\u547d\u4ee4 \\i \u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-f filename --file= filename"}}, {"summary": "\u4f7f\u7528 separator \u4f5c\u4e3a\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e \\pset fieldsep \u6216\u8005 \\f \u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-F separator --field-separator= separator"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-h hostname --host= hostname"}}, {"summary": "\u5207\u6362\u5230 HTML \u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e \\pset format html \u6216\u8005 \\H \u547d\u4ee4\u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-H --html"}}, {"summary": "\u5217\u51fa\u6240\u6709\u53ef\u7528\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u9000\u51fa\u3002\u5176\u4ed6\u975e\u8fde\u63a5\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002\u8fd9\u4e0e\u5143\u547d\u4ee4 \\list \u7c7b\u4f3c\u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-l --list"}}, {"summary": "\u9664\u4e86\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u5199\u5230\u666e\u901a\u8f93\u51fa\u76ee\u6807\u4e4b\u5916\uff0c\u8fd8\u5199\u5230\u6587\u4ef6 filename \u4e2d\u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-L filename --log-file= filename"}}, {"summary": "\u4e0d\u8981\u4f7f\u7528 Readline \u8fdb\u884c\u884c\u7f16\u8f91\uff0c\u4e5f\u4e0d\u8981\u4f7f\u7528\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\uff08\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684 \u201c\u547d\u4ee4\u884c\u7f16\u8f91\u201d\u4e00\u8282 \uff09\u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-n --no-readline"}}, {"summary": "\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u653e\u5230\u6587\u4ef6 filename \u4e2d\u3002\u8fd9\u7b49\u6548\u4e8e\u547d\u4ee4 \\o \u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-o filename --output= filename"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u7684\u6587\u4ef6\u540d\u540e\u7f00\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u7684\u503c\uff1b\u672a\u8bbe\u7f6e\u65f6\uff0c\u4f7f\u7528\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u7aef\u53e3\uff0c\u901a\u5e38\u4e3a 5432\u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-p port --port= port"}}, {"summary": "\u4ee5 \\pset \u7684\u5f62\u5f0f\u6307\u5b9a\u6253\u5370\u9009\u9879\u3002\u6ce8\u610f\uff0c\u8fd9\u91cc\u4f60\u5fc5\u987b\u7528\u4e00\u4e2a\u7b49\u53f7\u800c\u4e0d\u662f\u7a7a\u683c\u6765\u5206\u9694\u540d\u79f0\u548c\u503c\u3002\u4f8b\u5982\uff0c\u8981\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a LaTeX \uff0c\u5e94\u8be5\u5199\u6210 -P format=latex \u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-P assignment --pset= assignment"}}, {"summary": "\u6307\u5b9a psql \u5e94\u8be5\u5b89\u9759\u5730\u5de5\u4f5c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4f1a\u6253\u5370\u51fa\u6b22\u8fce\u6d88\u606f\u548c\u5404\u79cd\u63d0\u793a\u4fe1\u606f\u3002\u5982\u679c\u4f7f\u7528\u4e86\u8fd9\u4e2a\u9009\u9879\uff0c\u4ee5\u4e0a\u90a3\u4e9b\u5c31\u90fd\u4e0d\u4f1a\u8f93\u51fa\u3002\u5728\u4f7f\u7528 -c \u9009\u9879\u65f6\uff0c\u914d\u5408\u8fd9\u4e2a\u9009\u9879\u5f88\u6709\u7528\u3002\u8fd9\u7b49\u6548\u4e8e\u8bbe\u7f6e\u53d8\u91cf QUIET \u4e3a on \u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-q --quiet"}}, {"summary": "\u628a separator \u7528\u4f5c\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e \\pset recordsep \u547d\u4ee4\u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-R separator --record-separator= separator"}}, {"summary": "\u8fd0\u884c\u5728\u5355\u6b65\u6a21\u5f0f\u4e2d\u3002\u8fd9\u610f\u5473\u7740\u5728\u6bcf\u4e2a\u547d\u4ee4\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u4e4b\u524d\u90fd\u4f1a\u63d0\u793a\u7528\u6237\uff0c\u5e76\u5141\u8bb8\u53d6\u6d88\u6267\u884c\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u8c03\u8bd5\u811a\u672c\u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-s --single-step"}}, {"summary": "\u8fd0\u884c\u5728\u5355\u884c\u6a21\u5f0f\u4e2d\uff0c\u5176\u4e2d\u6362\u884c\u7b26\u4f1a\u7ec8\u6b62\u4e00\u4e2a SQL \u547d\u4ee4\uff0c\u5c31\u50cf\u5206\u53f7\u7684\u4f5c\u7528\u4e00\u6837\u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-S --single-line"}}, {"summary": "\u5173\u95ed\u6253\u5370\u5217\u540d\u548c\u7ed3\u679c\u884c\u8ba1\u6570\u9875\u811a\u7b49\u3002\u8fd9\u7b49\u6548\u4e8e \\t \u6216\u8005 \\pset tuples_only \u547d\u4ee4\u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-t --tuples-only"}}, {"summary": "\u6307\u5b9a\u8981\u653e\u5728 HTML table \u6807\u7b7e\u5185\u7684\u9009\u9879\u3002\u8be6\u89c1 \\pset tableattr \u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-T table_options --table-attr= table_options"}}, {"summary": "\u4f5c\u4e3a\u7528\u6237 username \u800c\u4e0d\u662f\u9ed8\u8ba4\u7528\u6237\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff08\u5f53\u7136\uff0c\u4f60\u5fc5\u987b\u5177\u6709\u8fd9\u6837\u505a\u7684\u6743\u9650\uff09\u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-U username --username= username"}}, {"summary": "\u6267\u884c\u4e00\u6b21\u53d8\u91cf\u8d4b\u503c\uff0c\u548c \\set \u5143\u547d\u4ee4\u76f8\u4f3c\u3002\u6ce8\u610f\u4f60\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u7528\u7b49\u53f7\u5206\u9694\u540d\u5b57\u548c\u503c\uff08\u5982\u679c\u6709\uff09\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u7684\u8bbe\u7f6e\uff0c\u53bb\u6389\u7b49\u53f7\u5c31\u884c\u3002\u8981\u628a\u4e00\u4e2a\u53d8\u91cf\u8bbe\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u4f7f\u7528\u7b49\u53f7\u4f46\u662f\u53bb\u6389\u503c\u3002\u8fd9\u4e9b\u8d4b\u503c\u5728\u547d\u4ee4\u884c\u5904\u7406\u671f\u95f4\u88ab\u5b8c\u6210\uff0c\u56e0\u6b64\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u7684\u53d8\u91cf\u5c06\u5728\u7a0d\u540e\u88ab\u8986\u76d6\u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-v assignment --set= assignment --variable= assignment"}}, {"summary": "\u6253\u5370 psql \u7248\u672c\u5e76\u4e14\u9000\u51fa\u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-V --version"}}, {"summary": "\u6c38\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982 .pgpass \u6587\u4ef6\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u8fd9\u4e2a\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4efb\u52a1\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u65f6\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 psql \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\uff0c\u5373\u4f7f\u8be5\u5bc6\u7801\u5b9e\u9645\u4e0a\u4e0d\u4f1a\u88ab\u4f7f\u7528\u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-W --password"}}, {"summary": "\u6253\u5f00\u6269\u5c55\u8868\u683c\u5f0f\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e \\x \u6216\u8005 \\pset expanded \u547d\u4ee4\u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-x --expanded"}}, {"summary": "\u4e0d\u8bfb\u53d6\u542f\u52a8\u6587\u4ef6\uff08\u65e2\u4e0d\u8bfb\u53d6\u7cfb\u7edf\u8303\u56f4\u7684 psqlrc \u6587\u4ef6\uff0c\u4e5f\u4e0d\u8bfb\u53d6\u7528\u6237\u7684 ~/.psqlrc \u6587\u4ef6\uff09\u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-X --no-psqlrc"}}, {"summary": "\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u8fd9\u7b49\u6548\u4e8e \\pset fieldsep_zero \u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-z --field-separator-zero"}}, {"summary": "\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u4f8b\u5982\uff0c\u8fd9\u6709\u52a9\u4e8e\u4e0e xargs -0 \u914d\u5408\u4f7f\u7528\u3002\u8fd9\u7b49\u6548\u4e8e \\pset recordsep_zero \u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-0 --record-separator-zero"}}, {"summary": "\u8fd9\u4e2a\u9009\u9879\u53ea\u80fd\u4e0e\u4e00\u4e2a\u6216\u591a\u4e2a -c \u548c/\u6216 -f \u9009\u9879\u7ed3\u5408\u4f7f\u7528\u3002\u5b83\u4f1a\u5bfc\u81f4 psql \u5728\u7b2c\u4e00\u4e2a\u8fd9\u6837\u7684\u9009\u9879\u4e4b\u524d\u53d1\u51fa\u4e00\u4e2a BEGIN \u547d\u4ee4\uff0c\u5e76\u5728\u6700\u540e\u4e00\u4e2a\u9009\u9879\u4e4b\u540e\u53d1\u51fa\u4e00\u4e2a COMMIT \u547d\u4ee4\uff0c\u4ece\u800c\u5c06\u6240\u6709\u547d\u4ee4\u5305\u88c5\u6210\u4e00\u4e2a\u5355\u72ec\u7684\u4e8b\u52a1\u3002\u5982\u679c\u4efb\u4f55\u547d\u4ee4\u5931\u8d25\u4e14\u53d8\u91cf ON_ERROR_STOP \u88ab\u8bbe\u7f6e\uff0c\u5219\u4f1a\u6539\u4e3a\u53d1\u9001\u4e00\u4e2a ROLLBACK \u547d\u4ee4\u3002\u8fd9\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-1 --single-transaction"}}, {"summary": "\u663e\u793a\u6709\u5173 psql \u7684\u5e2e\u52a9\u5e76\u4e14\u9000\u51fa\u3002\u53ef\u9009\u7684 topic \u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a options \uff09\u9009\u62e9\u8981\u89e3\u91ca psql \u7684\u54ea\u4e00\u90e8\u5206\uff1a commands \u63cf\u8ff0 psql \u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b options \u63cf\u8ff0\u53ef\u4ee5\u88ab\u4f20\u9012\u7ed9 psql \u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c variables \u5219\u663e\u793a\u6709\u5173 psql \u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002", "signature": {"url": "/docs/15/app-psql.html", "text": "-? --help[= topic ]"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "COLUMNS", "description": "\u5982\u679c \\pset columns \u4e3a\u96f6\uff0c\u8fd9\u4e2a\u73af\u5883\u53d8\u91cf\u63a7\u5236\u7528\u4e8e wrapped \u683c\u5f0f\u7684\u5bbd\u5ea6\u4ee5\u53ca\u7528\u6765\u786e\u5b9a\u8f83\u5bbd\u7684\u8f93\u51fa\u662f\u5426\u9700\u8981\u5206\u9875\u5668\uff0c\u6216\u8005\u662f\u5426\u5e94\u5207\u6362\u5230\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e2d\u7684\u5782\u76f4\u683c\u5f0f\u7684\u5bbd\u5ea6\u3002"}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\uff08\u89c1 \u7b2c 34.15 \u8282 \uff09\u3002"}, {"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "\\e \u3001 \\ef \u4ee5\u53ca \\ev \u547d\u4ee4\u6240\u4f7f\u7528\u7684\u7f16\u8f91\u5668\u3002\u4f1a\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u68c0\u67e5\u8fd9\u4e9b\u53d8\u91cf\uff0c\u7b2c\u4e00\u4e2a\u88ab\u8bbe\u7f6e\u7684\u5c06\u88ab\u4f7f\u7528\u3002\u5982\u679c\u90fd\u6ca1\u6709\u88ab\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u662f\u4f7f\u7528Unix\u7cfb\u7edf\u4e0a\u7684 vi \u6216\u8005Windows\u7cfb\u7edf\u4e0a\u7684 notepad.exe \u3002"}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "\u5f53 \\e \u3001 \\ef \u6216 \\ev \u5e26\u6709\u884c\u53f7\u53c2\u6570\u4f7f\u7528\u65f6\uff0c\u6b64\u53d8\u91cf\u6307\u5b9a\u5c06\u8d77\u59cb\u884c\u53f7\u4f20\u7ed9\u7528\u6237\u7f16\u8f91\u5668\u65f6\u6240\u7528\u7684\u547d\u4ee4\u884c\u53c2\u6570\u3002\u5bf9\u4e8e Emacs \u6216 vi \u4e4b\u7c7b\u7684\u7f16\u8f91\u5668\uff0c\u8fd9\u4e2a\u53c2\u6570\u662f\u4e00\u4e2a\u52a0\u53f7\u3002\u5982\u679c\u9009\u9879\u540d\u548c\u884c\u53f7\u4e4b\u95f4\u9700\u8981\u7a7a\u683c\uff0c\u8bf7\u5728\u53d8\u91cf\u503c\u4e2d\u5305\u542b\u672b\u5c3e\u7a7a\u683c\u3002\u4f8b\u5982\uff1a PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' \u5728 Unix \u7cfb\u7edf\u4e0a\u9ed8\u8ba4\u662f + \uff08\u5bf9\u5e94\u4e8e\u9ed8\u8ba4\u7f16\u8f91\u5668 vi \uff0c\u4e14\u5bf9\u5f88\u591a\u5176\u4ed6\u5e38\u89c1\u7f16\u8f91\u5668\u53ef\u7528\uff09\u3002\u5728 Windows \u7cfb\u7edf\u4e0a\u6ca1\u6709\u9ed8\u8ba4\u503c\u3002"}, {"name": "PSQL_HISTORY", "description": "\u547d\u4ee4\u5386\u53f2\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08 ~ \uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002"}, {"name": "PSQL_PAGER PAGER", "description": "\u5982\u679c\u67e5\u8be2\u7ed3\u679c\u65e0\u6cd5\u5728\u5c4f\u5e55\u4e0a\u663e\u793a\u5b8c\u6574\uff0c\u5b83\u4eec\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6b64\u547d\u4ee4\u3002\u5178\u578b\u7684\u503c\u662f more \u6216 less \u3002\u53ef\u4ee5\u901a\u8fc7\u5c06 PSQL_PAGER \u6216 PAGER \u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u6216\u901a\u8fc7\u8c03\u6574 \\pset \u547d\u4ee4\u7684\u4e0e\u5206\u9875\u76f8\u5173\u7684\u9009\u9879\u6765\u7981\u7528\u5206\u9875\u5668\u3002\u8fd9\u4e9b\u53d8\u91cf\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u8fdb\u884c\u68c0\u67e5\uff1b\u4f7f\u7528\u6309\u8be5\u987a\u5e8f\u627e\u5230\u7684\u7b2c\u4e00\u4e2a\u5df2\u8bbe\u7f6e\u7684\u53d8\u91cf\u3002\u5982\u679c\u5b83\u4eec\u90fd\u6ca1\u6709\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5728\u5927\u591a\u6570\u5e73\u53f0\u4e0a\u4f7f\u7528 more \uff0c\u4f46\u5728Cygwin\u4e0a\u4f7f\u7528 less \u3002"}, {"name": "PSQL_WATCH_PAGER", "description": "\u4f7f\u7528 \\watch \u547d\u4ee4\u53cd\u590d\u6267\u884c\u67e5\u8be2\u65f6\uff0c\u9ed8\u8ba4\u4e0d\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\u3002\u5728 Unix \u7cfb\u7edf\u4e0a\uff0c\u53ef\u4ee5\u5c06 PSQL_WATCH_PAGER \u8bbe\u4e3a\u5206\u9875\u7a0b\u5e8f\u547d\u4ee4\u6765\u6539\u53d8\u6b64\u884c\u4e3a\u3002pspg \u5206\u9875\u7a0b\u5e8f\uff08\u4e0d\u5c5e\u4e8e PostgreSQL\uff0c\u4f46\u8bb8\u591a\u5f00\u6e90\u8f6f\u4ef6\u53d1\u884c\u7248\u90fd\u63d0\u4f9b\u5b83\uff09\u4ee5 --stream \u9009\u9879\u542f\u52a8\u65f6\uff0c\u53ef\u4ee5\u663e\u793a \\watch \u7684\u8f93\u51fa\u3002"}, {"name": "PSQLRC", "description": "\u7528\u6237\u7684 .psqlrc \u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08 ~ \uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002"}, {"name": "SHELL", "description": "\u88ab \\! \u547d\u4ee4\u6267\u884c\u7684\u547d\u4ee4\u3002"}, {"name": "TMPDIR", "description": "\u5b58\u50a8\u4e34\u65f6\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u662f /tmp \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-a", "--echo-all"], "summary": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all .", "signature": "-a --echo-all", "source_url": "/docs/15/app-psql.html", "description": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all ."}, {"names": ["-A", "--no-align"], "summary": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned .", "signature": "-A --no-align", "source_url": "/docs/15/app-psql.html", "description": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned ."}, {"names": ["-b", "--echo-errors"], "summary": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors .", "signature": "-b --echo-errors", "source_url": "/docs/15/app-psql.html", "description": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors ."}, {"names": ["-c command", "--command= command"], "summary": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence.", "signature": "-c command --command= command", "source_url": "/docs/15/app-psql.html", "description": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. command must be either a command string that is completely parsable by the server (i.e., it contains no psql -specific features), or a single backslash command. Thus you cannot mix SQL and psql meta-commands within a -c option. To achieve that, you could use repeated -c options or pipe the string into psql , for example: psql -c '\\x' -c 'SELECT * FROM foo;' or echo '\\x \\\\ SELECT * FROM foo;' | psql ( \\\\ is the separator meta-command.) Each SQL command string passed to -c is sent to the server as a single request. Because of this, the server executes it as a single transaction even if the string contains multiple SQL commands, unless there are explicit BEGIN / COMMIT commands included in the string to divide it into multiple transactions. (See Section 55.2.2.1 for more details about how the server handles multi-query strings.) If having several commands executed in one transaction is not desired, use repeated -c commands or feed multiple commands to psql 's standard input, either using echo as illustrated above, or via a shell here-document, for example: psql <<EOF \\x SELECT * FROM foo; EOF"}, {"names": ["--csv"], "summary": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv .", "signature": "--csv", "source_url": "/docs/15/app-psql.html", "description": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv ."}, {"names": ["-d dbname", "--dbname= dbname"], "summary": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "signature": "-d dbname --dbname= dbname", "source_url": "/docs/15/app-psql.html", "description": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--echo-queries"], "summary": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries .", "signature": "-e --echo-queries", "source_url": "/docs/15/app-psql.html", "description": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries ."}, {"names": ["-E", "--echo-hidden"], "summary": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on .", "signature": "-E --echo-hidden", "source_url": "/docs/15/app-psql.html", "description": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on ."}, {"names": ["-f filename", "--file= filename"], "summary": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i .", "signature": "-f filename --file= filename", "source_url": "/docs/15/app-psql.html", "description": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i . If filename is - (hyphen), then standard input is read until an EOF indication or \\q meta-command. This can be used to intersperse interactive input with input from files. Note however that Readline is not used in this case (much as if -n had been specified). Using this option is subtly different from writing psql < filename . In general, both will do what you expect, but using -f enables some nice features such as error messages with line numbers. There is also a slight chance that using this option will reduce the start-up overhead. On the other hand, the variant using the shell's input redirection is (in theory) guaranteed to yield exactly the same output you would have received had you entered everything by hand."}, {"names": ["-F separator", "--field-separator= separator"], "summary": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f .", "signature": "-F separator --field-separator= separator", "source_url": "/docs/15/app-psql.html", "description": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f ."}, {"names": ["-h hostname", "--host= hostname"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket.", "signature": "-h hostname --host= hostname", "source_url": "/docs/15/app-psql.html", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket."}, {"names": ["-H", "--html"], "summary": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command.", "signature": "-H --html", "source_url": "/docs/15/app-psql.html", "description": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command."}, {"names": ["-l", "--list"], "summary": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list .", "signature": "-l --list", "source_url": "/docs/15/app-psql.html", "description": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list . When this option is used, psql will connect to the database postgres , unless a different database is named on the command line (option -d or non-option argument, possibly via a service entry, but not via an environment variable)."}, {"names": ["-L filename", "--log-file= filename"], "summary": "Write all query output into file filename , in addition to the normal output destination.", "signature": "-L filename --log-file= filename", "source_url": "/docs/15/app-psql.html", "description": "Write all query output into file filename , in addition to the normal output destination."}, {"names": ["-n", "--no-readline"], "summary": "Do not use Readline for line editing and do not use the command history (see the section called \u201cCommand-Line Editing\u201d below).", "signature": "-n --no-readline", "source_url": "/docs/15/app-psql.html", "description": "Do not use Readline for line editing and do not use the command history (see the section called \u201cCommand-Line Editing\u201d below)."}, {"names": ["-o filename", "--output= filename"], "summary": "Put all query output into file filename . This is equivalent to the command \\o .", "signature": "-o filename --output= filename", "source_url": "/docs/15/app-psql.html", "description": "Put all query output into file filename . This is equivalent to the command \\o ."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432.", "signature": "-p port --port= port", "source_url": "/docs/15/app-psql.html", "description": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432."}, {"names": ["-P assignment", "--pset= assignment"], "summary": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex .", "signature": "-P assignment --pset= assignment", "source_url": "/docs/15/app-psql.html", "description": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex ."}, {"names": ["-q", "--quiet"], "summary": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on .", "signature": "-q --quiet", "source_url": "/docs/15/app-psql.html", "description": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on ."}, {"names": ["-R separator", "--record-separator= separator"], "summary": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep .", "signature": "-R separator --record-separator= separator", "source_url": "/docs/15/app-psql.html", "description": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep ."}, {"names": ["-s", "--single-step"], "summary": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts.", "signature": "-s --single-step", "source_url": "/docs/15/app-psql.html", "description": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts."}, {"names": ["-S", "--single-line"], "summary": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does.", "signature": "-S --single-line", "source_url": "/docs/15/app-psql.html", "description": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does. Note This mode is provided for those who insist on it, but you are not necessarily encouraged to use it. In particular, if you mix SQL and meta-commands on a line the order of execution might not always be clear to the inexperienced user."}, {"names": ["-t", "--tuples-only"], "summary": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only .", "signature": "-t --tuples-only", "source_url": "/docs/15/app-psql.html", "description": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only ."}, {"names": ["-T table_options", "--table-attr= table_options"], "summary": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details.", "signature": "-T table_options --table-attr= table_options", "source_url": "/docs/15/app-psql.html", "description": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details."}, {"names": ["-U username", "--username= username"], "summary": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)", "signature": "-U username --username= username", "source_url": "/docs/15/app-psql.html", "description": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)"}, {"names": ["-v assignment", "--set= assignment", "--variable= assignment"], "summary": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later.", "signature": "-v assignment --set= assignment --variable= assignment", "source_url": "/docs/15/app-psql.html", "description": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later."}, {"names": ["-V", "--version"], "summary": "Print the psql version and exit.", "signature": "-V --version", "source_url": "/docs/15/app-psql.html", "description": "Print the psql version and exit."}, {"names": ["-w", "--no-password"], "summary": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/15/app-psql.html", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-W", "--password"], "summary": "Force psql to prompt for a password before connecting to a database, even if the password will not be used.", "signature": "-W --password", "source_url": "/docs/15/app-psql.html", "description": "Force psql to prompt for a password before connecting to a database, even if the password will not be used. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, psql will prompt for a password in any case. However, psql will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-x", "--expanded"], "summary": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded .", "signature": "-x --expanded", "source_url": "/docs/15/app-psql.html", "description": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded ."}, {"names": ["-X", "--no-psqlrc"], "summary": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file).", "signature": "-X --no-psqlrc", "source_url": "/docs/15/app-psql.html", "description": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file)."}, {"names": ["-z", "--field-separator-zero"], "summary": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero .", "signature": "-z --field-separator-zero", "source_url": "/docs/15/app-psql.html", "description": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero ."}, {"names": ["-0", "--record-separator-zero"], "summary": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero .", "signature": "-0 --record-separator-zero", "source_url": "/docs/15/app-psql.html", "description": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero ."}, {"names": ["-1", "--single-transaction"], "summary": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied.", "signature": "-1 --single-transaction", "source_url": "/docs/15/app-psql.html", "description": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied. If the commands themselves contain BEGIN , COMMIT , or ROLLBACK , this option will not have the desired effects. Also, if an individual command cannot be executed inside a transaction block, specifying this option will cause the whole transaction to fail."}, {"names": ["-?", "--help[= topic ]"], "summary": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables.", "signature": "-? --help[= topic ]", "source_url": "/docs/15/app-psql.html", "description": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables."}], "related": [{"url": "/wiki/psql/?v=15", "label": "psql \u5143\u547d\u4ee4"}, {"url": "/wiki/conn/?v=15", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v15.19/postgresql-15.19.tar.bz2", "label": "15.19", "major": "15", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/15/postgresql-15-A4.pdf", "bytes": 14609140, "pages": 2987, "sha256": "66228564a4d16efb47d6a914085716ecfe22ca1566db56bc7c3d82f790646d72", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/15/postgresql-15-US.pdf", "bytes": 14495690, "pages": 3153, "sha256": "645a498c2390d47a6223ec74770631185807a19c484edb0fc5a295d9f460bc02", "built_at": "2026-09-26"}}, "tree": "15", "index": "index.html", "major": "15", "pages": 1168, "release": "15.19", "source_url": "https://ftp.postgresql.org/pub/source/v15.19/postgresql-15.19.tar.bz2", "svg_assets": 3, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "e1a64a87a46b825b88c082e4518161a47aab53c45694964f8ba1df28f7859f89"}, "revision": "6af958c6520151fc7697d56e0616b03fb00522c4568158674d452ae0644ba545", "evidence_kind": "English manual and source declarations", "source_sha256": "e1a64a87a46b825b88c082e4518161a47aab53c45694964f8ba1df28f7859f89"}, "sources": [{"url": "https://pg.center/docs/15/app-psql.html", "file": "app-psql.html", "label": "15.19 English manual \u00b7 app-psql.html", "anchor": "", "sha256": "cb07228edb4914a53530afca316fd700a250cc062af2d5a74d24add93afbd0c8", "language": "en", "original_url": "/docs/15/app-psql.html"}, {"url": "https://pg.center/docs/15/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "015b2ea2bd205946a55a1b837e735570631bac831c92074a6bf58444f9a3cb98", "language": "en", "original_url": "/docs/15/reference-client.html"}], "sections": [], "synopsis": ["psql [ option ...] [ dbname [ username ]]"], "signature": "psql [ option ...] [ dbname [ username ]]", "description": ["psql \u2014 PostgreSQL \u7684\u4ea4\u4e92\u5f0f\u7ec8\u7aef"], "environment": [{"name": "COLUMNS", "description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode."}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters (see Section 34.15 )."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems."}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems."}, {"name": "PSQL_HISTORY", "description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed."}, {"name": "PSQL_PAGER PAGER", "description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If neither of them is set, the default is to use more on most platforms, but less on Cygwin."}, {"name": "PSQL_WATCH_PAGER", "description": "When a query is executed repeatedly with the \\watch command, a pager is not used by default. This behavior can be changed by setting PSQL_WATCH_PAGER to a pager command, on Unix systems. The pspg pager (not part of PostgreSQL but available in many open source software distributions) can display the output of \\watch if started with the option --stream ."}, {"name": "PSQLRC", "description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed."}, {"name": "SHELL", "description": "Command executed by the \\! command."}, {"name": "TMPDIR", "description": "Directory for storing temporary files. The default is /tmp ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PSQL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></h2>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u2014 <span class=\"productname\">PostgreSQL</span>\u7684\u4ea4\u4e92\u5f0f\u7ec8\u7aef</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.20.4.1\"><code class=\"command\">psql</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em> [<em class=\"replaceable\"><code>username</code></em>]]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.20.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u662f<span class=\"productname\">PostgreSQL</span>\u7684\u4e00\u4e2a\u57fa\u4e8e\u7ec8\u7aef\u7684\u524d\u7aef\u3002\u5b83\u4f7f\u4f60\u80fd\u591f\u4ea4\u4e92\u5f0f\u5730\u8f93\u5165\u67e5\u8be2\uff0c\u5c06\u5176\u53d1\u9001\u7ed9<span class=\"productname\">PostgreSQL</span>\uff0c\u5e76\u67e5\u770b\u67e5\u8be2\u7ed3\u679c\u3002\u4e5f\u53ef\u4ee5\u4ece\u6587\u4ef6\u6216\u547d\u4ee4\u884c\u53c2\u6570\u63d0\u4f9b\u8f93\u5165\u3002\u6b64\u5916\uff0c<span class=\"application\">psql</span>\u8fd8\u63d0\u4f9b\u4e86\u82e5\u5e72\u5143\u547d\u4ee4\u548c\u591a\u79cd\u7c7b\u4f3c shell \u7684\u7279\u6027\uff0c\u4ee5\u4fbf\u4e8e\u7f16\u5199\u811a\u672c\u548c\u81ea\u52a8\u5316\u6267\u884c\u5404\u79cd\u4efb\u52a1\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-PSQL-3\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"option\">-a</code><br/></span><span class=\"term\"><code class=\"option\">--echo-all</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8bfb\u5165\u65f6\u5c06\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u884c\u8bfb\u53d6\uff09\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a <code class=\"literal\">all</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-A</code><br/></span><span class=\"term\"><code class=\"option\">--no-align</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230\u975e\u5bf9\u9f50\u8f93\u51fa\u6a21\u5f0f\uff08\u9ed8\u8ba4\u8f93\u51fa\u6a21\u5f0f\u662f<code class=\"literal\">aligned</code>\uff09\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset format unaligned</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-b</code><br/></span><span class=\"term\"><code class=\"option\">--echo-errors</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u5931\u8d25\u7684 SQL \u547d\u4ee4\u6253\u5370\u5230\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">errors</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>command</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--command=<em class=\"replaceable\"><code>command</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a<span class=\"application\">psql</span>\u6267\u884c\u4e00\u4e2a\u7ed9\u5b9a\u7684\u547d\u4ee4\u5b57\u7b26\u4e32<em class=\"replaceable\"><code>command</code></em>\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u591a\u6b21\u5e76\u4e14\u4ee5\u4efb\u4f55\u987a\u5e8f\u4e0e<code class=\"option\">-f</code>\u9009\u9879\u7ec4\u5408\u5728\u4e00\u8d77\u3002\u5f53<code class=\"option\">-c</code>\u6216\u8005<code class=\"option\">-f</code>\u88ab\u6307\u5b9a\u65f6\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709<code class=\"option\">-c</code>\u548c<code class=\"option\">-f</code>\u9009\u9879\u540e\u7ec8\u6b62\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>command</code></em>\u5fc5\u987b\u662f\u4e00\u4e2a\u670d\u52a1\u5668\u5b8c\u5168\u53ef\u89e3\u6790\u7684\u547d\u4ee4\u5b57\u7b26\u4e32\uff08\u5373\u4e0d\u5305\u542b<span class=\"application\">psql</span>\u4e13\u6709\u7684\u7279\u6027\uff09\u6216\u8005\u5355\u4e2a\u53cd\u659c\u7ebf\u547d\u4ee4\u3002\u56e0\u6b64\u4e0d\u80fd\u5728\u4e00\u4e2a<code class=\"option\">-c</code>\u9009\u9879\u4e2d\u6df7\u5408<acronym class=\"acronym\">SQL</acronym>\u548c<span class=\"application\">psql</span>\u5143\u547d\u4ee4\u3002\u8981\u90a3\u6837\u505a\uff0c\u53ef\u4ee5\u4f7f\u7528\u591a\u4e2a<code class=\"option\">-c</code>\u9009\u9879\u6216\u8005\u628a\u5b57\u7b26\u4e32\u7528\u7ba1\u9053\u8f93\u9001\u5230<span class=\"application\">psql</span>\u4e2d\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">psql -c '\\x' -c 'SELECT * FROM foo;'\n</pre>\n<p lang=\"zh\">\u6216\u8005</p>\n<pre class=\"programlisting\">echo '\\x \\\\ SELECT * FROM foo;' | psql\n</pre>\n<p lang=\"zh\">\uff08<code class=\"literal\">\\\\</code>\u662f\u5206\u9694\u7b26\u5143\u547d\u4ee4\uff09\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u5b57\u7b26\u4e32\u4f20\u9012\u7ed9<code class=\"option\">-c</code>\u90fd\u4f5c\u4e3a\u4e00\u4e2a\u5355\u72ec\u7684\u8bf7\u6c42\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u56e0\u6b64\uff0c\u5373\u4f7f\u5b57\u7b26\u4e32\u5305\u542b\u591a\u4e2a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\uff0c\u670d\u52a1\u5668\u4e5f\u4f1a\u5c06\u5176\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff0c\u9664\u975e\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u660e\u786e\u7684<code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code>\u547d\u4ee4\u5c06\u5176\u5206\u6210\u591a\u4e2a\u4e8b\u52a1\u3002\uff08\u6709\u5173\u670d\u52a1\u5668\u5982\u4f55\u5904\u7406\u591a\u67e5\u8be2\u5b57\u7b26\u4e32\u7684\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/15/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT\" title=\"55.2.2.1.\u00a0\u4e00\u4e2a\u7b80\u5355\u67e5\u8be2\u4e2d\u7684\u591a\u6761\u8bed\u53e5\">\u7b2c\u00a055.2.2.1\u00a0\u8282</a>\u3002\uff09</p>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u5e0c\u671b\u5728\u4e00\u4e2a\u4e8b\u52a1\u4e2d\u6267\u884c\u591a\u4e2a\u547d\u4ee4\uff0c\u53ef\u4ee5\u4f7f\u7528\u91cd\u590d\u7684<code class=\"option\">-c</code>\u547d\u4ee4\uff0c\u6216\u5c06\u591a\u4e2a\u547d\u4ee4\u8f93\u5165\u5230<span class=\"application\">psql</span>\u7684\u6807\u51c6\u8f93\u5165\uff0c\u53ef\u4ee5\u50cf\u4e0a\u9762\u793a\u4f8b\u4e2d\u4f7f\u7528<span class=\"application\">echo</span>\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7shell\u7684here-document\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">psql &lt;&lt;EOF\n\\x\nSELECT * FROM foo;\nEOF\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">--csv</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230<acronym class=\"acronym\">CSV</acronym>\uff08\u9017\u53f7\u5206\u9694\u503c\uff09\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u76f8\u5f53\u4e8e<code class=\"command\">\\pset format csv</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>dbname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>dbname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002\u8fd9\u7b49\u6548\u4e8e\u6307\u5b9a<em class=\"replaceable\"><code>dbname</code></em>\u4e3a\u547d\u4ee4\u884c\u4e0a\u7684\u7b2c\u4e00\u4e2a\u975e\u9009\u9879\u53c2\u6570\u3002<em class=\"replaceable\"><code>dbname</code></em> \u53ef\u4ee5\u662f<a class=\"link\" href=\"/docs/15/libpq.html#LIBPQ-CONNSTRING\" title=\"34.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u5c06\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-e</code><br/></span><span class=\"term\"><code class=\"option\">--echo-queries</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e5f\u628a\u53d1\u9001\u5230\u670d\u52a1\u5668\u7684\u6240\u6709 SQL \u547d\u4ee4\u590d\u5236\u5230\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">queries</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-E</code><br/></span><span class=\"term\"><code class=\"option\">--echo-hidden</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u56de\u663e<code class=\"command\">\\d</code>\u4ee5\u53ca\u5176\u4ed6\u53cd\u659c\u7ebf\u547d\u4ee4\u751f\u6210\u7684\u5b9e\u9645\u67e5\u8be2\u3002\u53ef\u4ee5\u7528\u5b83\u6765\u5b66\u4e60<span class=\"application\">psql</span>\u7684\u5185\u90e8\u64cd\u4f5c\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO_HIDDEN</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u800c\u4e0d\u662f\u6807\u51c6\u8f93\u5165\u4e2d\u8bfb\u53d6\u547d\u4ee4\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u6307\u5b9a\uff0c\u4e5f\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u4e0e<code class=\"option\">-c</code>\u9009\u9879\u7ec4\u5408\u4f7f\u7528\u3002\u5f53\u6307\u5b9a\u4e86<code class=\"option\">-c</code>\u6216<code class=\"option\">-f</code>\u65f6\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709<code class=\"option\">-c</code>\u548c<code class=\"option\">-f</code>\u9009\u9879\u540e\u7ec8\u6b62\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u7b49\u4ef7\u4e8e\u5143\u547d\u4ee4<code class=\"command\">\\i</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c<em class=\"replaceable\"><code>filename</code></em>\u662f<code class=\"literal\">-</code>\uff08\u8fde\u5b57\u7b26\uff09\uff0c\u5219\u4f1a\u8bfb\u53d6\u6807\u51c6\u8f93\u5165\uff0c\u76f4\u5230\u9047\u5230 <acronym class=\"acronym\">EOF</acronym> \u6307\u793a\u6216<code class=\"command\">\\q</code>\u5143\u547d\u4ee4\u3002\u8fd9\u53ef\u7528\u4e8e\u5c06\u4ea4\u4e92\u5f0f\u8f93\u5165\u4e0e\u6587\u4ef6\u8f93\u5165\u4ea4\u9519\u4f7f\u7528\u3002\u4e0d\u8fc7\u8bf7\u6ce8\u610f\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\u4e0d\u4f1a\u4f7f\u7528 <span class=\"application\">Readline</span>\uff08\u5f88\u50cf\u6307\u5b9a\u4e86<code class=\"option\">-n</code>\u65f6\u7684\u60c5\u51b5\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u4e0e\u5199\u6210<code class=\"literal\">psql &lt; <em class=\"replaceable\"><code>filename</code></em></code>\u6709\u7ec6\u5fae\u5dee\u522b\u3002\u901a\u5e38\u4e24\u79cd\u5f62\u5f0f\u90fd\u4f1a\u5f97\u5230\u4f60\u671f\u671b\u7684\u7ed3\u679c\uff0c\u4f46\u4f7f\u7528<code class=\"literal\">-f</code>\u53ef\u4ee5\u542f\u7528\u4e00\u4e9b\u6709\u7528\u7684\u7279\u6027\uff0c\u4f8b\u5982\u5e26\u884c\u53f7\u7684\u9519\u8bef\u6d88\u606f\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u4e5f\u8fd8\u6709\u4e00\u70b9\u673a\u4f1a\u964d\u4f4e\u542f\u52a8\u5f00\u9500\u3002\u53e6\u4e00\u65b9\u9762\uff0c\u4f7f\u7528 shell \u8f93\u5165\u91cd\u5b9a\u5411\u7684\u5f62\u5f0f\u5728\u7406\u8bba\u4e0a\u80fd\u4fdd\u8bc1\u5f97\u5230\u4e0e\u4f60\u624b\u5de5\u9010\u884c\u8f93\u5165\u65f6\u5b8c\u5168\u76f8\u540c\u7684\u8f93\u51fa\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>separator</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--field-separator=<em class=\"replaceable\"><code>separator</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f7f\u7528<em class=\"replaceable\"><code>separator</code></em>\u4f5c\u4e3a\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset fieldsep</code>\u6216\u8005<code class=\"command\">\\f</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>hostname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>hostname</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-H</code><br/></span><span class=\"term\"><code class=\"option\">--html</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230<acronym class=\"acronym\">HTML</acronym>\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset format html</code>\u6216\u8005<code class=\"command\">\\H</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--list</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u6240\u6709\u53ef\u7528\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u9000\u51fa\u3002\u5176\u4ed6\u975e\u8fde\u63a5\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002\u8fd9\u4e0e\u5143\u547d\u4ee4<code class=\"command\">\\list</code>\u7c7b\u4f3c\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8be5\u9009\u9879\u65f6\uff0c<span class=\"application\">psql</span>\u5c06\u8fde\u63a5\u5230\u6570\u636e\u5e93<code class=\"literal\">postgres</code>\uff0c\u9664\u975e\u547d\u4ee4\u884c\u4e0a\u6307\u5b9a\u4e86\u5176\u4ed6\u6570\u636e\u5e93\uff08\u901a\u8fc7<code class=\"option\">-d</code>\u9009\u9879\u6216\u975e\u9009\u9879\u53c2\u6570\uff0c\u4e5f\u53ef\u80fd\u901a\u8fc7\u670d\u52a1\u9879\uff0c\u4f46\u4e0d\u80fd\u901a\u8fc7\u73af\u5883\u53d8\u91cf\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--log-file=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9664\u4e86\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u5199\u5230\u666e\u901a\u8f93\u51fa\u76ee\u6807\u4e4b\u5916\uff0c\u8fd8\u5199\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-readline</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8981\u4f7f\u7528<span class=\"application\">Readline</span>\u8fdb\u884c\u884c\u7f16\u8f91\uff0c\u4e5f\u4e0d\u8981\u4f7f\u7528\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\uff08\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/15/app-psql.html#APP-PSQL-READLINE\" title=\"\u547d\u4ee4\u884c\u7f16\u8f91\">\u201c\u547d\u4ee4\u884c\u7f16\u8f91\u201d\u4e00\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-o <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--output=<em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u653e\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u3002\u8fd9\u7b49\u6548\u4e8e\u547d\u4ee4<code class=\"command\">\\o</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u7684\u6587\u4ef6\u540d\u540e\u7f00\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u7684\u503c\uff1b\u672a\u8bbe\u7f6e\u65f6\uff0c\u4f7f\u7528\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u7aef\u53e3\uff0c\u901a\u5e38\u4e3a 5432\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-P <em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--pset=<em class=\"replaceable\"><code>assignment</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ee5<code class=\"command\">\\pset</code>\u7684\u5f62\u5f0f\u6307\u5b9a\u6253\u5370\u9009\u9879\u3002\u6ce8\u610f\uff0c\u8fd9\u91cc\u4f60\u5fc5\u987b\u7528\u4e00\u4e2a\u7b49\u53f7\u800c\u4e0d\u662f\u7a7a\u683c\u6765\u5206\u9694\u540d\u79f0\u548c\u503c\u3002\u4f8b\u5982\uff0c\u8981\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a<span class=\"application\">LaTeX</span>\uff0c\u5e94\u8be5\u5199\u6210<code class=\"literal\">-P format=latex</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-q</code><br/></span><span class=\"term\"><code class=\"option\">--quiet</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a<span class=\"application\">psql</span>\u5e94\u8be5\u5b89\u9759\u5730\u5de5\u4f5c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4f1a\u6253\u5370\u51fa\u6b22\u8fce\u6d88\u606f\u548c\u5404\u79cd\u63d0\u793a\u4fe1\u606f\u3002\u5982\u679c\u4f7f\u7528\u4e86\u8fd9\u4e2a\u9009\u9879\uff0c\u4ee5\u4e0a\u90a3\u4e9b\u5c31\u90fd\u4e0d\u4f1a\u8f93\u51fa\u3002\u5728\u4f7f\u7528<code class=\"option\">-c</code>\u9009\u9879\u65f6\uff0c\u914d\u5408\u8fd9\u4e2a\u9009\u9879\u5f88\u6709\u7528\u3002\u8fd9\u7b49\u6548\u4e8e\u8bbe\u7f6e\u53d8\u91cf<code class=\"varname\">QUIET</code>\u4e3a<code class=\"literal\">on</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-R <em class=\"replaceable\"><code>separator</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--record-separator=<em class=\"replaceable\"><code>separator</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a<em class=\"replaceable\"><code>separator</code></em>\u7528\u4f5c\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset recordsep</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-s</code><br/></span><span class=\"term\"><code class=\"option\">--single-step</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5728\u5355\u6b65\u6a21\u5f0f\u4e2d\u3002\u8fd9\u610f\u5473\u7740\u5728\u6bcf\u4e2a\u547d\u4ee4\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u4e4b\u524d\u90fd\u4f1a\u63d0\u793a\u7528\u6237\uff0c\u5e76\u5141\u8bb8\u53d6\u6d88\u6267\u884c\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u8c03\u8bd5\u811a\u672c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-S</code><br/></span><span class=\"term\"><code class=\"option\">--single-line</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd0\u884c\u5728\u5355\u884c\u6a21\u5f0f\u4e2d\uff0c\u5176\u4e2d\u6362\u884c\u7b26\u4f1a\u7ec8\u6b62\u4e00\u4e2a SQL \u547d\u4ee4\uff0c\u5c31\u50cf\u5206\u53f7\u7684\u4f5c\u7528\u4e00\u6837\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u79cd\u6a21\u5f0f\u662f\u4e3a\u575a\u6301\u4f7f\u7528\u5b83\u7684\u7528\u6237\u63d0\u4f9b\u7684\uff0c\u4f46\u5e76\u4e0d\u4e00\u5b9a\u503c\u5f97\u63a8\u8350\u3002\u7279\u522b\u662f\uff0c\u5982\u679c\u5728\u4e00\u884c\u4e2d\u6df7\u5408\u4e86<acronym class=\"acronym\">SQL</acronym>\u548c\u5143\u547d\u4ee4\uff0c\u5bf9\u4e8e\u6ca1\u6709\u7ecf\u9a8c\u7684\u7528\u6237\u6765\u8bf4\uff0c\u5b83\u4eec\u7684\u6267\u884c\u987a\u5e8f\u672a\u5fc5\u603b\u662f\u6e05\u695a\u7684\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-t</code><br/></span><span class=\"term\"><code class=\"option\">--tuples-only</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5173\u95ed\u6253\u5370\u5217\u540d\u548c\u7ed3\u679c\u884c\u8ba1\u6570\u9875\u811a\u7b49\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\t</code>\u6216\u8005<code class=\"command\">\\pset tuples_only</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>table_options</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--table-attr=<em class=\"replaceable\"><code>table_options</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u653e\u5728<acronym class=\"acronym\">HTML</acronym> <code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u9009\u9879\u3002\u8be6\u89c1<code class=\"command\">\\pset tableattr</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f5c\u4e3a\u7528\u6237<em class=\"replaceable\"><code>username</code></em>\u800c\u4e0d\u662f\u9ed8\u8ba4\u7528\u6237\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff08\u5f53\u7136\uff0c\u4f60\u5fc5\u987b\u5177\u6709\u8fd9\u6837\u505a\u7684\u6743\u9650\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-v <em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--set=<em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--variable=<em class=\"replaceable\"><code>assignment</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6267\u884c\u4e00\u6b21\u53d8\u91cf\u8d4b\u503c\uff0c\u548c<code class=\"command\">\\set</code>\u5143\u547d\u4ee4\u76f8\u4f3c\u3002\u6ce8\u610f\u4f60\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u7528\u7b49\u53f7\u5206\u9694\u540d\u5b57\u548c\u503c\uff08\u5982\u679c\u6709\uff09\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u7684\u8bbe\u7f6e\uff0c\u53bb\u6389\u7b49\u53f7\u5c31\u884c\u3002\u8981\u628a\u4e00\u4e2a\u53d8\u91cf\u8bbe\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u4f7f\u7528\u7b49\u53f7\u4f46\u662f\u53bb\u6389\u503c\u3002\u8fd9\u4e9b\u8d4b\u503c\u5728\u547d\u4ee4\u884c\u5904\u7406\u671f\u95f4\u88ab\u5b8c\u6210\uff0c\u56e0\u6b64\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u7684\u53d8\u91cf\u5c06\u5728\u7a0d\u540e\u88ab\u8986\u76d6\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">psql</span>\u7248\u672c\u5e76\u4e14\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6c38\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u8fd9\u4e2a\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4efb\u52a1\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u65f6\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u6574\u4e2a\u4f1a\u8bdd\u671f\u95f4\u90fd\u4f1a\u4fdd\u6301\u751f\u6548\uff0c\u56e0\u6b64\u5b83\u4e0d\u4ec5\u5f71\u54cd\u521d\u59cb\u8fde\u63a5\u5c1d\u8bd5\uff0c\u4e5f\u4f1a\u5f71\u54cd\u5143\u547d\u4ee4<code class=\"command\">\\connect</code>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236<span class=\"application\">psql</span>\u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\uff0c\u5373\u4f7f\u8be5\u5bc6\u7801\u5b9e\u9645\u4e0a\u4e0d\u4f1a\u88ab\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff0c\u5219<span class=\"application\">psql</span>\u65e0\u8bba\u5982\u4f55\u90fd\u4f1a\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">psql</span>\u9700\u8981\u5148\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\uff0c\u624d\u80fd\u77e5\u9053\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u663e\u5f0f\u6307\u5b9a<code class=\"option\">-W</code>\u503c\u5f97\u7528\u6765\u907f\u514d\u8fd9\u6b21\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u6574\u4e2a\u4f1a\u8bdd\u671f\u95f4\u90fd\u4f1a\u4fdd\u6301\u751f\u6548\uff0c\u56e0\u6b64\u5b83\u4e0d\u4ec5\u5f71\u54cd\u521d\u59cb\u8fde\u63a5\u5c1d\u8bd5\uff0c\u4e5f\u4f1a\u5f71\u54cd\u5143\u547d\u4ee4<code class=\"command\">\\connect</code>\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-x</code><br/></span><span class=\"term\"><code class=\"option\">--expanded</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5f00\u6269\u5c55\u8868\u683c\u5f0f\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\x</code>\u6216\u8005<code class=\"command\">\\pset expanded</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-X</code><br/></span><span class=\"term\"><code class=\"option\">--no-psqlrc</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8bfb\u53d6\u542f\u52a8\u6587\u4ef6\uff08\u65e2\u4e0d\u8bfb\u53d6\u7cfb\u7edf\u8303\u56f4\u7684<code class=\"filename\">psqlrc</code>\u6587\u4ef6\uff0c\u4e5f\u4e0d\u8bfb\u53d6\u7528\u6237\u7684<code class=\"filename\">~/.psqlrc</code>\u6587\u4ef6\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-z</code><br/></span><span class=\"term\"><code class=\"option\">--field-separator-zero</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset fieldsep_zero</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-0</code><br/></span><span class=\"term\"><code class=\"option\">--record-separator-zero</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u4f8b\u5982\uff0c\u8fd9\u6709\u52a9\u4e8e\u4e0e<code class=\"literal\">xargs -0</code>\u914d\u5408\u4f7f\u7528\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset recordsep_zero</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-1</code><br/></span><span class=\"term\"><code class=\"option\">--single-transaction</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u9009\u9879\u53ea\u80fd\u4e0e\u4e00\u4e2a\u6216\u591a\u4e2a<code class=\"option\">-c</code>\u548c/\u6216<code class=\"option\">-f</code>\u9009\u9879\u7ed3\u5408\u4f7f\u7528\u3002\u5b83\u4f1a\u5bfc\u81f4<span class=\"application\">psql</span>\u5728\u7b2c\u4e00\u4e2a\u8fd9\u6837\u7684\u9009\u9879\u4e4b\u524d\u53d1\u51fa\u4e00\u4e2a<code class=\"command\">BEGIN</code>\u547d\u4ee4\uff0c\u5e76\u5728\u6700\u540e\u4e00\u4e2a\u9009\u9879\u4e4b\u540e\u53d1\u51fa\u4e00\u4e2a<code class=\"command\">COMMIT</code>\u547d\u4ee4\uff0c\u4ece\u800c\u5c06\u6240\u6709\u547d\u4ee4\u5305\u88c5\u6210\u4e00\u4e2a\u5355\u72ec\u7684\u4e8b\u52a1\u3002\u5982\u679c\u4efb\u4f55\u547d\u4ee4\u5931\u8d25\u4e14\u53d8\u91cf<code class=\"varname\">ON_ERROR_STOP</code>\u88ab\u8bbe\u7f6e\uff0c\u5219\u4f1a\u6539\u4e3a\u53d1\u9001\u4e00\u4e2a<code class=\"command\">ROLLBACK</code>\u547d\u4ee4\u3002\u8fd9\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u547d\u4ee4\u672c\u8eab\u5305\u542b<code class=\"command\">BEGIN</code>\u3001<code class=\"command\">COMMIT</code>\u6216<code class=\"command\">ROLLBACK</code>\uff0c\u8fd9\u4e2a\u9009\u9879\u5c31\u4e0d\u4f1a\u4ea7\u751f\u671f\u671b\u7684\u6548\u679c\u3002\u53e6\u5916\uff0c\u5982\u679c\u67d0\u4e2a\u5355\u72ec\u547d\u4ee4\u4e0d\u80fd\u5728\u4e8b\u52a1\u5757\u4e2d\u6267\u884c\uff0c\u6307\u5b9a\u8fd9\u4e2a\u9009\u9879\u5c06\u5bfc\u81f4\u6574\u4e2a\u4e8b\u52a1\u5931\u8d25\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help[=<em class=\"replaceable\"><code>topic</code></em>]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u6709\u5173<span class=\"application\">psql</span>\u7684\u5e2e\u52a9\u5e76\u4e14\u9000\u51fa\u3002\u53ef\u9009\u7684<em class=\"replaceable\"><code>topic</code></em>\u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a<code class=\"literal\">options</code>\uff09\u9009\u62e9\u8981\u89e3\u91ca<span class=\"application\">psql</span>\u7684\u54ea\u4e00\u90e8\u5206\uff1a<code class=\"literal\">commands</code>\u63cf\u8ff0<span class=\"application\">psql</span>\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b<code class=\"literal\">options</code>\u63cf\u8ff0\u53ef\u4ee5\u88ab\u4f20\u9012\u7ed9<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c<code class=\"literal\">variables</code>\u5219\u663e\u793a\u6709\u5173<span class=\"application\">psql</span>\u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.20.7\">\n<h2 lang=\"zh\">\u9000\u51fa\u72b6\u6001</h2>\n<p lang=\"zh\">\u5982\u679c<span class=\"application\">psql</span>\u6b63\u5e38\u7ed3\u675f\uff0c\u5b83\u4f1a\u5411 shell \u8fd4\u56de 0\uff1b\u5982\u679c\u5b83\u81ea\u8eab\u53d1\u751f\u81f4\u547d\u9519\u8bef\uff08\u4f8b\u5982\u5185\u5b58\u8017\u5c3d\u3001\u627e\u4e0d\u5230\u6587\u4ef6\uff09\uff0c\u5219\u8fd4\u56de 1\uff1b\u5982\u679c\u5230\u670d\u52a1\u5668\u7684\u8fde\u63a5\u53d1\u751f\u6545\u969c\u4e14\u8be5\u4f1a\u8bdd\u4e0d\u662f\u4ea4\u4e92\u5f0f\u7684\uff0c\u5219\u8fd4\u56de 2\uff1b\u5982\u679c\u811a\u672c\u4e2d\u53d1\u751f\u9519\u8bef\u4e14\u53d8\u91cf<code class=\"varname\">ON_ERROR_STOP</code>\u5df2\u8bbe\u7f6e\uff0c\u5219\u8fd4\u56de 3\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.20.8\">\n<h2 lang=\"zh\">\u7528\u6cd5</h2>\n<div class=\"refsect2\" id=\"R2-APP-PSQL-CONNECTING\">\n<h3 lang=\"zh\">\u8fde\u63a5\u5230\u6570\u636e\u5e93</h3>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u662f\u5e38\u89c4\u7684 <span class=\"productname\">PostgreSQL</span> \u5ba2\u6237\u7aef\u5e94\u7528\u7a0b\u5e8f\u3002\u8981\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff0c\u4f60\u9700\u8981\u77e5\u9053\u76ee\u6807\u6570\u636e\u5e93\u540d\u79f0\u3001\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u548c\u7aef\u53e3\u53f7\uff0c\u4ee5\u53ca\u8981\u4ee5\u54ea\u4e2a\u6570\u636e\u5e93\u7528\u6237\u540d\u8fde\u63a5\u3002<span class=\"application\">psql</span> \u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u9009\u9879 <code class=\"option\">-d</code>\u3001<code class=\"option\">-h</code>\u3001<code class=\"option\">-p</code> \u548c <code class=\"option\">-U</code> \u5206\u522b\u6307\u5b9a\u8fd9\u4e9b\u53c2\u6570\u3002\u5982\u679c\u9047\u5230\u4e00\u4e2a\u4e0d\u5c5e\u4e8e\u4efb\u4f55\u9009\u9879\u7684\u53c2\u6570\uff0c\u5b83\u5c06\u88ab\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u540d\uff08\u5982\u679c\u6570\u636e\u5e93\u540d\u5df2\u7ecf\u7ed9\u51fa\uff0c\u5219\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u7528\u6237\u540d\uff09\u3002\u5e76\u975e\u6240\u6709\u8fd9\u4e9b\u9009\u9879\u90fd\u662f\u5fc5\u9700\u7684\uff1b\u5b83\u4eec\u90fd\u6709\u6709\u7528\u7684\u9ed8\u8ba4\u503c\u3002\u5982\u679c\u7701\u7565\u4e3b\u673a\u540d\uff0c<span class=\"application\">psql</span> \u5c06\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u5230\u672c\u5730\u4e3b\u673a\u4e0a\u7684\u670d\u52a1\u5668\uff0c\u800c\u5728\u6ca1\u6709 Unix \u57df\u5957\u63a5\u5b57\u7684\u673a\u5668\u4e0a\u5219\u901a\u8fc7 TCP/IP \u8fde\u63a5\u5230 <code class=\"literal\">localhost</code>\u3002\u9ed8\u8ba4\u7aef\u53e3\u53f7\u5728\u7f16\u8bd1\u65f6\u786e\u5b9a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u670d\u52a1\u5668\u4f7f\u7528\u76f8\u540c\u7684\u9ed8\u8ba4\u503c\uff0c\u56e0\u6b64\u5728\u5927\u591a\u6570\u60c5\u51b5\u4e0b\u4e0d\u5fc5\u6307\u5b9a\u7aef\u53e3\u3002\u9ed8\u8ba4\u7528\u6237\u540d\u662f\u4f60\u7684\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\uff0c\u9ed8\u8ba4\u6570\u636e\u5e93\u540d\u4e5f\u662f\u5982\u6b64\u3002\u8bf7\u6ce8\u610f\uff0c\u4f60\u4e0d\u80fd\u968f\u610f\u4ee5\u4efb\u610f\u6570\u636e\u5e93\u7528\u6237\u540d\u8fde\u63a5\u5230\u4efb\u610f\u6570\u636e\u5e93\u3002\u6570\u636e\u5e93\u7ba1\u7406\u5458\u5e94\u5f53\u5df2\u7ecf\u544a\u77e5\u4f60\u62e5\u6709\u7684\u8bbf\u95ee\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5f53\u9ed8\u8ba4\u503c\u4e0d\u5b8c\u5168\u5408\u9002\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7\u628a\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGDATABASE</code>\u3001<code class=\"envar\">PGHOST</code>\u3001<code class=\"envar\">PGPORT</code>\u548c<code class=\"envar\">PGUSER</code>\u8bbe\u7f6e\u4e3a\u9002\u5f53\u7684\u503c\u6765\u5c11\u6572\u4e00\u4e9b\u952e\u76d8\uff08\u989d\u5916\u7684\u73af\u5883\u53d8\u91cf\u89c1<a class=\"xref\" href=\"/docs/15/libpq-envars.html\" title=\"34.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a034.15\u00a0\u8282</a>\uff09\u3002\u53e6\u5916\uff0c\u51c6\u5907\u4e00\u4e2a<code class=\"filename\">~/.pgpass</code>\u6587\u4ef6\u4e5f\u5f88\u65b9\u4fbf\uff0c\u8fd9\u6837\u5c31\u4e0d\u5fc5\u7ecf\u5e38\u624b\u5de5\u8f93\u5165\u5bc6\u7801\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/15/libpq-pgpass.html\" title=\"34.16.\u00a0\u5bc6\u7801\u6587\u4ef6\">\u7b2c\u00a034.16\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u53e6\u4e00\u79cd\u6307\u5b9a\u8fde\u63a5\u53c2\u6570\u7684\u65b9\u6cd5\u662f\u4f7f\u7528 conninfo \u5b57\u7b26\u4e32\u6216 URI \u6765\u4ee3\u66ff\u6570\u636e\u5e93\u540d\u3002\u6b64\u673a\u5236\u5141\u8bb8\u5bf9\u8fde\u63a5\u8fdb\u884c\u975e\u5e38\u5e7f\u6cdb\u7684\u63a7\u5236\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">$ <strong class=\"userinput\"><code>psql \"service=myservice sslmode=require\"</code></strong>\n$ <strong class=\"userinput\"><code>psql postgresql://dbmaster:5433/mydb?sslmode=require</code></strong>\n</pre>\n<p lang=\"zh\">\u7528\u8fd9\u79cd\u65b9\u5f0f\uff0c\u4f60\u4e5f\u53ef\u4ee5\u628a<acronym class=\"acronym\">LDAP</acronym>\u7528\u4e8e<a class=\"xref\" href=\"/docs/15/libpq-ldap.html\" title=\"34.18.\u00a0\u8fde\u63a5\u53c2\u6570\u7684 LDAP \u67e5\u627e\">\u7b2c\u00a034.18\u00a0\u8282</a>\u4e2d\u63cf\u8ff0\u7684\u8fde\u63a5\u53c2\u6570\u67e5\u627e\u3002\u53ef\u7528\u8fde\u63a5\u9009\u9879\u7684\u66f4\u591a\u4fe1\u606f\u8bf7\u89c1<a class=\"xref\" href=\"/docs/15/libpq.html#LIBPQ-PARAMKEYWORDS\" title=\"34.1.2.\u00a0\u53c2\u6570\u5173\u952e\u8bcd\">\u7b2c\u00a034.1.2\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7531\u4e8e\u4efb\u4f55\u539f\u56e0\uff08\u4f8b\u5982\u6743\u9650\u4e0d\u8db3\u3001\u670d\u52a1\u5668\u6ca1\u6709\u5728\u76ee\u6807\u4e3b\u673a\u4e0a\u8fd0\u884c\u7b49\uff09\u5bfc\u81f4\u8fde\u63a5\u65e0\u6cd5\u5efa\u7acb\uff0c<span class=\"application\">psql</span>\u5c06\u8fd4\u56de\u4e00\u4e2a\u9519\u8bef\u5e76\u4e14\u7ec8\u6b62\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6807\u51c6\u8f93\u5165\u548c\u6807\u51c6\u8f93\u51fa\u90fd\u662f\u7ec8\u7aef\uff0c\u90a3\u4e48<span class=\"application\">psql</span>\u4f1a\u628a\u5ba2\u6237\u7aef\u7f16\u7801\u8bbe\u7f6e\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">auto</span>\u201d</span>\uff0c\u4ece\u533a\u57df\u8bbe\u7f6e\u4e2d\u68c0\u6d4b\u5408\u9002\u7684\u5ba2\u6237\u7aef\u7f16\u7801\uff08\u5728 Unix \u7cfb\u7edf\u4e0a\u662f<code class=\"envar\">LC_CTYPE</code>\u73af\u5883\u53d8\u91cf\uff09\u3002\u5982\u679c\u7ed3\u679c\u4e0d\u7b26\u5408\u9884\u671f\uff0c\u53ef\u4ee5\u4f7f\u7528\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGCLIENTENCODING</code>\u8986\u76d6\u5ba2\u6237\u7aef\u7f16\u7801\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"R2-APP-PSQL-4\">\n<h3 lang=\"zh\">\u8f93\u5165 SQL \u547d\u4ee4</h3>\n<p lang=\"zh\">\u5728\u6b63\u5e38\u64cd\u4f5c\u65f6\uff0c<span class=\"application\">psql</span>\u4f1a\u63d0\u4f9b\u4e00\u4e2a\u63d0\u793a\u7b26\uff0c\u8be5\u63d0\u793a\u7b26\u662f<span class=\"application\">psql</span>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u540d\u79f0\u540e\u9762\u8ddf\u4e0a\u5b57\u7b26\u4e32<code class=\"literal\">=&gt;</code>\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">$ <strong class=\"userinput\"><code>psql testdb</code></strong>\npsql (15.19)\nType \"help\" for help.\n\ntestdb=&gt;\n</pre>\n<p lang=\"zh\">\u5728\u63d0\u793a\u7b26\u4e0b\uff0c\u7528\u6237\u53ef\u4ee5\u8f93\u5165<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u3002\u901a\u5e38\uff0c\u5f53\u9047\u5230\u8868\u793a\u547d\u4ee4\u7ed3\u675f\u7684\u5206\u53f7\u65f6\uff0c\u8f93\u5165\u7684\u5185\u5bb9\u5c31\u4f1a\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u3002\u884c\u7ed3\u675f\u5e76\u4e0d\u4f1a\u7ec8\u6b62\u4e00\u6761\u547d\u4ee4\uff0c\u56e0\u6b64\u4e3a\u4e86\u63d0\u9ad8\u6e05\u6670\u5ea6\uff0c\u547d\u4ee4\u53ef\u4ee5\u5206\u5e03\u5728\u591a\u884c\u4e0a\u3002\u5982\u679c\u547d\u4ee4\u88ab\u53d1\u9001\u5e76\u6210\u529f\u6267\u884c\uff0c\u5176\u7ed3\u679c\u5c31\u4f1a\u663e\u793a\u5728\u5c4f\u5e55\u4e0a\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u53d7\u4fe1\u4efb\u7684\u7528\u6237\u80fd\u591f\u8bbf\u95ee\u5c1a\u672a\u91c7\u7528<a class=\"link\" href=\"/docs/15/ddl-schemas.html#DDL-SCHEMAS-PATTERNS\" title=\"5.9.6.\u00a0\u4f7f\u7528\u65b9\u5f0f\">\u6a21\u5f0f\u7684\u5b89\u5168\u4f7f\u7528\u65b9\u5f0f</a>\u7684\u6570\u636e\u5e93\uff0c\u8bf7\u5728\u4f1a\u8bdd\u5f00\u59cb\u65f6\u4ece<code class=\"varname\">search_path</code>\u4e2d\u79fb\u9664\u6240\u6709\u516c\u4f17\u53ef\u5199\u7684\u6a21\u5f0f\u3002\u53ef\u4ee5\u5728\u8fde\u63a5\u5b57\u7b26\u4e32\u4e2d\u52a0\u5165<code class=\"literal\">options=-csearch_path=</code>\uff0c\u6216\u8005\u5728\u6267\u884c\u5176\u4ed6 SQL \u547d\u4ee4\u4e4b\u524d\u53d1\u51fa<code class=\"literal\">SELECT pg_catalog.set_config('search_path', '', false)</code>\u3002\u8fd9\u79cd\u8003\u8651\u5e76\u975e<span class=\"application\">psql</span>\u7279\u6709\uff1b\u5b83\u9002\u7528\u4e8e\u4efb\u4f55\u6267\u884c\u4efb\u610f SQL \u547d\u4ee4\u7684\u63a5\u53e3\u3002</p>\n<p lang=\"zh\">\u6bcf\u5f53\u6267\u884c\u547d\u4ee4\u65f6\uff0c<span class=\"application\">psql</span>\u4e5f\u4f1a\u8f6e\u8be2\u7531<a class=\"link\" href=\"/docs/15/sql-listen.html\" title=\"LISTEN\"><code class=\"command\">LISTEN</code></a>\u548c<a class=\"link\" href=\"/docs/15/sql-notify.html\" title=\"NOTIFY\"><code class=\"command\">NOTIFY</code></a>\u751f\u6210\u7684\u5f02\u6b65\u901a\u77e5\u4e8b\u4ef6\u3002</p>\n<p lang=\"zh\">\u867d\u7136 C \u98ce\u683c\u7684\u5757\u6ce8\u91ca\u4f1a\u88ab\u4f20\u7ed9\u670d\u52a1\u5668\u5904\u7406\u5e76\u79fb\u9664\uff0c\u4f46 SQL \u6807\u51c6\u6ce8\u91ca\u4f1a\u7531<span class=\"application\">psql</span>\u81ea\u884c\u79fb\u9664\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"APP-PSQL-META-COMMANDS\">\n<h3 lang=\"zh\">\u5143\u547d\u4ee4</h3>\n<p lang=\"zh\">\u4f60\u8f93\u5165\u5230<span class=\"application\">psql</span>\u4e2d\u7684\u4efb\u4f55\u4ee5\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u5f00\u59cb\u7684\u4e1c\u897f\u90fd\u662f\u4e00\u4e2a<span class=\"application\">psql</span>\u5143\u547d\u4ee4\uff0c\u5b83\u4eec\u7531<span class=\"application\">psql</span>\u81ea\u884c\u5904\u7406\u3002\u8fd9\u4e9b\u547d\u4ee4\u8ba9<span class=\"application\">psql</span>\u5bf9\u7ba1\u7406\u548c\u7f16\u5199\u811a\u672c\u66f4\u6709\u7528\u3002\u5143\u547d\u4ee4\u5e38\u5e38\u88ab\u79f0\u4f5c\u659c\u7ebf\u6216\u8005\u53cd\u659c\u7ebf\u547d\u4ee4\u3002</p>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u547d\u4ee4\u7684\u683c\u5f0f\u662f\u7528\u53cd\u659c\u7ebf\u540e\u9762\u76f4\u63a5\u8ddf\u4e0a\u4e00\u4e2a\u547d\u4ee4\u52a8\u8bcd\uff0c\u7136\u540e\u662f\u4e00\u4e9b\u53c2\u6570\u3002\u53c2\u6570\u4e0e\u547d\u4ee4\u52a8\u8bcd\u548c\u5176\u4ed6\u53c2\u6570\u4e4b\u95f4\u7528\u4efb\u610f\u591a\u4e2a\u7a7a\u767d\u5b57\u7b26\u5206\u9694\u5f00\u3002</p>\n<p lang=\"zh\">\u8981\u5728\u53c2\u6570\u4e2d\u5305\u542b\u7a7a\u767d\uff0c\u53ef\u4ee5\u7528\u5355\u5f15\u53f7\u5c06\u5b83\u62ec\u8d77\u6765\u3002\u8981\u5728\u53c2\u6570\u4e2d\u5305\u542b\u4e00\u4e2a\u5355\u5f15\u53f7\uff0c\u53ef\u4ee5\u5728\u5355\u5f15\u53f7\u6587\u672c\u5185\u5199\u4e24\u4e2a\u5355\u5f15\u53f7\u3002\u5355\u5f15\u53f7\u4e2d\u7684\u5185\u5bb9\u8fd8\u4f1a\u63a5\u53d7\u7c7b\u4f3c C \u8bed\u8a00\u7684\u66ff\u6362\uff1a<code class=\"literal\">\\n</code>\uff08\u6362\u884c\uff09\u3001<code class=\"literal\">\\t</code>\uff08\u5236\u8868\u7b26\uff09\u3001<code class=\"literal\">\\b</code>\uff08\u9000\u683c\uff09\u3001<code class=\"literal\">\\r</code>\uff08\u56de\u8f66\uff09\u3001<code class=\"literal\">\\f</code>\uff08\u6362\u9875\uff09\u3001<code class=\"literal\">\\</code><em class=\"replaceable\"><code>digits</code></em>\uff08\u516b\u8fdb\u5236\uff09\u4ee5\u53ca<code class=\"literal\">\\x</code><em class=\"replaceable\"><code>digits</code></em>\uff08\u5341\u516d\u8fdb\u5236\uff09\u3002\u5728\u5355\u5f15\u53f7\u6587\u672c\u5185\uff0c\u53cd\u659c\u7ebf\u51fa\u73b0\u5728\u4efb\u4f55\u5176\u4ed6\u5b57\u7b26\u524d\u9762\u65f6\uff0c\u53ea\u662f\u5bf9\u8be5\u5355\u4e2a\u5b57\u7b26\u8fdb\u884c\u8f6c\u4e49\uff0c\u4e0d\u8bba\u5b83\u662f\u4ec0\u4e48\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u53c2\u6570\u4e2d\u51fa\u73b0\u4e00\u4e2a\u672a\u52a0\u5f15\u53f7\u7684\u5192\u53f7\uff08<code class=\"literal\">:</code>\uff09\uff0c\u540e\u9762\u7d27\u8ddf\u4e00\u4e2a<span class=\"application\">psql</span>\u53d8\u91cf\u540d\uff0c\u5b83\u5c31\u4f1a\u88ab\u8be5\u53d8\u91cf\u7684\u503c\u66ff\u6362\uff0c\u5982\u4e0b\u9762<a class=\"xref\" href=\"/docs/15/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL \u63d2\u503c\">SQL \u63d2\u503c</a>\u6240\u8ff0\u3002\u5176\u4e2d\u4ecb\u7ecd\u7684<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u548c<code class=\"literal\">:\"<em class=\"replaceable\"><code>variable_name</code></em>\"</code>\u5f62\u5f0f\u4e5f\u540c\u6837\u9002\u7528\u3002<code class=\"literal\">:{?<em class=\"replaceable\"><code>variable_name</code></em>}</code>\u8bed\u6cd5\u5141\u8bb8\u6d4b\u8bd5\u53d8\u91cf\u662f\u5426\u5df2\u5b9a\u4e49\uff1b\u5b83\u4f1a\u88ab TRUE \u6216 FALSE \u66ff\u6362\u3002\u7528\u53cd\u659c\u7ebf\u8f6c\u4e49\u8be5\u5192\u53f7\u53ef\u4ee5\u9632\u6b62\u66ff\u6362\u53d1\u751f\u3002</p>\n<p lang=\"zh\">\u5728\u53c2\u6570\u4e2d\uff0c\u7528\u53cd\u5f15\u53f7\uff08<code class=\"literal\">`</code>\uff09\u5305\u56f4\u7684\u6587\u672c\u4f1a\u88ab\u89c6\u4e3a\u4f20\u7ed9 shell \u7684\u547d\u4ee4\u884c\u3002\u8be5\u547d\u4ee4\u7684\u8f93\u51fa\uff08\u53bb\u6389\u672b\u5c3e\u7684\u6362\u884c\u7b26\uff09\u4f1a\u66ff\u6362\u53cd\u5f15\u53f7\u4e2d\u7684\u6587\u672c\u3002\u5728\u53cd\u5f15\u53f7\u5305\u56f4\u7684\u6587\u672c\u5185\u90e8\uff0c\u4e0d\u4f1a\u8fdb\u884c\u7279\u6b8a\u7684\u5f15\u53f7\u5904\u7406\u6216\u5176\u4ed6\u5904\u7406\uff0c\u4f46\u51fa\u73b0<code class=\"literal\">:<em class=\"replaceable\"><code>variable_name</code></em></code>\u65f6\uff0c\u5982\u679c<em class=\"replaceable\"><code>variable_name</code></em>\u662f<span class=\"application\">psql</span>\u53d8\u91cf\u540d\uff0c\u5c31\u4f1a\u88ab\u66ff\u6362\u4e3a\u8be5\u53d8\u91cf\u7684\u503c\u3002\u6b64\u5916\uff0c<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u4e5f\u4f1a\u88ab\u66ff\u6362\u4e3a\u8be5\u53d8\u91cf\u7684\u503c\uff0c\u5e76\u4f1a\u9002\u5f53\u5730\u52a0\u4e0a\u5f15\u53f7\uff0c\u4f7f\u5176\u6210\u4e3a\u5355\u4e2a shell \u547d\u4ee4\u53c2\u6570\u3002\uff08\u540e\u4e00\u79cd\u5f62\u5f0f\u51e0\u4e4e\u603b\u662f\u66f4\u53ef\u53d6\uff0c\u9664\u975e\u4f60\u975e\u5e38\u786e\u5b9a\u53d8\u91cf\u4e2d\u5305\u542b\u4ec0\u4e48\u3002\uff09\u7531\u4e8e\u65e0\u6cd5\u4fdd\u8bc1\u5728\u6240\u6709\u5e73\u53f0\u4e0a\u90fd\u80fd\u5bf9\u56de\u8f66\u548c\u6362\u884c\u5b57\u7b26\u5b89\u5168\u5730\u52a0\u5f15\u53f7\uff0c\u5f53\u53d8\u91cf\u503c\u4e2d\u51fa\u73b0\u8fd9\u7c7b\u5b57\u7b26\u65f6\uff0c<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u5f62\u5f0f\u4f1a\u6253\u5370\u9519\u8bef\u6d88\u606f\uff0c\u5e76\u4e14\u4e0d\u4f1a\u66ff\u6362\u53d8\u91cf\u503c\u3002</p>\n<p lang=\"zh\">\u4e00\u4e9b\u547d\u4ee4\u63a5\u53d7 SQL \u6807\u8bc6\u7b26\uff08\u4f8b\u5982\u8868\u540d\uff09\u4f5c\u4e3a\u53c2\u6570\u3002\u8fd9\u4e9b\u53c2\u6570\u9075\u5faa SQL \u8bed\u6cd5\u89c4\u5219\uff1a\u672a\u52a0\u5f15\u53f7\u7684\u5b57\u6bcd\u4f1a\u5f3a\u5236\u8f6c\u6362\u4e3a\u5c0f\u5199\uff0c\u800c\u53cc\u5f15\u53f7\uff08\"\uff09\u4f1a\u4fdd\u62a4\u5b57\u6bcd\u4e0d\u88ab\u8f6c\u6362\u5927\u5c0f\u5199\uff0c\u5e76\u5141\u8bb8\u6807\u8bc6\u7b26\u5305\u542b\u7a7a\u767d\u5b57\u7b26\u3002\u5728\u53cc\u5f15\u53f7\u5185\u90e8\uff0c\u8fde\u7eed\u4e24\u4e2a\u53cc\u5f15\u53f7\u4f1a\u5728\u6700\u7ec8\u540d\u79f0\u4e2d\u53d8\u4e3a\u4e00\u4e2a\u53cc\u5f15\u53f7\u3002\u4f8b\u5982\uff0cFOO\"BAR\"BAZ \u4f1a\u88ab\u89e3\u91ca\u4e3a fooBARbaz\uff0c\u800c \"A weird\"\" name\" \u4f1a\u53d8\u4e3a A weird\" name\u3002</p>\n<p lang=\"zh\">\u53c2\u6570\u89e3\u6790\u4f1a\u5728\u884c\u5c3e\u6216\u9047\u5230\u53e6\u4e00\u4e2a\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u65f6\u505c\u6b62\u3002\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u4f1a\u88ab\u89c6\u4e3a\u65b0\u5143\u547d\u4ee4\u7684\u5f00\u59cb\u3002\u7279\u6b8a\u5e8f\u5217<code class=\"literal\">\\\\</code>\uff08\u4e24\u4e2a\u53cd\u659c\u7ebf\uff09\u8868\u793a\u53c2\u6570\u7ed3\u675f\uff0c\u5e76\u7ee7\u7eed\u89e3\u6790<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\uff08\u5982\u679c\u8fd8\u6709\uff09\u3002\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u548c<span class=\"application\">psql</span>\u547d\u4ee4\u53ef\u4ee5\u81ea\u7531\u5730\u6df7\u5408\u5728\u540c\u4e00\u884c\u4e2d\u3002\u4f46\u65e0\u8bba\u5982\u4f55\uff0c\u5143\u547d\u4ee4\u7684\u53c2\u6570\u90fd\u4e0d\u80fd\u5ef6\u7eed\u5230\u4e0b\u4e00\u884c\u3002</p>\n<p lang=\"zh\">\u8bb8\u591a\u5143\u547d\u4ee4\u4f5c\u7528\u4e8e<em class=\"firstterm\">\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a</em>\u3002\u8fd9\u53ea\u662f\u4e00\u4e2a\u4fdd\u5b58\u5df2\u8f93\u5165\u4f46\u5c1a\u672a\u53d1\u9001\u5230\u670d\u52a1\u5668\u6267\u884c\u7684 SQL \u547d\u4ee4\u6587\u672c\u7684\u7f13\u51b2\u533a\u3002\u5176\u4e2d\u65e2\u5305\u62ec\u5148\u524d\u8f93\u5165\u7684\u884c\uff0c\u4e5f\u5305\u62ec\u540c\u4e00\u884c\u4e0a\u4f4d\u4e8e\u5143\u547d\u4ee4\u4e4b\u524d\u7684\u6587\u672c\u3002</p>\n<p lang=\"zh\">\u5b9a\u4e49\u4e86\u4ee5\u4e0b\u5143\u547d\u4ee4\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">\\a</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u5f53\u524d\u8868\u683c\u8f93\u51fa\u683c\u5f0f\u662f\u975e\u5bf9\u9f50\uff0c\u5219\u5207\u6362\u4e3a\u5bf9\u9f50\uff1b\u5426\u5219\u5207\u6362\u4e3a\u975e\u5bf9\u9f50\u3002\u4fdd\u7559\u6b64\u547d\u4ee4\u662f\u4e3a\u4e86\u5411\u540e\u517c\u5bb9\u3002\u66f4\u901a\u7528\u7684\u89e3\u51b3\u65b9\u6848\u8bf7\u53c2\u89c1<code class=\"command\">\\pset</code>\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\c</code> \u6216 <code class=\"literal\">\\connect [ -reuse-previous=<em class=\"replaceable\"><code>on|off</code></em> ] [ <em class=\"replaceable\"><code>dbname</code></em> [ <em class=\"replaceable\"><code>username</code></em> ] [ <em class=\"replaceable\"><code>host</code></em> ] [ <em class=\"replaceable\"><code>port</code></em> ] | <em class=\"replaceable\"><code>conninfo</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5efa\u7acb\u5230<span class=\"productname\">PostgreSQL</span>\u670d\u52a1\u5668\u7684\u65b0\u8fde\u63a5\u3002\u53ef\u4ee5\u4f7f\u7528\u4f4d\u7f6e\u8bed\u6cd5\uff08\u6570\u636e\u5e93\u540d\u79f0\u3001\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\u4e2d\u7684\u4e00\u4e2a\u6216\u591a\u4e2a\uff09\u6307\u5b9a\u8981\u4f7f\u7528\u7684\u8fde\u63a5\u53c2\u6570\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528<em class=\"replaceable\"><code>conninfo</code></em>\u8fde\u63a5\u5b57\u7b26\u4e32\uff0c\u8be6\u89c1<a class=\"xref\" href=\"/docs/15/libpq.html#LIBPQ-CONNSTRING\" title=\"34.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u7b2c\u00a034.1.1\u00a0\u8282</a>\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa\u53c2\u6570\uff0c\u5219\u4f7f\u7528\u4e0e\u4e4b\u524d\u76f8\u540c\u7684\u53c2\u6570\u5efa\u7acb\u65b0\u8fde\u63a5\u3002</p>\n<p lang=\"zh\">\u5c06<em class=\"replaceable\"><code>dbname</code></em>\u3001<em class=\"replaceable\"><code>username</code></em>\u3001<em class=\"replaceable\"><code>host</code></em>\u6216 <em class=\"replaceable\"><code>port</code></em>\u4e2d\u7684\u4efb\u610f\u4e00\u4e2a\u6307\u5b9a\u4e3a <code class=\"literal\">-</code>\uff0c\u7b49\u540c\u4e8e\u7701\u7565\u8be5\u53c2\u6570\u3002</p>\n<p lang=\"zh\">\u65b0\u8fde\u63a5\u53ef\u4ee5\u91cd\u7528\u524d\u4e00\u4e2a\u8fde\u63a5\u7684\u8fde\u63a5\u53c2\u6570\uff1b\u4e0d\u4ec5\u5305\u62ec\u6570\u636e\u5e93\u540d\u79f0\u3001\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\uff0c\u8fd8\u5305\u62ec\u5176\u4ed6\u8bbe\u7f6e\uff0c\u5982<em class=\"replaceable\"><code>sslmode</code></em>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53c2\u6570\u5728\u4f4d\u7f6e\u8bed\u6cd5\u4e2d\u88ab\u91cd\u7528\uff0c\u4f46\u5728\u7ed9\u5b9a<em class=\"replaceable\"><code>conninfo</code></em>\u5b57\u7b26\u4e32\u65f6\u4e0d\u4f1a\u88ab\u91cd\u7528\u3002\u4f20\u9012<code class=\"literal\">-reuse-previous=on</code>\u6216<code class=\"literal\">-reuse-previous=off</code>\u4f5c\u4e3a\u7b2c\u4e00\u4e2a\u53c2\u6570\u5c06\u8986\u76d6\u8be5\u9ed8\u8ba4\u8bbe\u7f6e\u3002\u5982\u679c\u53c2\u6570\u88ab\u91cd\u7528\uff0c\u5219\u4efb\u4f55\u672a\u660e\u786e\u6307\u5b9a\u4e3a\u4f4d\u7f6e\u53c2\u6570\u6216\u5728<em class=\"replaceable\"><code>conninfo</code></em>\u5b57\u7b26\u4e32\u4e2d\u7684\u53c2\u6570\u5c06\u4ece\u73b0\u6709\u8fde\u63a5\u7684\u53c2\u6570\u4e2d\u83b7\u53d6\u3002\u4e00\u4e2a\u4f8b\u5916\u662f\uff0c\u5982\u679c\u4f7f\u7528\u4f4d\u7f6e\u8bed\u6cd5\u66f4\u6539<em class=\"replaceable\"><code>host</code></em>\u8bbe\u7f6e\uff0c\u4f7f\u5176\u4e0d\u540c\u4e8e\u5148\u524d\u7684\u503c\uff0c\u5219\u73b0\u6709\u8fde\u63a5\u53c2\u6570\u4e2d\u5b58\u5728\u7684\u4efb\u4f55<em class=\"replaceable\"><code>hostaddr</code></em>\u8bbe\u7f6e\u5c06\u88ab\u5220\u9664\u3002\u6b64\u5916\uff0c\u4ec5\u5f53\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\u8bbe\u7f6e\u672a\u66f4\u6539\u65f6\uff0c\u624d\u4f1a\u91cd\u7528\u73b0\u6709\u8fde\u63a5\u4f7f\u7528\u7684\u4efb\u4f55\u5bc6\u7801\u3002\u5f53\u547d\u4ee4\u65e2\u4e0d\u6307\u5b9a\u4e5f\u4e0d\u91cd\u7528\u7279\u5b9a\u53c2\u6570\u65f6\uff0c\u5c06\u4f7f\u7528<span class=\"application\">libpq</span>\u7684\u9ed8\u8ba4\u503c\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u65b0\u8fde\u63a5\u6210\u529f\u5efa\u7acb\uff0c\u5219\u5173\u95ed\u5148\u524d\u7684\u8fde\u63a5\u3002\u5982\u679c\u8fde\u63a5\u5c1d\u8bd5\u5931\u8d25\uff08\u7528\u6237\u540d\u9519\u8bef\uff0c\u8bbf\u95ee\u88ab\u62d2\u7edd\u7b49\uff09\uff0c\u4e14<span class=\"application\">psql</span>\u5904\u4e8e\u4ea4\u4e92\u6a21\u5f0f\uff0c\u5219\u4fdd\u7559\u5148\u524d\u7684\u8fde\u63a5\u3002\u4f46\u5728\u6267\u884c\u975e\u4ea4\u4e92\u811a\u672c\u65f6\uff0c\u65e7\u8fde\u63a5\u5c06\u88ab\u5173\u95ed\u5e76\u62a5\u544a\u9519\u8bef\u3002\u8fd9\u53ef\u80fd\u4f1a\u6216\u53ef\u80fd\u4e0d\u4f1a\u7ec8\u6b62\u811a\u672c\uff1b\u5982\u679c\u6ca1\u6709\u7ec8\u6b62\uff0c\u76f4\u5230\u6210\u529f\u6267\u884c\u53e6\u4e00\u4e2a<code class=\"literal\">\\connect</code>\u547d\u4ee4\u4e4b\u524d\uff0c\u6240\u6709\u8bbf\u95ee\u6570\u636e\u5e93\u7684\u547d\u4ee4\u90fd\u5c06\u5931\u8d25\u3002\u91c7\u7528\u8fd9\u79cd\u533a\u522b\uff0c\u4e00\u65b9\u9762\u662f\u4e3a\u4e86\u65b9\u4fbf\u7528\u6237\u5e94\u5bf9\u8f93\u5165\u7b14\u8bef\uff0c\u53e6\u4e00\u65b9\u9762\u662f\u4e3a\u4e86\u9632\u6b62\u811a\u672c\u610f\u5916\u64cd\u4f5c\u9519\u8bef\u7684\u6570\u636e\u5e93\u3002\u8bf7\u6ce8\u610f\uff0c\u6bcf\u5f53<code class=\"literal\">\\connect</code>\u547d\u4ee4\u5c1d\u8bd5\u91cd\u65b0\u4f7f\u7528\u53c2\u6570\u65f6\uff0c\u91cd\u65b0\u4f7f\u7528\u7684\u503c\u662f\u6700\u540e\u4e00\u4e2a\u6210\u529f\u8fde\u63a5\u7684\u503c\uff0c\u800c\u4e0d\u662f\u968f\u540e\u7684\u4efb\u4f55\u5931\u8d25\u5c1d\u8bd5\u7684\u503c\u3002\u4f46\u662f\uff0c\u5728\u975e\u4ea4\u4e92<code class=\"literal\">\\connect</code>\u5931\u8d25\u7684\u60c5\u51b5\u4e0b\uff0c\u4e0d\u5141\u8bb8\u7a0d\u540e\u91cd\u65b0\u4f7f\u7528\u53c2\u6570\uff0c\u56e0\u4e3a\u811a\u672c\u53ef\u80fd\u671f\u671b\u4ece\u5931\u8d25\u7684<code class=\"literal\">\\connect</code>\u4e2d\u91cd\u65b0\u4f7f\u7528\u503c\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">=&gt; \\c mydb myuser host.dom 6432\n=&gt; \\c service=foo\n=&gt; \\c \"host=localhost port=5432 dbname=mydb connect_timeout=10 sslmode=disable\"\n=&gt; \\c -reuse-previous=on sslmode=require    -- changes only sslmode\n=&gt; \\c postgresql://tom@localhost/mydb?application_name=myapp\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\C [ <em class=\"replaceable\"><code>title</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u4f5c\u4e3a\u67e5\u8be2\u7ed3\u679c\u6253\u5370\u7684\u8868\u7684\u6807\u9898\uff0c\u6216\u53d6\u6d88\u6b64\u7c7b\u6807\u9898\u3002\u8be5\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset title <em class=\"replaceable\"><code>title</code></em></code>\u3002\uff08\u6b64\u547d\u4ee4\u7684\u540d\u79f0\u6e90\u81ea<span class=\"quote\">\u201c<span class=\"quote\">caption</span>\u201d</span>\uff0c\u56e0\u4e3a\u5b83\u8fc7\u53bb\u53ea\u7528\u4e8e\u8bbe\u7f6e<acronym class=\"acronym\">HTML</acronym>\u8868\u7684\u6807\u9898\u3002\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\cd [ <em class=\"replaceable\"><code>directory</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u66f4\u6539\u4e3a<em class=\"replaceable\"><code>directory</code></em>\u3002\u5982\u679c\u6ca1\u6709\u53c2\u6570\uff0c\u5219\u5207\u6362\u5230\u5f53\u524d\u7528\u6237\u7684\u4e3b\u76ee\u5f55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8981\u6253\u5370\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\uff0c\u8bf7\u4f7f\u7528<code class=\"literal\">\\! pwd</code>\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\conninfo</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa\u5f53\u524d\u6570\u636e\u5e93\u8fde\u63a5\u7684\u4fe1\u606f\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMANDS-COPY\"><span class=\"term\"><code class=\"literal\">\\copy { <em class=\"replaceable\"><code>table</code></em> [ ( <em class=\"replaceable\"><code>column_list</code></em> ) ] } <code class=\"literal\">from</code> { <em class=\"replaceable\"><code>'filename'</code></em> | program <em class=\"replaceable\"><code>'command'</code></em> | stdin | pstdin } [ [ with ] ( <em class=\"replaceable\"><code>option</code></em> [, ...] ) ] [ where <em class=\"replaceable\"><code>condition</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\copy { <em class=\"replaceable\"><code>table</code></em> [ ( <em class=\"replaceable\"><code>column_list</code></em> ) ] | ( <em class=\"replaceable\"><code>query</code></em> ) } <code class=\"literal\">to</code> { <em class=\"replaceable\"><code>'filename'</code></em> | program <em class=\"replaceable\"><code>'command'</code></em> | stdout | pstdout } [ [ with ] ( <em class=\"replaceable\"><code>option</code></em> [, ...] ) ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6267\u884c\u524d\u7aef\uff08\u5ba2\u6237\u7aef\uff09\u590d\u5236\u3002\u8be5\u64cd\u4f5c\u4f1a\u8fd0\u884c\u4e00\u4e2a<acronym class=\"acronym\">SQL</acronym> <a class=\"link\" href=\"/docs/15/sql-copy.html\" title=\"COPY\"><code class=\"command\">COPY</code></a>\u547d\u4ee4\uff0c\u4f46\u5e76\u4e0d\u662f\u7531\u670d\u52a1\u5668\u8bfb\u53d6\u6216\u5199\u5165\u6307\u5b9a\u6587\u4ef6\uff0c\u800c\u662f\u7531<span class=\"application\">psql</span>\u8bfb\u53d6\u6216\u5199\u5165\u6587\u4ef6\uff0c\u5e76\u5728\u670d\u52a1\u5668\u4e0e\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e4b\u95f4\u8f6c\u9001\u6570\u636e\u3002\u8fd9\u610f\u5473\u7740\u6587\u4ef6\u53ef\u8bbf\u95ee\u6027\u548c\u6743\u9650\u53d6\u51b3\u4e8e\u672c\u5730\u7528\u6237\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\uff0c\u4e5f\u4e0d\u9700\u8981 SQL \u8d85\u7ea7\u7528\u6237\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5f53\u6307\u5b9a<code class=\"literal\">program</code>\u65f6\uff0c<em class=\"replaceable\"><code>command</code></em> \u7531<span class=\"application\">psql</span>\u6267\u884c\uff0c\u4f20\u7ed9<em class=\"replaceable\"><code>command</code></em>\u7684\u6570\u636e\u6216\u4ece\u5176\u4e2d\u8bfb\u51fa\u7684\u6570\u636e\u90fd\u4f1a\u5728\u670d\u52a1\u5668\u4e0e\u5ba2\u6237\u7aef\u4e4b\u95f4\u8f6c\u9001\u3002\u518d\u6b21\u5f3a\u8c03\uff0c\u6267\u884c\u6743\u9650\u5c5e\u4e8e\u672c\u5730\u7528\u6237\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\uff0c\u4e5f\u4e0d\u9700\u8981 SQL \u8d85\u7ea7\u7528\u6237\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e \\copy ... from stdin\uff0c\u4ece\u53d1\u51fa\u547d\u4ee4\u7684\u540c\u4e00\u8f93\u5165\u6e90\u8bfb\u53d6\u6570\u636e\u884c\uff0c\u76f4\u5230\u8bfb\u53d6\u5230 \\.\u6216\u8f93\u5165\u6d41\u5230\u8fbe EOF\u3002\u8fd9\u9002\u5408\u5728 SQL \u811a\u672c\u4e2d\u5185\u8054\u586b\u5145\u8868\u3002\u5bf9\u4e8e \\copy ... to stdout\uff0c\u8f93\u51fa\u53d1\u5f80\u4e0e psql \u547d\u4ee4\u8f93\u51fa\u76f8\u540c\u7684\u4f4d\u7f6e\uff0c\u4e14\u4e0d\u6253\u5370 COPY count \u547d\u4ee4\u72b6\u6001\uff0c\u4ee5\u514d\u4e0e\u6570\u636e\u884c\u6df7\u6dc6\u3002\u82e5\u8981\u59cb\u7ec8\u8bfb\u5199 psql \u7684\u6807\u51c6\u8f93\u5165\u6216\u8f93\u51fa\uff0c\u800c\u4e0d\u53d7\u5f53\u524d\u547d\u4ee4\u6765\u6e90\u6216 \\o \u9009\u9879\u5f71\u54cd\uff0c\u8bf7\u4f7f\u7528 from pstdin \u6216 to pstdout\u3002</p>\n<p lang=\"zh\">\u8be5\u547d\u4ee4\u7684\u8bed\u6cd5\u4e0e<acronym class=\"acronym\">SQL</acronym> <a class=\"link\" href=\"/docs/15/sql-copy.html\" title=\"COPY\"><code class=\"command\">COPY</code></a>\u547d\u4ee4\u7c7b\u4f3c\u3002\u9664\u6570\u636e\u6e90\u6216\u76ee\u6807\u4e4b\u5916\uff0c\u5176\u4ed6\u6240\u6709\u9009\u9879\u90fd\u4e0e<code class=\"command\">COPY</code>\u547d\u4ee4\u4e2d\u7684\u6307\u5b9a\u76f8\u540c\u3002\u56e0\u6b64\uff0c\u7279\u6b8a\u7684\u89e3\u6790\u89c4\u5219\u9002\u7528\u4e8e<code class=\"command\">\\copy</code>\u5143\u547d\u4ee4\u3002\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u5269\u4f59\u884c\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\copy</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u6267\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u53e6\u4e00\u79cd\u83b7\u5f97\u4e0e<code class=\"literal\">\\copy ... to</code>\u76f8\u540c\u7ed3\u679c\u7684\u65b9\u6cd5\u662f\u4f7f\u7528<acronym class=\"acronym\">SQL</acronym> <code class=\"literal\">COPY ... TO STDOUT</code>\u547d\u4ee4\uff0c\u5e76\u4ee5<code class=\"literal\">\\g <em class=\"replaceable\"><code>filename</code></em></code> \u6216<code class=\"literal\">\\g |<em class=\"replaceable\"><code>program</code></em></code>\u7ed3\u675f\u3002\u4e0e<code class=\"literal\">\\copy</code>\u4e0d\u540c\uff0c\u8fd9\u79cd\u65b9\u6cd5\u5141\u8bb8\u547d\u4ee4\u8de8\u8d8a\u591a\u884c\uff1b\u6b64\u5916\uff0c\u53ef\u4ee5\u4f7f\u7528\u53d8\u91cf\u63d2\u503c\u548c\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</div>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8fd9\u4e9b\u64cd\u4f5c\u4e0d\u5982\u4ee5\u6587\u4ef6\u6216\u7a0b\u5e8f\u4f5c\u4e3a\u6570\u636e\u6e90\u6216\u76ee\u6807\u7684<acronym class=\"acronym\">SQL</acronym> <code class=\"command\">COPY</code>\u547d\u4ee4\u9ad8\u6548\uff0c\u56e0\u4e3a\u6240\u6709\u6570\u636e\u90fd\u5fc5\u987b\u901a\u8fc7\u5ba2\u6237\u7aef/\u670d\u52a1\u5668\u8fde\u63a5\u4f20\u8f93\u3002\u5bf9\u4e8e\u5927\u91cf\u6570\u636e\uff0c\u4f7f\u7528<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u53ef\u80fd\u66f4\u5408\u9002\u3002\u53e6\u5916\uff0c\u7531\u4e8e\u91c7\u7528\u8fd9\u79cd\u6570\u636e\u8f6c\u9001\u65b9\u5f0f\uff0c<acronym class=\"acronym\">CSV</acronym>\u6a21\u5f0f\u4e0b\u7684<code class=\"literal\">\\copy ... from</code>\u4f1a\u9519\u8bef\u5730\u628a\u5355\u72ec\u5360\u636e\u4e00\u884c\u7684<code class=\"literal\">\\.</code>\u6570\u636e\u503c\u5f53\u4f5c\u8f93\u5165\u7ed3\u675f\u6807\u8bb0\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\copyright</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"productname\">PostgreSQL</span>\u7684\u7248\u6743\u548c\u5206\u53d1\u6761\u6b3e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMANDS-CROSSTABVIEW\"><span class=\"term\"><code class=\"literal\">\\crosstabview [ <em class=\"replaceable\"><code>colV</code></em> [ <em class=\"replaceable\"><code>colH</code></em> [ <em class=\"replaceable\"><code>colD</code></em> [ <em class=\"replaceable\"><code>sortcolH</code></em> ] ] ] ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6267\u884c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\uff08\u4e0e<code class=\"literal\">\\g</code>\u7c7b\u4f3c\uff09\uff0c\u5e76\u4ee5\u4ea4\u53c9\u8868\u7f51\u683c\u663e\u793a\u7ed3\u679c\u3002\u67e5\u8be2\u5fc5\u987b\u8fd4\u56de\u81f3\u5c11\u4e09\u5217\u3002\u7531<em class=\"replaceable\"><code>colV</code></em>\u6807\u8bc6\u7684\u8f93\u51fa\u5217\u6210\u4e3a\u7eb5\u5411\u8868\u5934\uff0c\u7531<em class=\"replaceable\"><code>colH</code></em>\u6807\u8bc6\u7684\u8f93\u51fa\u5217\u6210\u4e3a\u6a2a\u5411\u8868\u5934\u3002<em class=\"replaceable\"><code>colD</code></em>\u6807\u8bc6\u8981\u5728\u7f51\u683c\u4e2d\u663e\u793a\u7684\u8f93\u51fa\u5217\u3002<em class=\"replaceable\"><code>sortcolH</code></em>\u6807\u8bc6\u6a2a\u5411\u8868\u5934\u7684\u53ef\u9009\u6392\u5e8f\u5217\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a\u5217\u6307\u5b9a\u9879\u53ef\u4ee5\u662f\u4ece 1 \u5f00\u59cb\u7684\u5217\u53f7\uff0c\u4e5f\u53ef\u4ee5\u662f\u5217\u540d\uff1b\u5217\u540d\u9075\u5faa\u5e38\u89c4 SQL \u5927\u5c0f\u5199\u6298\u53e0\u548c\u5f15\u53f7\u89c4\u5219\u3002\u7701\u7565\u65f6\uff0ccolV \u9ed8\u8ba4\u4e3a\u7b2c 1 \u5217\uff0ccolH \u9ed8\u8ba4\u4e3a\u7b2c 2 \u5217\u3002colH \u5fc5\u987b\u4e0e colV \u4e0d\u540c\u3002\u82e5\u4e0d\u6307\u5b9a colD\uff0c\u67e5\u8be2\u7ed3\u679c\u5fc5\u987b\u6070\u6709\u4e09\u5217\uff0c\u65e2\u975e colV \u4e5f\u975e colH \u7684\u90a3\u4e00\u5217\u4f5c\u4e3a colD\u3002</p>\n<p lang=\"zh\">\u7eb5\u5411\u8868\u5934\u663e\u793a\u4e3a\u6700\u5de6\u5217\uff0c\u5305\u542b<em class=\"replaceable\"><code>colV</code></em>\u5217\u4e2d\u7684\u503c\uff0c\u5176\u987a\u5e8f\u4e0e\u67e5\u8be2\u7ed3\u679c\u4e2d\u76f8\u540c\uff0c\u4f46\u4f1a\u79fb\u9664\u91cd\u590d\u503c\u3002</p>\n<p lang=\"zh\">\u6a2a\u5411\u8868\u5934\u663e\u793a\u4e3a\u7b2c\u4e00\u884c\uff0c\u5305\u542b<em class=\"replaceable\"><code>colH</code></em>\u5217\u4e2d\u7684\u503c\uff0c\u5e76\u79fb\u9664\u91cd\u590d\u503c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4eec\u6309\u67e5\u8be2\u7ed3\u679c\u4e2d\u7684\u76f8\u540c\u987a\u5e8f\u663e\u793a\u3002\u4f46\u5982\u679c\u7ed9\u51fa\u4e86\u53ef\u9009\u7684<em class=\"replaceable\"><code>sortcolH</code></em>\u53c2\u6570\uff0c\u5b83\u6240\u6807\u8bc6\u7684\u5217\u7684\u503c\u5fc5\u987b\u662f\u6574\u6570\uff0c\u800c<em class=\"replaceable\"><code>colH</code></em>\u4e2d\u7684\u503c\u4f1a\u6309\u7167\u5bf9\u5e94\u7684<em class=\"replaceable\"><code>sortcolH</code></em>\u503c\u6392\u5e8f\u540e\u663e\u793a\u5728\u6a2a\u5411\u8868\u5934\u4e2d\u3002</p>\n<p lang=\"zh\">\u4ea4\u53c9\u8868\u4e2d\uff0c\u5bf9\u4e8e colH \u7684\u6bcf\u4e2a\u4e0d\u540c\u503c x \u548c colV \u7684\u6bcf\u4e2a\u4e0d\u540c\u503c y\uff0c\u4ea4\u70b9 (x,y) \u7684\u5355\u5143\u683c\u4fdd\u5b58\u67e5\u8be2\u7ed3\u679c\u4e2d colH=x \u4e14 colV=y \u90a3\u4e00\u884c\u7684 colD \u503c\u3002\u6ca1\u6709\u5339\u914d\u884c\u65f6\u5355\u5143\u683c\u4e3a\u7a7a\uff1b\u5b58\u5728\u591a\u884c\u65f6\u4f1a\u62a5\u9519\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\d[S+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5bf9\u4e8e\u6bcf\u4e2a\u4e0e<em class=\"replaceable\"><code>pattern</code></em>\u5339\u914d\u7684\u5173\u7cfb\uff08\u8868\u3001\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u7d22\u5f15\u3001\u5e8f\u5217\u6216\u5916\u90e8\u8868\uff09\u6216\u590d\u5408\u7c7b\u578b\uff0c\u663e\u793a\u6240\u6709\u5217\u3001\u5b83\u4eec\u7684\u7c7b\u578b\u3001\u8868\u7a7a\u95f4\uff08\u5982\u679c\u4e0d\u662f\u9ed8\u8ba4\u7684\uff09\u4ee5\u53ca\u4efb\u4f55\u7279\u6b8a\u5c5e\u6027\uff0c\u5982<code class=\"literal\">NOT NULL</code>\u6216\u9ed8\u8ba4\u503c\u3002\u8fd8\u663e\u793a\u76f8\u5173\u7684\u7d22\u5f15\u3001\u7ea6\u675f\u3001\u89c4\u5219\u548c\u89e6\u53d1\u5668\u3002\u5bf9\u4e8e\u5916\u90e8\u8868\uff0c\u8fd8\u663e\u793a\u5173\u8054\u7684\u5916\u90e8\u670d\u52a1\u5668\u3002\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u5339\u914d\u6a21\u5f0f</span>\u201d</span>\u7684\u5b9a\u4e49\u5728\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"\u6a21\u5f0f\">\u6a21\u5f0f</a>\u4e2d\u3002\uff09</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u67d0\u4e9b\u7c7b\u578b\u7684\u5173\u7cfb\uff0c<code class=\"literal\">\\d</code>\u663e\u793a\u6bcf\u5217\u7684\u9644\u52a0\u4fe1\u606f\uff1a\u5e8f\u5217\u7684\u5217\u503c\uff0c\u7d22\u5f15\u7684\u7d22\u5f15\u8868\u8fbe\u5f0f\uff0c\u5916\u90e8\u8868\u7684\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u547d\u4ee4\u5f62\u5f0f<code class=\"literal\">\\d+</code>\u4e0e\u524d\u8005\u76f8\u540c\uff0c\u4f46\u4f1a\u663e\u793a\u66f4\u591a\u4fe1\u606f\uff1a\u8868\u5217\u5173\u8054\u7684\u6ce8\u91ca\u3001\u8868\u662f\u5426\u5305\u542b OID\u3001\u5f53\u5173\u7cfb\u4e3a\u89c6\u56fe\u65f6\u7684\u89c6\u56fe\u5b9a\u4e49\u3001\u975e\u9ed8\u8ba4\u7684<a class=\"link\" href=\"/docs/15/sql-altertable.html#SQL-ALTERTABLE-REPLICA-IDENTITY\">\u590d\u5236\u6807\u8bc6</a>\u8bbe\u7f6e\uff0c\u4ee5\u53ca\u5f53\u5173\u7cfb\u5177\u6709\u8bbf\u95ee\u65b9\u6cd5\u65f6\u7684<a class=\"link\" href=\"/docs/15/sql-create-access-method.html\" title=\"CREATE ACCESS METHOD\">\u8bbf\u95ee\u65b9\u6cd5</a>\u540d\u79f0\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u4e00\u4e2a\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u4ee5\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528<code class=\"command\">\\d</code>\u800c\u6ca1\u6709<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\uff0c\u5b83\u7b49\u540c\u4e8e<code class=\"command\">\\dtvmsE</code>\uff0c\u5b83\u5c06\u663e\u793a\u6240\u6709\u53ef\u89c1\u7684\u8868\u3001\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u7684\u5217\u8868\u3002\u8fd9\u7eaf\u7cb9\u662f\u4e00\u79cd\u4fbf\u5229\u63aa\u65bd\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\da[S] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u805a\u5408\u51fd\u6570\uff0c\u4ee5\u53ca\u5b83\u4eec\u7684\u8fd4\u56de\u7c7b\u578b\u548c\u6240\u4f5c\u7528\u7684\u6570\u636e\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u805a\u5408\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dA[+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8bbf\u95ee\u65b9\u6cd5\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bbf\u95ee\u65b9\u6cd5\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u8bbf\u95ee\u65b9\u6cd5\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u7684\u5904\u7406\u5668\u51fd\u6570\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dAc[+] [<a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>input-type-pattern</code></em></a>]]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u64cd\u4f5c\u7b26\u7c7b\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/15/xindex.html#XINDEX-OPCLASS\" title=\"38.16.1.\u00a0\u7d22\u5f15\u65b9\u6cd5\u548c\u64cd\u4f5c\u7b26\u7c7b\">\u7b2c\u00a038.16.1\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u7c7b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>input-type-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8f93\u5165\u7c7b\u578b\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u7c7b\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u7c7b\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u548c\u6240\u6709\u8005\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dAf[+] [<a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>input-type-pattern</code></em></a>]]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u64cd\u4f5c\u7b26\u65cf\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/15/xindex.html#XINDEX-OPFAMILY\" title=\"38.16.5.\u00a0\u64cd\u4f5c\u7b26\u7c7b\u548c\u64cd\u4f5c\u7b26\u65cf\">\u7b2c\u00a038.16.5\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>input-type-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8f93\u5165\u7c7b\u578b\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u65cf\u90fd\u4f1a\u8fde\u540c\u5176\u6240\u6709\u8005\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dAo[+] [<a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>operator-family-pattern</code></em></a>]]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u4e0e\u64cd\u4f5c\u7b26\u65cf\u5173\u8054\u7684\u64cd\u4f5c\u7b26\uff08\u89c1<a class=\"xref\" href=\"/docs/15/xindex.html#XINDEX-STRATEGIES\" title=\"38.16.2.\u00a0\u7d22\u5f15\u65b9\u6cd5\u7b56\u7565\">\u7b2c\u00a038.16.2\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u5173\u8054\u8bbf\u95ee\u65b9\u6cd5\u7684\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u64cd\u4f5c\u7b26\u65cf\u6210\u5458\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>operator-family-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u64cd\u4f5c\u7b26\u65cf\u6210\u5458\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u5217\u51fa\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u7684\u6392\u5e8f\u64cd\u4f5c\u7b26\u65cf\uff08\u5982\u679c\u5b83\u662f\u4e00\u4e2a\u6392\u5e8f\u64cd\u4f5c\u7b26\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dAp[+] [<a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>operator-family-pattern</code></em></a>]]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u4e0e\u64cd\u4f5c\u7b26\u65cf\u5173\u8054\u7684\u652f\u6301\u51fd\u6570\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/15/xindex.html#XINDEX-SUPPORT\" title=\"38.16.3.\u00a0\u7d22\u5f15\u65b9\u6cd5\u652f\u6301\u4f8b\u7a0b\">\u7b2c\u00a038.16.3\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u6240\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u51fd\u6570\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>operator-family-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u8be5\u6a21\u5f0f\u5339\u914d\u7684\u64cd\u4f5c\u7b26\u65cf\u51fd\u6570\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u51fd\u6570\u4f1a\u4ee5\u8be6\u7ec6\u5f62\u5f0f\u663e\u793a\uff0c\u5e76\u5e26\u6709\u5176\u5b9e\u9645\u53c2\u6570\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\db[+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8868\u7a7a\u95f4\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8868\u7a7a\u95f4\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u8868\u7a7a\u95f4\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u9009\u9879\u3001\u78c1\u76d8\u5927\u5c0f\u3001\u6743\u9650\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dc[S+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5b57\u7b26\u96c6\u7f16\u7801\u4e4b\u95f4\u7684\u8f6c\u6362\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8f6c\u6362\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dconfig[+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u670d\u52a1\u5668\u914d\u7f6e\u53c2\u6570\u53ca\u5176\u503c\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u53c2\u6570\u3002\u4e0d\u5e26 <em class=\"replaceable\"><code>pattern</code></em> \u65f6\uff0c\u53ea\u5217\u51fa\u88ab\u8bbe\u7f6e\u4e3a\u975e\u9ed8\u8ba4\u503c\u7684\u53c2\u6570\u3002\uff08\u4f7f\u7528 <code class=\"literal\">\\dconfig *</code> \u53ef\u67e5\u770b\u6240\u6709\u53c2\u6570\u3002\uff09\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u53c2\u6570\u90fd\u4f1a\u8fde\u540c\u5176\u6570\u636e\u7c7b\u578b\u3001\u8be5\u53c2\u6570\u53ef\u8bbe\u7f6e\u7684\u4e0a\u4e0b\u6587\u4ee5\u53ca\u8bbf\u95ee\u6743\u9650\uff08\u5982\u679c\u5df2\u6388\u4e88\u975e\u9ed8\u8ba4\u8bbf\u95ee\u6743\u9650\uff09\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dC[+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u7c7b\u578b\u8f6c\u6362\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u6e90\u7c7b\u578b\u6216\u76ee\u6807\u7c7b\u578b\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u7c7b\u578b\u8f6c\u6362\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u5217\u51fa\u6bcf\u4e2a\u5bf9\u8c61\u5173\u8054\u7684\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dd[S] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u663e\u793a<code class=\"literal\">constraint</code>\u3001<code class=\"literal\">operator class</code>\u3001<code class=\"literal\">operator family</code>\u3001<code class=\"literal\">rule</code>\u548c <code class=\"literal\">trigger</code>\u7c7b\u578b\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002\u5176\u4ed6\u6ce8\u91ca\u53ef\u901a\u8fc7\u5bf9\u5e94\u5bf9\u8c61\u7c7b\u578b\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u67e5\u770b\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">\\dd</code> \u663e\u793a\u4e0e <em class=\"replaceable\"><code>pattern</code></em> \u5339\u914d\u7684\u5bf9\u8c61\u63cf\u8ff0\uff1b\u5982\u679c\u6ca1\u6709\u7ed9\u51fa\u53c2\u6570\uff0c\u5219\u663e\u793a\u76f8\u5e94\u7c7b\u578b\u7684\u53ef\u89c1\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002\u4f46\u65e0\u8bba\u54ea\u79cd\u60c5\u51b5\uff0c\u53ea\u5217\u51fa\u90a3\u4e9b\u5df2\u6709\u63cf\u8ff0\u7684\u5bf9\u8c61\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528 <a class=\"link\" href=\"/docs/15/sql-comment.html\" title=\"COMMENT\"><code class=\"command\">COMMENT</code></a> <acronym class=\"acronym\">SQL</acronym> \u547d\u4ee4\u521b\u5efa\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dD[S+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u57df\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u57df\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u6743\u9650\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\ddp [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u9ed8\u8ba4\u8bbf\u95ee\u6743\u9650\u8bbe\u7f6e\u3002\u5bf9\u4e8e\u6bcf\u4e2a\u9ed8\u8ba4\u6743\u9650\u8bbe\u7f6e\u5df2\u504f\u79bb\u5185\u7f6e\u9ed8\u8ba4\u503c\u7684\u89d2\u8272\uff08\u4ee5\u53ca\u9002\u7528\u65f6\u7684\u6a21\u5f0f\uff09\uff0c\u90fd\u4f1a\u663e\u793a\u4e00\u6761\u8bb0\u5f55\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u89d2\u8272\u540d\u6216\u6a21\u5f0f\u540d\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bb0\u5f55\u3002</p>\n<p lang=\"zh\"><a class=\"link\" href=\"/docs/15/sql-alterdefaultprivileges.html\" title=\"ALTER DEFAULT PRIVILEGES\"><code class=\"command\">ALTER DEFAULT PRIVILEGES</code></a>\u547d\u4ee4\u7528\u4e8e\u8bbe\u7f6e\u9ed8\u8ba4\u8bbf\u95ee\u6743\u9650\u3002\u6743\u9650\u663e\u793a\u7684\u542b\u4e49\u5728<a class=\"xref\" href=\"/docs/15/ddl-priv.html\" title=\"5.7.\u00a0\u6743\u9650\">\u7b2c\u00a05.7\u00a0\u8282</a>\u4e2d\u6709\u89e3\u91ca\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dE[S+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\di[S+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dm[S+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\ds[S+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dt[S+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dv[S+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd9\u7ec4\u547d\u4ee4\u4e2d\uff0c\u5b57\u6bcd <code class=\"literal\">E</code>\u3001<code class=\"literal\">i</code>\u3001<code class=\"literal\">m</code>\u3001<code class=\"literal\">s</code>\u3001<code class=\"literal\">t</code> \u548c <code class=\"literal\">v</code> \u5206\u522b\u8868\u793a\u5916\u90e8\u8868\u3001\u7d22\u5f15\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u3001\u8868\u548c\u89c6\u56fe\u3002\u4f60\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u6307\u5b9a\u5176\u4e2d\u4efb\u610f\u4e00\u4e2a\u6216\u591a\u4e2a\u5b57\u6bcd\uff0c\u4ee5\u83b7\u53d6\u8fd9\u4e9b\u7c7b\u578b\u5bf9\u8c61\u7684\u5217\u8868\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dti</code> \u4f1a\u5217\u51fa\u8868\u548c\u7d22\u5f15\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u6301\u4e45\u6027\u72b6\u6001\uff08\u6c38\u4e45\u3001\u4e34\u65f6\u6216\u4e0d\u8bb0\u5f55 WAL\uff09\u3001\u78c1\u76d8\u4e0a\u7684\u7269\u7406\u5927\u5c0f\u4ee5\u53ca\u76f8\u5173\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u4e00\u8d77\u5217\u51fa\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u5bf9\u8c61\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\des[+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u670d\u52a1\u5668\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external servers</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u670d\u52a1\u5668\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\des+</code>\u5f62\u5f0f\uff0c\u5219\u663e\u793a\u6bcf\u4e2a\u670d\u52a1\u5668\u7684\u5b8c\u6574\u8bf4\u660e\uff0c\u5305\u62ec\u670d\u52a1\u5668\u7684\u8bbf\u95ee\u6743\u9650\u3001\u7c7b\u578b\u3001\u7248\u672c\u3001\u9009\u9879\u548c\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\det[+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u8868\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external tables</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u8868\u540d\u6216\u6a21\u5f0f\u540d\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6761\u76ee\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\det+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u901a\u7528\u9009\u9879\u548c\u5916\u90e8\u8868\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\deu[+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u7528\u6237\u6620\u5c04\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external users</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u7528\u6237\u540d\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6620\u5c04\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\deu+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u6620\u5c04\u7684\u9644\u52a0\u4fe1\u606f\u3002</p>\n<div class=\"caution\">\n<h3 class=\"title\" lang=\"zh\">\u5c0f\u5fc3</h3>\n<p lang=\"zh\"><code class=\"literal\">\\deu+</code>\u8fd8\u53ef\u80fd\u663e\u793a\u8fdc\u7a0b\u7528\u6237\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u56e0\u6b64\u5e94\u6ce8\u610f\u4e0d\u8981\u6cc4\u9732\u5b83\u4eec\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dew[+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external wrappers</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dew+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u7684\u8bbf\u95ee\u6743\u9650\u3001\u9009\u9879\u548c\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\df[anptwS+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> [ <em class=\"replaceable\"><code>arg_pattern</code></em> ... ] ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u51fd\u6570\uff0c\u4ee5\u53ca\u5b83\u4eec\u7684\u7ed3\u679c\u6570\u636e\u7c7b\u578b\u3001\u53c2\u6570\u6570\u636e\u7c7b\u578b\u548c\u51fd\u6570\u7c7b\u578b\uff0c\u51fd\u6570\u7c7b\u578b\u5206\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">agg</span>\u201d</span>\uff08\u805a\u5408\uff09\u3001<span class=\"quote\">\u201c<span class=\"quote\">normal</span>\u201d</span>\u3001<span class=\"quote\">\u201c<span class=\"quote\">procedure</span>\u201d</span>\u3001<span class=\"quote\">\u201c<span class=\"quote\">trigger</span>\u201d</span>\u6216<span class=\"quote\">\u201c<span class=\"quote\">window</span>\u201d</span>\u3002\u8981\u53ea\u663e\u793a\u7279\u5b9a\u7c7b\u578b\u7684\u51fd\u6570\uff0c\u8bf7\u5728\u547d\u4ee4\u540e\u6dfb\u52a0\u76f8\u5e94\u7684\u5b57\u6bcd <code class=\"literal\">a</code>\u3001<code class=\"literal\">n</code>\u3001<code class=\"literal\">p</code>\u3001<code class=\"literal\">t</code> \u6216 <code class=\"literal\">w</code>\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u51fd\u6570\u3002\u4efb\u4f55\u9644\u52a0\u53c2\u6570\u90fd\u662f\u7c7b\u578b\u540d\u6a21\u5f0f\uff0c\u5206\u522b\u4e0e\u51fd\u6570\u7b2c\u4e00\u3001\u7b2c\u4e8c\u7b49\u53c2\u6570\u7684\u7c7b\u578b\u540d\u5339\u914d\u3002\uff08\u5339\u914d\u5230\u7684\u51fd\u6570\u53ef\u4ee5\u6bd4\u4f60\u6307\u5b9a\u7684\u53c2\u6570\u66f4\u591a\uff1b\u82e5\u8981\u9632\u6b62\u8fd9\u79cd\u60c5\u51b5\uff0c\u53ef\u5c06\u8fde\u5b57\u7b26 <code class=\"literal\">-</code> \u5199\u6210\u6700\u540e\u4e00\u4e2a <em class=\"replaceable\"><code>arg_pattern</code></em>\u3002\uff09\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u4f7f\u7528 <code class=\"literal\">\\df+</code> \u5f62\u5f0f\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u51fd\u6570\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u6613\u53d8\u6027\u3001\u5e76\u884c\u5b89\u5168\u6027\u3001\u6240\u6709\u8005\u3001\u5b89\u5168\u5206\u7c7b\u3001\u8bbf\u95ee\u6743\u9650\u3001\u8bed\u8a00\u3001\u6e90\u4ee3\u7801\u548c\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dF[+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u914d\u7f6e\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u914d\u7f6e\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dF+</code>\u5f62\u5f0f\uff0c\u5219\u663e\u793a\u6bcf\u4e2a\u914d\u7f6e\u7684\u5b8c\u6574\u8bf4\u660e\uff0c\u5305\u62ec\u5e95\u5c42\u5168\u6587\u68c0\u7d22\u89e3\u6790\u5668\u548c\u6bcf\u79cd\u89e3\u6790\u5668\u8bcd\u5143\u7c7b\u578b\u7684\u8bcd\u5178\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dFd[+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u8bcd\u5178\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bcd\u5178\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dFd+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u9009\u4e2d\u8bcd\u5178\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5e95\u5c42\u5168\u6587\u68c0\u7d22\u6a21\u677f\u548c\u9009\u9879\u503c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dFp[+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u89e3\u6790\u5668\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u89e3\u6790\u5668\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dFp+</code>\u5f62\u5f0f\uff0c\u5219\u663e\u793a\u6bcf\u4e2a\u89e3\u6790\u5668\u7684\u5b8c\u6574\u8bf4\u660e\uff0c\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u548c\u53ef\u8bc6\u522b\u7684\u8bcd\u5143\u7c7b\u578b\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dFt[+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u6a21\u677f\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6a21\u677f\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dFt+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u6a21\u677f\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dg[S+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u5e93\u89d2\u8272\u3002\uff08\u7531\u4e8e<span class=\"quote\">\u201c<span class=\"quote\">\u7528\u6237</span>\u201d</span>\u548c<span class=\"quote\">\u201c<span class=\"quote\">\u7ec4</span>\u201d</span>\u7684\u6982\u5ff5\u5df2\u7ecf\u7edf\u4e00\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">\u89d2\u8272</span>\u201d</span>\uff0c\u6b64\u547d\u4ee4\u73b0\u5728\u7b49\u4ef7\u4e8e<code class=\"literal\">\\du</code>\u3002\uff09\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u89d2\u8272\uff1b\u63d0\u4f9b<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u89d2\u8272\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u89d2\u8272\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dg+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u89d2\u8272\u7684\u9644\u52a0\u4fe1\u606f\uff1b\u76ee\u524d\u4f1a\u589e\u52a0\u6bcf\u4e2a\u89d2\u8272\u7684\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dl[+]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u662f <code class=\"command\">\\lo_list</code> \u7684\u522b\u540d\uff0c\u540e\u8005\u4f1a\u663e\u793a\u5927\u5bf9\u8c61\u5217\u8868\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u5217\u51fa\u6bcf\u4e2a\u5927\u5bf9\u8c61\u7684\u76f8\u5173\u6743\u9650\uff08\u5982\u679c\u6709\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dL[S+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8fc7\u7a0b\u8bed\u8a00\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bed\u8a00\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u8bed\u8a00\uff1b\u63d0\u4f9b <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u79cd\u8bed\u8a00\u90fd\u4f1a\u8fde\u540c\u5176\u8c03\u7528\u5904\u7406\u5668\u3001\u9a8c\u8bc1\u5668\u3001\u8bbf\u95ee\u6743\u9650\u4ee5\u53ca\u5b83\u662f\u5426\u4e3a\u7cfb\u7edf\u5bf9\u8c61\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dn[S+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6a21\u5f0f\uff08\u547d\u540d\u7a7a\u95f4\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6a21\u5f0f\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u6743\u9650\u548c\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\do[S+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> [ <em class=\"replaceable\"><code>arg_pattern</code></em> [ <em class=\"replaceable\"><code>arg_pattern</code></em> ] ] ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u64cd\u4f5c\u7b26\u53ca\u5176\u64cd\u4f5c\u6570\u7c7b\u578b\u548c\u7ed3\u679c\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u64cd\u4f5c\u7b26\u3002\u5982\u679c\u6307\u5b9a\u4e86\u4e00\u4e2a <em class=\"replaceable\"><code>arg_pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u5176\u53f3\u53c2\u6570\u7c7b\u578b\u540d\u79f0\u4e0e\u8be5\u6a21\u5f0f\u5339\u914d\u7684\u524d\u7f00\u64cd\u4f5c\u7b26\u3002\u5982\u679c\u6307\u5b9a\u4e86\u4e24\u4e2a <em class=\"replaceable\"><code>arg_pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u53c2\u6570\u7c7b\u578b\u540d\u79f0\u4e0e\u8fd9\u4e9b\u6a21\u5f0f\u5339\u914d\u7684\u4e8c\u5143\u64cd\u4f5c\u7b26\u3002\uff08\u5bf9\u4e8e\u4e00\u5143\u64cd\u4f5c\u7b26\u672a\u4f7f\u7528\u7684\u53c2\u6570\uff0c\u4e5f\u53ef\u4ee5\u5199\u6210 <code class=\"literal\">-</code>\u3002\uff09\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u76ee\u524d\u4ec5\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u540d\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dO[S+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6392\u5e8f\u89c4\u5219\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6392\u5e8f\u89c4\u5219\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u6392\u5e8f\u89c4\u5219\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u4e00\u8d77\u5217\u51fa\u3002\u8bf7\u6ce8\u610f\uff0c\u53ea\u4f1a\u663e\u793a\u4e0e\u5f53\u524d\u6570\u636e\u5e93\u7f16\u7801\u517c\u5bb9\u7684\u6392\u5e8f\u89c4\u5219\uff0c\u56e0\u6b64\u5728\u540c\u4e00\u5b89\u88c5\u4e2d\u7684\u4e0d\u540c\u6570\u636e\u5e93\u91cc\u7ed3\u679c\u53ef\u80fd\u4e0d\u540c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dp [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u53ca\u5176\u76f8\u5173\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u3002</p>\n<p lang=\"zh\"><a class=\"link\" href=\"/docs/15/sql-grant.html\" title=\"GRANT\"><code class=\"command\">GRANT</code></a>\u548c <a class=\"link\" href=\"/docs/15/sql-revoke.html\" title=\"REVOKE\"><code class=\"command\">REVOKE</code></a> \u547d\u4ee4\u7528\u4e8e\u8bbe\u7f6e\u8bbf\u95ee\u6743\u9650\u3002\u6743\u9650\u663e\u793a\u7684\u542b\u4e49\u5728<a class=\"xref\" href=\"/docs/15/ddl-priv.html\" title=\"5.7.\u00a0\u6743\u9650\">\u7b2c\u00a05.7\u00a0\u8282</a>\u4e2d\u6709\u89e3\u91ca\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dP[itn+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5206\u533a\u5173\u7cfb\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6761\u76ee\u3002\u53ef\u4ee5\u5728\u547d\u4ee4\u540e\u9644\u52a0\u4fee\u9970\u7b26<code class=\"literal\">t</code>\uff08\u8868\uff09\u548c<code class=\"literal\">i</code>\uff08\u7d22\u5f15\uff09\uff0c\u7b5b\u9009\u8981\u5217\u51fa\u7684\u5173\u7cfb\u7c7b\u578b\u3002\u9ed8\u8ba4\u4f1a\u5217\u51fa\u5206\u533a\u8868\u548c\u5206\u533a\u7d22\u5f15\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528\u4e86\u4fee\u9970\u7b26<code class=\"literal\">n</code>\uff08<span class=\"quote\">\u201c<span class=\"quote\">nested</span>\u201d</span>\uff09\uff0c\u6216\u6307\u5b9a\u4e86\u6a21\u5f0f\uff0c\u5219\u4f1a\u5305\u542b\u975e\u6839\u5206\u533a\u5173\u7cfb\uff0c\u5e76\u663e\u793a\u4e00\u5217\uff0c\u5217\u51fa\u6bcf\u4e2a\u5206\u533a\u5173\u7cfb\u7684\u7236\u5173\u7cfb\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u5173\u7cfb\u7684\u5404\u4e2a\u5206\u533a\u7684\u5927\u5c0f\u4e4b\u548c\uff0c\u4ee5\u53ca\u8be5\u5173\u7cfb\u7684\u63cf\u8ff0\u3002\u5982\u679c\u5c06<code class=\"literal\">n</code>\u4e0e<code class=\"literal\">+</code>\u7ed3\u5408\u4f7f\u7528\uff0c\u5219\u663e\u793a\u4e24\u4e2a\u5927\u5c0f\uff1a\u4e00\u4e2a\u662f\u76f4\u63a5\u9644\u52a0\u7684\u53f6\u5b50\u5206\u533a\u7684\u603b\u5927\u5c0f\uff0c\u53e6\u4e00\u4e2a\u662f\u6240\u6709\u5206\u533a\u7684\u603b\u5927\u5c0f\uff0c\u5305\u62ec\u95f4\u63a5\u9644\u52a0\u7684\u5b50\u5206\u533a\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\drds [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>role-pattern</code></em></a> [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>database-pattern</code></em></a> ] ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5df2\u5b9a\u4e49\u7684\u914d\u7f6e\u8bbe\u7f6e\u3002\u8fd9\u4e9b\u8bbe\u7f6e\u53ef\u4ee5\u7279\u5b9a\u4e8e\u89d2\u8272\u3001\u7279\u5b9a\u4e8e\u6570\u636e\u5e93\uff0c\u6216\u540c\u65f6\u7279\u5b9a\u4e8e\u4e24\u8005\u3002<em class=\"replaceable\"><code>role-pattern</code></em>\u548c<em class=\"replaceable\"><code>database-pattern</code></em>\u5206\u522b\u7528\u4e8e\u9009\u62e9\u8981\u5217\u51fa\u7684\u89d2\u8272\u548c\u6570\u636e\u5e93\u3002\u7701\u7565\u67d0\u4e2a\u6a21\u5f0f\u53c2\u6570\u6216\u5c06\u5176\u6307\u5b9a\u4e3a<code class=\"literal\">*</code>\u65f6\uff0c\u4e0d\u4f1a\u6309\u8be5\u53c2\u6570\u7b5b\u9009\uff0c\u8fd8\u4f1a\u5206\u522b\u5305\u542b\u4e0d\u7279\u5b9a\u4e8e\u89d2\u8272\u6216\u4e0d\u7279\u5b9a\u4e8e\u6570\u636e\u5e93\u7684\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\"><a class=\"link\" href=\"/docs/15/sql-alterrole.html\" title=\"ALTER ROLE\"><code class=\"command\">ALTER ROLE</code></a>\u548c <a class=\"link\" href=\"/docs/15/sql-alterdatabase.html\" title=\"ALTER DATABASE\"><code class=\"command\">ALTER DATABASE</code></a> \u547d\u4ee4\u7528\u4e8e\u5b9a\u4e49\u6bcf\u4e2a\u89d2\u8272\u548c\u6bcf\u4e2a\u6570\u636e\u5e93\u7684\u914d\u7f6e\u8bbe\u7f6e\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dRp[+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u903b\u8f91\u590d\u5236\u53d1\u5e03\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u53d1\u5e03\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u8fd8\u4f1a\u663e\u793a\u4e0e\u6bcf\u4e2a\u53d1\u5e03\u5173\u8054\u7684\u8868\u548c\u6a21\u5f0f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dRs[+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u903b\u8f91\u590d\u5236\u8ba2\u9605\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8ba2\u9605\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u8ba2\u9605\u7684\u5176\u4ed6\u5c5e\u6027\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dT[S+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u7c7b\u578b\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u7c7b\u578b\u90fd\u4f1a\u8fde\u540c\u5176\u5185\u90e8\u540d\u79f0\u3001\u5927\u5c0f\u4ee5\u53ca\u76f8\u5173\u6743\u9650\u4e00\u8d77\u5217\u51fa\uff1b\u5bf9\u4e8e <code class=\"type\">enum</code> \u7c7b\u578b\uff0c\u8fd8\u4f1a\u663e\u793a\u5176\u5141\u8bb8\u503c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\du[S+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u5e93\u89d2\u8272\u3002\uff08\u7531\u4e8e<span class=\"quote\">\u201c<span class=\"quote\">\u7528\u6237</span>\u201d</span>\u548c<span class=\"quote\">\u201c<span class=\"quote\">\u7ec4</span>\u201d</span>\u7684\u6982\u5ff5\u5df2\u7ecf\u7edf\u4e00\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">\u89d2\u8272</span>\u201d</span>\uff0c\u6b64\u547d\u4ee4\u73b0\u5728\u7b49\u4ef7\u4e8e<code class=\"literal\">\\dg</code>\u3002\uff09\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u89d2\u8272\uff1b\u63d0\u4f9b<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u89d2\u8272\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u89d2\u8272\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\du+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u89d2\u8272\u7684\u9644\u52a0\u4fe1\u606f\uff1b\u76ee\u524d\u4f1a\u589e\u52a0\u6bcf\u4e2a\u89d2\u8272\u7684\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dx[+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5df2\u5b89\u88c5\u7684\u6269\u5c55\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6269\u5c55\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dx+</code>\u5f62\u5f0f\uff0c\u5219\u5217\u51fa\u5c5e\u4e8e\u6bcf\u4e2a\u5339\u914d\u6269\u5c55\u7684\u6240\u6709\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dX [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u6269\u5c55\u7edf\u8ba1\u4fe1\u606f\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6269\u5c55\u7edf\u8ba1\u4fe1\u606f\u3002</p>\n<p lang=\"zh\">\u6bcf\u79cd\u6269\u5c55\u7edf\u8ba1\u7684\u72b6\u6001\u663e\u793a\u5728\u4ee5\u7edf\u8ba1\u79cd\u7c7b\u547d\u540d\u7684\u5217\u4e2d\uff0c\u4f8b\u5982 Ndistinct\u3002defined \u8868\u793a\u521b\u5efa\u7edf\u8ba1\u65f6\u8bf7\u6c42\u4e86\u8be5\u7edf\u8ba1\uff0cNULL \u8868\u793a\u672a\u8bf7\u6c42\u3002\u82e5\u8981\u5224\u65ad ANALYZE \u662f\u5426\u8fd0\u884c\u8fc7\u3001\u7edf\u8ba1\u662f\u5426\u53ef\u4f9b\u89c4\u5212\u5668\u4f7f\u7528\uff0c\u53ef\u67e5\u8be2 pg_stats_ext\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\dy[+] [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u4e8b\u4ef6\u89e6\u53d1\u5668\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u4e8b\u4ef6\u89e6\u53d1\u5668\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\e</code> \u6216 <code class=\"literal\">\\edit</code> <code class=\"literal\">[ <span class=\"optional\"><em class=\"replaceable\"><code>filename</code></em></span> ] [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5219\u7f16\u8f91\u8be5\u6587\u4ef6\uff1b\u7f16\u8f91\u5668\u9000\u51fa\u540e\uff0c\u6587\u4ef6\u5185\u5bb9\u5c06\u88ab\u590d\u5236\u5230\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5219\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u590d\u5236\u5230\u4e34\u65f6\u6587\u4ef6\u4e2d\uff0c\u7136\u540e\u4ee5\u76f8\u540c\u65b9\u5f0f\u8fdb\u884c\u7f16\u8f91\u3002\u6216\u8005\uff0c\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u5c06\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u590d\u5236\u5230\u4e34\u65f6\u6587\u4ef6\u4e2d\uff0c\u5e76\u4ee5\u76f8\u540c\u65b9\u5f0f\u8fdb\u884c\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7f16\u8f91\u6587\u4ef6\u6216\u4e0a\u4e00\u4e2a\u67e5\u8be2\u540e\u5728\u672a\u4fee\u6539\u6587\u4ef6\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5219\u67e5\u8be2\u7f13\u51b2\u533a\u5c06\u88ab\u6e05\u9664\u3002\u5426\u5219\uff0c\u67e5\u8be2\u7f13\u51b2\u533a\u7684\u65b0\u5185\u5bb9\u5c06\u6839\u636e<span class=\"application\">psql</span>\u7684\u6b63\u5e38\u89c4\u5219\u91cd\u65b0\u89e3\u6790\uff0c\u5c06\u6574\u4e2a\u7f13\u51b2\u533a\u89c6\u4e3a\u5355\u884c\u3002\u4efb\u4f55\u5b8c\u6574\u7684\u67e5\u8be2\u5c06\u7acb\u5373\u6267\u884c\uff1b\u4e5f\u5c31\u662f\u8bf4\uff0c\u5982\u679c\u67e5\u8be2\u7f13\u51b2\u533a\u5305\u542b\u5206\u53f7\u6216\u4ee5\u5206\u53f7\u7ed3\u5c3e\uff0c\u5219\u6267\u884c\u5e76\u4ece\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u5220\u9664\u5230\u8be5\u70b9\u7684\u6240\u6709\u5185\u5bb9\u3002\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u5269\u4f59\u7684\u5185\u5bb9\u5c06\u91cd\u65b0\u663e\u793a\u3002\u8f93\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u8f93\u5165<code class=\"literal\">\\r</code>\u901a\u8fc7\u6e05\u9664\u67e5\u8be2\u7f13\u51b2\u533a\u6765\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u5c06\u7f13\u51b2\u533a\u89c6\u4e3a\u5355\u884c\u4e3b\u8981\u5f71\u54cd\u5143\u547d\u4ee4\uff1a\u5728\u5143\u547d\u4ee4\u540e\u7684\u7f13\u51b2\u533a\u5c06\u88ab\u89c6\u4e3a\u5143\u547d\u4ee4\u7684\u53c2\u6570\uff0c\u5373\u4f7f\u5b83\u8de8\u8d8a\u591a\u884c\u3002\uff08\u56e0\u6b64\uff0c\u4e0d\u80fd\u7528\u8fd9\u79cd\u65b9\u5f0f\u521b\u5efa\u4f7f\u7528\u5143\u547d\u4ee4\u7684\u811a\u672c\u3002\u8bf7\u4f7f\u7528<code class=\"command\">\\i</code>\u3002\uff09</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u5c06\u5149\u6807\u5b9a\u4f4d\u5728\u6587\u4ef6\u6216\u67e5\u8be2\u7f13\u51b2\u533a\u7684\u6307\u5b9a\u884c\u4e0a\u3002\u8bf7\u6ce8\u610f\uff0c\u5982\u679c\u53ea\u7ed9\u51fa\u4e00\u4e2a\u5168\u662f\u6570\u5b57\u7684\u53c2\u6570\uff0c<span class=\"application\">psql</span>\u4f1a\u5047\u5b9a\u5b83\u662f\u4e00\u4e2a\u884c\u53f7\uff0c\u800c\u4e0d\u662f\u6587\u4ef6\u540d\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5173\u4e8e\u5982\u4f55\u914d\u7f6e\u548c\u81ea\u5b9a\u4e49\u7f16\u8f91\u5668\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/15/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"\u73af\u5883\">\u73af\u5883</a>\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\echo <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6c42\u503c\u540e\u7684\u53c2\u6570\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff0c\u7528\u7a7a\u683c\u5206\u9694\uff0c\u5e76\u5728\u672b\u5c3e\u52a0\u4e0a\u6362\u884c\u7b26\u3002\u8fd9\u5bf9\u4e8e\u5728\u811a\u672c\u8f93\u51fa\u4e2d\u7a7f\u63d2\u4fe1\u606f\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>\\echo `date`</code></strong>\nTue Oct 26 21:40:57 CEST 1999\n</pre>\n<p lang=\"zh\">\u5982\u679c\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f\u672a\u52a0\u5f15\u53f7\u7684<code class=\"literal\">-n</code>\uff0c\u5219\u4e0d\u4f1a\u5199\u5165\u5c3e\u968f\u7684\u6362\u884c\u7b26\uff08\u4e5f\u4e0d\u4f1a\u5199\u5165\u7b2c\u4e00\u4e2a\u53c2\u6570\uff09\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528<code class=\"command\">\\o</code>\u547d\u4ee4\u91cd\u5b9a\u5411\u67e5\u8be2\u8f93\u51fa\uff0c\u53ef\u80fd\u4f1a\u60f3\u7528<code class=\"command\">\\qecho</code>\u4ee3\u66ff\u8fd9\u4e2a\u547d\u4ee4\u3002\u53e6\u8bf7\u53c2\u9605<code class=\"command\">\\warn</code>\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\ef [ <span class=\"optional\"><em class=\"replaceable\"><code>function_description</code></em> [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</span> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u7f16\u8f91\u6307\u5b9a\u51fd\u6570\u6216\u8fc7\u7a0b\u7684\u5b9a\u4e49\uff0c\u5f62\u5f0f\u4e3a<code class=\"command\">CREATE OR REPLACE FUNCTION</code>\u6216 <code class=\"command\">CREATE OR REPLACE PROCEDURE</code>\u547d\u4ee4\u3002\u7f16\u8f91\u65b9\u5f0f\u4e0e<code class=\"literal\">\\edit</code>\u76f8\u540c\u3002\u5982\u679c\u5728\u4e0d\u4fdd\u5b58\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5219\u8be5\u8bed\u53e5\u4f1a\u88ab\u4e22\u5f03\u3002\u5982\u679c\u4fdd\u5b58\u5e76\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5e76\u5728\u5176\u4e2d\u6dfb\u52a0\u4e86\u5206\u53f7\uff0c\u5219\u66f4\u65b0\u540e\u7684\u547d\u4ee4\u4f1a\u7acb\u5373\u6267\u884c\u3002\u5426\u5219\u5b83\u4f1a\u91cd\u65b0\u663e\u793a\uff1b\u952e\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u7528<code class=\"literal\">\\r</code>\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u76ee\u6807\u51fd\u6570\u53ef\u4ec5\u7528\u540d\u79f0\u6307\u5b9a\uff0c\u4e5f\u53ef\u7528\u540d\u79f0\u548c\u53c2\u6570\u6307\u5b9a\uff0c\u4f8b\u5982 foo(integer, text)\u3002\u82e5\u6709\u591a\u4e2a\u540c\u540d\u51fd\u6570\uff0c\u5219\u5fc5\u987b\u63d0\u4f9b\u53c2\u6570\u7c7b\u578b\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u51fd\u6570\uff0c\u5219\u4f1a\u5448\u73b0\u4e00\u4e2a\u7a7a\u7684<code class=\"command\">CREATE FUNCTION</code>\u6a21\u677f\u4f9b\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u5c06\u5149\u6807\u5b9a\u4f4d\u5728\u51fd\u6570\u4f53\u7684\u6307\u5b9a\u884c\u4e0a\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u51fd\u6570\u4f53\u901a\u5e38\u4e0d\u4f1a\u4ece\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u5f00\u59cb\u3002\uff09</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\ef</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5173\u4e8e\u5982\u4f55\u914d\u7f6e\u548c\u81ea\u5b9a\u4e49\u7f16\u8f91\u5668\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/15/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"\u73af\u5883\">\u73af\u5883</a>\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\encoding [ <em class=\"replaceable\"><code>encoding</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5ba2\u6237\u7aef\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u6ca1\u6709\u53c2\u6570\u65f6\uff0c\u6b64\u547d\u4ee4\u663e\u793a\u5f53\u524d\u7f16\u7801\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\errverbose</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ee5\u6700\u5927\u7684\u8be6\u7ec6\u7a0b\u5ea6\u91cd\u590d\u6700\u8fd1\u7684\u670d\u52a1\u5668\u9519\u8bef\u6d88\u606f\uff0c\u5c31\u597d\u50cf<code class=\"varname\">VERBOSITY</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">verbose</code>\uff0c<code class=\"varname\">SHOW_CONTEXT</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">always</code>\u4e00\u6837\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\ev [ <span class=\"optional\"><em class=\"replaceable\"><code>view_name</code></em> [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</span> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u7f16\u8f91\u6307\u5b9a\u89c6\u56fe\u7684\u5b9a\u4e49\uff0c\u5f62\u5f0f\u4e3a<code class=\"command\">CREATE OR REPLACE VIEW</code>\u547d\u4ee4\u3002\u7f16\u8f91\u65b9\u5f0f\u4e0e<code class=\"literal\">\\edit</code>\u76f8\u540c\u3002\u5982\u679c\u5728\u4e0d\u4fdd\u5b58\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5219\u8be5\u8bed\u53e5\u4f1a\u88ab\u4e22\u5f03\u3002\u5982\u679c\u4fdd\u5b58\u5e76\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5e76\u5728\u5176\u4e2d\u6dfb\u52a0\u4e86\u5206\u53f7\uff0c\u5219\u66f4\u65b0\u540e\u7684\u547d\u4ee4\u4f1a\u7acb\u5373\u6267\u884c\uff1b\u5426\u5219\u5c06\u91cd\u65b0\u663e\u793a\uff1b\u8f93\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u7528<code class=\"literal\">\\r</code>\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u89c6\u56fe\uff0c\u5219\u4f1a\u5448\u73b0\u4e00\u4e2a\u7a7a\u7684<code class=\"command\">CREATE VIEW</code>\u6a21\u677f\u4f9b\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u5c06\u5149\u6807\u5b9a\u4f4d\u5728\u89c6\u56fe\u5b9a\u4e49\u7684\u6307\u5b9a\u884c\u4e0a\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\ev</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\f [ <em class=\"replaceable\"><code>string</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u67e5\u8be2\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u9ed8\u8ba4\u503c\u662f\u7ad6\u7ebf\uff08<code class=\"literal\">|</code>\uff09\u3002\u5b83\u7b49\u540c\u4e8e<code class=\"command\">\\pset fieldsep</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\g [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\g [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u6267\u884c\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728<code class=\"literal\">\\g</code>\u540e\u9762\u51fa\u73b0\u62ec\u53f7\uff0c\u5219\u62ec\u53f7\u4e2d\u662f\u7528\u7a7a\u683c\u5206\u9694\u7684<em class=\"replaceable\"><code>option</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em>\u683c\u5f0f\u9009\u9879\u5b50\u53e5\u5217\u8868\u3002\u8fd9\u4e9b\u5b50\u53e5\u7684\u89e3\u91ca\u65b9\u5f0f\u4e0e<code class=\"literal\">\\pset</code> <em class=\"replaceable\"><code>option</code></em> <em class=\"replaceable\"><code>value</code></em>\u547d\u4ee4\u76f8\u540c\uff0c\u4f46\u4ec5\u5728\u6b64\u67e5\u8be2\u6267\u884c\u671f\u95f4\u751f\u6548\u3002\u5728\u6b64\u5217\u8868\u4e2d\uff0c<code class=\"literal\">=</code>\u7b26\u53f7\u5468\u56f4\u4e0d\u5141\u8bb8\u6709\u7a7a\u683c\uff0c\u4f46\u9009\u9879\u5b50\u53e5\u4e4b\u95f4\u5fc5\u987b\u6709\u7a7a\u683c\u3002\u5982\u679c<code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em>\u88ab\u7701\u7565\uff0c\u5219\u6307\u5b9a\u7684<em class=\"replaceable\"><code>option</code></em>\u4f1a\u6309\u4ee5\u4e0b\u547d\u4ee4\u7684\u65b9\u5f0f\u66f4\u6539\uff1a<code class=\"literal\">\\pset</code> <em class=\"replaceable\"><code>option</code></em>\uff0c\u5176\u4e2d\u4e0d\u663e\u5f0f\u6307\u5b9a<em class=\"replaceable\"><code>value</code></em>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7ed9\u51fa\u4e86<em class=\"replaceable\"><code>filename</code></em>\u6216<code class=\"literal\">|</code><em class=\"replaceable\"><code>command</code></em>\u53c2\u6570\uff0c\u67e5\u8be2\u8f93\u51fa\u5c31\u4f1a\u5199\u5165\u6307\u5b9a\u6587\u4ef6\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6307\u5b9a\u7684 shell \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u7167\u5e38\u663e\u793a\u3002\u53ea\u6709\u5f53\u67e5\u8be2\u6210\u529f\u8fd4\u56de\u96f6\u4e2a\u6216\u591a\u4e2a\u5143\u7ec4\u65f6\uff0c\u624d\u4f1a\u5411\u6587\u4ef6\u6216\u547d\u4ee4\u5199\u5165\uff1b\u5982\u679c\u67e5\u8be2\u5931\u8d25\uff0c\u6216\u6267\u884c\u7684\u662f\u4e0d\u8fd4\u56de\u6570\u636e\u7684 SQL \u547d\u4ee4\uff0c\u5219\u4e0d\u4f1a\u5199\u5165\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u5c06\u88ab\u91cd\u65b0\u6267\u884c\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u6ca1\u6709\u4efb\u4f55\u53c2\u6570\u7684<code class=\"literal\">\\g</code>\u57fa\u672c\u4e0a\u7b49\u540c\u4e8e\u4e00\u4e2a\u5206\u53f7\u3002\u5e26\u6709\u53c2\u6570\u7684<code class=\"literal\">\\g</code>\u63d0\u4f9b\u4e86\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u4e00\u6b21\u6027</span>\u201d</span>\u66ff\u4ee3<code class=\"command\">\\o</code>\u547d\u4ee4\u7684\u9009\u62e9\uff0c\u5e76\u4e14\u8fd8\u5141\u8bb8\u4e00\u6b21\u6027\u8c03\u6574\u901a\u5e38\u7531<code class=\"literal\">\\pset</code>\u8bbe\u7f6e\u7684\u8f93\u51fa\u683c\u5f0f\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u5f53\u6700\u540e\u4e00\u4e2a\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\u65f6\uff0c\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u90fd\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u65e2\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\uff0c\u4e5f\u4e0d\u8fdb\u884c\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u90e8\u5206\u4f1a\u76f4\u63a5\u6309\u5b57\u9762\u4f20\u7ed9 shell\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\gdesc</code></span></dt>\n<dd>\n<p lang=\"zh\">\u663e\u793a\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u67e5\u8be2\u7ed3\u679c\u7684\u63cf\u8ff0\uff08\u5373\u5217\u540d\u548c\u6570\u636e\u7c7b\u578b\uff09\u3002\u67e5\u8be2\u5e76\u4e0d\u4f1a\u5b9e\u9645\u6267\u884c\uff1b\u4e0d\u8fc7\uff0c\u5982\u679c\u5176\u4e2d\u5b58\u5728\u8bed\u6cd5\u9519\u8bef\uff0c\u4f1a\u6309\u901a\u5e38\u7684\u65b9\u5f0f\u62a5\u544a\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6539\u4e3a\u63cf\u8ff0\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\getenv <em class=\"replaceable\"><code>psql_var</code></em> <em class=\"replaceable\"><code>env_var</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u83b7\u53d6\u73af\u5883\u53d8\u91cf<em class=\"replaceable\"><code>env_var</code></em>\u7684\u503c\uff0c\u5e76\u5c06\u5176\u8d4b\u7ed9<span class=\"application\">psql</span>\u53d8\u91cf<em class=\"replaceable\"><code>psql_var</code></em>\u3002\u5982\u679c<em class=\"replaceable\"><code>env_var</code></em>\u5728<span class=\"application\">psql</span>\u8fdb\u7a0b\u7684\u73af\u5883\u4e2d\u672a\u5b9a\u4e49\uff0c<em class=\"replaceable\"><code>psql_var</code></em>\u4e0d\u4f1a\u88ab\u6539\u53d8\u3002\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>\\getenv home HOME</code></strong>\n=&gt; <strong class=\"userinput\"><code>\\echo :home</code></strong>\n/home/postgres\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\gexec</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u7136\u540e\u5c06\u67e5\u8be2\u8f93\u51fa\u7684\u6bcf\u884c\u6bcf\u5217\u89c6\u4e3a\u8981\u6267\u884c\u7684SQL\u8bed\u53e5\u3002\u4f8b\u5982\uff0c\u8981\u5728<code class=\"structname\">my_table</code>\u7684\u6bcf\u4e00\u5217\u4e0a\u521b\u5efa\u7d22\u5f15\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT format('create index on my_table(%I)', attname)</code></strong>\n-&gt; <strong class=\"userinput\"><code>FROM pg_attribute</code></strong>\n-&gt; <strong class=\"userinput\"><code>WHERE attrelid = 'my_table'::regclass AND attnum &gt; 0</code></strong>\n-&gt; <strong class=\"userinput\"><code>ORDER BY attnum</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gexec</code></strong>\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\n</pre>\n<p lang=\"zh\">\u751f\u6210\u7684\u67e5\u8be2\u6309\u8fd4\u56de\u884c\u7684\u987a\u5e8f\u6267\u884c\uff1b\u540c\u4e00\u884c\u6709\u591a\u5217\u65f6\u4ece\u5de6\u5230\u53f3\u6267\u884c\uff0c\u5ffd\u7565 NULL \u5b57\u6bb5\u3002\u67e5\u8be2\u539f\u6837\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u56e0\u6b64\u4e0d\u80fd\u662f psql \u5143\u547d\u4ee4\uff0c\u4e5f\u4e0d\u80fd\u5305\u542b psql \u53d8\u91cf\u5f15\u7528\u3002\u9664\u975e\u8bbe\u7f6e ON_ERROR_STOP\uff0c\u67d0\u6761\u67e5\u8be2\u5931\u8d25\u540e\u4ecd\u7ee7\u7eed\u6267\u884c\u5176\u4f59\u67e5\u8be2\u3002\u6bcf\u6761\u67e5\u8be2\u5747\u9075\u5faa ECHO \u8bbe\u7f6e\uff08\u4f7f\u7528 \\gexec \u65f6\uff0c\u901a\u5e38\u5efa\u8bae\u5c06 ECHO \u8bbe\u4e3a all \u6216 queries\uff09\uff0c\u67e5\u8be2\u65e5\u5fd7\u3001\u5355\u6b65\u6a21\u5f0f\u3001\u8ba1\u65f6\u7b49\u6267\u884c\u529f\u80fd\u4e5f\u5206\u522b\u5e94\u7528\u4e8e\u6bcf\u6761\u751f\u6210\u7684\u67e5\u8be2\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\gset [ <em class=\"replaceable\"><code>prefix</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u5e76\u5c06\u67e5\u8be2\u8f93\u51fa\u5b58\u5165 <span class=\"application\">psql</span> \u53d8\u91cf\uff08\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/15/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\uff09\u3002\u8981\u6267\u884c\u7684\u67e5\u8be2\u5fc5\u987b\u6070\u597d\u8fd4\u56de\u4e00\u884c\u3002\u8be5\u884c\u7684\u6bcf\u4e00\u5217\u5206\u522b\u5b58\u5165\u4e00\u4e2a\u53d8\u91cf\uff0c\u53d8\u91cf\u540d\u4e0e\u5217\u540d\u76f8\u540c\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT 'hello' AS var1, 10 AS var2</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gset</code></strong>\n=&gt; <strong class=\"userinput\"><code>\\echo :var1 :var2</code></strong>\nhello 10\n</pre>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>prefix</code></em>\uff0c\u5219\u4f1a\u5c06\u8be5\u5b57\u7b26\u4e32\u52a0\u5230\u67e5\u8be2\u7684\u5217\u540d\u524d\u9762\uff0c\u4ee5\u6784\u6210\u8981\u4f7f\u7528\u7684\u53d8\u91cf\u540d\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT 'hello' AS var1, 10 AS var2</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gset result_</code></strong>\n=&gt; <strong class=\"userinput\"><code>\\echo :result_var1 :result_var2</code></strong>\nhello 10\n</pre>\n<p lang=\"zh\">\u5982\u679c\u67d0\u4e00\u5217\u7684\u7ed3\u679c\u4e3a NULL\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u5bf9\u5e94\u7684\u53d8\u91cf\uff0c\u800c\u4e0d\u662f\u8bbe\u7f6e\u5b83\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u67e5\u8be2\u5931\u8d25\u6216\u6ca1\u6709\u6070\u597d\u8fd4\u56de\u4e00\u884c\uff0c\u5219\u4e0d\u4f1a\u66f4\u6539\u4efb\u4f55\u53d8\u91cf\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\gx [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\gx [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\\gx \u4e0e \\g \u7b49\u4ef7\uff0c\u4f46\u4f1a\u5f3a\u5236\u6b64\u67e5\u8be2\u4f7f\u7528\u6269\u5c55\u8f93\u51fa\u6a21\u5f0f\uff0c\u76f8\u5f53\u4e8e\u5728 \\pset \u9009\u9879\u5217\u8868\u4e2d\u6307\u5b9a expanded=on\u3002\u53e6\u89c1 \\x\u3002</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\h</code>\u6216<code class=\"literal\">\\help</code> <code class=\"literal\">[ <em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u7ed9\u51fa\u6307\u5b9a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u7684\u8bed\u6cd5\u5e2e\u52a9\u3002\u5982\u679c\u672a\u6307\u5b9a<em class=\"replaceable\"><code>command</code></em>\uff0c\u5219<span class=\"application\">psql</span>\u5c06\u5217\u51fa\u6240\u6709\u53ef\u7528\u8bed\u6cd5\u5e2e\u52a9\u7684\u547d\u4ee4\u3002\u5982\u679c<em class=\"replaceable\"><code>command</code></em>\u662f\u661f\u53f7\uff08<code class=\"literal\">*</code>\uff09\uff0c\u5219\u663e\u793a\u6240\u6709<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u7684\u8bed\u6cd5\u5e2e\u52a9\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\help</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u4e3a\u4e86\u7b80\u5316\u8f93\u5165\uff0c\u7531\u591a\u4e2a\u5355\u8bcd\u7ec4\u6210\u7684\u547d\u4ee4\u4e0d\u9700\u8981\u52a0\u5f15\u53f7\u3002\u56e0\u6b64\uff0c\u53ef\u4ee5\u76f4\u63a5\u8f93\u5165<strong class=\"userinput\"><code>\\help alter table</code></strong>\u3002</p>\n</div>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\H</code> \u6216 <code class=\"literal\">\\html</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5f00<acronym class=\"acronym\">HTML</acronym>\u67e5\u8be2\u8f93\u51fa\u683c\u5f0f\u3002\u5982\u679c<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u5df2\u7ecf\u6253\u5f00\uff0c\u5219\u5207\u6362\u56de\u9ed8\u8ba4\u7684\u5bf9\u9f50\u6587\u672c\u683c\u5f0f\u3002\u6b64\u547d\u4ee4\u662f\u4e3a\u517c\u5bb9\u6027\u548c\u4fbf\u5229\u6027\u800c\u4fdd\u7559\u7684\uff1b\u8bbe\u7f6e\u5176\u4ed6\u8f93\u51fa\u9009\u9879\u7684\u65b9\u6cd5\u89c1<code class=\"command\">\\pset</code>\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\i</code> \u6216 <code class=\"literal\">\\include</code> <em class=\"replaceable\"><code>filename</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u8bfb\u53d6\u8f93\u5165\uff0c\u5e76\u50cf\u5728\u952e\u76d8\u4e0a\u8f93\u5165\u4e00\u6837\u6267\u884c\u5b83\u3002</p>\n<p lang=\"zh\">\u5982\u679c<em class=\"replaceable\"><code>filename</code></em>\u662f<code class=\"literal\">-</code>\uff08\u8fde\u5b57\u7b26\uff09\uff0c\u5219\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\uff0c\u76f4\u5230\u9047\u5230 EOF \u6307\u793a\u6216<code class=\"command\">\\q</code>\u5143\u547d\u4ee4\u3002\u8fd9\u53ef\u7528\u4e8e\u5c06\u4ea4\u4e92\u5f0f\u8f93\u5165\u4e0e\u6587\u4ef6\u8f93\u5165\u4ea4\u9519\u4f7f\u7528\u3002\u8bf7\u6ce8\u610f\uff0c\u53ea\u6709\u5728\u6700\u5916\u5c42\u542f\u7528\u4e86 Readline\uff0c\u6b64\u5904\u624d\u4f1a\u4f7f\u7528 Readline \u529f\u80fd\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5982\u679c\u60f3\u5728\u5c4f\u5e55\u4e0a\u770b\u5230\u88ab\u8bfb\u5165\u7684\u5404\u884c\uff0c\u8bf7\u5c06\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">all</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"PSQL-METACOMMAND-IF\"><span class=\"term\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\elif</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\else</code><br/></span><span class=\"term\"><code class=\"literal\">\\endif</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u7ec4\u547d\u4ee4\u5b9e\u73b0\u4e86\u53ef\u5d4c\u5957\u7684\u6761\u4ef6\u5757\u3002\u6761\u4ef6\u5757\u5fc5\u987b\u4ee5<code class=\"command\">\\if</code>\u5f00\u59cb\uff0c\u5e76\u4ee5<code class=\"command\">\\endif</code>\u7ed3\u675f\u3002\u5728\u4e24\u8005\u4e4b\u95f4\u53ef\u4ee5\u6709\u4efb\u610f\u6570\u91cf\u7684<code class=\"command\">\\elif</code>\u5b50\u53e5\uff0c\u540e\u9762\u53ef\u4ee5\u9009\u62e9\u6027\u5730\u8ddf\u7740\u4e00\u4e2a<code class=\"command\">\\else</code>\u5b50\u53e5\u3002\u5728\u5f62\u6210\u6761\u4ef6\u5757\u7684\u547d\u4ee4\u4e4b\u95f4\u901a\u5e38\u4f1a\u51fa\u73b0\u666e\u901a\u67e5\u8be2\u548c\u5176\u4ed6\u7c7b\u578b\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\\if \u548c \\elif \u8bfb\u53d6\u53c2\u6570\u5e76\u5c06\u5176\u4f5c\u4e3a\u5e03\u5c14\u8868\u8fbe\u5f0f\u6c42\u503c\u3002\u7ed3\u679c\u4e3a\u771f\u65f6\u7ee7\u7eed\u6b63\u5e38\u5904\u7406\uff0c\u5426\u5219\u8df3\u8fc7\u540e\u7eed\u884c\uff0c\u76f4\u5230\u9047\u5230\u5339\u914d\u7684 \\elif\u3001\\else \u6216 \\endif\u3002\u67d0\u4e2a \\if \u6216 \\elif \u6761\u4ef6\u6210\u7acb\u540e\uff0c\u540c\u4e00\u5757\u4e2d\u540e\u7eed \\elif \u7684\u53c2\u6570\u4e0d\u518d\u6c42\u503c\uff0c\u76f4\u63a5\u89c6\u4e3a\u5047\u3002\u53ea\u6709\u4e4b\u524d\u5339\u914d\u7684 \\if \u548c \\elif \u5747\u672a\u6210\u7acb\uff0c\u624d\u5904\u7406 \\else \u540e\u7684\u884c\u3002</p>\n<p lang=\"zh\">\u4e0e\u5176\u4ed6\u53cd\u659c\u6760\u547d\u4ee4\u53c2\u6570\u4e00\u6837\uff0c\\if \u6216 \\elif \u7684\u8868\u8fbe\u5f0f\u53c2\u6570\u5148\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u548c\u53cd\u5f15\u53f7\u5c55\u5f00\uff0c\u7136\u540e\u50cf\u5f00\u5173\u9009\u9879\u53d8\u91cf\u4e00\u6837\u6c42\u503c\u3002\u6709\u6548\u503c\u4e3a true\u3001false\u30011\u30010\u3001on\u3001off\u3001yes\u3001no \u7684\u4efb\u610f\u65e0\u6b67\u4e49\u3001\u4e0d\u533a\u5206\u5927\u5c0f\u5199\u7684\u5339\u914d\u3002\u4f8b\u5982 t\u3001T \u548c tR \u90fd\u4f1a\u89c6\u4e3a\u771f\u3002</p>\n<p lang=\"zh\">\u4e0d\u80fd\u6b63\u786e\u6c42\u503c\u4e3a\u771f\u6216\u5047\u7684\u8868\u8fbe\u5f0f\u4f1a\u4ea7\u751f\u8b66\u544a\uff0c\u5e76\u88ab\u89c6\u4e3a\u5047\u3002</p>\n<p lang=\"zh\">\u88ab\u8df3\u8fc7\u7684\u884c\u4f1a\u88ab\u6b63\u5e38\u89e3\u6790\u4ee5\u8bc6\u522b\u67e5\u8be2\u548c\u53cd\u659c\u7ebf\u547d\u4ee4\uff0c\u4f46\u67e5\u8be2\u4e0d\u4f1a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u4e14\u9664\u4e86\u6761\u4ef6\u547d\u4ee4\uff08<code class=\"command\">\\if</code>\u3001<code class=\"command\">\\elif</code>\u3001<code class=\"command\">\\else</code>\u3001<code class=\"command\">\\endif</code>\uff09\u4e4b\u5916\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u4f1a\u88ab\u5ffd\u7565\u3002\u4ec5\u68c0\u67e5\u8df3\u8fc7\u884c\u4e2d\u6761\u4ef6\u547d\u4ee4\u7684\u6709\u6548\u5d4c\u5957\u3002\u8df3\u8fc7\u884c\u4e2d\u7684\u53d8\u91cf\u5f15\u7528\u4e0d\u4f1a\u88ab\u5c55\u5f00\uff0c\u4e5f\u4e0d\u4f1a\u6267\u884c\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<p lang=\"zh\">\u540c\u4e00\u4e2a\u6761\u4ef6\u5757\u7684\u6240\u6709\u53cd\u659c\u7ebf\u547d\u4ee4\u5fc5\u987b\u51fa\u73b0\u5728\u540c\u4e00\u4e2a\u6e90\u6587\u4ef6\u4e2d\u3002\u5982\u679c\u4e3b\u8f93\u5165\u6587\u4ef6\u6216\u901a\u8fc7<code class=\"command\">\\include</code>\u5f15\u5165\u7684\u6587\u4ef6\u5230\u8fbe EOF \u65f6\uff0c\u4ecd\u6709\u672c\u5730<code class=\"command\">\\if</code>\u5757\u672a\u5173\u95ed\uff0c<span class=\"application\">psql</span>\u5c31\u4f1a\u62a5\u9519\u3002</p>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4e00\u4e2a\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">-- check for the existence of two separate records in the database and store\n-- the results in separate psql variables\nSELECT\n    EXISTS(SELECT 1 FROM customer WHERE customer_id = 123) as is_customer,\n    EXISTS(SELECT 1 FROM employee WHERE employee_id = 456) as is_employee\n\\gset\n\\if :is_customer\n    SELECT * FROM customer WHERE customer_id = 123;\n\\elif :is_employee\n    \\echo 'is not a customer but is an employee'\n    SELECT * FROM employee WHERE employee_id = 456;\n\\else\n    \\if yes\n        \\echo 'not a customer or employee'\n    \\else\n        \\echo 'this will never print'\n    \\endif\n\\endif\n</pre>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\ir</code> \u6216 <code class=\"literal\">\\include_relative</code> <em class=\"replaceable\"><code>filename</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"literal\">\\ir</code>\u547d\u4ee4\u4e0e<code class=\"literal\">\\i</code>\u76f8\u4f3c\uff0c\u4f46\u89e3\u6790\u76f8\u5bf9\u6587\u4ef6\u540d\u7684\u65b9\u5f0f\u4e0d\u540c\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\u6267\u884c\u65f6\uff0c\u8fd9\u4e24\u4e2a\u547d\u4ee4\u7684\u884c\u4e3a\u76f8\u540c\u3002\u4e0d\u8fc7\uff0c\u5728\u811a\u672c\u4e2d\u8c03\u7528\u65f6\uff0c<code class=\"literal\">\\ir</code>\u4f1a\u76f8\u5bf9\u4e8e\u811a\u672c\u6240\u5728\u7684\u76ee\u5f55\u6765\u89e3\u91ca\u6587\u4ef6\u540d\uff0c\u800c\u4e0d\u662f\u76f8\u5bf9\u4e8e\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\l[+]</code>\u6216<code class=\"literal\">\\list[+] [ <a class=\"link\" href=\"/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"\u6a21\u5f0f\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u670d\u52a1\u5668\u4e2d\u7684\u6570\u636e\u5e93\uff0c\u5e76\u663e\u793a\u5176\u540d\u79f0\u3001\u6240\u6709\u8005\u3001\u5b57\u7b26\u96c6\u7f16\u7801\u548c\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6570\u636e\u5e93\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u8fd8\u4f1a\u663e\u793a\u6570\u636e\u5e93\u5927\u5c0f\u3001\u9ed8\u8ba4\u8868\u7a7a\u95f4\u548c\u63cf\u8ff0\u3002\u5f53\u524d\u7528\u6237\u5bf9\u5176\u62e5\u6709 <code class=\"literal\">CONNECT</code> \u6743\u9650\u7684\u6570\u636e\u5e93\u53ef\u4ee5\u663e\u793a\u5927\u5c0f\u4fe1\u606f\uff1b\u5982\u679c\u5f53\u524d\u7528\u6237\u662f\u8d85\u7ea7\u7528\u6237\u6216\u5177\u6709 <code class=\"literal\">pg_read_all_stats</code> \u89d2\u8272\u7684\u6743\u9650\uff0c\u4e5f\u53ef\u4ee5\u663e\u793a\u5927\u5c0f\u4fe1\u606f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\lo_export <em class=\"replaceable\"><code>loid</code></em> <em class=\"replaceable\"><code>filename</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6570\u636e\u5e93\u4e2d\u8bfb\u53d6\u5177\u6709<acronym class=\"acronym\">OID</acronym><em class=\"replaceable\"><code>loid</code></em>\u7684\u5927\u5bf9\u8c61\uff0c\u5e76\u5c06\u5176\u5199\u5165<em class=\"replaceable\"><code>filename</code></em>\u3002\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e0e\u670d\u52a1\u5668\u51fd\u6570 <code class=\"function\">lo_export</code>\u7565\u6709\u4e0d\u540c\uff0c\u540e\u8005\u4f7f\u7528\u8fd0\u884c\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7528\u6237\u7684\u6743\u9650\uff0c\u5e76\u5728\u670d\u52a1\u5668\u7684\u6587\u4ef6\u7cfb\u7edf\u4e0a\u64cd\u4f5c\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u4f7f\u7528 \\lo_list \u67e5\u627e\u5927\u5bf9\u8c61\u7684 OID\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\lo_import <em class=\"replaceable\"><code>filename</code></em> [ <em class=\"replaceable\"><code>comment</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6587\u4ef6\u5b58\u50a8\u5230\u4e00\u4e2a<span class=\"productname\">PostgreSQL</span>\u5927\u5bf9\u8c61\u4e2d\u3002\u53ef\u9009\u5730\uff0c\u5b83\u5c06\u7ed9\u5b9a\u7684\u6ce8\u91ca\u4e0e\u5bf9\u8c61\u5173\u8054\u8d77\u6765\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">foo=&gt; <strong class=\"userinput\"><code>\\lo_import '/home/peter/pictures/photo.xcf' 'a picture of me'</code></strong>\nlo_import 152801\n</pre>\n<p lang=\"zh\">\u54cd\u5e94\u8868\u660e\u5927\u5bf9\u8c61\u83b7\u5f97\u4e86\u5bf9\u8c61 ID 152801\uff0c\u8fd9\u4e2a ID \u53ef\u4ee5\u7528\u6765\u5728\u5c06\u6765\u8bbf\u95ee\u65b0\u521b\u5efa\u7684\u5927\u5bf9\u8c61\u3002\u4e3a\u4fbf\u4e8e\u9605\u8bfb\uff0c\u5efa\u8bae\u59cb\u7ec8\u4e3a\u6bcf\u4e2a\u5bf9\u8c61\u5173\u8054\u4e00\u6761\u4fbf\u4e8e\u4eba\u9605\u8bfb\u7684\u6ce8\u91ca\u3002\u67e5\u770b OID \u548c\u6ce8\u91ca\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528<code class=\"command\">\\lo_list</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u6b64\u547d\u4ee4\u4e0e\u670d\u52a1\u5668\u7aef\u7684<code class=\"function\">lo_import</code>\u7565\u6709\u4e0d\u540c\uff0c\u56e0\u4e3a\u5b83\u4f5c\u4e3a\u672c\u5730\u7528\u6237\u5728\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e0a\u64cd\u4f5c\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\u7684\u7528\u6237\u548c\u6587\u4ef6\u7cfb\u7edf\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\lo_list[+]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5f53\u524d\u5b58\u50a8\u5728\u6570\u636e\u5e93\u4e2d\u7684\u5168\u90e8 <span class=\"productname\">PostgreSQL</span> \u5927\u5bf9\u8c61\u5217\u8868\uff0c\u4ee5\u53ca\u4e3a\u5b83\u4eec\u63d0\u4f9b\u7684\u4efb\u4f55\u6ce8\u91ca\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u5217\u51fa\u6bcf\u4e2a\u5927\u5bf9\u8c61\u7684\u76f8\u5173\u6743\u9650\uff08\u5982\u679c\u6709\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\lo_unlink <em class=\"replaceable\"><code>loid</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6570\u636e\u5e93\u4e2d\u5220\u9664<acronym class=\"acronym\">OID</acronym> \u4e3a <em class=\"replaceable\"><code>loid</code></em>\u7684\u5927\u5bf9\u8c61\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u4f7f\u7528 \\lo_list \u67e5\u627e\u5927\u5bf9\u8c61\u7684 OID\u3002</p>\n</div>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\o</code> \u6216 <code class=\"literal\">\\out [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\o</code> \u6216 <code class=\"literal\">\\out [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u540e\u7eed\u67e5\u8be2\u7ed3\u679c\u4fdd\u5b58\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9 shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002\u5982\u679c\u6ca1\u6709\u6307\u5b9a\u53c2\u6570\uff0c\u67e5\u8be2\u8f93\u51fa\u5c06\u6062\u590d\u4e3a\u6807\u51c6\u8f93\u51fa\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\uff0c\u5219\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u7684\u5185\u5bb9\u53ea\u4f1a\u539f\u6837\u4f20\u9012\u7ed9 shell\u3002</p>\n<p lang=\"zh\"><span class=\"quote\">\u201c<span class=\"quote\">\u67e5\u8be2\u7ed3\u679c</span>\u201d</span>\u5305\u62ec\u4ece\u6570\u636e\u5e93\u670d\u52a1\u5668\u83b7\u53d6\u7684\u6240\u6709\u8868\u683c\u3001\u547d\u4ee4\u54cd\u5e94\u548c\u901a\u77e5\uff0c\u4ee5\u53ca\u67e5\u8be2\u6570\u636e\u5e93\u7684\u5404\u79cd\u53cd\u659c\u6760\u547d\u4ee4\u7684\u8f93\u51fa\uff08\u4f8b\u5982<code class=\"command\">\\d</code>\uff09\uff1b\u4f46\u4e0d\u5305\u62ec\u9519\u8bef\u6d88\u606f\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8981\u5728\u67e5\u8be2\u7ed3\u679c\u4e4b\u95f4\u63d2\u5165\u6587\u672c\u8f93\u51fa\uff0c\u4f7f\u7528<code class=\"command\">\\qecho</code>\u3002</p>\n</div>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\p</code>\u6216<code class=\"literal\">\\print</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\u3002\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6253\u5370\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\password [ <em class=\"replaceable\"><code>username</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u66f4\u6539\u6307\u5b9a\u7528\u6237\uff08\u9ed8\u8ba4\u4e3a\u5f53\u524d\u7528\u6237\uff09\u7684\u5bc6\u7801\u3002\u6b64\u547d\u4ee4\u63d0\u793a\u8f93\u5165\u65b0\u5bc6\u7801\uff0c\u5bf9\u5176\u8fdb\u884c\u52a0\u5bc6\uff0c\u5e76\u5c06\u5176\u4f5c\u4e3a<code class=\"command\">ALTER ROLE</code>\u547d\u4ee4\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u65b0\u5bc6\u7801\u4e0d\u4f1a\u4ee5\u660e\u6587\u5f62\u5f0f\u51fa\u73b0\u5728\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\u3001\u670d\u52a1\u5668\u65e5\u5fd7\u6216\u5176\u4ed6\u5730\u65b9\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\prompt [ <em class=\"replaceable\"><code>text</code></em> ] <em class=\"replaceable\"><code>name</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u63d0\u793a\u7528\u6237\u63d0\u4f9b\u6587\u672c\uff0c\u5c06\u5176\u8d4b\u503c\u7ed9\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u3002\u53ef\u4ee5\u6307\u5b9a\u4e00\u4e2a\u53ef\u9009\u7684\u63d0\u793a\u5b57\u7b26\u4e32<em class=\"replaceable\"><code>text</code></em>\u3002\uff08\u5bf9\u4e8e\u591a\u4e2a\u5355\u8bcd\u7684\u63d0\u793a\uff0c\u7528\u5355\u5f15\u53f7\u62ec\u8d77\u6587\u672c\u3002\uff09</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"literal\">\\prompt</code> \u4f7f\u7528\u7ec8\u7aef\u8fdb\u884c\u8f93\u5165\u548c\u8f93\u51fa\u3002\u7136\u800c\uff0c\u5982\u679c\u4f7f\u7528\u4e86 <code class=\"option\">-f</code> \u547d\u4ee4\u884c\u5f00\u5173\uff0c<code class=\"literal\">\\prompt</code> \u5c06\u4f7f\u7528\u6807\u51c6\u8f93\u5165\u548c\u6807\u51c6\u8f93\u51fa\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\pset [ <em class=\"replaceable\"><code>option</code></em> [ <em class=\"replaceable\"><code>value</code></em> ] ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u8bbe\u7f6e\u5f71\u54cd\u67e5\u8be2\u7ed3\u679c\u8868\u8f93\u51fa\u7684\u9009\u9879\u3002<em class=\"replaceable\"><code>option</code></em>\u6307\u5b9a\u8981\u8bbe\u7f6e\u54ea\u4e2a\u9009\u9879\u3002<em class=\"replaceable\"><code>value</code></em>\u7684\u542b\u4e49\u53d6\u51b3\u4e8e\u6240\u9009\u7684\u9009\u9879\u3002\u5bf9\u4e8e\u67d0\u4e9b\u9009\u9879\uff0c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\u4f1a\u5207\u6362\u6216\u53d6\u6d88\u8bbe\u7f6e\u8be5\u9009\u9879\uff0c\u5177\u4f53\u89c1\u5404\u9009\u9879\u7684\u8bf4\u660e\u3002\u5982\u679c\u6ca1\u6709\u63d0\u53ca\u8fd9\u7c7b\u884c\u4e3a\uff0c\u90a3\u4e48\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\u53ea\u4f1a\u663e\u793a\u5f53\u524d\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\">\u4e0d\u5e26\u4efb\u4f55\u53c2\u6570\u7684<code class=\"command\">\\pset</code>\u4f1a\u663e\u793a\u6240\u6709\u6253\u5370\u9009\u9879\u7684\u5f53\u524d\u72b6\u6001\u3002</p>\n<p lang=\"zh\">\u53ef\u8c03\u6574\u7684\u6253\u5370\u9009\u9879\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">border</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><em class=\"replaceable\"><code>value</code></em>\u5fc5\u987b\u662f\u6570\u5b57\u3002\u4e00\u822c\u6765\u8bf4\uff0c\u6570\u5b57\u8d8a\u5927\uff0c\u8868\u683c\u7684\u8fb9\u6846\u548c\u5206\u9694\u7ebf\u5c31\u8d8a\u591a\uff0c\u4f46\u7ec6\u8282\u53d6\u51b3\u4e8e\u5177\u4f53\u683c\u5f0f\u3002\u5728<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u4e2d\uff0c\u5b83\u4f1a\u76f4\u63a5\u8f6c\u6362\u4e3a<code class=\"literal\">border=...</code>\u5c5e\u6027\u3002\u5728\u5927\u591a\u6570\u5176\u4ed6\u683c\u5f0f\u4e2d\uff0c\u53ea\u6709\u503c 0\uff08\u65e0\u8fb9\u6846\uff09\u30011\uff08\u5185\u90e8\u5206\u9694\u7ebf\uff09\u548c 2\uff08\u8868\u683c\u5916\u6846\uff09\u6709\u610f\u4e49\uff0c\u5927\u4e8e 2 \u7684\u503c\u4f1a\u4e0e<code class=\"literal\">border = 2</code>\u4f5c\u76f8\u540c\u5904\u7406\u3002<code class=\"literal\">latex</code>\u548c<code class=\"literal\">latex-longtable</code>\u683c\u5f0f\u8fd8\u5141\u8bb8\u4f7f\u7528\u503c 3\uff0c\u4ee5\u5728\u6570\u636e\u884c\u4e4b\u95f4\u6dfb\u52a0\u5206\u9694\u7ebf\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><em>\u5217</em></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u76ee\u6807\u5bbd\u5ea6\uff0c\u540c\u65f6\u4e5f\u662f\u786e\u5b9a\u8f93\u51fa\u662f\u5426\u8db3\u591f\u5bbd\u4ee5\u9700\u8981\u5206\u9875\u5668\u6216\u5728\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e0b\u5207\u6362\u5230\u5782\u76f4\u663e\u793a\u7684\u5bbd\u5ea6\u9650\u5236\u3002\u96f6\uff08\u9ed8\u8ba4\u503c\uff09\u4f1a\u5bfc\u81f4\u76ee\u6807\u5bbd\u5ea6\u7531\u73af\u5883\u53d8\u91cf<code class=\"envar\">COLUMNS</code>\u63a7\u5236\uff0c\u6216\u8005\u5982\u679c\u672a\u8bbe\u7f6e <code class=\"envar\">COLUMNS</code>\u5219\u7531\u68c0\u6d4b\u5230\u7684\u5c4f\u5e55\u5bbd\u5ea6\u63a7\u5236\u3002\u53e6\u5916\uff0c\u5982\u679c<code class=\"literal\">columns</code>\u4e3a\u96f6\uff0c\u5219<code class=\"literal\">wrapped</code>\u683c\u5f0f\u4ec5\u5f71\u54cd\u5c4f\u5e55\u8f93\u51fa\u3002\u5982\u679c<code class=\"literal\">columns</code>\u4e3a\u975e\u96f6\uff0c\u5219\u6587\u4ef6\u548c\u7ba1\u9053\u8f93\u51fa\u4e5f\u4f1a\u6309\u8be5\u5bbd\u5ea6\u6298\u884c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">csv_fieldsep</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728<acronym class=\"acronym\">CSV</acronym>\u8f93\u51fa\u683c\u5f0f\u4e2d\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u5982\u679c\u5206\u9694\u7b26\u5b57\u7b26\u51fa\u73b0\u5728\u5b57\u6bb5\u7684\u503c\u4e2d\uff0c\u5219\u8be5\u5b57\u6bb5\u5c06\u6839\u636e\u6807\u51c6<acronym class=\"acronym\">CSV</acronym>\u89c4\u5219\u5728\u53cc\u5f15\u53f7\u5185\u8f93\u51fa\u3002\u9ed8\u8ba4\u503c\u662f\u9017\u53f7\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">expanded</code>\uff08\u6216<code class=\"literal\">x</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff08\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u6269\u5c55\u6a21\u5f0f\uff09\uff0c\u6216\u8005\u662f<code class=\"literal\">auto</code>\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5f00\u542f\u548c\u5173\u95ed\u8bbe\u7f6e\u4e4b\u95f4\u5207\u6362\u3002\u542f\u7528\u6269\u5c55\u6a21\u5f0f\u65f6\uff0c\u67e5\u8be2\u7ed3\u679c\u4ee5\u4e24\u5217\u663e\u793a\uff0c\u5de6\u4fa7\u4e3a\u5217\u540d\uff0c\u53f3\u4fa7\u4e3a\u6570\u636e\u3002\u5982\u679c\u6570\u636e\u5728\u901a\u5e38\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u6a2a\u5411</span>\u201d</span>\u6a21\u5f0f\u4e0b\u65e0\u6cd5\u9002\u5e94\u5c4f\u5e55\uff0c\u8fd9\u79cd\u6a21\u5f0f\u5c31\u5f88\u6709\u7528\u3002\u5728\u81ea\u52a8\u8bbe\u7f6e\u4e0b\uff0c\u5f53\u67e5\u8be2\u8f93\u51fa\u5305\u542b\u591a\u5217\u4e14\u5bbd\u5ea6\u8d85\u8fc7\u5c4f\u5e55\u65f6\uff0c\u4f1a\u4f7f\u7528\u6269\u5c55\u6a21\u5f0f\uff1b\u5426\u5219\u4f7f\u7528\u5e38\u89c4\u6a21\u5f0f\u3002\u81ea\u52a8\u8bbe\u7f6e\u53ea\u5728\u5bf9\u9f50\u548c\u6298\u884c\u683c\u5f0f\u4e2d\u6709\u6548\u3002\u5728\u5176\u4ed6\u683c\u5f0f\u4e2d\uff0c\u5b83\u7684\u884c\u4e3a\u59cb\u7ec8\u4e0e\u5173\u95ed\u6269\u5c55\u6a21\u5f0f\u76f8\u540c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">fieldsep</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u6837\u53ef\u4ee5\u521b\u5efa\u4f8b\u5982\u5236\u8868\u7b26\u5206\u9694\u7684\u8f93\u51fa\uff0c\u8fd9\u53ef\u80fd\u66f4\u7b26\u5408\u5176\u4ed6\u7a0b\u5e8f\u7684\u9700\u8981\u3002\u8981\u5c06\u5236\u8868\u7b26\u8bbe\u7f6e\u4e3a\u5b57\u6bb5\u5206\u9694\u7b26\uff0c\u8bf7\u8f93\u5165<code class=\"literal\">\\pset fieldsep '\\t'</code>\u3002\u9ed8\u8ba4\u5b57\u6bb5\u5206\u9694\u7b26\u662f<code class=\"literal\">'|'</code>\uff08\u7ad6\u7ebf\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">fieldsep_zero</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u8bbe\u7f6e\u4e3a\u96f6\u5b57\u8282\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">footer</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u8868\u683c\u9875\u811a\uff08<code class=\"literal\">(<em class=\"replaceable\"><code>n</code></em> rows)</code>\u8ba1\u6570\uff09\u7684\u663e\u793a\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5207\u6362\u9875\u811a\u663e\u793a\u7684\u5f00\u5173\u72b6\u6001\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">format</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a<code class=\"literal\">aligned</code>\u3001<code class=\"literal\">asciidoc</code>\u3001<code class=\"literal\">csv</code>\u3001<code class=\"literal\">html</code>\u3001<code class=\"literal\">latex</code>\u3001<code class=\"literal\">latex-longtable</code>\u3001<code class=\"literal\">troff-ms</code>\u3001<code class=\"literal\">unaligned</code>\u6216<code class=\"literal\">wrapped</code>\u3002\u5141\u8bb8\u4f7f\u7528\u552f\u4e00\u7f29\u5199\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">aligned</code>\u683c\u5f0f\u662f\u6807\u51c6\u7684\u3001\u9002\u5408\u4eba\u9605\u8bfb\u4e14\u6392\u7248\u6574\u9f50\u7684\u6587\u672c\u8f93\u51fa\uff1b\u8fd9\u662f\u9ed8\u8ba4\u683c\u5f0f\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">unaligned</code>\u683c\u5f0f\u5c06\u4e00\u884c\u4e2d\u7684\u6240\u6709\u5217\u5199\u5728\u4e00\u884c\u4e0a\uff0c\u7531\u5f53\u524d\u6d3b\u52a8\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u5206\u9694\u3002\u8fd9\u5bf9\u4e8e\u521b\u5efa\u53ef\u80fd\u88ab\u5176\u4ed6\u7a0b\u5e8f\u8bfb\u53d6\u7684\u8f93\u51fa\u5f88\u6709\u7528\uff0c\u4f8b\u5982\uff0c\u5236\u8868\u7b26\u5206\u9694\u6216\u9017\u53f7\u5206\u9694\u683c\u5f0f\u3002\u7136\u800c\uff0c\u5982\u679c\u5b57\u6bb5\u5206\u9694\u7b26\u5b57\u7b26\u51fa\u73b0\u5728\u5217\u7684\u503c\u4e2d\uff0c\u5219\u4e0d\u4f1a\u88ab\u7279\u6b8a\u5904\u7406\uff1b\u56e0\u6b64\uff0c<acronym class=\"acronym\">CSV</acronym>\u683c\u5f0f\u53ef\u80fd\u66f4\u9002\u5408\u8fd9\u4e9b\u76ee\u7684\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">csv</code>\u683c\u5f0f<a class=\"indexterm\" id=\"id-1.9.4.20.8.4.10.1.76.2.3.1.8.2.4.2\" name=\"id-1.9.4.20.8.4.10.1.76.2.3.1.8.2.4.2\"></a>\u6309\u9017\u53f7\u5206\u9694\u7684\u5217\u503c\u8f93\u51fa\uff0c\u5e76\u5e94\u7528 <a class=\"ulink\" href=\"https://datatracker.ietf.org/doc/html/rfc4180\" target=\"_top\">RFC 4180</a> \u4e2d\u63cf\u8ff0\u7684\u52a0\u5f15\u53f7\u89c4\u5219\u3002\u6b64\u8f93\u51fa\u4e0e\u670d\u52a1\u5668\u7684CSV\u683c\u5f0f\u7684 <code class=\"command\">COPY</code>\u547d\u4ee4\u517c\u5bb9\u3002\u751f\u6210\u5305\u542b\u5217\u540d\u7684\u8868\u5934\u884c\uff0c\u9664\u975e <code class=\"literal\">tuples_only</code>\u53c2\u6570\u8bbe\u7f6e\u4e3a <code class=\"literal\">on</code>\u3002\u4e0d\u6253\u5370\u8868\u683c\u6807\u9898\u548c\u9875\u811a\u3002\u6bcf\u884c\u4ee5\u7cfb\u7edf\u76f8\u5173\u7684\u884c\u7ed3\u675f\u5b57\u7b26\u7ed3\u675f\uff0c\u5bf9\u4e8e\u7c7bUnix\u7cfb\u7edf\u901a\u5e38\u662f\u5355\u4e2a\u6362\u884c\u7b26\uff08<code class=\"literal\">\\n</code>\uff09\uff0c\u5bf9\u4e8eMicrosoft Windows\u5219\u662f\u56de\u8f66\u548c\u6362\u884c\u5e8f\u5217\uff08<code class=\"literal\">\\r\\n</code>\uff09\u3002\u53ef\u4ee5\u7528<code class=\"command\">\\pset csv_fieldsep</code>\u9009\u62e9\u9017\u53f7\u4ee5\u5916\u7684\u5b57\u6bb5\u5206\u9694\u5b57\u7b26\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">wrapped</code>\u683c\u5f0f\u4e0e<code class=\"literal\">aligned</code>\u76f8\u4f3c\uff0c\u4f46\u4f1a\u5c06\u8f83\u5bbd\u7684\u6570\u636e\u503c\u6298\u6210\u591a\u884c\uff0c\u4f7f\u8f93\u51fa\u9002\u5e94\u76ee\u6807\u5217\u5bbd\u3002\u76ee\u6807\u5bbd\u5ea6\u7684\u786e\u5b9a\u65b9\u5f0f\u89c1<code class=\"literal\">columns</code>\u9009\u9879\u7684\u8bf4\u660e\u3002\u8bf7\u6ce8\u610f\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u5c1d\u8bd5\u5bf9\u5217\u6807\u9898\u6298\u884c\uff1b\u56e0\u6b64\uff0c\u5982\u679c\u5217\u6807\u9898\u6240\u9700\u7684\u603b\u5bbd\u5ea6\u8d85\u8fc7\u76ee\u6807\u5bbd\u5ea6\uff0c<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u884c\u4e3a\u5c31\u4e0e<code class=\"literal\">aligned</code>\u76f8\u540c\u3002</p>\n<p lang=\"zh\">asciidoc\u3001html\u3001latex\u3001latex-longtable \u548c troff-ms \u683c\u5f0f\u8f93\u51fa\u7684\u662f\u53ef\u5d4c\u5165\u76f8\u5e94\u6807\u8bb0\u8bed\u8a00\u6587\u6863\u7684\u8868\u683c\uff0c\u5e76\u975e\u5b8c\u6574\u6587\u6863\u3002HTML \u53ef\u80fd\u4e0d\u8981\u6c42\u5b8c\u6574\u5c01\u88c5\uff0c\u4f46 LaTeX \u5fc5\u987b\u6709\u5b8c\u6574\u6587\u6863\u7ed3\u6784\u3002latex \u4f7f\u7528 LaTeX \u7684 tabular \u73af\u5883\uff1blatex-longtable \u9700\u8981 LaTeX \u7684 longtable \u548c booktabs \u5b8f\u5305\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">linestyle</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u8fb9\u6846\u7ebf\u7ed8\u5236\u6837\u5f0f\u4e3a<code class=\"literal\">ascii</code>\u3001<code class=\"literal\">old-ascii</code>\u6216<code class=\"literal\">unicode</code>\u4e4b\u4e00\u3002\u5141\u8bb8\u4f7f\u7528\u552f\u4e00\u7f29\u5199\u3002\uff08\u8fd9\u610f\u5473\u7740\u4e00\u4e2a\u5b57\u6bcd\u5c31\u8db3\u591f\u4e86\u3002\uff09\u9ed8\u8ba4\u8bbe\u7f6e\u4e3a<code class=\"literal\">ascii</code>\u3002\u6b64\u9009\u9879\u4ec5\u5f71\u54cd<code class=\"literal\">aligned</code>\u548c<code class=\"literal\">wrapped</code>\u8f93\u51fa\u683c\u5f0f\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">ascii</code>\u6837\u5f0f\u4f7f\u7528\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u53f3\u8fb9\u7f18\u7684<code class=\"literal\">+</code>\u7b26\u53f7\u8868\u793a\u3002\u5f53<code class=\"literal\">wrapped</code>\u683c\u5f0f\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u628a\u6570\u636e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u4f1a\u5728\u7b2c\u4e00\u884c\u7684\u53f3\u8fb9\u7f18\u663e\u793a\u4e00\u4e2a\u70b9\uff08<code class=\"literal\">.</code>\uff09\uff0c\u5e76\u5728\u4e0b\u4e00\u884c\u7684\u5de6\u8fb9\u7f18\u518d\u6b21\u663e\u793a\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">old-ascii</code>\u6837\u5f0f\u4f7f\u7528\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\uff0c\u91c7\u7528<span class=\"productname\">PostgreSQL</span> 8.4 \u53ca\u66f4\u65e9\u7248\u672c\u7684\u683c\u5f0f\u6837\u5f0f\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u66ff\u4ee3\u5de6\u4fa7\u5217\u5206\u9694\u7b26\u7684<code class=\"literal\">:</code>\u7b26\u53f7\u8868\u793a\u3002\u5f53\u6570\u636e\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u5219\u7528<code class=\"literal\">;</code>\u7b26\u53f7\u66ff\u4ee3\u5de6\u4fa7\u5217\u5206\u9694\u7b26\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">unicode</code>\u6837\u5f0f\u4f7f\u7528 Unicode \u6846\u7ebf\u7ed8\u5236\u5b57\u7b26\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u53f3\u8fb9\u7f18\u7684\u56de\u8f66\u7b26\u53f7\u8868\u793a\u3002\u5f53\u6570\u636e\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u4f1a\u5728\u7b2c\u4e00\u884c\u7684\u53f3\u8fb9\u7f18\u663e\u793a\u7701\u7565\u53f7\u7b26\u53f7\uff0c\u5e76\u5728\u4e0b\u4e00\u884c\u7684\u5de6\u8fb9\u7f18\u518d\u6b21\u663e\u793a\u3002</p>\n<p lang=\"zh\">\u5f53<code class=\"literal\">border</code>\u8bbe\u7f6e\u5927\u4e8e\u96f6\u65f6\uff0c<code class=\"literal\">linestyle</code>\u9009\u9879\u8fd8\u51b3\u5b9a\u7528\u54ea\u4e9b\u5b57\u7b26\u7ed8\u5236\u8fb9\u6846\u7ebf\u3002\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\u5728\u4efb\u4f55\u73af\u5883\u4e2d\u90fd\u53ef\u7528\uff0c\u4f46\u5728\u652f\u6301 Unicode \u7684\u663e\u793a\u8bbe\u5907\u4e0a\uff0cUnicode \u5b57\u7b26\u66f4\u7f8e\u89c2\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">null</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u7528\u4e8e\u4ee3\u66ff\u7a7a\u503c\u6253\u5370\u7684\u5b57\u7b26\u4e32\u3002\u9ed8\u8ba4\u4e0d\u6253\u5370\u4efb\u4f55\u5185\u5bb9\uff0c\u8fd9\u5f88\u5bb9\u6613\u88ab\u8bef\u8ba4\u4e3a\u7a7a\u5b57\u7b26\u4e32\u3002\u4f8b\u5982\uff0c\u4f60\u53ef\u80fd\u66f4\u559c\u6b22\u4f7f\u7528<code class=\"literal\">\\pset null '(null)'</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">numericlocale</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u4f7f\u7528\u533a\u57df\u8bbe\u7f6e\u7279\u5b9a\u7684\u5b57\u7b26\u6765\u5206\u9694\u5c0f\u6570\u70b9\u5de6\u4fa7\u7684\u6570\u5b57\u7ec4\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5e38\u89c4\u6570\u5b57\u8f93\u51fa\u548c\u533a\u57df\u8bbe\u7f6e\u7279\u5b9a\u7684\u6570\u5b57\u8f93\u51fa\u4e4b\u95f4\u5207\u6362\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">pager</code></span></dt>\n<dd>\n<p lang=\"zh\">\u63a7\u5236\u67e5\u8be2\u7ed3\u679c\u4e0e psql \u5e2e\u52a9\u8f93\u51fa\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\u7684\u65b9\u5f0f\u3002\u5f53 pager \u4e3a off \u65f6\uff0c\u4e0d\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\uff1b\u4e3a on \u65f6\uff0c\u5728\u9002\u5f53\u60c5\u51b5\u4e0b\u4f7f\u7528\uff0c\u5373\u8f93\u51fa\u76ee\u6807\u662f\u7ec8\u7aef\u4e14\u5185\u5bb9\u65e0\u6cd5\u5728\u5c4f\u5e55\u5185\u663e\u793a\u5b8c\u3002\u8bbe\u4e3a always \u65f6\uff0c\u6240\u6709\u7ec8\u7aef\u8f93\u51fa\u5747\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\uff0c\u65e0\u8bba\u662f\u5426\u80fd\u5728\u5c4f\u5e55\u5185\u663e\u793a\u5b8c\u3002\u4e0d\u5e26\u503c\u7684 \\pset pager \u4f1a\u5207\u6362\u5206\u9875\u7684\u5f00\u5173\u72b6\u6001\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u8bbe\u7f6e\u4e86\u73af\u5883\u53d8\u91cf<code class=\"envar\">PSQL_PAGER</code>\u6216<code class=\"envar\">PAGER</code>\uff0c\u9700\u8981\u5206\u9875\u7684\u8f93\u51fa\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6307\u5b9a\u7a0b\u5e8f\u3002\u5426\u5219\uff0c\u4f7f\u7528\u4e0e\u5e73\u53f0\u6709\u5173\u7684\u9ed8\u8ba4\u7a0b\u5e8f\uff08\u5982<code class=\"filename\">more</code>\uff09\u3002</p>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 <code class=\"literal\">\\watch</code> \u547d\u4ee4\u91cd\u590d\u6267\u884c\u67e5\u8be2\u65f6\uff0c\u5728 Unix \u7cfb\u7edf\u4e0a\u4f1a\u6539\u7528\u73af\u5883\u53d8\u91cf <code class=\"envar\">PSQL_WATCH_PAGER</code> \u6765\u67e5\u627e\u5206\u9875\u5668\u7a0b\u5e8f\u3002\u4e4b\u6240\u4ee5\u5355\u72ec\u914d\u7f6e\u5b83\uff0c\u662f\u56e0\u4e3a\u8fd9\u79cd\u7528\u6cd5\u53ef\u80fd\u4f1a\u8ba9\u4f20\u7edf\u5206\u9875\u5668\u65e0\u6cd5\u6b63\u5e38\u5de5\u4f5c\uff1b\u4f46\u5b83\u53ef\u7528\u4e8e\u628a\u8f93\u51fa\u53d1\u9001\u7ed9\u80fd\u591f\u7406\u89e3 <span class=\"application\">psql</span> \u8f93\u51fa\u683c\u5f0f\u7684\u5de5\u5177\uff08\u4f8b\u5982 <code class=\"filename\">pspg --stream</code>\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">pager_min_lines</code></span></dt>\n<dd>\n<p lang=\"zh\">\u82e5 pager_min_lines \u5927\u4e8e\u5c4f\u5e55\u9875\u9ad8\uff0c\u53ea\u6709\u8f93\u51fa\u884c\u6570\u8fbe\u5230\u8be5\u503c\u65f6\u624d\u8c03\u7528\u5206\u9875\u7a0b\u5e8f\u3002\u9ed8\u8ba4\u503c\u4e3a 0\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">recordsep</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u8bb0\u5f55\uff08\u884c\uff09\u5206\u9694\u7b26\u3002\u9ed8\u8ba4\u4e3a\u6362\u884c\u7b26\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">recordsep_zero</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u8bbe\u7f6e\u4e3a\u96f6\u5b57\u8282\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">tableattr</code>\uff08\u6216<code class=\"literal\">T</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\u5728<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u4e2d\uff0c\u8fd9\u6307\u5b9a\u8981\u653e\u5728<code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u5c5e\u6027\uff0c\u4f8b\u5982<code class=\"literal\">cellpadding</code>\u6216<code class=\"literal\">bgcolor</code>\u3002\u8bf7\u6ce8\u610f\uff0c\u4f60\u53ef\u80fd\u4e0d\u9700\u8981\u5728\u8fd9\u91cc\u6307\u5b9a<code class=\"literal\">border</code>\uff0c\u56e0\u4e3a<code class=\"literal\">\\pset border</code>\u5df2\u7ecf\u8d1f\u8d23\u5904\u7406\u5b83\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u8868\u683c\u5c5e\u6027\u3002</p>\n<p lang=\"zh\">\u5728<code class=\"literal\">latex-longtable</code>\u683c\u5f0f\u4e2d\uff0c\u8fd9\u63a7\u5236\u6bcf\u4e2a\u5305\u542b\u5de6\u5bf9\u9f50\u6570\u636e\u7c7b\u578b\u7684\u5217\u7684\u5bbd\u5ea6\u6bd4\u4f8b\u3002\u5b83\u4ee5\u7a7a\u767d\u5206\u9694\u7684\u503c\u5217\u8868\u6307\u5b9a\uff0c\u4f8b\u5982<code class=\"literal\">'0.2 0.2 0.6'</code>\u3002\u672a\u6307\u5b9a\u7684\u8f93\u51fa\u5217\u4f7f\u7528\u6700\u540e\u6307\u5b9a\u7684\u503c\u3002</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">title</code>\uff08\u6216<code class=\"literal\">C</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u968f\u540e\u6253\u5370\u7684\u6240\u6709\u8868\u683c\u7684\u6807\u9898\u3002\u8fd9\u53ef\u4ee5\u4e3a\u8f93\u51fa\u63d0\u4f9b\u63cf\u8ff0\u6027\u6807\u7b7e\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u6807\u9898\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">tuples_only</code>\uff08\u6216<code class=\"literal\">t</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u4ec5\u5143\u7ec4\u6a21\u5f0f\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5e38\u89c4\u8f93\u51fa\u548c\u4ec5\u5143\u7ec4\u8f93\u51fa\u4e4b\u95f4\u5207\u6362\u3002\u5e38\u89c4\u8f93\u51fa\u5305\u542b\u5217\u6807\u9898\u3001\u8868\u683c\u6807\u9898\u548c\u5404\u79cd\u9875\u811a\u7b49\u9644\u52a0\u4fe1\u606f\u3002\u5728\u4ec5\u5143\u7ec4\u6a21\u5f0f\u4e0b\uff0c\u53ea\u663e\u793a\u5b9e\u9645\u7684\u8868\u683c\u6570\u636e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">unicode_border_linestyle</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u8fb9\u6846\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">unicode_column_linestyle</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u5217\u5206\u9694\u7ebf\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">unicode_header_linestyle</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u8868\u5934\u5206\u9694\u7ebf\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8fd9\u4e9b\u4e0d\u540c\u683c\u5f0f\u7684\u5916\u89c2\u793a\u4f8b\u53ef\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/15/app-psql.html#APP-PSQL-EXAMPLES\" title=\"\u793a\u4f8b\">\u793a\u4f8b</a>\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u6709\u5404\u79cd\u5feb\u6377\u547d\u4ee4\u7528\u4e8e<code class=\"command\">\\pset</code>\u3002\u8bf7\u53c2\u89c1<code class=\"command\">\\a</code>\u3001<code class=\"command\">\\C</code>\u3001<code class=\"command\">\\f</code>\u3001<code class=\"command\">\\H</code>\u3001<code class=\"command\">\\t</code>\u3001<code class=\"command\">\\T</code>\u548c<code class=\"command\">\\x</code>\u3002</p>\n</div>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\q</code>\u6216<code class=\"literal\">\\quit</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9000\u51fa<span class=\"application\">psql</span>\u7a0b\u5e8f\u3002\u5728\u811a\u672c\u6587\u4ef6\u4e2d\uff0c\u53ea\u4f1a\u7ec8\u6b62\u8be5\u811a\u672c\u7684\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\qecho <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u547d\u4ee4\u4e0e<code class=\"command\">\\echo</code>\u76f8\u540c\uff0c\u53ea\u662f\u8f93\u51fa\u4f1a\u5199\u5165\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u7684\u67e5\u8be2\u8f93\u51fa\u901a\u9053\u3002</p>\n</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\r</code>\u6216<code class=\"literal\">\\reset</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u91cd\u7f6e\uff08\u6e05\u7a7a\uff09\u67e5\u8be2\u7f13\u51b2\u533a\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\restrict <em class=\"replaceable\"><code>restrict_key</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528\u7ed9\u5b9a\u7684\u5bc6\u94a5\u8fdb\u5165<span class=\"quote\">\u201c<span class=\"quote\">\u53d7\u9650</span>\u201d</span>\u6a21\u5f0f\u3002\u5728\u8be5\u6a21\u5f0f\u4e0b\uff0c\u552f\u4e00\u5141\u8bb8\u7684\u5143\u547d\u4ee4\u662f\u7528\u4e8e\u9000\u51fa\u53d7\u9650\u6a21\u5f0f\u7684<code class=\"command\">\\unrestrict</code>\u3002\u5bc6\u94a5\u53ea\u80fd\u5305\u542b\u5b57\u6bcd\u6570\u5b57\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4e3b\u8981\u7528\u4e8e pg_dump\u3001pg_dumpall \u548c pg_restore \u751f\u6210\u7684\u7eaf\u6587\u672c\u8f6c\u50a8\uff0c\u4e5f\u53ef\u80fd\u9002\u7528\u4e8e\u5176\u4ed6\u573a\u666f\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\s [ <em class=\"replaceable\"><code>filename</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u5386\u53f2\u8bb0\u5f55\u5230<em class=\"replaceable\"><code>filename</code></em>\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5386\u53f2\u8bb0\u5f55\u5c06\u88ab\u5199\u5165\u6807\u51c6\u8f93\u51fa\uff08\u5982\u679c\u9002\u7528\uff0c\u5c06\u4f7f\u7528\u5206\u9875\u5668\uff09\u3002\u5982\u679c<span class=\"application\">psql</span>\u5728\u6784\u5efa\u65f6\u6ca1\u6709\u4f7f\u7528<span class=\"application\">Readline</span>\u652f\u6301\uff0c\u5219\u6b64\u547d\u4ee4\u4e0d\u53ef\u7528\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\set [ <em class=\"replaceable\"><code>name</code></em> [ <em class=\"replaceable\"><code>value</code></em> [ ... ] ] ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e<span class=\"application\">psql</span>\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u4e3a<em class=\"replaceable\"><code>value</code></em>\uff0c\u5982\u679c\u7ed9\u51fa\u591a\u4e2a\u503c\uff0c\u5219\u8bbe\u7f6e\u4e3a\u6240\u6709\u503c\u7684\u8fde\u63a5\u3002\u5982\u679c\u53ea\u7ed9\u51fa\u4e00\u4e2a\u53c2\u6570\uff0c\u5219\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\u503c\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u8bbe\u7f6e\uff0c\u8bf7\u4f7f\u7528<code class=\"command\">\\unset</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\"><code class=\"command\">\\set</code>\u6ca1\u6709\u4efb\u4f55\u53c2\u6570\u65f6\uff0c\u663e\u793a\u5f53\u524d\u8bbe\u7f6e\u7684\u6240\u6709<span class=\"application\">psql</span>\u53d8\u91cf\u7684\u540d\u79f0\u548c\u503c\u3002</p>\n<p lang=\"zh\">\u6709\u6548\u7684\u53d8\u91cf\u540d\u53ef\u4ee5\u5305\u542b\u5b57\u6bcd\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u3002\u6709\u5173\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/15/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002\u53d8\u91cf\u540d\u533a\u5206\u5927\u5c0f\u5199\u3002</p>\n<p lang=\"zh\">\u67d0\u4e9b\u53d8\u91cf\u662f\u7279\u6b8a\u7684\uff0c\u5b83\u4eec\u63a7\u5236<span class=\"application\">psql</span>\u7684\u884c\u4e3a\u6216\u8005\u81ea\u52a8\u8bbe\u7f6e\u4ee5\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u3002\u8fd9\u4e9b\u53d8\u91cf\u5728\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/15/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u4e2d\u6709\u6587\u6863\u8bb0\u5f55\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u4e0e<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4<a class=\"link\" href=\"/docs/15/sql-set.html\" title=\"SET\"><code class=\"command\">SET</code></a>\u65e0\u5173\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\setenv <em class=\"replaceable\"><code>name</code></em> [ <em class=\"replaceable\"><code>value</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u4e3a<em class=\"replaceable\"><code>value</code></em>\uff0c\u6216\u8005\u5982\u679c\u672a\u63d0\u4f9b<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3002\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\setenv PAGER less</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>\\setenv LESS -imx4F</code></strong>\n</pre>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\sf[+] <em class=\"replaceable\"><code>function_description</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u663e\u793a\u6307\u5b9a\u51fd\u6570\u6216\u8fc7\u7a0b\u7684\u5b9a\u4e49\uff0c\u4ee5<code class=\"command\">CREATE OR REPLACE FUNCTION</code>\u6216 <code class=\"command\">CREATE OR REPLACE PROCEDURE</code>\u547d\u4ee4\u7684\u5f62\u5f0f\u5448\u73b0\u3002\u5b9a\u4e49\u5c06\u6253\u5370\u5230\u5f53\u524d\u67e5\u8be2\u8f93\u51fa\u901a\u9053\uff0c\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\">\u76ee\u6807\u51fd\u6570\u53ef\u4ec5\u7528\u540d\u79f0\u6307\u5b9a\uff0c\u4e5f\u53ef\u7528\u540d\u79f0\u548c\u53c2\u6570\u6307\u5b9a\uff0c\u4f8b\u5982 foo(integer, text)\u3002\u82e5\u6709\u591a\u4e2a\u540c\u540d\u51fd\u6570\uff0c\u5219\u5fc5\u987b\u63d0\u4f9b\u53c2\u6570\u7c7b\u578b\u3002</p>\n<p lang=\"zh\">\u5728\u547d\u4ee4\u540d\u540e\u6dfb\u52a0 +\uff0c\u4f1a\u4e3a\u8f93\u51fa\u884c\u7f16\u53f7\uff0c\u51fd\u6570\u4f53\u7b2c\u4e00\u884c\u4e3a\u7b2c 1 \u884c\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\sf</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\sv[+] <em class=\"replaceable\"><code>view_name</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u6307\u5b9a\u89c6\u56fe\u7684\u5b9a\u4e49\uff0c\u5e76\u4ee5<code class=\"command\">CREATE OR REPLACE VIEW</code>\u547d\u4ee4\u7684\u5f62\u5f0f\u663e\u793a\u3002\u5b9a\u4e49\u4f1a\u6253\u5370\u5230\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u7684\u5f53\u524d\u67e5\u8be2\u8f93\u51fa\u901a\u9053\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u547d\u4ee4\u540d\u79f0\u540e\u6dfb\u52a0<code class=\"literal\">+</code>\uff0c\u90a3\u4e48\u8f93\u51fa\u884c\u5c06\u4ece1\u5f00\u59cb\u7f16\u53f7\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\sv</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\t</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u8f93\u51fa\u4e2d\u7684\u5217\u540d\u6807\u9898\u548c\u884c\u6570\u9875\u811a\u7684\u663e\u793a\u72b6\u6001\u3002\u8fd9\u4e2a\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset tuples_only</code>\uff0c\u63d0\u4f9b\u5b83\u662f\u4e3a\u4e86\u4f7f\u7528\u65b9\u4fbf\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\T <em class=\"replaceable\"><code>table_options</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728<acronym class=\"acronym\">HTML</acronym>\u8f93\u51fa\u683c\u5f0f\u4e2d\u653e\u5728<code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u5c5e\u6027\u3002\u8fd9\u4e2a\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset tableattr <em class=\"replaceable\"><code>table_options</code></em></code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\timing [ <em class=\"replaceable\"><code>on</code></em> | <em class=\"replaceable\"><code>off</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5e26\u53c2\u6570\u65f6\uff0c\u5f00\u542f\u6216\u5173\u95ed\u6bcf\u6761 SQL \u8bed\u53e5\u6267\u884c\u8017\u65f6\u7684\u663e\u793a\u3002\u4e0d\u5e26\u53c2\u6570\u65f6\uff0c\u5207\u6362\u663e\u793a\u7684\u5f00\u5173\u72b6\u6001\u3002\u8017\u65f6\u4ee5\u6beb\u79d2\u663e\u793a\uff1b\u8d85\u8fc7 1 \u79d2\u7684\u65f6\u95f4\u95f4\u9694\u8fd8\u4f1a\u4ee5\u5206\u949f:\u79d2\u7684\u683c\u5f0f\u663e\u793a\uff0c\u5fc5\u8981\u65f6\u6dfb\u52a0\u5c0f\u65f6\u548c\u5929\u5b57\u6bb5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\unrestrict <em class=\"replaceable\"><code>restrict_key</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u9000\u51fa<span class=\"quote\">\u201c<span class=\"quote\">\u53d7\u9650</span>\u201d</span>\u6a21\u5f0f\uff08\u5373\u6240\u6709\u5176\u4ed6\u5143\u547d\u4ee4\u90fd\u88ab\u963b\u6b62\u7684\u6a21\u5f0f\uff09\uff0c\u524d\u63d0\u662f\u6307\u5b9a\u7684\u5bc6\u94a5\u4e0e\u8fdb\u5165\u53d7\u9650\u6a21\u5f0f\u65f6\u4f20\u7ed9<code class=\"command\">\\restrict</code>\u7684\u5bc6\u94a5\u5339\u914d\u3002</p>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4e3b\u8981\u7528\u4e8e pg_dump\u3001pg_dumpall \u548c pg_restore \u751f\u6210\u7684\u7eaf\u6587\u672c\u8f6c\u50a8\uff0c\u4e5f\u53ef\u80fd\u9002\u7528\u4e8e\u5176\u4ed6\u573a\u666f\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u5269\u4f59\u884c\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\unrestrict</code>\u7684\u53c2\u6570\uff0c\u5e76\u4e14\u4e0d\u4f1a\u6267\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\unset <em class=\"replaceable\"><code>name</code></em></code></span></dt>\n<dd>\n<p lang=\"zh\">\u53d6\u6d88\u8bbe\u7f6e\uff08\u5220\u9664\uff09<span class=\"application\">psql</span>\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u3002</p>\n<p lang=\"zh\">\u5927\u591a\u6570\u63a7\u5236<span class=\"application\">psql</span>\u884c\u4e3a\u7684\u53d8\u91cf\u4e0d\u80fd\u53d6\u6d88\u8bbe\u7f6e\uff1b\u5bf9\u4e8e\u8fd9\u4e9b\u53d8\u91cf\uff0c<code class=\"literal\">\\unset</code>\u547d\u4ee4\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u5176\u8bbe\u7f6e\u4e3a\u9ed8\u8ba4\u503c\u3002\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/15/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002</p>\n</dd>\n<dt lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\w</code> \u6216 <code class=\"literal\">\\write</code> <em class=\"replaceable\"><code>filename</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\w</code> \u6216 <code class=\"literal\">\\write</code> <code class=\"literal\">|</code><em class=\"replaceable\"><code>command</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u5199\u5165\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u9012\u7ed9 shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6539\u4e3a\u5199\u5165\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\uff0c\u5219\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u7684\u5185\u5bb9\u53ea\u4f1a\u539f\u6837\u4f20\u9012\u7ed9 shell\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\warn <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u547d\u4ee4\u4e0e<code class=\"command\">\\echo</code>\u547d\u4ee4\u76f8\u540c\uff0c\u53ea\u662f\u8f93\u51fa\u5c06\u88ab\u5199\u5165<span class=\"application\">psql</span>\u7684\u6807\u51c6\u9519\u8bef\u901a\u9053\uff0c\u800c\u4e0d\u662f\u6807\u51c6\u8f93\u51fa\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\watch [ <em class=\"replaceable\"><code>seconds</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u91cd\u590d\u6267\u884c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\uff08\u5982\u540c <code class=\"literal\">\\g</code> \u4e00\u6837\uff09\uff0c\u76f4\u5230\u88ab\u4e2d\u65ad\u6216\u67e5\u8be2\u5931\u8d25\u3002\u4e24\u6b21\u6267\u884c\u4e4b\u95f4\u7b49\u5f85\u6307\u5b9a\u7684\u79d2\u6570\uff08\u9ed8\u8ba4 2 \u79d2\uff09\u3002\u6bcf\u6b21\u67e5\u8be2\u7ed3\u679c\u90fd\u4f1a\u5e26\u6709\u4e00\u4e2a\u5934\u90e8\uff0c\u5176\u4e2d\u5305\u542b <code class=\"literal\">\\pset title</code> \u5b57\u7b26\u4e32\uff08\u5982\u679c\u6709\uff09\u3001\u67e5\u8be2\u5f00\u59cb\u65f6\u7684\u65f6\u95f4\u4ee5\u53ca\u5ef6\u8fdf\u95f4\u9694\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\x [ <em class=\"replaceable\"><code>on</code></em> | <em class=\"replaceable\"><code>off</code></em> | <em class=\"replaceable\"><code>auto</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u6216\u5207\u6362\u6269\u5c55\u8868\u683c\u683c\u5f0f\u6a21\u5f0f\u3002\u5b83\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset expanded</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\z [ <a class=\"link\" href=\"https://pg.center/docs/15/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u53ca\u5176\u5173\u8054\u7684\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u3002</p>\n<p lang=\"zh\">\u8fd9\u662f<code class=\"command\">\\dp</code>\u7684\u522b\u540d\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u663e\u793a\u6743\u9650</span>\u201d</span>\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\! [ <em class=\"replaceable\"><code>command</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u5e26\u53c2\u6570\u65f6\uff0c\u8fdb\u5165\u4e00\u4e2a\u5b50 shell\uff1b\u5b50 shell \u9000\u51fa\u540e\uff0c<span class=\"application\">psql</span>\u6062\u590d\u8fd0\u884c\u3002\u5e26\u53c2\u6570\u65f6\uff0c\u6267\u884c shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\!</code>\u7684\u53c2\u6570\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u5185\u5bb9\u4f1a\u539f\u6837\u4f20\u7ed9 shell\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\? [ <em class=\"replaceable\"><code>topic</code></em> ]</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5e2e\u52a9\u4fe1\u606f\u3002\u53ef\u9009\u7684<em class=\"replaceable\"><code>topic</code></em>\u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a<code class=\"literal\">commands</code>\uff09\u9009\u62e9\u8981\u89e3\u91ca\u7684<span class=\"application\">psql</span>\u7684\u54ea\u4e2a\u90e8\u5206\uff1a<code class=\"literal\">commands</code>\u63cf\u8ff0<span class=\"application\">psql</span>\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b<code class=\"literal\">options</code>\u63cf\u8ff0\u53ef\u4ee5\u4f20\u9012\u7ed9<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c<code class=\"literal\">variables</code>\u663e\u793a\u5173\u4e8e<span class=\"application\">psql</span>\u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">\\;</code></span></dt>\n<dd>\n<p lang=\"zh\">\u53cd\u659c\u7ebf\u5206\u53f7\u4e0d\u50cf\u524d\u9762\u7684\u547d\u4ee4\u90a3\u6837\u662f\u4e00\u4e2a\u5143\u547d\u4ee4\uff1b\u76f8\u53cd\uff0c\u5b83\u53ea\u662f\u5728\u4e0d\u8fdb\u884c\u8fdb\u4e00\u6b65\u5904\u7406\u7684\u60c5\u51b5\u4e0b\u5c06\u4e00\u4e2a\u5206\u53f7\u6dfb\u52a0\u5230\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u3002</p>\n<p lang=\"zh\">\u901a\u5e38\uff0c<span class=\"application\">psql</span>\u4f1a\u5728\u5230\u8fbe\u547d\u4ee4\u7ed3\u675f\u7684\u5206\u53f7\u65f6\u7acb\u5373\u5c06SQL\u547d\u4ee4\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u5373\u4f7f\u5f53\u524d\u884c\u8fd8\u6709\u66f4\u591a\u8f93\u5165\u3002\u56e0\u6b64\uff0c\u4f8b\u5982\u8f93\u5165</p>\n<pre class=\"programlisting\">select 1; select 2; select 3;\n</pre>\n<p lang=\"zh\">\u5c06\u5bfc\u81f4\u4e09\u4e2aSQL\u547d\u4ee4\u5206\u522b\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u6bcf\u4e2a\u547d\u4ee4\u7684\u7ed3\u679c\u5728\u7ee7\u7eed\u4e0b\u4e00\u4e2a\u547d\u4ee4\u4e4b\u524d\u663e\u793a\u3002\u7136\u800c\uff0c\u8f93\u5165\u4e3a<code class=\"literal\">\\;</code>\u7684\u5206\u53f7\u4e0d\u4f1a\u89e6\u53d1\u547d\u4ee4\u5904\u7406\uff0c\u56e0\u6b64\u5b83\u4e4b\u524d\u548c\u4e4b\u540e\u7684\u547d\u4ee4\u5b9e\u9645\u4e0a\u88ab\u5408\u5e76\u5e76\u4f5c\u4e3a\u4e00\u4e2a\u8bf7\u6c42\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u56e0\u6b64\uff0c\u4f8b\u5982</p>\n<pre class=\"programlisting\">select 1\\; select 2\\; select 3;\n</pre>\n<p lang=\"zh\">\u4f1a\u5728\u9047\u5230\u524d\u9762\u6ca1\u6709\u53cd\u659c\u7ebf\u7684\u5206\u53f7\u65f6\uff0c\u5c06\u8fd9\u4e09\u4e2a SQL \u547d\u4ee4\u4f5c\u4e3a\u5355\u4e2a\u8bf7\u6c42\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u670d\u52a1\u5668\u4f1a\u5c06\u6b64\u7c7b\u8bf7\u6c42\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff0c\u9664\u975e\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u663e\u5f0f\u7684<code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code>\u547d\u4ee4\u5c06\u5176\u5206\u6210\u591a\u4e2a\u4e8b\u52a1\u3002\uff08\u6709\u5173\u670d\u52a1\u5668\u5982\u4f55\u5904\u7406\u591a\u67e5\u8be2\u5b57\u7b26\u4e32\u7684\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/15/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT\" title=\"55.2.2.1.\u00a0\u4e00\u4e2a\u7b80\u5355\u67e5\u8be2\u4e2d\u7684\u591a\u6761\u8bed\u53e5\">\u7b2c\u00a055.2.2.1\u00a0\u8282</a>\u3002\uff09</p>\n</dd>\n</dl>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-PATTERNS\">\n<h4 lang=\"zh\">\u6a21\u5f0f</h4>\n<p lang=\"zh\">\u5f88\u591a<code class=\"literal\">\\d</code>\u547d\u4ee4\u90fd\u53ef\u4ee5\u7528\u4e00\u4e2a<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\u6765\u6307\u5b9a\u8981\u88ab\u663e\u793a\u7684\u5bf9\u8c61\u540d\u79f0\u3002\u5728\u6700\u7b80\u5355\u7684\u60c5\u51b5\u4e0b\uff0c\u6a21\u5f0f\u6b63\u597d\u5c31\u662f\u8be5\u5bf9\u8c61\u7684\u51c6\u786e\u540d\u79f0\u3002\u5728\u6a21\u5f0f\u4e2d\u7684\u5b57\u7b26\u901a\u5e38\u4f1a\u88ab\u53d8\u6210\u5c0f\u5199\u5f62\u5f0f\uff08\u5c31\u50cf\u5728 SQL \u540d\u79f0\u4e2d\u90a3\u6837\uff09\uff0c\u4f8b\u5982<code class=\"literal\">\\dt FOO</code>\u5c06\u4f1a\u663e\u793a\u540d\u4e3a<code class=\"literal\">foo</code>\u7684\u8868\u3002\u5c31\u50cf\u5728 SQL \u540d\u79f0\u4e2d\u90a3\u6837\uff0c\u628a\u6a21\u5f0f\u653e\u5728\u53cc\u5f15\u53f7\u4e2d\u53ef\u4ee5\u963b\u6b62\u5b83\u88ab\u8f6c\u6362\u6210\u5c0f\u5199\u5f62\u5f0f\u3002\u5982\u679c\u9700\u8981\u5728\u4e00\u4e2a\u6a21\u5f0f\u4e2d\u5305\u62ec\u4e00\u4e2a\u771f\u6b63\u7684\u53cc\u5f15\u53f7\u5b57\u7b26\uff0c\u5219\u9700\u8981\u5728\u53cc\u5f15\u53f7\u5305\u56f4\u7684\u6587\u672c\u5185\u628a\u5b83\u5199\u6210\u4e24\u4e2a\u76f8\u90bb\u7684\u53cc\u5f15\u53f7\uff0c\u8fd9\u540c\u6837\u662f\u7b26\u5408 SQL \u52a0\u5f15\u53f7\u6807\u8bc6\u7b26\u7684\u89c4\u5219\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dt \"FOO\"\"BAR\"</code>\u5c06\u663e\u793a\u540d\u4e3a<code class=\"literal\">FOO\"BAR</code>\uff08\u4e0d\u662f<code class=\"literal\">foo\"bar</code>\uff09\u7684\u8868\u3002\u548c\u666e\u901a\u7684 SQL \u540d\u79f0\u89c4\u5219\u4e0d\u540c\uff0c\u4f60\u53ef\u4ee5\u53ea\u5728\u6a21\u5f0f\u7684\u4e00\u90e8\u5206\u5468\u56f4\u653e\u4e0a\u53cc\u5f15\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">\\dt FOO\"FOO\"BAR</code>\u5c06\u4f1a\u663e\u793a\u540d\u4e3a<code class=\"literal\">fooFOObar</code>\u7684\u8868\u3002</p>\n<p lang=\"zh\">\u53ea\u8981\u5b8c\u5168\u7701\u7565<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\uff0c<code class=\"literal\">\\d</code>\u547d\u4ee4\u5c31\u4f1a\u663e\u793a\u5f53\u524d\u6a21\u5f0f\u641c\u7d22\u8def\u5f84\u4e2d\u53ef\u89c1\u7684\u5168\u90e8\u5bf9\u8c61 \u2014 \u8fd9\u7b49\u4ef7\u4e8e\u7528<code class=\"literal\">*</code>\u4f5c\u4e3a\u6a21\u5f0f\uff08\u5982\u679c\u4e00\u4e2a\u5bf9\u8c61\u6240\u5728\u7684\u6a21\u5f0f\u4f4d\u4e8e\u641c\u7d22\u8def\u5f84\u4e2d\uff0c\u5e76\u4e14\u5728\u641c\u7d22\u8def\u5f84\u4e2d\u8be5\u6a21\u5f0f\u4e4b\u524d\u6ca1\u6709\u540c\u7c7b\u4e14\u540c\u540d\u7684\u5bf9\u8c61\uff0c\u5219\u8be5\u5bf9\u8c61\u5c31\u662f<em class=\"firstterm\">\u53ef\u89c1</em>\u7684\u3002\u8fd9\u8868\u793a\u53ef\u4ee5\u76f4\u63a5\u7528\u540d\u79f0\u5f15\u7528\u8be5\u5bf9\u8c61\uff0c\u800c\u4e0d\u9700\u8981\u7528\u6a21\u5f0f\u6765\u9650\u5b9a\uff09\u3002\u8981\u67e5\u770b\u6570\u636e\u5e93\u4e2d\u6240\u6709\u5bf9\u8c61\u800c\u4e0d\u8003\u8651\u5176\u53ef\u89c1\u6027\uff0c\u53ef\u4ee5\u628a<code class=\"literal\">*.*</code>\u7528\u4f5c\u6a21\u5f0f\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u653e\u5728\u4e00\u4e2a\u6a21\u5f0f\u4e2d\uff0c<code class=\"literal\">*</code>\u5c06\u5339\u914d\u4efb\u610f\u5b57\u7b26\u5e8f\u5217\uff08\u5305\u62ec\u7a7a\u5e8f\u5217\uff09\uff0c\u800c<code class=\"literal\">?</code>\u4f1a\u5339\u914d\u4efb\u610f\u7684\u5355\u4e2a\u5b57\u7b26\uff08\u8fd9\u79cd\u8bb0\u53f7\u65b9\u6cd5\u5c31\u50cf Unix shell \u7684\u6587\u4ef6\u540d\u6a21\u5f0f\u4e00\u6837\uff09\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dt int*</code>\u4f1a\u663e\u793a\u540d\u79f0\u4ee5<code class=\"literal\">int</code>\u5f00\u59cb\u7684\u8868\u3002\u4f46\u662f\u5982\u679c\u88ab\u653e\u5728\u53cc\u5f15\u53f7\u5185\uff0c<code class=\"literal\">*</code>\u548c<code class=\"literal\">?</code>\u5c31\u4f1a\u5931\u53bb\u8fd9\u4e9b\u7279\u6b8a\u542b\u4e49\u800c\u53d8\u6210\u666e\u901a\u7684\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u5305\u542b\u70b9\u53f7\uff08.\uff09\u7684\u5173\u7cfb\u540d\u6a21\u5f0f\u4f1a\u88ab\u89e3\u91ca\u4e3a\u6a21\u5f0f\u540d\u5339\u914d\u6a21\u5f0f\uff0c\u540e\u63a5\u5bf9\u8c61\u540d\u5339\u914d\u6a21\u5f0f\u3002\u4f8b\u5982\uff0c\\dt foo*.*bar* \u4f1a\u663e\u793a\u6240\u6709\u6a21\u5f0f\u540d\u4ee5 foo \u5f00\u5934\u3001\u8868\u540d\u5305\u542b bar \u7684\u8868\u3002\u6ca1\u6709\u70b9\u53f7\u65f6\uff0c\u53ea\u5339\u914d\u5f53\u524d\u6a21\u5f0f\u641c\u7d22\u8def\u5f84\u4e2d\u53ef\u89c1\u7684\u5bf9\u8c61\u3002\u540c\u6837\uff0c\u53cc\u5f15\u53f7\u5185\u7684\u70b9\u53f7\u4e0d\u5177\u6709\u7279\u6b8a\u542b\u4e49\uff0c\u6309\u5b57\u9762\u5339\u914d\u3002\u5305\u542b\u4e24\u4e2a\u70b9\u53f7\uff08.\uff09\u7684\u5173\u7cfb\u540d\u6a21\u5f0f\u4f1a\u88ab\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u540d\uff0c\u540e\u63a5\u6a21\u5f0f\u540d\u5339\u914d\u6a21\u5f0f\uff0c\u518d\u63a5\u5bf9\u8c61\u540d\u5339\u914d\u6a21\u5f0f\u3002\u6570\u636e\u5e93\u540d\u90e8\u5206\u4e0d\u4f5c\u4e3a\u5339\u914d\u6a21\u5f0f\uff0c\u5fc5\u987b\u4e0e\u5f53\u524d\u8fde\u63a5\u7684\u6570\u636e\u5e93\u540d\u79f0\u76f8\u540c\uff0c\u5426\u5219\u4f1a\u62a5\u9519\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7528\u4e8e\u5339\u914d\u6a21\u5f0f\u540d\u7684\u6a21\u5f0f\u5305\u542b\u4e00\u4e2a\u70b9\uff08<code class=\"literal\">.</code>\uff09\uff0c\u5219\u4f1a\u88ab\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u540d\uff0c\u540e\u63a5\u6a21\u5f0f\u540d\u7684\u5339\u914d\u6a21\u5f0f\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dn mydb.*foo*</code>\u4f1a\u663e\u793a\u540d\u79f0\u4e2d\u5305\u542b<code class=\"literal\">foo</code>\u7684\u6240\u6709\u6a21\u5f0f\u3002\u6570\u636e\u5e93\u540d\u90e8\u5206\u4e0d\u4f1a\u88ab\u5f53\u4f5c\u5339\u914d\u6a21\u5f0f\uff0c\u5fc5\u987b\u4e0e\u5f53\u524d\u8fde\u63a5\u7684\u6570\u636e\u5e93\u540d\u76f8\u540c\uff0c\u5426\u5219\u4f1a\u62a5\u9519\u3002</p>\n<p lang=\"zh\">\u9ad8\u7ea7\u7528\u6237\u53ef\u4ee5\u4f7f\u7528\u5b57\u7b26\u7c7b\u7b49\u6b63\u5219\u8868\u8fbe\u5f0f\u8bb0\u6cd5\uff0c\u5982<code class=\"literal\">[0-9]</code>\u53ef\u4ee5\u5339\u914d\u4efb\u610f\u6570\u5b57\u3002\u6240\u6709\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u90fd\u6309\u7167<a class=\"xref\" href=\"/docs/15/functions-matching.html#FUNCTIONS-POSIX-REGEXP\" title=\"9.7.3.\u00a0POSIX\u6b63\u5219\u8868\u8fbe\u5f0f\">\u7b2c\u00a09.7.3\u00a0\u8282</a>\u6240\u8bf4\u7684\u5de5\u4f5c\uff0c\u4ee5\u4e0b\u5b57\u7b26\u9664\u5916\uff1a<code class=\"literal\">.</code>\u4f1a\u6309\u7167\u4e0a\u9762\u6240\u8bf4\u7684\u4f5c\u4e3a\u4e00\u79cd\u5206\u9694\u7b26\uff0c<code class=\"literal\">*</code>\u4f1a\u88ab\u7ffb\u8bd1\u6210\u6b63\u5219\u8868\u8fbe\u5f0f\u8bb0\u53f7<code class=\"literal\">.*</code>\uff0c<code class=\"literal\">?</code>\u4f1a\u88ab\u7ffb\u8bd1\u6210<code class=\"literal\">.</code>\uff0c\u800c<code class=\"literal\">$</code>\u5219\u6309\u5b57\u9762\u610f\u601d\u5339\u914d\u3002\u6839\u636e\u9700\u8981\uff0c\u53ef\u4ee5\u7528<code class=\"literal\">?</code>\u6a21\u62df<code class=\"literal\">.</code>\uff0c\u7528<code class=\"literal\">(<em class=\"replaceable\"><code>R</code></em>+|)</code>\u6a21\u62df<code class=\"literal\"><em class=\"replaceable\"><code>R</code></em>*</code>\uff0c\u6216\u7528<code class=\"literal\">(<em class=\"replaceable\"><code>R</code></em>|)</code>\u6a21\u62df<code class=\"literal\"><em class=\"replaceable\"><code>R</code></em>?</code>\u3002<code class=\"literal\">$</code>\u4e0d\u9700\u8981\u4f5c\u4e3a\u4e00\u4e2a\u6b63\u5219\u8868\u8fbe\u5f0f\u5b57\u7b26\uff0c\u56e0\u4e3a\u6a21\u5f0f\u5fc5\u987b\u5339\u914d\u6574\u4e2a\u540d\u79f0\uff0c\u800c\u4e0d\u662f\u50cf\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5e38\u89c4\u7528\u6cd5\u90a3\u6837\u89e3\u91ca\uff08\u6362\u53e5\u8bdd\u8bf4\uff0c<code class=\"literal\">$</code>\u4f1a\u88ab\u81ea\u52a8\u5730\u8ffd\u52a0\u5230\u6a21\u5f0f\u4e0a\uff09\u3002\u5982\u679c\u4e0d\u5e0c\u671b\u8be5\u6a21\u5f0f\u7684\u5339\u914d\u4f4d\u7f6e\u88ab\u56fa\u5b9a\uff0c\u53ef\u4ee5\u5728\u5f00\u5934\u6216\u8005\u7ed3\u5c3e\u5199\u4e0a<code class=\"literal\">*</code>\u3002\u6ce8\u610f\u5728\u53cc\u5f15\u53f7\u5185\uff0c\u6240\u6709\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u4f1a\u5931\u53bb\u5176\u7279\u6b8a\u542b\u4e49\u5e76\u4e14\u6309\u7167\u5176\u5b57\u9762\u610f\u601d\u8fdb\u884c\u5339\u914d\u3002\u8fd8\u6709\uff0c\u5728\u64cd\u4f5c\u7b26\u540d\u79f0\u6a21\u5f0f\u4e2d\uff08\u5373\u4f5c\u4e3a<code class=\"literal\">\\do</code>\u7684\u53c2\u6570\uff09\uff0c\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u4e5f\u6309\u7167\u5b57\u9762\u610f\u601d\u8fdb\u884c\u5339\u914d\u3002</p>\n</div>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.20.8.5\">\n<h3 lang=\"zh\">\u9ad8\u7ea7\u7279\u6027</h3>\n<div class=\"refsect3\" id=\"APP-PSQL-VARIABLES\">\n<h4 lang=\"zh\">\u53d8\u91cf</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u63d0\u4f9b\u4e86\u548c\u666e\u901a Unix \u547d\u4ee4 shell \u76f8\u4f3c\u7684\u53d8\u91cf\u66ff\u6362\u7279\u6027\u3002\u53d8\u91cf\u7b80\u5355\u6765\u8bf4\u5c31\u662f\u4e00\u5bf9\u540d\u79f0/\u503c\uff0c\u5176\u4e2d\u503c\u53ef\u4ee5\u662f\u4efb\u610f\u957f\u5ea6\u7684\u4efb\u610f\u5b57\u7b26\u4e32\u3002\u540d\u79f0\u5fc5\u987b\u7531\u5b57\u6bcd\uff08\u5305\u62ec\u975e\u62c9\u4e01\u5b57\u6bcd\uff09\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u6784\u6210\u3002</p>\n<p lang=\"zh\">\u8981\u8bbe\u7f6e\u4e00\u4e2a\u53d8\u91cf\uff0c\u53ef\u4ee5\u4f7f\u7528<span class=\"application\">psql</span>\u7684\u5143\u547d\u4ee4<code class=\"command\">\\set</code>\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo bar</code></strong>\n</pre>\n<p lang=\"zh\">\u4f1a\u5c06<code class=\"literal\">foo</code>\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">bar</code>\u3002\u8981\u68c0\u7d22\u8be5\u53d8\u91cf\u7684\u5185\u5bb9\uff0c\u53ef\u4ee5\u5728\u540d\u79f0\u524d\u653e\u4e00\u4e2a\u5192\u53f7\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\echo :foo</code></strong>\nbar\n</pre>\n<p lang=\"zh\">\u8fd9\u5728\u5e38\u89c4 SQL \u547d\u4ee4\u548c\u5143\u547d\u4ee4\u4e2d\u5747\u6709\u6548\uff0c\u4e0b\u6587\u7684<a class=\"xref\" href=\"/docs/15/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL \u63d2\u503c\">SQL \u63d2\u503c</a>\u4e2d\u6709\u66f4\u591a\u7ec6\u8282\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u8c03\u7528<code class=\"command\">\\set</code>\u65f6\u6ca1\u6709\u7b2c\u4e8c\u4e2a\u53c2\u6570\uff0c\u8be5\u53d8\u91cf\u4f1a\u88ab\u8bbe\u7f6e\u4e3a\u4e00\u4e2a\u7a7a\u5b57\u7b26\u4e32\u503c\u3002\u8981\u53d6\u6d88\u8bbe\u7f6e\uff08\u5373\u5220\u9664\uff09\u4e00\u4e2a\u53d8\u91cf\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4<code class=\"command\">\\unset</code>\u3002\u8981\u663e\u793a\u6240\u6709\u53d8\u91cf\u7684\u503c\uff0c\u5728\u8c03\u7528<code class=\"command\">\\set</code>\u65f6\u4e0d\u5e26\u4efb\u4f55\u53c2\u6570\u5373\u53ef\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\"><code class=\"command\">\\set</code>\u7684\u53c2\u6570\u670d\u4ece\u4e0e\u5176\u4ed6\u547d\u4ee4\u76f8\u540c\u7684\u66ff\u6362\u89c4\u5219\u3002\u56e0\u6b64\u53ef\u4ee5\u6784\u9020\u6709\u8da3\u7684\u5f15\u7528\uff0c\u4f8b\u5982<code class=\"literal\">\\set :foo 'something'</code>\u4ee5\u53ca\u5206\u522b\u5f97\u5230<span class=\"productname\">Perl</span>\u6216\u8005<span class=\"productname\"><acronym class=\"acronym\">PHP</acronym></span>\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u8f6f\u94fe\u63a5</span>\u201d</span>\u6216\u8005<span class=\"quote\">\u201c<span class=\"quote\">\u53ef\u53d8\u53d8\u91cf</span>\u201d</span>\u3002\u4e0d\u5e78\u7684\u662f\uff08\u6216\u8005\u5e78\u8fd0\u7684\u662f\uff1f\uff09\uff0c\u8fd9\u4e9b\u6784\u9020\u51fa\u6765\u7684\u4e1c\u897f\u5e76\u6ca1\u6709\u4ec0\u4e48\u7528\u5904\u3002\u5728\u53e6\u4e00\u65b9\u9762\uff0c<code class=\"literal\">\\set bar :foo</code>\u662f\u4e00\u79cd\u5f88\u597d\u7684\u62f7\u8d1d\u53d8\u91cf\u7684\u65b9\u6cd5\u3002</p>\n</div>\n<p lang=\"zh\">\u6709\u4e00\u4e9b\u53d8\u91cf\u4f1a\u88ab<span class=\"application\">psql</span>\u7279\u6b8a\u5bf9\u5f85\u3002\u5b83\u4eec\u8868\u793a\u7279\u5b9a\u7684\u9009\u9879\u8bbe\u7f6e\uff0c\u8fd0\u884c\u65f6\u8fd9\u7c7b\u9009\u9879\u8bbe\u7f6e\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539\u8be5\u53d8\u91cf\u7684\u503c\u6765\u6539\u53d8\uff0c\u6216\u8005\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u5b83\u4eec\u8868\u793a<span class=\"application\">psql</span>\u7684\u53ef\u66f4\u6539\u7684\u72b6\u6001\u3002\u6309\u7167\u60ef\u4f8b\uff0c\u6240\u6709\u88ab\u7279\u6b8a\u5bf9\u5f85\u7684\u53d8\u91cf\u7684\u540d\u79f0\u7531\u5168\u90e8\u5927\u5199\u5f62\u5f0f\u7684 ASCII \u5b57\u6bcd\uff08\u8fd8\u6709\u53ef\u80fd\u662f\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\uff09\u7ec4\u6210\u3002\u4e3a\u4e86\u786e\u4fdd\u672a\u6765\u6700\u5927\u7684\u517c\u5bb9\u6027\uff0c\u6700\u597d\u907f\u514d\u628a\u8fd9\u7c7b\u53d8\u91cf\u540d\u7528\u4e8e\u81ea\u5df1\u7684\u76ee\u7684\u3002</p>\n<p lang=\"zh\">\u63a7\u5236<span class=\"application\">psql</span>\u884c\u4e3a\u7684\u53d8\u91cf\u901a\u5e38\u4e0d\u80fd\u88ab\u53d6\u6d88\u8bbe\u7f6e\u6216\u8005\u8bbe\u7f6e\u4e3a\u65e0\u6548\u503c\u3002\u5141\u8bb8<code class=\"literal\">\\unset</code>\u547d\u4ee4\uff0c\u4f46\u5b83\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u5b83\u7684\u9ed8\u8ba4\u503c\u3002\u6ca1\u6709\u7b2c\u4e8c\u53c2\u6570\u7684<code class=\"literal\">\\set</code>\u547d\u4ee4\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\uff08\u5bf9\u4e8e\u63a5\u53d7\u8be5\u503c\u7684\u63a7\u5236\u53d8\u91cf\uff09\uff0c\u5bf9\u4e0d\u63a5\u53d7\u8be5\u503c\u7684\u53d8\u91cf\u5219\u4f1a\u62d2\u7edd\u8fd9\u4e2a\u547d\u4ee4\u3002\u6b64\u5916\uff0c\u63a5\u53d7\u503c<code class=\"literal\">on</code>\u548c<code class=\"literal\">off</code>\u7684\u63a7\u5236\u53d8\u91cf\u4e5f\u80fd\u63a5\u53d7\u5176\u4ed6\u5e38\u89c1\u7684\u5e03\u5c14\u503c\u62fc\u5199\u65b9\u5f0f\uff0c\u4f8b\u5982<code class=\"literal\">true</code>\u548c<code class=\"literal\">false</code>\u3002</p>\n<p lang=\"zh\">\u88ab\u7279\u6b8a\u5bf9\u5f85\u7684\u53d8\u91cf\u662f\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"varname\">AUTOCOMMIT</code> </span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\uff08\u9ed8\u8ba4\uff09\u65f6\uff0c\u6bcf\u4e00\u4e2a SQL \u547d\u4ee4\u5728\u6210\u529f\u5b8c\u6210\u65f6\u4f1a\u88ab\u81ea\u52a8\u63d0\u4ea4\u3002\u5728\u8fd9\u79cd\u6a21\u5f0f\u4e2d\u8981\u63a8\u8fdf\u63d0\u4ea4\uff0c\u5fc5\u987b\u8f93\u5165\u4e00\u4e2a<code class=\"command\">BEGIN</code>\u6216\u8005<code class=\"command\">START TRANSACTION</code> SQL \u547d\u4ee4\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">off</code>\u6216\u8005\u88ab\u53d6\u6d88\u8bbe\u7f6e\u65f6\uff0c\u5728\u663e\u5f0f\u53d1\u51fa<code class=\"command\">COMMIT</code>\u6216\u8005<code class=\"command\">END</code>\u4e4b\u524d\uff0cSQL \u547d\u4ee4\u4e0d\u4f1a\u88ab\u63d0\u4ea4\u3002\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u4f1a\u4e3a\u4f60\u53d1\u51fa\u4e00\u4e2a\u9690\u5f0f\u7684<code class=\"command\">BEGIN</code>\uff0c\u8fd9\u4f1a\u53d1\u751f\u5728\u547d\u4ee4\u6267\u884c\u4e4b\u524d\uff0c\u524d\u63d0\u662f\u8be5\u547d\u4ee4\u4e0d\u5728\u4e8b\u52a1\u5757\u4e2d\uff0c\u4e14\u5176\u672c\u8eab\u65e2\u4e0d\u662f<code class=\"command\">BEGIN</code>\u6216\u5176\u4ed6\u4e8b\u52a1\u63a7\u5236\u547d\u4ee4\uff0c\u4e5f\u4e0d\u662f\u65e0\u6cd5\u5728\u4e8b\u52a1\u5757\u4e2d\u6267\u884c\u7684\u547d\u4ee4\uff08\u4f8b\u5982<code class=\"command\">VACUUM</code>\uff09\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u4e2d\uff0c\u5fc5\u987b\u901a\u8fc7<code class=\"command\">ABORT</code>\u6216\u8005<code class=\"command\">ROLLBACK</code>\u663e\u5f0f\u5730\u653e\u5f03\u4efb\u4f55\u5931\u8d25\u7684\u4e8b\u52a1\u3002\u8fd8\u8981\u8bb0\u4f4f\uff0c\u5982\u679c\u9000\u51fa\u4f1a\u8bdd\u65f6\u6ca1\u6709\u63d0\u4ea4\uff0c\u5219\u6240\u6709\u7684\u5de5\u4f5c\u90fd\u4f1a\u4e22\u5931\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u81ea\u52a8\u63d0\u4ea4\u6253\u5f00\u6a21\u5f0f\u662f<span class=\"productname\">PostgreSQL</span>\u7684\u4f20\u7edf\u884c\u4e3a\uff0c\u4f46\u662f\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u66f4\u63a5\u8fd1\u4e8e SQL \u7684\u89c4\u8303\u3002\u5982\u679c\u66f4\u559c\u6b22\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\uff0c\u53ef\u4ee5\u5728\u7cfb\u7edf\u7ea7\u7684<code class=\"filename\">psqlrc</code>\u6587\u4ef6\u6216\u8005\u4e2a\u4eba\u7684<code class=\"filename\">~/.psqlrc</code>\u6587\u4ef6\u4e2d\u8bbe\u7f6e\u5b83\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">COMP_KEYWORD_CASE</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u786e\u5b9a\u5728\u8865\u5168\u4e00\u4e2a SQL \u5173\u952e\u8bcd\u65f6\u8981\u4f7f\u7528\u7684\u5927\u5c0f\u5199\u5f62\u5f0f\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">lower</code>\u6216\u8005<code class=\"literal\">upper</code>\uff0c\u8865\u5168\u540e\u7684\u8bcd\u5c06\u5206\u522b\u662f\u5c0f\u5199\u6216\u8005\u5927\u5199\u5f62\u5f0f\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">preserve-lower</code>\u6216\u8005<code class=\"literal\">preserve-upper</code>\uff08\u9ed8\u8ba4\uff09\uff0c\u8865\u5168\u540e\u7684\u8bcd\u5c06\u4f1a\u4fdd\u6301\u8be5\u8bcd\u5df2\u8f93\u5165\u90e8\u5206\u7684\u5927\u5c0f\u5199\u5f62\u5f0f\uff0c\u4f46\u662f\u5982\u679c\u88ab\u8865\u5168\u7684\u8bcd\u8fd8\u6ca1\u6709\u88ab\u8f93\u5165\uff0c\u5219\u5b83\u4f1a\u88ab\u5206\u522b\u8865\u5168\u6210\u5c0f\u5199\u6216\u8005\u5927\u5199\u5f62\u5f0f\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">DBNAME</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u5df2\u8fde\u63a5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u662f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ECHO</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">all</code>\uff0c\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u4f1a\u5728\u8bfb\u5165\u65f6\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u8bfb\u53d6\u7684\u884c\uff09\u3002\u8981\u5728\u7a0b\u5e8f\u5f00\u59cb\u65f6\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\uff0c\u53ef\u4ee5\u4f7f\u7528\u5f00\u5173<code class=\"option\">-a</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">queries</code>\uff0c<span class=\"application\">psql</span>\u4f1a\u5728\u53d1\u9001\u6bcf\u4e2a\u67e5\u8be2\u7ed9\u670d\u52a1\u5668\u65f6\u5c06\u5b83\u4eec\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\u3002\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\u7684\u5f00\u5173\u662f<code class=\"option\">-e</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">errors</code>\uff0c\u90a3\u4e48\u53ea\u6709\u5931\u8d25\u7684\u67e5\u8be2\u4f1a\u88ab\u663e\u793a\u5728\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u4e0a\u3002\u8fd9\u79cd\u884c\u4e3a\u7684\u5f00\u5173\u662f<code class=\"option\">-b</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">none</code>\uff08\u9ed8\u8ba4\u503c\uff09\u5219\u4e0d\u4f1a\u663e\u793a\u4efb\u4f55\u67e5\u8be2\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ECHO_HIDDEN</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u4e14\u4e00\u4e2a\u53cd\u659c\u7ebf\u547d\u4ee4\u67e5\u8be2\u6570\u636e\u5e93\u65f6\uff0c\u76f8\u5e94\u7684\u67e5\u8be2\u4f1a\u88ab\u5148\u663e\u793a\u3002\u8fd9\u79cd\u7279\u6027\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u5b66\u4e60<span class=\"productname\">PostgreSQL</span>\u7684\u5185\u90e8\u5e76\u4e14\u5728\u81ea\u5df1\u7684\u7a0b\u5e8f\u4e2d\u63d0\u4f9b\u7c7b\u4f3c\u7684\u529f\u80fd\uff08\u8981\u5728\u7a0b\u5e8f\u5f00\u59cb\u65f6\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\uff0c\u53ef\u4ee5\u4f7f\u7528\u5f00\u5173<code class=\"option\">-E</code>\uff09\u3002\u5982\u679c\u628a\u8fd9\u4e2a\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">noexec</code>\uff0c\u5219\u5bf9\u5e94\u7684\u67e5\u8be2\u53ea\u4f1a\u88ab\u663e\u793a\u800c\u5e76\u4e0d\u771f\u6b63\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u6267\u884c\u3002\u9ed8\u8ba4\u503c\u662f<code class=\"literal\">off</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ENCODING</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u7684\u5ba2\u6237\u7aef\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u6bcf\u4e00\u6b21\u4f60\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\uff09\u65f6\u4ee5\u53ca\u5f53\u4f60\u7528<code class=\"literal\">\\encoding</code>\u66f4\u6539\u7f16\u7801\u65f6\uff0c\u8fd9\u4e2a\u53d8\u91cf\u90fd\u4f1a\u88ab\u8bbe\u7f6e\uff0c\u4f46\u5b83\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ERROR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u4e0a\u4e00\u4e2aSQL\u67e5\u8be2\u5931\u8d25\u5219\u4e3a<code class=\"literal\">true</code>\uff0c\u5982\u679c\u6210\u529f\u5219\u662f<code class=\"literal\">false</code>\u3002\u53e6\u89c1<code class=\"varname\">SQLSTATE</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">FETCH_COUNT</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a\u4e00\u4e2a\u5927\u4e8e\u96f6\u7684\u6574\u6570\u503c\uff0c<code class=\"command\">SELECT</code>\u67e5\u8be2\u7684\u7ed3\u679c\u4f1a\u4ee5\u4e00\u7ec4\u4e00\u7ec4\u7684\u65b9\u5f0f\u53d6\u51fa\u5e76\u4e14\u663e\u793a\uff08\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u7684\u90a3\u6837\u628a\u6574\u4e2a\u7ed3\u679c\u96c6\u62ff\u5230\u4ee5\u540e\u518d\u663e\u793a\uff09\uff0c\u6bcf\u7ec4\u5305\u542b\u7684\u884c\u6570\u7b49\u4e8e\u8be5\u6574\u6570\u503c\u3002\u56e0\u6b64\uff0c\u8fd9\u79cd\u65b9\u5f0f\u53ea\u4f1a\u4f7f\u7528\u6709\u9650\u7684\u5185\u5b58\u91cf\uff0c\u800c\u4e0d\u7ba1\u6574\u4e2a\u7ed3\u679c\u96c6\u7684\u5927\u5c0f\u3002\u5728\u542f\u7528\u8fd9\u4e2a\u7279\u6027\u65f6\uff0c\u901a\u5e38\u4f1a\u4f7f\u7528 100 \u5230 1000 \u7684\u8bbe\u7f6e\u3002\u8bb0\u4f4f\u5728\u4f7f\u7528\u8fd9\u79cd\u7279\u6027\u65f6\uff0c\u4e00\u4e2a\u67e5\u8be2\u53ef\u80fd\u4f1a\u5728\u5df2\u7ecf\u663e\u793a\u4e86\u4e00\u4e9b\u884c\u4e4b\u540e\u5931\u8d25\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5c3d\u7ba1\u53ef\u4ee5\u628a\u8fd9\u79cd\u7279\u6027\u7528\u4e8e\u4efb\u4f55\u7684\u8f93\u51fa\u683c\u5f0f\uff0c\u4f46\u662f\u9ed8\u8ba4\u7684<code class=\"literal\">aligned</code>\u683c\u5f0f\u770b\u8d77\u6765\u4f1a\u6bd4\u8f83\u7cdf\u7cd5\uff0c\u56e0\u4e3a\u6bcf\u4e00\u7ec4\u7684<code class=\"varname\">FETCH_COUNT</code>\u884c\u5c06\u88ab\u5355\u72ec\u683c\u5f0f\u5316\uff0c\u8fd9\u5c31\u4f1a\u5bfc\u81f4\u4e0d\u540c\u7684\u884c\u7ec4\u7684\u5217\u5bbd\u4e0d\u540c\u3002\u5176\u4ed6\u7684\u8f93\u51fa\u683c\u5f0f\u4f1a\u66f4\u597d\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">HIDE_TABLEAM</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6b64\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">true</code>\uff0c\u5219\u4e0d\u663e\u793a\u8868\u7684\u8bbf\u95ee\u65b9\u6cd5\u7684\u8be6\u7ec6\u4fe1\u606f\u3002\u8fd9\u4e3b\u8981\u7528\u4e8e\u56de\u5f52\u6d4b\u8bd5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">HIDE_TOAST_COMPRESSION</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">true</code>\uff0c\u4e0d\u663e\u793a\u5217\u538b\u7f29\u65b9\u6cd5\u7684\u7ec6\u8282\u3002\u8fd9\u4e3b\u8981\u7528\u4e8e\u56de\u5f52\u6d4b\u8bd5\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">HISTCONTROL</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">ignorespace</code>\uff0c\u5219\u4ee5\u4e00\u4e2a\u7a7a\u683c\u5f00\u59cb\u7684\u884c\u4e0d\u4f1a\u88ab\u653e\u5165\u5230\u5386\u53f2\u5217\u8868\u4e2d\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">ignoredups</code>\uff0c\u5219\u4e0e\u4e0a\u4e00\u6761\u5386\u53f2\u8bb0\u5f55\u76f8\u540c\u7684\u884c\u4e0d\u4f1a\u88ab\u653e\u5165\u3002\u503c<code class=\"literal\">ignoreboth</code>\u7ec4\u5408\u4e86\u4e0a\u8ff0\u4e24\u79cd\u503c\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">none</code>\uff08\u9ed8\u8ba4\u503c\uff09\uff0c\u6240\u6709\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e2d\u88ab\u8bfb\u5165\u7684\u884c\u90fd\u4f1a\u4fdd\u5b58\u5728\u5386\u53f2\u5217\u8868\u4e2d\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">HISTFILE</code></span></dt>\n<dd>\n<p lang=\"zh\">\u8be5\u6587\u4ef6\u540d\u5c06\u88ab\u7528\u4e8e\u5b58\u50a8\u5386\u53f2\u5217\u8868\u3002\u5982\u679c\u672a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff0c\u6587\u4ef6\u540d\u5c06\u4ece<code class=\"envar\">PSQL_HISTORY</code>\u73af\u5883\u53d8\u91cf\u4e2d\u53d6\u5f97\u3002\u5982\u679c\u8be5\u73af\u5883\u53d8\u91cf\u4e5f\u6ca1\u6709\u88ab\u8bbe\u7f6e\uff0c\u5219\u9ed8\u8ba4\u503c\u662f<code class=\"filename\">~/.psql_history</code>\uff0c\u5728Windows\u4e0a\u662f<code class=\"filename\">%APPDATA%\\postgresql\\psql_history</code>\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">\\set HISTFILE ~/.psql_history-:DBNAME\n</pre>\n<p lang=\"zh\">\u653e\u5728<code class=\"filename\">~/.psqlrc</code>\u4e2d\u5c06\u4f1a\u5bfc\u81f4<span class=\"application\">psql</span>\u4e3a\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u7ef4\u62a4\u4e00\u4e2a\u5355\u72ec\u7684\u5386\u53f2\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">HISTSIZE</code></span></dt>\n<dd>\n<p lang=\"zh\">\u547d\u4ee4\u5386\u53f2\u4e2d\u6700\u591a\u4fdd\u5b58\u7684\u547d\u4ee4\u6570\uff08\u9ed8\u8ba4 500\uff09\u3002\u8bbe\u4e3a\u8d1f\u503c\u65f6\uff0c\u4e0d\u8bbe\u4e0a\u9650\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">HOST</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e3b\u673a\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u4e5f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">IGNOREEOF</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8bbe\u4e3a 1 \u6216\u66f4\u5c0f\u7684\u503c\uff0c\u5411 psql \u4ea4\u4e92\u4f1a\u8bdd\u53d1\u9001 EOF \u5b57\u7b26\uff08\u901a\u5e38\u4e3a Control + D\uff09\u5c31\u4f1a\u7ec8\u6b62\u5e94\u7528\u3002\u5982\u679c\u8bbe\u4e3a\u66f4\u5927\u7684\u6570\u503c\uff0c\u5219\u5fc5\u987b\u8fde\u7eed\u8f93\u5165\u76f8\u5e94\u6b21\u6570\u7684 EOF \u5b57\u7b26\u624d\u4f1a\u7ec8\u6b62\u4ea4\u4e92\u4f1a\u8bdd\u3002\u5982\u679c\u53d8\u91cf\u8bbe\u4e3a\u975e\u6570\u503c\uff0c\u4f1a\u88ab\u89e3\u91ca\u4e3a 10\u3002\u9ed8\u8ba4\u503c\u4e3a 0\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">LASTOID</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6700\u8fd1\u4e00\u6b21\u53d7\u5f71\u54cd\u7684 OID \u503c\uff0c\u7531 INSERT \u6216 \\lo_import \u547d\u4ee4\u8fd4\u56de\u3002\u6b64\u53d8\u91cf\u4ec5\u4fdd\u8bc1\u5728\u4e0b\u4e00\u6761 SQL \u547d\u4ee4\u7684\u7ed3\u679c\u663e\u793a\u4e4b\u524d\u6709\u6548\u3002\u4ece\u7248\u672c 12 \u8d77\uff0cPostgreSQL \u670d\u52a1\u5668\u4e0d\u518d\u652f\u6301 OID \u7cfb\u7edf\u5217\uff0c\u56e0\u6b64\u8fde\u63a5\u5230\u8fd9\u4e9b\u670d\u52a1\u5668\u65f6\uff0c\u6267\u884c INSERT \u540e LASTOID \u59cb\u7ec8\u4e3a 0\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">LAST_ERROR_MESSAGE</code><br/></span><span class=\"term\"><code class=\"varname\">LAST_ERROR_SQLSTATE</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d<span class=\"application\">psql</span>\u4f1a\u8bdd\u4e2d\u6700\u8fd1\u4e00\u4e2a\u5931\u8d25\u67e5\u8be2\u7684\u4e3b\u9519\u8bef\u6d88\u606f\u548c\u76f8\u5173\u7684SQLSTATE\u4ee3\u7801\uff0c\u5982\u679c\u5728\u5f53\u524d\u4f1a\u8bdd\u4e2d\u6ca1\u6709\u53d1\u751f\u9519\u8bef\uff0c\u5219\u662f\u4e00\u4e2a\u7a7a\u5b57\u7b26\u4e32\u548c<code class=\"literal\">00000</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ON_ERROR_ROLLBACK</code> </span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u65f6\uff0c\u5982\u679c\u4e8b\u52a1\u5757\u4e2d\u7684\u4e00\u4e2a\u8bed\u53e5\u4ea7\u751f\u4e00\u4e2a\u9519\u8bef\uff0c\u8be5\u9519\u8bef\u4f1a\u88ab\u5ffd\u7565\u5e76\u4e14\u8be5\u4e8b\u52a1\u4f1a\u7ee7\u7eed\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">interactive</code>\u65f6\uff0c\u53ea\u5728\u4ea4\u4e92\u5f0f\u4f1a\u8bdd\u4e2d\u5ffd\u7565\u8fd9\u7c7b\u9519\u8bef\uff0c\u800c\u8bfb\u53d6\u811a\u672c\u6587\u4ef6\u65f6\u5219\u4e0d\u4f1a\u5ffd\u7565\u9519\u8bef\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">off</code>\uff08\u9ed8\u8ba4\u503c\uff09\u65f6\uff0c\u4e8b\u52a1\u5757\u4e2d\u4ea7\u751f\u9519\u8bef\u7684\u4e00\u4e2a\u8bed\u53e5\u4f1a\u4e2d\u6b62\u6574\u4e2a\u4e8b\u52a1\u3002\u9519\u8bef\u56de\u6eda\u6a21\u5f0f\u7684\u5de5\u4f5c\u539f\u7406\u662f\u5728\u4e8b\u52a1\u5757\u7684\u6bcf\u4e2a\u547d\u4ee4\u4e4b\u524d\u90fd\u4e3a\u4f60\u53d1\u51fa\u4e00\u4e2a\u9690\u5f0f\u7684<code class=\"command\">SAVEPOINT</code>\uff0c\u7136\u540e\u5728\u8be5\u547d\u4ee4\u5931\u8d25\u65f6\u56de\u6eda\u5230\u8be5\u4fdd\u5b58\u70b9\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ON_ERROR_STOP</code></span></dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u51fa\u9519\u540e\u4ecd\u4f1a\u7ee7\u7eed\u5904\u7406\u547d\u4ee4\u3002\u5c06\u6b64\u53d8\u91cf\u8bbe\u4e3a on \u540e\uff0c\u5904\u7406\u4f1a\u7acb\u5373\u505c\u6b62\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\uff0cpsql \u4f1a\u8fd4\u56de\u547d\u4ee4\u63d0\u793a\u7b26\uff1b\u5426\u5219\uff0cpsql \u4f1a\u9000\u51fa\u5e76\u8fd4\u56de\u9519\u8bef\u7801 3\uff0c\u4ee5\u533a\u522b\u4e8e\u9519\u8bef\u7801 1 \u6240\u8868\u793a\u7684\u81f4\u547d\u9519\u8bef\u3002\u65e0\u8bba\u54ea\u79cd\u60c5\u51b5\uff0c\u5f53\u524d\u6b63\u5728\u8fd0\u884c\u7684\u6240\u6709\u811a\u672c\uff08\u5982\u679c\u5b58\u5728\u9876\u5c42\u811a\u672c\uff0c\u5219\u5305\u62ec\u8be5\u811a\u672c\u53ca\u5176\u8c03\u7528\u7684\u5176\u4ed6\u811a\u672c\uff09\u90fd\u4f1a\u7acb\u5373\u7ec8\u6b62\u3002\u5982\u679c\u9876\u5c42\u547d\u4ee4\u5b57\u7b26\u4e32\u5305\u542b\u591a\u6761 SQL \u547d\u4ee4\uff0c\u5219\u4f1a\u5728\u5f53\u524d\u547d\u4ee4\u5904\u505c\u6b62\u5904\u7406\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">PORT</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u7aef\u53e3\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u4e5f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">PROMPT1</code><br/></span><span class=\"term\"><code class=\"varname\">PROMPT2</code><br/></span><span class=\"term\"><code class=\"varname\">PROMPT3</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e9b\u53d8\u91cf\u6307\u5b9a<span class=\"application\">psql</span>\u53d1\u51fa\u7684\u63d0\u793a\u7b26\u7684\u6a21\u6837\u3002\u89c1\u4e0b\u6587\u7684<a class=\"xref\" href=\"/docs/15/app-psql.html#APP-PSQL-PROMPTING\" title=\"\u63d0\u793a\u7b26\">\u63d0\u793a\u7b26</a>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">QUIET</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u8fd9\u4e2a\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-q</code>\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\u53ef\u80fd\u7528\u5904\u4e0d\u5927\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">ROW_COUNT</code></span></dt>\n<dd>\n<p lang=\"zh\">\u6700\u8fd1\u4e00\u6761 SQL \u67e5\u8be2\u8fd4\u56de\u6216\u5f71\u54cd\u7684\u884c\u6570\uff1b\u5982\u679c\u67e5\u8be2\u5931\u8d25\u6216\u6ca1\u6709\u62a5\u544a\u884c\u6570\uff0c\u5219\u4e3a 0\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">SERVER_VERSION_NAME</code><br/></span><span class=\"term\"><code class=\"varname\">SERVER_VERSION_NUM</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b57\u7b26\u4e32\u5f62\u5f0f\u7684\u670d\u52a1\u5668\u7248\u672c\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">9.6.2</code>\u3001<code class=\"literal\">10.1</code>\u6216\u8005<code class=\"literal\">11beta1</code>\uff0c\u4ee5\u53ca\u6570\u5b57\u5f62\u5f0f\u7684\u670d\u52a1\u5668\u7248\u672c\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">90602</code>\u6216\u8005<code class=\"literal\">100001</code>\u3002\u6bcf\u6b21\u4f60\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\uff09\u65f6\uff0c\u8fd9\u4e9b\u90fd\u4f1a\u88ab\u8bbe\u7f6e\uff0c\u4f46\u53ef\u4ee5\u88ab\u6539\u53d8\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">SHOW_ALL_RESULTS</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u6b64\u53d8\u91cf\u88ab\u8bbe\u4e3a <code class=\"literal\">off</code> \u65f6\uff0c\u7ec4\u5408\u67e5\u8be2\uff08<code class=\"literal\">\\;</code>\uff09\u53ea\u663e\u793a\u6700\u540e\u4e00\u4e2a\u7ed3\u679c\uff0c\u800c\u4e0d\u662f\u663e\u793a\u5168\u90e8\u7ed3\u679c\u3002\u9ed8\u8ba4\u503c\u4e3a <code class=\"literal\">on</code>\u3002\u8bbe\u4e3a off \u7684\u884c\u4e3a\u662f\u4e3a\u4e86\u517c\u5bb9\u65e7\u7248\u672c\u7684 <span class=\"application\">psql</span>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">SHOW_CONTEXT</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u53d8\u91cf\u53ef\u4ee5\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">never</code>\u3001<code class=\"literal\">errors</code>\u6216\u8005<code class=\"literal\">always</code>\u6765\u63a7\u5236\u662f\u5426\u5728\u6765\u81ea\u670d\u52a1\u5668\u7684\u6d88\u606f\u4e2d\u663e\u793a<code class=\"literal\">CONTEXT</code>\u5b57\u6bb5\u3002\u9ed8\u8ba4\u662f<code class=\"literal\">errors</code>\uff08\u8868\u793a\u5728\u9519\u8bef\u6d88\u606f\u4e2d\u663e\u793a\u4e0a\u4e0b\u6587\uff0c\u4f46\u5728\u901a\u77e5\u548c\u8b66\u544a\u6d88\u606f\u4e2d\u4e0d\u663e\u793a\uff09\u3002\u5f53<code class=\"varname\">VERBOSITY</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">terse</code>\u6216<code class=\"literal\">sqlstate</code>\u65f6\uff0c\u8fd9\u4e2a\u8bbe\u7f6e\u65e0\u6548\uff08\u53e6\u89c1<code class=\"command\">\\errverbose</code>\uff0c\u5b83\u53ef\u4ee5\u7528\u6765\u5f97\u5230\u521a\u9047\u5230\u7684\u9519\u8bef\u7684\u8be6\u7ec6\u4fe1\u606f\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">SINGLELINE</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u8fd9\u4e2a\u53d8\u91cf\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-S</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">SINGLESTEP</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u8fd9\u4e2a\u53d8\u91cf\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-s</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">SQLSTATE</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0e\u4e0a\u4e00\u4e2aSQL\u67e5\u8be2\u7684\u5931\u8d25\u76f8\u5173\u7684\u9519\u8bef\u4ee3\u7801\uff08\u89c1<a class=\"xref\" href=\"/docs/15/errcodes-appendix.html\" title=\"\u9644\u5f55\u00a0A.\u00a0PostgreSQL\u9519\u8bef\u4ee3\u7801\">\u9644\u5f55\u00a0A</a>\uff09\uff0c\u5982\u679c\u4e0a\u4e00\u4e2a\u67e5\u8be2\u6210\u529f\u5219\u4e3a<code class=\"literal\">00000</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">USER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7528\u6237\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u662f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">VERBOSITY</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u53d8\u91cf\u53ef\u4ee5\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">default</code>\u3001<code class=\"literal\">verbose</code>\u3001<code class=\"literal\">terse</code>\u6216\u8005<code class=\"literal\">sqlstate</code>\u6765\u63a7\u5236\u9519\u8bef\u62a5\u544a\u7684\u8be6\u7ec6\u7a0b\u5ea6\uff08\u53e6\u89c1<code class=\"command\">\\errverbose</code>\uff0c\u5728\u60f3\u5f97\u5230\u521a\u9047\u5230\u7684\u9519\u8bef\u7684\u8be6\u7ec6\u4fe1\u606f\u65f6\u4f7f\u7528\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"varname\">VERSION</code><br/></span><span class=\"term\"><code class=\"varname\">VERSION_NAME</code><br/></span><span class=\"term\"><code class=\"varname\">VERSION_NUM</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e9b\u53d8\u91cf\u5728\u7a0b\u5e8f\u542f\u52a8\u65f6\u88ab\u8bbe\u7f6e\u4ee5\u53cd\u6620<span class=\"application\">psql</span>\u7684\u7248\u672c\uff0c\u5206\u522b\u662f\u4e00\u4e2a\u8be6\u7ec6\u7684\u5b57\u7b26\u4e32\u3001\u4e00\u4e2a\u77ed\u5b57\u7b26\u4e32\uff08\u4f8b\u5982<code class=\"literal\">9.6.2</code>\u3001<code class=\"literal\">10.1</code>\u6216\u8005<code class=\"literal\">11beta1</code>\uff09\u4ee5\u53ca\u4e00\u4e2a\u6570\u5b57\uff08\u4f8b\u5982<code class=\"literal\">90602</code>\u6216\u8005<code class=\"literal\">100001</code>\uff09\u3002\u5b83\u4eec\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-INTERPOLATION\">\n<h4 lang=\"zh\">SQL \u63d2\u503c</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u53d8\u91cf\u7684\u4e00\u4e2a\u5173\u952e\u7279\u6027\u662f\u53ef\u4ee5\u628a\u5b83\u4eec\u66ff\u6362\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u63d2\u503c</span>\u201d</span>\uff09\u5230\u5e38\u89c4<acronym class=\"acronym\">SQL</acronym>\u8bed\u53e5\u4e2d\uff0c\u4e5f\u53ef\u4ee5\u628a\u5b83\u4eec\u66ff\u6362\u5230\u5143\u547d\u4ee4\u7684\u53c2\u6570\u4e2d\u3002\u6b64\u5916\uff0c<span class=\"application\">psql</span>\u8fd8\u63d0\u4f9b\u4e86\u529f\u80fd\u6765\u786e\u4fdd\u88ab\u7528\u4f5c SQL \u5b57\u9762\u91cf\u548c\u6807\u8bc6\u7b26\u7684\u53d8\u91cf\u503c\u4f1a\u88ab\u6b63\u786e\u5730\u52a0\u5f15\u53f7\u3002\u4e0d\u52a0\u5f15\u53f7\u5730\u63d2\u503c\u4e00\u4e2a\u503c\u7684\u8bed\u6cd5\u662f\u5728\u53d8\u91cf\u540d\u524d\u9762\u52a0\u4e0a\u4e00\u4e2a\u5192\u53f7\uff08<code class=\"literal\">:</code>\uff09\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo 'my_table'</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM :foo;</code></strong>\n</pre>\n<p lang=\"zh\">\u5c06\u67e5\u8be2\u8868<code class=\"literal\">my_table</code>\u3002\u6ce8\u610f\u8fd9\u53ef\u80fd\u4f1a\u4e0d\u5b89\u5168\uff1a\u8be5\u53d8\u91cf\u7684\u503c\u4f1a\u88ab\u6309\u5b57\u9762\u62f7\u8d1d\uff0c\u56e0\u6b64\u5b83\u53ef\u80fd\u5305\u542b\u4e0d\u5e73\u8861\u7684\u5f15\u53f7\u751a\u81f3\u53cd\u659c\u7ebf\u547d\u4ee4\u3002\u5fc5\u987b\u786e\u4fdd\u628a\u5b83\u653e\u5728\u90a3\u91cc\u662f\u6709\u610f\u4e49\u7684\u3002</p>\n<p lang=\"zh\">\u5f53\u4e00\u4e2a\u503c\u8981\u7528\u4f5c SQL \u5b57\u9762\u91cf\u6216\u6807\u8bc6\u7b26\u65f6\uff0c\u6700\u5b89\u5168\u7684\u505a\u6cd5\u662f\u4e3a\u5b83\u52a0\u4e0a\u5f15\u53f7\u3002\u8981\u5c06\u53d8\u91cf\u503c\u4f5c\u4e3a SQL \u5b57\u9762\u91cf\u52a0\u5f15\u53f7\uff0c\u5e94\u5199\u4e00\u4e2a\u5192\u53f7\uff0c\u540e\u9762\u8ddf\u7528\u5355\u5f15\u53f7\u62ec\u8d77\u6765\u7684\u53d8\u91cf\u540d\u3002\u8981\u5c06\u53d8\u91cf\u503c\u4f5c\u4e3a SQL \u6807\u8bc6\u7b26\u52a0\u5f15\u53f7\uff0c\u5219\u5728\u5192\u53f7\u540e\u9762\u7528\u53cc\u5f15\u53f7\u62ec\u8d77\u53d8\u91cf\u540d\u3002\u8fd9\u4e9b\u5199\u6cd5\u80fd\u6b63\u786e\u5904\u7406\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165\u7684\u5f15\u53f7\u548c\u5176\u4ed6\u7279\u6b8a\u5b57\u7b26\u3002\u524d\u9762\u7684\u793a\u4f8b\u53ef\u7528\u4ee5\u4e0b\u66f4\u5b89\u5168\u7684\u5199\u6cd5\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo 'my_table'</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM :\"foo\";</code></strong>\n</pre>\n<p lang=\"zh\">\u5728\u52a0\u5f15\u53f7\u7684<acronym class=\"acronym\">SQL</acronym>\u5b57\u9762\u91cf\u548c\u6807\u8bc6\u7b26\u5185\u90e8\uff0c\u4e0d\u4f1a\u6267\u884c\u53d8\u91cf\u63d2\u503c\u3002\u56e0\u6b64\uff0c<code class=\"literal\">':foo'</code>\u8fd9\u6837\u7684\u5199\u6cd5\u4e0d\u80fd\u6839\u636e\u53d8\u91cf\u503c\u751f\u6210\u52a0\u5f15\u53f7\u7684\u5b57\u9762\u91cf\uff08\u5373\u4f7f\u80fd\u591f\u751f\u6548\uff0c\u4e5f\u4e0d\u5b89\u5168\uff0c\u56e0\u4e3a\u5b83\u65e0\u6cd5\u6b63\u786e\u5904\u7406\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165\u7684\u5f15\u53f7\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8fd9\u79cd\u673a\u5236\u7684\u4e00\u4e2a\u793a\u4f8b\u662f\u628a\u4e00\u4e2a\u6587\u4ef6\u7684\u5185\u5bb9\u62f7\u8d1d\u5230\u4e00\u4e2a\u8868\u5217\u4e2d\u3002\u9996\u5148\u628a\u8be5\u6587\u4ef6\u8f7d\u5165\u5230\u4e00\u4e2a\u53d8\u91cf\uff0c\u7136\u540e\u628a\u8be5\u53d8\u91cf\u7684\u503c\u4f5c\u4e3a\u4e00\u4e2a\u52a0\u5f15\u53f7\u7684\u5b57\u7b26\u4e32\u8fdb\u884c\u63d2\u503c\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set content `cat my_file.txt`</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>INSERT INTO my_table VALUES (:'content');</code></strong>\n</pre>\n<p lang=\"zh\">\uff08\u6ce8\u610f\u5982\u679c<code class=\"filename\">my_file.txt</code>\u5305\u542b NUL \u5b57\u8282\uff0c\u8fd9\u6837\u4e5f\u4e0d\u884c\u3002<span class=\"application\">psql</span>\u4e0d\u652f\u6301\u5728\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165 NUL \u5b57\u8282\uff09\u3002</p>\n<p lang=\"zh\">\u56e0\u4e3a\u5192\u53f7\u53ef\u4ee5\u5408\u6cd5\u5730\u51fa\u73b0\u5728 SQL \u547d\u4ee4\u4e2d\uff0c\u770b\u4f3c\u63d2\u503c\u7684\u5199\u6cd5\uff08\u5373<code class=\"literal\">:name</code>\u3001<code class=\"literal\">:'name'</code>\u6216\u8005<code class=\"literal\">:\"name\"</code>\uff09\u4e0d\u4f1a\u88ab\u66ff\u6362\uff0c\u9664\u975e\u6240\u6307\u7684\u53d8\u91cf\u5f53\u524d\u5df2\u8bbe\u7f6e\u3002\u5728\u4efb\u4f55\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u7528\u4e00\u4e2a\u53cd\u659c\u7ebf\u5bf9\u5192\u53f7\u8fdb\u884c\u8f6c\u4e49\u4ee5\u907f\u514d\u5b83\u88ab\u66ff\u6362\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">:{?<em class=\"replaceable\"><code>name</code></em>}</code>\u7279\u6b8a\u8bed\u6cd5\u4f1a\u6839\u636e\u8be5\u53d8\u91cf\u662f\u5426\u5b58\u5728\u8fd4\u56de TRUE \u6216 FALSE\uff0c\u56e0\u6b64\u603b\u662f\u4f1a\u88ab\u66ff\u6362\uff0c\u9664\u975e\u5192\u53f7\u88ab\u53cd\u659c\u7ebf\u8f6c\u4e49\u3002</p>\n<p lang=\"zh\">\u53d8\u91cf\u7684\u5192\u53f7\u8bed\u6cd5\u5bf9\u5d4c\u5165\u5f0f\u67e5\u8be2\u8bed\u8a00\uff08\u4f8b\u5982<span class=\"application\">ECPG</span>\uff09\u6765\u8bf4\u662f\u6807\u51c6\u7684<acronym class=\"acronym\">SQL</acronym>\u3002\u7528\u4e8e\u6570\u7ec4\u5207\u7247\u548c\u7c7b\u578b\u8f6c\u6362\u7684\u5192\u53f7\u8bed\u6cd5\u662f<span class=\"productname\">PostgreSQL</span>\u6269\u5c55\uff0c\u5b83\u6709\u65f6\u53ef\u80fd\u4f1a\u4e0e\u6807\u51c6\u7528\u6cd5\u51b2\u7a81\u3002\u628a\u4e00\u4e2a\u53d8\u91cf\u503c\u8f6c\u4e49\u6210 SQL \u5b57\u9762\u91cf\u6216\u8005\u6807\u8bc6\u7b26\u7684\u5192\u53f7\u52a0\u5f15\u53f7\u8bed\u6cd5\u662f\u4e00\u79cd<span class=\"application\">psql</span>\u6269\u5c55\u3002</p>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-PROMPTING\">\n<h4 lang=\"zh\">\u63d0\u793a\u7b26</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u53d1\u51fa\u7684\u63d0\u793a\u7b26\u53ef\u4ee5\u6309\u4f60\u7684\u559c\u597d\u8fdb\u884c\u5b9a\u5236\u3002<code class=\"varname\">PROMPT1</code>\u3001<code class=\"varname\">PROMPT2</code> \u548c <code class=\"varname\">PROMPT3</code> \u8fd9\u4e09\u4e2a\u53d8\u91cf\u5305\u542b\u63cf\u8ff0\u63d0\u793a\u7b26\u5916\u89c2\u7684\u5b57\u7b26\u4e32\u548c\u7279\u6b8a\u8f6c\u4e49\u5e8f\u5217\u3002\u63d0\u793a\u7b26 1 \u662f <span class=\"application\">psql</span> \u8bf7\u6c42\u65b0\u547d\u4ee4\u65f6\u53d1\u51fa\u7684\u5e38\u89c4\u63d0\u793a\u7b26\u3002\u63d0\u793a\u7b26 2 \u4f1a\u5728\u5f55\u5165\u547d\u4ee4\u671f\u95f4\u8fd8\u9700\u8981\u66f4\u591a\u8f93\u5165\u65f6\u53d1\u51fa\uff0c\u4f8b\u5982\u547d\u4ee4\u5c1a\u672a\u4ee5\u5206\u53f7\u7ed3\u675f\uff0c\u6216\u8005\u5f15\u53f7\u5c1a\u672a\u95ed\u5408\u65f6\u3002\u5728\u6267\u884c <acronym class=\"acronym\">SQL</acronym> <code class=\"command\">COPY FROM STDIN</code> \u547d\u4ee4\u5e76\u9700\u8981\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4e00\u884c\u503c\u65f6\uff0c\u4f1a\u53d1\u51fa\u63d0\u793a\u7b26 3\u3002</p>\n<p lang=\"zh\">\u9009\u4e2d\u7684\u63d0\u793a\u7b26\u53d8\u91cf\u503c\u4f1a\u6309\u5b57\u9762\u8f93\u51fa\uff0c\u9664\u975e\u9047\u5230\u767e\u5206\u53f7\uff08<code class=\"literal\">%</code>\uff09\u3002\u6839\u636e\u4e0b\u4e00\u4e2a\u5b57\u7b26\u7684\u4e0d\u540c\uff0c\u4f1a\u66ff\u6362\u6210\u67d0\u4e9b\u5176\u4ed6\u6587\u672c\u3002\u5df2\u5b9a\u4e49\u7684\u66ff\u6362\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"literal\">%M</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5b8c\u6574\u4e3b\u673a\u540d\uff08\u542b\u57df\u540d\uff09\uff1b\u5982\u679c\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\uff0c\u5219\u4e3a<code class=\"literal\">[local]</code>\uff1b\u5982\u679c Unix \u57df\u5957\u63a5\u5b57\u4e0d\u5728\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u9ed8\u8ba4\u4f4d\u7f6e\uff0c\u5219\u4e3a<code class=\"literal\">[local:<em class=\"replaceable\"><code>/dir/name</code></em>]</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%m</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\uff0c\u5728\u7b2c\u4e00\u4e2a\u70b9\u53f7\u5904\u622a\u65ad\uff1b\u5982\u679c\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\uff0c\u5219\u4e3a<code class=\"literal\">[local]</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%&gt;</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u76d1\u542c\u7684\u7aef\u53e3\u53f7\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%n</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u4f1a\u8bdd\u7528\u6237\u540d\u3002\uff08\u5728\u6570\u636e\u5e93\u4f1a\u8bdd\u671f\u95f4\uff0c<code class=\"command\">SET SESSION AUTHORIZATION</code>\u547d\u4ee4\u53ef\u80fd\u6539\u53d8\u8be5\u503c\u7684\u6269\u5c55\u7ed3\u679c\u3002\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%/</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%~</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7c7b\u4f3c <code class=\"literal\">%/</code>\uff0c\u4f46\u5982\u679c\u8be5\u6570\u636e\u5e93\u662f\u4f60\u7684\u9ed8\u8ba4\u6570\u636e\u5e93\uff0c\u5219\u8f93\u51fa <code class=\"literal\">~</code>\uff08\u6ce2\u6d6a\u53f7\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%#</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u4f1a\u8bdd\u7528\u6237\u662f\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\uff0c\u5219\u4e3a<code class=\"literal\">#</code>\uff0c\u5426\u5219\u4e3a<code class=\"literal\">&gt;</code>\u3002\uff08\u5728\u6570\u636e\u5e93\u4f1a\u8bdd\u671f\u95f4\uff0c<code class=\"command\">SET SESSION AUTHORIZATION</code>\u547d\u4ee4\u53ef\u80fd\u6539\u53d8\u8be5\u503c\u7684\u6269\u5c55\u7ed3\u679c\u3002\uff09</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%p</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u6240\u8fde\u63a5\u540e\u7aef\u7684\u8fdb\u7a0b ID\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%R</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5728\u63d0\u793a\u7b26 1 \u4e2d\uff0c\u901a\u5e38\u663e\u793a =\uff1b\u4f46\u5982\u679c\u4f1a\u8bdd\u5904\u4e8e\u6761\u4ef6\u5757\u4e2d\u672a\u6fc0\u6d3b\u7684\u5206\u652f\uff0c\u5219\u663e\u793a @\uff1b\u5982\u679c\u5904\u4e8e\u5355\u884c\u6a21\u5f0f\uff0c\u5219\u663e\u793a ^\uff1b\u5982\u679c\u4f1a\u8bdd\u5df2\u65ad\u5f00\u6570\u636e\u5e93\u8fde\u63a5\uff08\u4f8b\u5982 \\connect \u5931\u8d25\u65f6\uff09\uff0c\u5219\u663e\u793a !\u3002\u5728\u63d0\u793a\u7b26 2 \u4e2d\uff0c%R \u4f1a\u66ff\u6362\u4e3a\u8868\u793a psql \u7b49\u5f85\u66f4\u591a\u8f93\u5165\u539f\u56e0\u7684\u5b57\u7b26\uff1a\u547d\u4ee4\u5c1a\u672a\u7ed3\u675f\u65f6\u4e3a -\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684 /* ... */ \u6ce8\u91ca\u65f6\u4e3a *\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u5e26\u5f15\u53f7\u5b57\u7b26\u4e32\u65f6\u4e3a\u5355\u5f15\u53f7\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u5e26\u5f15\u53f7\u6807\u8bc6\u7b26\u65f6\u4e3a\u53cc\u5f15\u53f7\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u7f8e\u5143\u5f15\u7528\u5b57\u7b26\u4e32\u65f6\u4e3a\u7f8e\u5143\u7b26\u53f7\uff1b\u5b58\u5728\u672a\u5339\u914d\u7684\u5de6\u62ec\u53f7\u65f6\u4e3a (\u3002\u5728\u63d0\u793a\u7b26 3 \u4e2d\uff0c%R \u4e0d\u4ea7\u751f\u4efb\u4f55\u5185\u5bb9\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%x</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u72b6\u6001\uff1a\u5982\u679c\u5f53\u524d\u4e0d\u5728\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff1b\u5982\u679c\u5904\u4e8e\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a <code class=\"literal\">*</code>\uff1b\u5982\u679c\u5904\u4e8e\u5931\u8d25\u7684\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a <code class=\"literal\">!</code>\uff1b\u5982\u679c\u4e8b\u52a1\u72b6\u6001\u4e0d\u786e\u5b9a\uff08\u4f8b\u5982\u56e0\u4e3a\u5f53\u524d\u6ca1\u6709\u8fde\u63a5\uff09\uff0c\u5219\u4e3a <code class=\"literal\">?</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%l</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8bed\u53e5\u4e2d\u7684\u884c\u53f7\uff0c\u4ece <code class=\"literal\">1</code> \u5f00\u59cb\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%</code><em class=\"replaceable\"><code>digits</code></em></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u66ff\u6362\u4e3a\u6307\u5b9a\u516b\u8fdb\u5236\u4ee3\u7801\u5bf9\u5e94\u7684\u5b57\u7b26\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%:</code><em class=\"replaceable\"><code>name</code></em><code class=\"literal\">:</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><span class=\"application\">psql</span> \u53d8\u91cf <em class=\"replaceable\"><code>name</code></em> \u7684\u503c\u3002\u8be6\u89c1\u4e0a\u9762\u7684<a class=\"xref\" href=\"/docs/15/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%`</code><em class=\"replaceable\"><code>command</code></em><code class=\"literal\">`</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><em class=\"replaceable\"><code>command</code></em> \u7684\u8f93\u51fa\uff0c\u7c7b\u4f3c\u666e\u901a\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u53cd\u5f15\u53f7</span>\u201d</span>\u66ff\u6362\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%[</code> ... <code class=\"literal\">%]</code></span></dt>\n<dd>\n<p lang=\"zh\">\u63d0\u793a\u7b26\u4e2d\u53ef\u4ee5\u5305\u542b\u7ec8\u7aef\u63a7\u5236\u5b57\u7b26\uff0c\u4f8b\u5982\u6539\u53d8\u63d0\u793a\u6587\u672c\u7684\u989c\u8272\u3001\u80cc\u666f\u6216\u6837\u5f0f\uff0c\u6216\u8005\u6539\u53d8\u7ec8\u7aef\u7a97\u53e3\u6807\u9898\u3002\u4e3a\u4e86\u8ba9 <span class=\"application\">Readline</span> \u7684\u884c\u7f16\u8f91\u529f\u80fd\u6b63\u5e38\u5de5\u4f5c\uff0c\u8fd9\u4e9b\u4e0d\u53ef\u6253\u5370\u7684\u63a7\u5236\u5b57\u7b26\u5fc5\u987b\u7528 <code class=\"literal\">%[</code> \u548c <code class=\"literal\">%]</code> \u5305\u56f4\u8d77\u6765\uff0c\u4ee5\u6807\u8bb0\u4e3a\u4e0d\u53ef\u89c1\u5b57\u7b26\u3002\u63d0\u793a\u7b26\u4e2d\u53ef\u4ee5\u51fa\u73b0\u591a\u7ec4\u8fd9\u6837\u7684\u6807\u8bb0\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; \\set PROMPT1 '%[%033[1;33;40m%]%n@%/%R%[%033[0m%]%# '\n</pre>\n<p lang=\"zh\">\u5176\u6548\u679c\u662f\u5728\u517c\u5bb9 VT100 \u4e14\u652f\u6301\u989c\u8272\u7684\u7ec8\u7aef\u4e0a\uff0c\u751f\u6210\u4e00\u4e2a\u7c97\u4f53\uff08<code class=\"literal\">1;</code>\uff09\u7684\u9ed1\u5e95\u9ec4\u5b57\u63d0\u793a\u7b26\uff08<code class=\"literal\">33;40</code>\uff09\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"literal\">%w</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0e\u6700\u8fd1\u4e00\u6b21\u8f93\u51fa\u7684 <code class=\"varname\">PROMPT1</code> \u5177\u6709\u76f8\u540c\u5bbd\u5ea6\u7684\u7a7a\u767d\u3002\u8fd9\u53ef\u7528\u4f5c <code class=\"varname\">PROMPT2</code> \u7684\u8bbe\u7f6e\uff0c\u4f7f\u591a\u884c\u8bed\u53e5\u4e0e\u7b2c\u4e00\u884c\u5bf9\u9f50\uff0c\u4f46\u4e0d\u663e\u793a\u53ef\u89c1\u7684\u4e8c\u7ea7\u63d0\u793a\u7b26\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8981\u5728\u63d0\u793a\u7b26\u4e2d\u63d2\u5165\u767e\u5206\u53f7\uff0c\u8bf7\u5199 %%\u3002\u63d0\u793a\u7b26 1 \u548c 2 \u7684\u9ed8\u8ba4\u503c\u4e3a '%/%R%x%# '\uff0c\u63d0\u793a\u7b26 3 \u7684\u9ed8\u8ba4\u503c\u4e3a '&gt;&gt; '\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">tcsh</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-READLINE\">\n<h4 lang=\"zh\">\u547d\u4ee4\u884c\u7f16\u8f91</h4>\n<p lang=\"zh\">\u5982\u679c\u53ef\u7528\uff0c<span class=\"application\">psql</span> \u4f1a\u4f7f\u7528<span class=\"application\">Readline</span>\u6216<span class=\"application\">libedit</span>\u5e93\uff0c\u4ee5\u4fbf\u8fdb\u884c\u4fbf\u6377\u7684\u884c\u7f16\u8f91\u548c\u5386\u53f2\u68c0\u7d22\u3002\u5f53<span class=\"application\">psql</span>\u9000\u51fa\u65f6\uff0c\u547d\u4ee4\u5386\u53f2\u4f1a\u81ea\u52a8\u4fdd\u5b58\uff1b\u5f53<span class=\"application\">psql</span>\u542f\u52a8\u65f6\uff0c\u53c8\u4f1a\u91cd\u65b0\u8f7d\u5165\u3002\u8f93\u5165\u4e0a\u7bad\u5934\u6216 control-P \u53ef\u4ee5\u53d6\u56de\u4e4b\u524d\u7684\u884c\u3002</p>\n<p lang=\"zh\">\u5728\u8bb8\u591a\uff08\u7edd\u975e\u5168\u90e8\uff09\u4e0a\u4e0b\u6587\u4e2d\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528 TAB \u8865\u5168\u90e8\u5206\u8f93\u5165\u7684\u5173\u952e\u5b57\u548c SQL \u5bf9\u8c61\u540d\u3002\u4f8b\u5982\uff0c\u5728\u547d\u4ee4\u5f00\u5934\u8f93\u5165<code class=\"literal\">ins</code>\u5e76\u6309\u4e0b TAB \u952e\uff0c\u4f1a\u8865\u5168\u4e3a<code class=\"literal\">insert into</code> \u3002\u7136\u540e\u8f93\u5165\u8868\u540d\u6216\u6a21\u5f0f\u540d\u7684\u51e0\u4e2a\u5b57\u7b26\uff0c\u518d\u6309\u4e0b<code class=\"literal\">TAB</code>\u952e\uff0c\u5c31\u4f1a\u8865\u5168\u5c1a\u672a\u8f93\u5b8c\u7684\u540d\u79f0\uff1b\u5982\u679c\u6709\u591a\u4e2a\u5019\u9009\u9879\uff0c\u5219\u4f1a\u7ed9\u51fa\u53ef\u80fd\u7684\u8865\u5168\u83dc\u5355\u3002\uff08\u5177\u4f53\u53d6\u51b3\u4e8e\u6240\u4f7f\u7528\u7684\u5e93\uff0c\u53ef\u80fd\u9700\u8981\u6309\u591a\u6b21<code class=\"literal\">TAB</code>\u952e\u624d\u80fd\u770b\u5230\u83dc\u5355\u3002\uff09</p>\n<p lang=\"zh\">\u5bf9 SQL \u5bf9\u8c61\u540d\u8fdb\u884c TAB \u8865\u5168\u65f6\uff0c\u9700\u8981\u5411\u670d\u52a1\u5668\u53d1\u9001\u67e5\u8be2\u6765\u67e5\u627e\u53ef\u80fd\u7684\u5339\u914d\u9879\u3002\u5728\u67d0\u4e9b\u4e0a\u4e0b\u6587\u4e2d\uff0c\u8fd9\u53ef\u80fd\u4f1a\u5e72\u6270\u5176\u4ed6\u64cd\u4f5c\u3002\u4f8b\u5982\uff0c\u5728<code class=\"command\">BEGIN</code>\u4e4b\u540e\uff0c\u5982\u679c\u4e2d\u95f4\u53d1\u51fa\u4e86\u4e00\u6b21 TAB \u8865\u5168\u67e5\u8be2\uff0c\u90a3\u4e48\u518d\u53d1\u51fa<code class=\"command\">SET TRANSACTION ISOLATION LEVEL</code>\u5c31\u4e3a\u65f6\u5df2\u665a\u4e86\u3002\u5982\u679c\u6839\u672c\u4e0d\u60f3\u4f7f\u7528 TAB \u8865\u5168\uff0c\u53ef\u4ee5\u628a\u4e0b\u9762\u7684\u5185\u5bb9\u653e\u5230\u4e3b\u76ee\u5f55\u4e2d\u540d\u4e3a<code class=\"filename\">.inputrc</code>\u7684\u6587\u4ef6\u91cc\uff0c\u4ece\u800c\u6c38\u4e45\u5173\u95ed\u5b83\uff1a</p>\n<pre class=\"programlisting\">$if psql\nset disable-completion on\n$endif\n</pre>\n<p lang=\"zh\">\uff08\u8fd9\u4e0d\u662f<span class=\"application\">psql</span>\u800c\u662f\u4e00\u4e2a<span class=\"application\">Readline</span>\u529f\u80fd\u3002\u9605\u8bfb\u5176\u6587\u6863\u4ee5\u83b7\u53d6\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\u3002\uff09</p>\n<p lang=\"zh\"><code class=\"option\">-n</code>\uff08<code class=\"option\">--no-readline</code>\uff09\u547d\u4ee4\u884c\u9009\u9879\u4e5f\u53ef\u7528\u4e8e\u5728\u5355\u6b21\u8fd0\u884c<span class=\"application\">psql</span>\u65f6\u7981\u7528 <span class=\"application\">Readline</span>\u3002\u8fd9\u4f1a\u963b\u6b62TAB \u8865\u5168\u3001\u547d\u4ee4\u884c\u5386\u53f2\u7684\u4f7f\u7528\u6216\u8bb0\u5f55\uff0c\u4ee5\u53ca\u591a\u884c\u547d\u4ee4\u7684\u7f16\u8f91\u3002\u5f53\u4f60\u9700\u8981\u590d\u5236\u7c98\u8d34\u5305\u542b <code class=\"literal\">TAB</code> \u5b57\u7b26\u7684\u6587\u672c\u65f6\uff0c\u5b83\u5c24\u5176\u6709\u7528\u3002</p>\n</div>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PSQL-ENVIRONMENT\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt><span class=\"term\"><code class=\"envar\">COLUMNS</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c<code class=\"literal\">\\pset columns</code>\u4e3a\u96f6\uff0c\u8fd9\u4e2a\u73af\u5883\u53d8\u91cf\u63a7\u5236\u7528\u4e8e<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u5bbd\u5ea6\u4ee5\u53ca\u7528\u6765\u786e\u5b9a\u8f83\u5bbd\u7684\u8f93\u51fa\u662f\u5426\u9700\u8981\u5206\u9875\u5668\uff0c\u6216\u8005\u662f\u5426\u5e94\u5207\u6362\u5230\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e2d\u7684\u5782\u76f4\u683c\u5f0f\u7684\u5bbd\u5ea6\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PGDATABASE</code><br/></span><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\uff08\u89c1<a class=\"xref\" href=\"/docs/15/libpq-envars.html\" title=\"34.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a034.15\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PSQL_EDITOR</code><br/></span><span class=\"term\"><code class=\"envar\">EDITOR</code><br/></span><span class=\"term\"><code class=\"envar\">VISUAL</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"command\">\\e</code>\u3001<code class=\"command\">\\ef</code>\u4ee5\u53ca<code class=\"command\">\\ev</code>\u547d\u4ee4\u6240\u4f7f\u7528\u7684\u7f16\u8f91\u5668\u3002\u4f1a\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u68c0\u67e5\u8fd9\u4e9b\u53d8\u91cf\uff0c\u7b2c\u4e00\u4e2a\u88ab\u8bbe\u7f6e\u7684\u5c06\u88ab\u4f7f\u7528\u3002\u5982\u679c\u90fd\u6ca1\u6709\u88ab\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u662f\u4f7f\u7528Unix\u7cfb\u7edf\u4e0a\u7684<code class=\"filename\">vi</code>\u6216\u8005Windows\u7cfb\u7edf\u4e0a\u7684<code class=\"filename\">notepad.exe</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PSQL_EDITOR_LINENUMBER_ARG</code></span></dt>\n<dd>\n<p lang=\"zh\">\u5f53 <code class=\"command\">\\e</code>\u3001<code class=\"command\">\\ef</code> \u6216 <code class=\"command\">\\ev</code> \u5e26\u6709\u884c\u53f7\u53c2\u6570\u4f7f\u7528\u65f6\uff0c\u6b64\u53d8\u91cf\u6307\u5b9a\u5c06\u8d77\u59cb\u884c\u53f7\u4f20\u7ed9\u7528\u6237\u7f16\u8f91\u5668\u65f6\u6240\u7528\u7684\u547d\u4ee4\u884c\u53c2\u6570\u3002\u5bf9\u4e8e <span class=\"productname\">Emacs</span> \u6216 <span class=\"productname\">vi</span> \u4e4b\u7c7b\u7684\u7f16\u8f91\u5668\uff0c\u8fd9\u4e2a\u53c2\u6570\u662f\u4e00\u4e2a\u52a0\u53f7\u3002\u5982\u679c\u9009\u9879\u540d\u548c\u884c\u53f7\u4e4b\u95f4\u9700\u8981\u7a7a\u683c\uff0c\u8bf7\u5728\u53d8\u91cf\u503c\u4e2d\u5305\u542b\u672b\u5c3e\u7a7a\u683c\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">PSQL_EDITOR_LINENUMBER_ARG='+'\nPSQL_EDITOR_LINENUMBER_ARG='--line '\n</pre>\n<p lang=\"zh\">\u5728 Unix \u7cfb\u7edf\u4e0a\u9ed8\u8ba4\u662f<code class=\"literal\">+</code>\uff08\u5bf9\u5e94\u4e8e\u9ed8\u8ba4\u7f16\u8f91\u5668<code class=\"filename\">vi</code>\uff0c\u4e14\u5bf9\u5f88\u591a\u5176\u4ed6\u5e38\u89c1\u7f16\u8f91\u5668\u53ef\u7528\uff09\u3002\u5728 Windows \u7cfb\u7edf\u4e0a\u6ca1\u6709\u9ed8\u8ba4\u503c\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PSQL_HISTORY</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u547d\u4ee4\u5386\u53f2\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08<code class=\"literal\">~</code>\uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PSQL_PAGER</code><br/></span><span class=\"term\"><code class=\"envar\">PAGER</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u67e5\u8be2\u7ed3\u679c\u65e0\u6cd5\u5728\u5c4f\u5e55\u4e0a\u663e\u793a\u5b8c\u6574\uff0c\u5b83\u4eec\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6b64\u547d\u4ee4\u3002\u5178\u578b\u7684\u503c\u662f<code class=\"literal\">more</code>\u6216<code class=\"literal\">less</code>\u3002\u53ef\u4ee5\u901a\u8fc7\u5c06<code class=\"envar\">PSQL_PAGER</code>\u6216<code class=\"envar\">PAGER</code>\u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u6216\u901a\u8fc7\u8c03\u6574<code class=\"command\">\\pset</code>\u547d\u4ee4\u7684\u4e0e\u5206\u9875\u76f8\u5173\u7684\u9009\u9879\u6765\u7981\u7528\u5206\u9875\u5668\u3002\u8fd9\u4e9b\u53d8\u91cf\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u8fdb\u884c\u68c0\u67e5\uff1b\u4f7f\u7528\u6309\u8be5\u987a\u5e8f\u627e\u5230\u7684\u7b2c\u4e00\u4e2a\u5df2\u8bbe\u7f6e\u7684\u53d8\u91cf\u3002\u5982\u679c\u5b83\u4eec\u90fd\u6ca1\u6709\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5728\u5927\u591a\u6570\u5e73\u53f0\u4e0a\u4f7f\u7528<code class=\"literal\">more</code>\uff0c\u4f46\u5728Cygwin\u4e0a\u4f7f\u7528<code class=\"literal\">less</code>\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PSQL_WATCH_PAGER</code></span></dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528 \\watch \u547d\u4ee4\u53cd\u590d\u6267\u884c\u67e5\u8be2\u65f6\uff0c\u9ed8\u8ba4\u4e0d\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\u3002\u5728 Unix \u7cfb\u7edf\u4e0a\uff0c\u53ef\u4ee5\u5c06 PSQL_WATCH_PAGER \u8bbe\u4e3a\u5206\u9875\u7a0b\u5e8f\u547d\u4ee4\u6765\u6539\u53d8\u6b64\u884c\u4e3a\u3002pspg \u5206\u9875\u7a0b\u5e8f\uff08\u4e0d\u5c5e\u4e8e PostgreSQL\uff0c\u4f46\u8bb8\u591a\u5f00\u6e90\u8f6f\u4ef6\u53d1\u884c\u7248\u90fd\u63d0\u4f9b\u5b83\uff09\u4ee5 --stream \u9009\u9879\u542f\u52a8\u65f6\uff0c\u53ef\u4ee5\u663e\u793a \\watch \u7684\u8f93\u51fa\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">PSQLRC</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7528\u6237\u7684<code class=\"filename\">.psqlrc</code>\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08<code class=\"literal\">~</code>\uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">SHELL</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u88ab<code class=\"command\">\\!</code>\u547d\u4ee4\u6267\u884c\u7684\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt><span class=\"term\"><code class=\"envar\">TMPDIR</code></span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b58\u50a8\u4e34\u65f6\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u662f<code class=\"filename\">/tmp</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6 <span class=\"productname\">PostgreSQL</span> \u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528 <span class=\"application\">libpq</span> \u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/15/libpq-envars.html\" title=\"34.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a034.15\u00a0\u8282</a>\uff09\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.20.10\">\n<h2 lang=\"zh\">\u6587\u4ef6</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt lang=\"zh\"><span class=\"term\"><code class=\"filename\">psqlrc</code> \u548c <code class=\"filename\">~/.psqlrc</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u6ca1\u6709<code class=\"option\">-X</code>\u9009\u9879\uff0c\u5728\u8fde\u63a5\u5230\u6570\u636e\u5e93\u540e\u4f46\u5728\u63a5\u6536\u6b63\u5e38\u7684\u547d\u4ee4\u4e4b\u524d\uff0c<span class=\"application\">psql</span>\u4f1a\u5c1d\u8bd5\u4f9d\u6b21\u4ece\u7cfb\u7edf\u7ea7\u7684\u542f\u52a8\u6587\u4ef6\uff08<code class=\"filename\">psqlrc</code>\uff09\u548c\u7528\u6237\u7684\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\uff08<code class=\"filename\">~/.psqlrc</code>\uff09\u4e2d\u8bfb\u53d6\u5e76\u4e14\u6267\u884c\u547d\u4ee4\u3002\u8fd9\u4e9b\u6587\u4ef6\u53ef\u4ee5\u88ab\u7528\u6765\u8bbe\u7f6e\u5ba2\u6237\u7aef\u6216\u8005\u670d\u52a1\u5668\uff0c\u901a\u5e38\u662f\u4e00\u4e9b<code class=\"command\">\\set</code>\u548c<code class=\"command\">SET</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u7cfb\u7edf\u8303\u56f4\u7684\u542f\u52a8\u6587\u4ef6\u540d\u4e3a <code class=\"filename\">psqlrc</code>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4f1a\u5728\u5b89\u88c5\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u7cfb\u7edf\u914d\u7f6e</span>\u201d</span>\u76ee\u5f55\u4e2d\u67e5\u627e\u5b83\uff0c\u6700\u53ef\u9760\u7684\u8bc6\u522b\u65b9\u5f0f\u662f\u8fd0\u884c <code class=\"literal\">pg_config --sysconfdir</code>\u3002\u901a\u5e38\u8fd9\u4e2a\u76ee\u5f55\u662f\u76f8\u5bf9\u4e8e\u5305\u542b <span class=\"productname\">PostgreSQL</span> \u53ef\u6267\u884c\u6587\u4ef6\u7684\u76ee\u5f55\u7684 <code class=\"filename\">../etc/</code>\u3002\u4e5f\u53ef\u4ee5\u901a\u8fc7 <code class=\"envar\">PGSYSCONFDIR</code> \u73af\u5883\u53d8\u91cf\u663e\u5f0f\u6307\u5b9a\u67e5\u627e\u76ee\u5f55\u3002</p>\n<p lang=\"zh\">\u7528\u6237\u7684\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\u540d\u4e3a<code class=\"filename\">.psqlrc</code>\uff0c\u5e76\u4e14\u5728\u8c03\u7528\u7528\u6237\u7684\u4e3b\u76ee\u5f55\u4e2d\u5bfb\u627e\u3002\u5728Windows\u4e0a\uff0c\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\u7684\u540d\u79f0\u6539\u4e3a<code class=\"filename\">%APPDATA%\\postgresql\\psqlrc.conf</code>\u3002\u5728\u4efb\u4f55\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e<code class=\"envar\">PSQLRC</code>\u73af\u5883\u53d8\u91cf\u6765\u8986\u76d6\u6b64\u9ed8\u8ba4\u6587\u4ef6\u8def\u5f84\u3002</p>\n<p lang=\"zh\">\u7cfb\u7edf\u8303\u56f4\u7684\u542f\u52a8\u6587\u4ef6\u548c\u7528\u6237\u4e2a\u4eba\u7684\u542f\u52a8\u6587\u4ef6\u90fd\u53ef\u4ee5\u901a\u8fc7\u5728\u6587\u4ef6\u540d\u540e\u9644\u52a0\u8fde\u5b57\u7b26\u548c<span class=\"productname\">PostgreSQL</span>\u7684\u5927\u7248\u672c\u6216\u5c0f\u7248\u672c\u6807\u8bc6\u7b26\u6765\u4f7f\u5176\u4e0e<span class=\"application\">psql</span>\u7248\u672c\u76f8\u5173\uff0c\u4f8b\u5982<code class=\"filename\">~/.psqlrc-15</code>\u6216<code class=\"filename\">~/.psqlrc-15.19</code>\u3002\u6700\u5177\u4f53\u7248\u672c\u5339\u914d\u7684\u6587\u4ef6\u5c06\u4f18\u5148\u8bfb\u53d6\uff0c\u800c\u4e0d\u662f\u975e\u7279\u5b9a\u7248\u672c\u7684\u6587\u4ef6\u3002\u8fd9\u4e9b\u7248\u672c\u540e\u7f00\u662f\u5728\u786e\u5b9a\u6587\u4ef6\u8def\u5f84\u540e\u6dfb\u52a0\u7684\uff0c\u5982\u4e0a\u6240\u8ff0\u3002</p>\n</dd>\n<dt><span class=\"term\"><code class=\"filename\">.psql_history</code></span></dt>\n<dd>\n<p lang=\"zh\">\u547d\u4ee4\u884c\u5386\u53f2\u88ab\u5b58\u50a8\u5728\u6587\u4ef6<code class=\"filename\">~/.psql_history</code>\u4e2d\uff0c\u5728 Windows \u4e0a\u5219\u5b58\u50a8\u5728\u6587\u4ef6<code class=\"filename\">%APPDATA%\\postgresql\\psql_history</code>\u4e2d\u3002</p>\n<p lang=\"zh\">\u5386\u53f2\u6587\u4ef6\u7684\u4f4d\u7f6e\u53ef\u4ee5\u901a\u8fc7<code class=\"varname\">HISTFILE</code> <span class=\"application\">psql</span>\u53d8\u91cf\u6216\u8005<code class=\"envar\">PSQL_HISTORY</code>\u73af\u5883\u53d8\u91cf\u663e\u5f0f\u8bbe\u7f6e\u3002</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.20.11\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">psql</span>\u6700\u9002\u5408\u4e0e\u76f8\u540c\u6216\u8f83\u65e7\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\u914d\u5408\u4f7f\u7528\u3002\u5982\u679c\u670d\u52a1\u5668\u7684\u7248\u672c\u6bd4<span class=\"application\">psql</span>\u672c\u8eab\u66f4\u65b0\uff0c\u53cd\u659c\u7ebf\u547d\u4ee4\u7279\u522b\u5bb9\u6613\u5931\u8d25\u3002\u7136\u800c\uff0c<code class=\"literal\">\\d</code>\u7cfb\u5217\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u5e94\u8be5\u53ef\u4ee5\u5728\u6700\u4f4e\u81f3 9.2 \u7248\u672c\u7684\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\uff0c\u4f46\u4e0d\u4e00\u5b9a\u9002\u7528\u4e8e\u6bd4<span class=\"application\">psql</span>\u672c\u8eab\u66f4\u65b0\u7684\u670d\u52a1\u5668\u3002\u8fd0\u884cSQL\u547d\u4ee4\u548c\u663e\u793a\u67e5\u8be2\u7ed3\u679c\u7684\u4e00\u822c\u529f\u80fd\u4e5f\u5e94\u8be5\u53ef\u4ee5\u5728\u66f4\u65b0\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\uff0c\u4f46\u4e0d\u80fd\u4fdd\u8bc1\u5728\u6240\u6709\u60c5\u51b5\u4e0b\u90fd\u80fd\u5b9e\u73b0\u3002</p>\n<p>\u5982\u679c\u4f60\u60f3\u7528<span class=\"application\">psql</span>\u8fde\u63a5\u5230\u591a\u4e2a\u5177\u6709\u4e0d\u540c\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\uff0c\u63a8\u8350\u4f7f\u7528\u6700\u65b0\u7248\u672c\u7684<span class=\"application\">psql</span>\u3002\u6216\u8005\uff0c\u4f60\u53ef\u4ee5\u4e3a\u6bcf\u4e00\u4e2a\u5927\u7248\u672c\u4fdd\u7559\u4e00\u4efd<span class=\"application\">psql</span>\u62f7\u8d1d\uff0c\u5e76\u4e14\u9488\u5bf9\u76f8\u5e94\u7684\u670d\u52a1\u5668\u4f7f\u7528\u5339\u914d\u7684\u7248\u672c\u3002\u4f46\u5b9e\u9645\u4e0a\uff0c\u8fd9\u79cd\u989d\u5916\u7684\u9ebb\u70e6\u662f\u4e0d\u5fc5\u8981\u7684\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5728 <span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\uff0c<code class=\"option\">-c</code> \u9009\u9879\u610f\u5473\u7740 <code class=\"option\">-X</code>\uff08<code class=\"option\">--no-psqlrc</code>\uff09\uff1b\u73b0\u5728\u5df2\u7ecf\u4e0d\u662f\u8fd9\u6837\u4e86\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5728<span class=\"productname\">PostgreSQL</span> 8.4 \u4e4b\u524d\uff0c<span class=\"application\">psql</span>\u5141\u8bb8\u4e00\u4e2a\u5355\u5b57\u6bcd\u53cd\u659c\u7ebf\u547d\u4ee4\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u76f4\u63a5\u5199\u5728\u8be5\u547d\u4ee4\u540e\u9762\uff0c\u4e2d\u95f4\u4e0d\u9700\u8981\u7a7a\u767d\u3002\u73b0\u5728\u5219\u8981\u6c42\u7528\u7a7a\u767d\u5206\u9694\u3002</p>\n</li>\n</ul>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.20.12\">\n<h2 lang=\"zh\">\u7ed9 Windows \u7528\u6237\u7684\u6ce8\u89e3</h2>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u662f\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u63a7\u5236\u53f0\u5e94\u7528</span>\u201d</span>\u3002\u7531\u4e8e Windows \u7684\u63a7\u5236\u53f0\u7a97\u53e3\u4f7f\u7528\u7684\u662f\u4e00\u79cd\u548c\u7cfb\u7edf\u4e2d\u5176\u4ed6\u5e94\u7528\u4e0d\u540c\u7684\u7f16\u7801\uff0c\u5728<span class=\"application\">psql</span>\u4e2d\u4f7f\u7528 8 \u4f4d\u5b57\u7b26\u65f6\u8981\u7279\u522b\u6ce8\u610f\u3002\u5982\u679c<span class=\"application\">psql</span>\u68c0\u6d4b\u5230\u4e00\u4e2a\u6709\u95ee\u9898\u7684\u63a7\u5236\u53f0\u4ee3\u7801\u9875\uff0c\u5b83\u5c06\u4f1a\u5728\u542f\u52a8\u65f6\u8b66\u544a\u4f60\u3002\u8981\u66f4\u6539\u63a7\u5236\u53f0\u4ee3\u7801\u9875\uff0c\u6709\u4e24\u4ef6\u4e8b\u662f\u5fc5\u8981\u7684\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u8f93\u5165<strong class=\"userinput\"><code>cmd.exe /c chcp 1252</code></strong>\u53ef\u4ee5\u8bbe\u7f6e\u4ee3\u7801\u9875\uff081252 \u662f\u9002\u7528\u4e8e\u5fb7\u8bed\u7684\u4e00\u4e2a\u4ee3\u7801\u9875\uff0c\u8bf7\u5728\u8fd9\u91cc\u66ff\u6362\u6210\u4f60\u7684\u503c\uff09\u3002\u5982\u679c\u6b63\u5728\u4f7f\u7528 Cygwin\uff0c\u53ef\u4ee5\u628a\u8fd9\u4e2a\u547d\u4ee4\u653e\u5728<code class=\"filename\">/etc/profile</code>\u4e2d\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u628a\u63a7\u5236\u53f0\u5b57\u4f53\u8bbe\u7f6e\u4e3a<code class=\"literal\">Lucida Console</code>\uff0c\u56e0\u4e3a\u6805\u683c\u5b57\u4f53\u65e0\u6cd5\u4e0e ANSI \u4ee3\u7801\u9875\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</li>\n</ul>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PSQL-EXAMPLES\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u7b2c\u4e00\u4e2a\u793a\u4f8b\u5c55\u793a\u4e86\u5982\u4f55\u628a\u4e00\u6761\u547d\u4ee4\u5206\u6563\u5230\u591a\u884c\u8f93\u5165\u4e2d\u3002\u6ce8\u610f\u63d0\u793a\u7b26\u7684\u53d8\u5316\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>CREATE TABLE my_table (</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code> first integer not null default 0,</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code> second text)</code></strong>\ntestdb-&gt; <strong class=\"userinput\"><code>;</code></strong>\nCREATE TABLE\n</pre>\n<p lang=\"zh\">\u73b0\u5728\u518d\u6765\u770b\u4e00\u4e0b\u8fd9\u4e2a\u8868\u7684\u5b9a\u4e49\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\d my_table</code></strong>\n              Table \"public.my_table\"\n Column |  Type   | Collation | Nullable | Default\n--------+---------+-----------+----------+---------\n first  | integer |           | not null | 0\n second | text    |           |          |\n</pre>\n<p lang=\"zh\">\u73b0\u5728\u6211\u4eec\u628a\u63d0\u793a\u7b26\u6539\u6210\u66f4\u6709\u8da3\u7684\u5f62\u5f0f\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set PROMPT1 '%n@%m %~%R%# '</code></strong>\npeter@localhost testdb=&gt;\n</pre>\n<p lang=\"zh\">\u5047\u8bbe\u4f60\u5df2\u7ecf\u5411\u8868\u4e2d\u586b\u5165\u6570\u636e\uff0c\u5e76\u60f3\u770b\u4e00\u770b\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; SELECT * FROM my_table;\n first | second\n-------+--------\n     1 | one\n     2 | two\n     3 | three\n     4 | four\n(4 rows)\n</pre>\n<p lang=\"zh\">\u4f60\u53ef\u4ee5\u4f7f\u7528 <code class=\"command\">\\pset</code> \u547d\u4ee4\u4ee5\u4e0d\u540c\u65b9\u5f0f\u663e\u793a\u8868\u683c\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 2</code></strong>\nBorder style is 2.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\n+-------+--------+\n| first | second |\n+-------+--------+\n|     1 | one    |\n|     2 | two    |\n|     3 | three  |\n|     4 | four   |\n+-------+--------+\n(4 rows)\n\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 0</code></strong>\nBorder style is 0.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\nfirst second\n----- ------\n    1 one\n    2 two\n    3 three\n    4 four\n(4 rows)\n\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 1</code></strong>\nBorder style is 1.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset format csv</code></strong>\nOutput format is csv.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset tuples_only</code></strong>\nTuples only is on.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT second, first FROM my_table;</code></strong>\none,1\ntwo,2\nthree,3\nfour,4\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset format unaligned</code></strong>\nOutput format is unaligned.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset fieldsep '\\t'</code></strong>\nField separator is \"    \".\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT second, first FROM my_table;</code></strong>\none     1\ntwo     2\nthree   3\nfour    4\n</pre>\n<p lang=\"zh\">\u6216\u8005\u4f7f\u7528\u77ed\u547d\u4ee4\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\a \\t \\x</code></strong>\nOutput format is aligned.\nTuples only is off.\nExpanded display is on.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\n-[ RECORD 1 ]-\nfirst  | 1\nsecond | one\n-[ RECORD 2 ]-\nfirst  | 2\nsecond | two\n-[ RECORD 3 ]-\nfirst  | 3\nsecond | three\n-[ RECORD 4 ]-\nfirst  | 4\nsecond | four\n</pre>\n<p lang=\"zh\">\u6b64\u5916\uff0c\u53ef\u4ee5\u4f7f\u7528<code class=\"literal\">\\g</code>\u4e3a\u4e00\u4e2a\u67e5\u8be2\u8bbe\u7f6e\u8fd9\u4e9b\u8f93\u51fa\u683c\u5f0f\u9009\u9879\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table</code></strong>\npeter@localhost testdb-&gt; <strong class=\"userinput\"><code>\\g (format=aligned tuples_only=off expanded=on)</code></strong>\n-[ RECORD 1 ]-\nfirst  | 1\nsecond | one\n-[ RECORD 2 ]-\nfirst  | 2\nsecond | two\n-[ RECORD 3 ]-\nfirst  | 3\nsecond | three\n-[ RECORD 4 ]-\nfirst  | 4\nsecond | four\n</pre>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4e00\u4e2a\u4f7f\u7528 <code class=\"command\">\\df</code> \u547d\u4ee4\u53ea\u67e5\u627e\u540d\u79f0\u5339\u914d <code class=\"literal\">int*pl</code> \u4e14\u7b2c\u4e8c\u4e2a\u53c2\u6570\u7c7b\u578b\u4e3a <code class=\"type\">bigint</code> \u7684\u51fd\u6570\u7684\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\df int*pl * bigint</code></strong>\n                          List of functions\n   Schema   |  Name   | Result data type | Argument data types | Type\n------------+---------+------------------+---------------------+------\n pg_catalog | int28pl | bigint           | smallint, bigint    | func\n pg_catalog | int48pl | bigint           | integer, bigint     | func\n pg_catalog | int8pl  | bigint           | bigint, bigint      | func\n(3 rows)\n</pre>\n<p lang=\"zh\">\u5728\u9002\u5408\u7684\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u4f7f\u7528 <code class=\"command\">\\crosstabview</code> \u547d\u4ee4\u5c06\u67e5\u8be2\u7ed3\u679c\u663e\u793a\u4e3a\u4ea4\u53c9\u8868\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>SELECT first, second, first &gt; 2 AS gt2 FROM my_table;</code></strong>\n first | second | gt2\n-------+--------+-----\n     1 | one    | f\n     2 | two    | f\n     3 | three  | t\n     4 | four   | t\n(4 rows)\n\ntestdb=&gt; <strong class=\"userinput\"><code>\\crosstabview first second</code></strong>\n first | one | two | three | four\n-------+-----+-----+-------+------\n     1 | f   |     |       |\n     2 |     | f   |       |\n     3 |     |     | t     |\n     4 |     |     |       | t\n(4 rows)\n</pre>\n<p lang=\"zh\">\u7b2c\u4e8c\u4e2a\u793a\u4f8b\u5c55\u793a\u4e86\u4e00\u4e2a\u4e58\u6cd5\u8868\uff0c\u5176\u4e2d\u884c\u6309\u6570\u5b57\u5012\u5e8f\u6392\u5217\uff0c\u800c\u5217\u6309\u72ec\u7acb\u7684\u5347\u5e8f\u6570\u5b57\u6392\u5217\u3002</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>SELECT t1.first as \"A\", t2.first+100 AS \"B\", t1.first*(t2.first+100) as \"AxB\",</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code>row_number() over(order by t2.first) AS ord</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code>FROM my_table t1 CROSS JOIN my_table t2 ORDER BY 1 DESC</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code>\\crosstabview \"A\" \"B\" \"AxB\" ord</code></strong>\n A | 101 | 102 | 103 | 104\n---+-----+-----+-----+-----\n 4 | 404 | 408 | 412 | 416\n 3 | 303 | 306 | 309 | 312\n 2 | 202 | 204 | 206 | 208\n 1 | 101 | 102 | 103 | 104\n(4 rows)\n</pre>\n</div>\n</div></div>", "manual_path": "app-psql.html", "localization": {"status": "complete", "sources": [{"url": "/docs/15/app-psql.html", "method": "same-major semantic node", "sha256": "8d6ed2e3400192f466dca73fd9423e91b9ede916fe0981b7e0cd42bc091394d2", "language": "zh", "matched_nodes": ["#APP-PSQL/div[10]/div[1]/ul[0]/li[0]", "#APP-PSQL/div[10]/div[1]/ul[0]/li[1]", "#APP-PSQL/div[10]/div[1]/ul[0]/li[2]", "#APP-PSQL/div[10]/h2[0]", "#APP-PSQL/div[11]/div[2]/ul[0]/li[0]", "#APP-PSQL/div[11]/div[2]/ul[0]/li[1]", "#APP-PSQL/div[11]/h2[0]", "#APP-PSQL/div[11]/p[1]", "#APP-PSQL/div[12]/p[11]", "#APP-PSQL/div[12]/p[13]", "#APP-PSQL/div[12]/p[15]", "#APP-PSQL/div[12]/p[17]", "#APP-PSQL/div[12]/p[19]", "#APP-PSQL/div[12]/p[1]", "#APP-PSQL/div[12]/p[3]", "#APP-PSQL/div[12]/p[5]", "#APP-PSQL/div[12]/p[7]", "#APP-PSQL/div[12]/p[9]", "#APP-PSQL/div[2]/p[1]", "#APP-PSQL/div[3]/h2[0]", "#APP-PSQL/div[4]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[11]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[13]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[15]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]/p[2]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[19]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[21]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[23]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[25]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[25]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[27]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[29]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[31]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[35]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[37]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[39]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[3]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[41]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]/div[1]/h3[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]/div[1]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[45]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[47]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[49]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[51]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[53]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[55]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[55]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[57]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[57]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[59]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[5]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[61]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[63]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[65]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[67]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[67]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[69]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[3]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[5]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[6]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[7]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[9]", "#APP-PSQL/div[6]/h2[0]", "#APP-PSQL/div[6]/p[1]", "#APP-PSQL/div[7]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[1]/p[1]", "#APP-PSQL/div[7]/div[1]/p[2]", "#APP-PSQL/div[7]/div[1]/p[5]", "#APP-PSQL/div[7]/div[1]/p[6]", "#APP-PSQL/div[7]/div[1]/p[7]", "#APP-PSQL/div[7]/div[2]/h3[0]", "#APP-PSQL/div[7]/div[2]/p[1]", "#APP-PSQL/div[7]/div[2]/p[3]", "#APP-PSQL/div[7]/div[2]/p[4]", "#APP-PSQL/div[7]/div[2]/p[5]", "#APP-PSQL/div[7]/div[2]/p[6]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[101]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[101]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[101]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[101]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[103]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[105]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[107]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[107]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[107]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[107]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[109]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[111]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[111]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[111]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[111]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[111]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[113]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[113]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[115]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[117]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[119]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[119]/p[0]/a[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[119]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[119]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[119]/p[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]/div[5]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[123]/div[2]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[123]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[123]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[125]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[127]/div[2]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[127]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[127]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[129]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[129]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[129]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[129]/p[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[129]/p[6]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[131]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[139]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[141]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[143]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[143]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[143]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[143]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[149]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[149]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dd[15]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dd[15]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dd[15]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dd[15]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dd[17]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dd[17]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dd[17]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dd[17]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dd[21]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dd[23]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dd[23]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dd[29]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dd[31]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dd[31]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dd[37]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dd[41]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dt[30]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dt[32]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dt[34]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[3]/dl[0]/dt[6]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/div[5]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]/p[4]/a[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[153]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[157]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[159]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[15]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[15]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[161]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[163]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[163]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[163]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[163]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[163]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[165]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[167]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[167]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[169]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[169]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[169]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[171]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[173]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[175]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[177]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[177]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[179]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[179]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[0]/a[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[181]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[183]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[185]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[187]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[189]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[189]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[191]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[191]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[193]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[195]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[195]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[195]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[195]/p[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[21]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[23]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[25]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[29]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[31]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[37]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[39]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[39]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[39]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[41]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[43]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[43]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[45]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[47]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[49]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[51]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[51]/div[1]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[51]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[53]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[55]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[57]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[59]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[61]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[63]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[65]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[67]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[69]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[71]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[73]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[75]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[77]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[77]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[79]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[79]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[79]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[7]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[7]/div[1]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[7]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[81]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[81]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[83]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[85]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[87]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[89]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[91]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[93]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[95]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[97]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[97]/div[4]/p[1]/a[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[97]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[97]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[97]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[97]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[99]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[99]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[99]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[122]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[124]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[126]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[130]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[132]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[142]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[144]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[152]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[156]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[180]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[96]", "#APP-PSQL/div[7]/div[3]/div[11]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/p[6]", "#APP-PSQL/div[7]/div[3]/div[11]/p[7]", "#APP-PSQL/div[7]/div[3]/h3[0]", "#APP-PSQL/div[7]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/p[2]", "#APP-PSQL/div[7]/div[3]/p[3]", "#APP-PSQL/div[7]/div[3]/p[4]", "#APP-PSQL/div[7]/div[3]/p[4]/a[2]", "#APP-PSQL/div[7]/div[3]/p[5]", "#APP-PSQL/div[7]/div[3]/p[7]", "#APP-PSQL/div[7]/div[3]/p[8]", "#APP-PSQL/div[7]/div[3]/p[9]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[15]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[17]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/div[2]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[21]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[21]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[23]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[23]/p[2]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[41]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[41]/p[0]/a[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[43]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[47]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[49]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[51]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[53]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[55]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[57]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[59]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[61]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[63]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[4]/div[1]/div[8]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/p[10]", "#APP-PSQL/div[7]/div[4]/div[1]/p[11]", "#APP-PSQL/div[7]/div[4]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/p[2]", "#APP-PSQL/div[7]/div[4]/div[1]/p[4]", "#APP-PSQL/div[7]/div[4]/div[1]/p[6]", "#APP-PSQL/div[7]/div[4]/div[1]/p[7]", "#APP-PSQL/div[7]/div[4]/div[1]/p[9]", "#APP-PSQL/div[7]/div[4]/div[2]/p[10]", "#APP-PSQL/div[7]/div[4]/div[2]/p[11]", "#APP-PSQL/div[7]/div[4]/div[2]/p[12]", "#APP-PSQL/div[7]/div[4]/div[2]/p[1]", "#APP-PSQL/div[7]/div[4]/div[2]/p[3]", "#APP-PSQL/div[7]/div[4]/div[2]/p[4]", "#APP-PSQL/div[7]/div[4]/div[2]/p[6]", "#APP-PSQL/div[7]/div[4]/div[2]/p[7]", "#APP-PSQL/div[7]/div[4]/div[2]/p[9]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[15]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[21]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[23]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[25]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[29]/p[0]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[29]/p[2]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[31]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[4]/div[3]/div[5]/p[1]", "#APP-PSQL/div[7]/div[4]/div[3]/p[1]", "#APP-PSQL/div[7]/div[4]/div[3]/p[2]", "#APP-PSQL/div[7]/div[4]/div[4]/h4[0]", "#APP-PSQL/div[7]/div[4]/div[4]/p[3]", "#APP-PSQL/div[7]/div[4]/div[4]/p[4]", "#APP-PSQL/div[7]/div[4]/div[4]/p[5]", "#APP-PSQL/div[7]/div[4]/div[4]/p[7]", "#APP-PSQL/div[7]/div[4]/div[4]/p[8]", "#APP-PSQL/div[7]/div[4]/h3[0]", "#APP-PSQL/div[7]/h2[0]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[11]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[13]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[17]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[19]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[1]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[21]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[3]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[5]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[7]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]/p[0]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]/p[2]", "#APP-PSQL/div[8]/p[2]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[0]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[1]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[2]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[3]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[3]/p[0]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[3]/p[1]", "#APP-PSQL/div[9]/div[1]/dl[0]/dt[0]", "#APP-PSQL/div[9]/h2[0]"]}, {"url": "/docs/15/indexes-index-only-scans.html", "method": "same-major semantic node", "sha256": "894668c63c72e046117004d4721dffa2e052a30ebac980edede3c45f64b313d9", "language": "zh", "matched_nodes": ["#INDEXES-INDEX-ONLY-SCANS/p[25]/span[2]"]}], "language": "zh", "original_text": {"/versions/15/description/0": "psql \u2014 PostgreSQL interactive terminal", "/versions/15/facts/0/label": "Documented executable", "/versions/15/facts/1/label": "Executable version", "/versions/15/facts/2/label": "Reference inventory", "/versions/15/facts/2/value": "Client applications", "/versions/15/facts/3/label": "Option definition groups", "/versions/15/tables/0/title": "Documented options", "/versions/15/tables/1/title": "Environment variables", "/versions/15/related/0/label": "psql meta-commands", "/versions/15/related/1/label": "libpq connection parameters", "/versions/15/tables/0/rows/0/summary": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all .", "/versions/15/tables/0/rows/1/summary": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned .", "/versions/15/tables/0/rows/2/summary": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors .", "/versions/15/tables/0/rows/3/summary": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence.", "/versions/15/tables/0/rows/4/summary": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv .", "/versions/15/tables/0/rows/5/summary": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "/versions/15/tables/0/rows/6/summary": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries .", "/versions/15/tables/0/rows/7/summary": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on .", "/versions/15/tables/0/rows/8/summary": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i .", "/versions/15/tables/0/rows/9/summary": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f .", "/versions/15/tables/0/columns/0/label": "Option and arguments", "/versions/15/tables/0/columns/1/label": "Description", "/versions/15/tables/0/rows/10/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket.", "/versions/15/tables/0/rows/11/summary": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command.", "/versions/15/tables/0/rows/12/summary": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list .", "/versions/15/tables/0/rows/13/summary": "Write all query output into file filename , in addition to the normal output destination.", "/versions/15/tables/0/rows/14/summary": "Do not use Readline for line editing and do not use the command history (see the section called \u201cCommand-Line Editing\u201d below).", "/versions/15/tables/0/rows/15/summary": "Put all query output into file filename . This is equivalent to the command \\o .", "/versions/15/tables/0/rows/16/summary": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432.", "/versions/15/tables/0/rows/17/summary": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex .", "/versions/15/tables/0/rows/18/summary": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on .", "/versions/15/tables/0/rows/19/summary": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep .", "/versions/15/tables/0/rows/20/summary": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts.", "/versions/15/tables/0/rows/21/summary": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does.", "/versions/15/tables/0/rows/22/summary": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only .", "/versions/15/tables/0/rows/23/summary": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details.", "/versions/15/tables/0/rows/24/summary": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)", "/versions/15/tables/0/rows/25/summary": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later.", "/versions/15/tables/0/rows/26/summary": "Print the psql version and exit.", "/versions/15/tables/0/rows/27/summary": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/15/tables/0/rows/28/summary": "Force psql to prompt for a password before connecting to a database, even if the password will not be used.", "/versions/15/tables/0/rows/29/summary": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded .", "/versions/15/tables/0/rows/30/summary": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file).", "/versions/15/tables/0/rows/31/summary": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero .", "/versions/15/tables/0/rows/32/summary": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero .", "/versions/15/tables/0/rows/33/summary": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied.", "/versions/15/tables/0/rows/34/summary": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables.", "/versions/15/tables/1/columns/0/label": "Variable", "/versions/15/tables/1/columns/1/label": "Meaning", "/versions/15/tables/1/rows/0/description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode.", "/versions/15/tables/1/rows/1/description": "Default connection parameters (see Section 34.15 ).", "/versions/15/tables/1/rows/2/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .", "/versions/15/tables/1/rows/3/description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems.", "/versions/15/tables/1/rows/4/description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems.", "/versions/15/tables/1/rows/5/description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed.", "/versions/15/tables/1/rows/6/description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If neither of them is set, the default is to use more on most platforms, but less on Cygwin.", "/versions/15/tables/1/rows/7/description": "When a query is executed repeatedly with the \\watch command, a pager is not used by default. This behavior can be changed by setting PSQL_WATCH_PAGER to a pager command, on Unix systems. The pspg pager (not part of PostgreSQL but available in many open source software distributions) can display the output of \\watch if started with the option --stream .", "/versions/15/tables/1/rows/8/description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed.", "/versions/15/tables/1/rows/9/description": "Command executed by the \\! command.", "/versions/15/tables/1/rows/10/description": "Directory for storing temporary files. The default is /tmp ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "c39b7f74a8196ba40fedbb0c8fee27757ee88923175fc4efb9664103680c416c"}, "comparison_data": {"options": [{"names": ["-a", "--echo-all"], "signature": "-a --echo-all", "description": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all ."}, {"names": ["-A", "--no-align"], "signature": "-A --no-align", "description": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned ."}, {"names": ["-b", "--echo-errors"], "signature": "-b --echo-errors", "description": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors ."}, {"names": ["-c command", "--command= command"], "signature": "-c command --command= command", "description": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. command must be either a command string that is completely parsable by the server (i.e., it contains no psql -specific features), or a single backslash command. Thus you cannot mix SQL and psql meta-commands within a -c option. To achieve that, you could use repeated -c options or pipe the string into psql , for example: psql -c '\\x' -c 'SELECT * FROM foo;' or echo '\\x \\\\ SELECT * FROM foo;' | psql ( \\\\ is the separator meta-command.) Each SQL command string passed to -c is sent to the server as a single request. Because of this, the server executes it as a single transaction even if the string contains multiple SQL commands, unless there are explicit BEGIN / COMMIT commands included in the string to divide it into multiple transactions. (See Section 55.2.2.1 for more details about how the server handles multi-query strings.) If having several commands executed in one transaction is not desired, use repeated -c commands or feed multiple commands to psql 's standard input, either using echo as illustrated above, or via a shell here-document, for example: psql <<EOF \\x SELECT * FROM foo; EOF"}, {"names": ["--csv"], "signature": "--csv", "description": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv ."}, {"names": ["-d dbname", "--dbname= dbname"], "signature": "-d dbname --dbname= dbname", "description": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--echo-queries"], "signature": "-e --echo-queries", "description": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries ."}, {"names": ["-E", "--echo-hidden"], "signature": "-E --echo-hidden", "description": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on ."}, {"names": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i . If filename is - (hyphen), then standard input is read until an EOF indication or \\q meta-command. This can be used to intersperse interactive input with input from files. Note however that Readline is not used in this case (much as if -n had been specified). Using this option is subtly different from writing psql < filename . In general, both will do what you expect, but using -f enables some nice features such as error messages with line numbers. There is also a slight chance that using this option will reduce the start-up overhead. On the other hand, the variant using the shell's input redirection is (in theory) guaranteed to yield exactly the same output you would have received had you entered everything by hand."}, {"names": ["-F separator", "--field-separator= separator"], "signature": "-F separator --field-separator= separator", "description": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f ."}, {"names": ["-h hostname", "--host= hostname"], "signature": "-h hostname --host= hostname", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket."}, {"names": ["-H", "--html"], "signature": "-H --html", "description": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command."}, {"names": ["-l", "--list"], "signature": "-l --list", "description": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list . When this option is used, psql will connect to the database postgres , unless a different database is named on the command line (option -d or non-option argument, possibly via a service entry, but not via an environment variable)."}, {"names": ["-L filename", "--log-file= filename"], "signature": "-L filename --log-file= filename", "description": "Write all query output into file filename , in addition to the normal output destination."}, {"names": ["-n", "--no-readline"], "signature": "-n --no-readline", "description": "Do not use Readline for line editing and do not use the command history (see the section called \u201cCommand-Line Editing\u201d below)."}, {"names": ["-o filename", "--output= filename"], "signature": "-o filename --output= filename", "description": "Put all query output into file filename . This is equivalent to the command \\o ."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432."}, {"names": ["-P assignment", "--pset= assignment"], "signature": "-P assignment --pset= assignment", "description": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex ."}, {"names": ["-q", "--quiet"], "signature": "-q --quiet", "description": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on ."}, {"names": ["-R separator", "--record-separator= separator"], "signature": "-R separator --record-separator= separator", "description": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep ."}, {"names": ["-s", "--single-step"], "signature": "-s --single-step", "description": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts."}, {"names": ["-S", "--single-line"], "signature": "-S --single-line", "description": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does. Note This mode is provided for those who insist on it, but you are not necessarily encouraged to use it. In particular, if you mix SQL and meta-commands on a line the order of execution might not always be clear to the inexperienced user."}, {"names": ["-t", "--tuples-only"], "signature": "-t --tuples-only", "description": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only ."}, {"names": ["-T table_options", "--table-attr= table_options"], "signature": "-T table_options --table-attr= table_options", "description": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)"}, {"names": ["-v assignment", "--set= assignment", "--variable= assignment"], "signature": "-v assignment --set= assignment --variable= assignment", "description": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the psql version and exit."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Force psql to prompt for a password before connecting to a database, even if the password will not be used. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, psql will prompt for a password in any case. However, psql will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-x", "--expanded"], "signature": "-x --expanded", "description": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded ."}, {"names": ["-X", "--no-psqlrc"], "signature": "-X --no-psqlrc", "description": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file)."}, {"names": ["-z", "--field-separator-zero"], "signature": "-z --field-separator-zero", "description": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero ."}, {"names": ["-0", "--record-separator-zero"], "signature": "-0 --record-separator-zero", "description": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero ."}, {"names": ["-1", "--single-transaction"], "signature": "-1 --single-transaction", "description": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied. If the commands themselves contain BEGIN , COMMIT , or ROLLBACK , this option will not have the desired effects. Also, if an individual command cannot be executed inside a transaction block, specifying this option will cause the whole transaction to fail."}, {"names": ["-?", "--help[= topic ]"], "signature": "-? --help[= topic ]", "description": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables."}], "synopsis": ["psql [ option ...] [ dbname [ username ]]"], "environment": [{"name": "COLUMNS", "description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode."}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters (see Section 34.15 )."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems."}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems."}, {"name": "PSQL_HISTORY", "description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed."}, {"name": "PSQL_PAGER PAGER", "description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If neither of them is set, the default is to use more on most platforms, but less on Cygwin."}, {"name": "PSQL_WATCH_PAGER", "description": "When a query is executed repeatedly with the \\watch command, a pager is not used by default. This behavior can be changed by setting PSQL_WATCH_PAGER to a pager command, on Unix systems. The pspg pager (not part of PostgreSQL but available in many open source software distributions) can display the output of \\watch if started with the option --stream ."}, {"name": "PSQLRC", "description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed."}, {"name": "SHELL", "description": "Command executed by the \\! command."}, {"name": "TMPDIR", "description": "Directory for storing temporary files. The default is /tmp ."}]}, "comparison_hash": "56308506614ae7883bdbb2ab59674f49e48510360db59a7100407d7b430ca7b4", "manual_language": "zh"}, "16": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "psql"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "16.15"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "35"}], "tables": [{"key": "options", "rows": [{"summary": "\u5728\u8bfb\u5165\u65f6\u5c06\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u884c\u8bfb\u53d6\uff09\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a all \u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-ECHO-ALL", "text": "-a --echo-all"}}, {"summary": "\u5207\u6362\u5230\u975e\u5bf9\u9f50\u8f93\u51fa\u6a21\u5f0f\uff08\u9ed8\u8ba4\u8f93\u51fa\u6a21\u5f0f\u662f aligned \uff09\u3002\u8fd9\u7b49\u6548\u4e8e \\pset format unaligned \u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-NO-ALIGN", "text": "-A --no-align"}}, {"summary": "\u628a\u5931\u8d25\u7684 SQL \u547d\u4ee4\u6253\u5370\u5230\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a errors \u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-ECHO-ERRORS", "text": "-b --echo-errors"}}, {"summary": "\u6307\u5b9a psql \u6267\u884c\u4e00\u4e2a\u7ed9\u5b9a\u7684\u547d\u4ee4\u5b57\u7b26\u4e32 command \u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u591a\u6b21\u5e76\u4e14\u4ee5\u4efb\u4f55\u987a\u5e8f\u4e0e -f \u9009\u9879\u7ec4\u5408\u5728\u4e00\u8d77\u3002\u5f53 -c \u6216\u8005 -f \u88ab\u6307\u5b9a\u65f6\uff0c psql \u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709 -c \u548c -f \u9009\u9879\u540e\u7ec8\u6b62\u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-COMMAND", "text": "-c command --command= command"}}, {"summary": "\u5207\u6362\u5230 CSV \uff08\u9017\u53f7\u5206\u9694\u503c\uff09\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u76f8\u5f53\u4e8e \\pset format csv \u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-CSV", "text": "--csv"}}, {"summary": "\u6307\u5b9a\u8981\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002\u8fd9\u7b49\u6548\u4e8e\u6307\u5b9a dbname \u4e3a\u547d\u4ee4\u884c\u4e0a\u7684\u7b2c\u4e00\u4e2a\u975e\u9009\u9879\u53c2\u6570\u3002 dbname \u53ef\u4ee5\u662f \u8fde\u63a5\u5b57\u7b26\u4e32 \u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u5c06\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-DBNAME", "text": "-d dbname --dbname= dbname"}}, {"summary": "\u4e5f\u628a\u53d1\u9001\u5230\u670d\u52a1\u5668\u7684\u6240\u6709 SQL \u547d\u4ee4\u590d\u5236\u5230\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a queries \u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-ECHO-QUERIES", "text": "-e --echo-queries"}}, {"summary": "\u56de\u663e \\d \u4ee5\u53ca\u5176\u4ed6\u53cd\u659c\u7ebf\u547d\u4ee4\u751f\u6210\u7684\u5b9e\u9645\u67e5\u8be2\u3002\u53ef\u4ee5\u7528\u5b83\u6765\u5b66\u4e60 psql \u7684\u5185\u90e8\u64cd\u4f5c\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO_HIDDEN \u8bbe\u7f6e\u4e3a on \u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-ECHO-HIDDEN", "text": "-E --echo-hidden"}}, {"summary": "\u4ece\u6587\u4ef6 filename \u800c\u4e0d\u662f\u6807\u51c6\u8f93\u5165\u4e2d\u8bfb\u53d6\u547d\u4ee4\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u6307\u5b9a\uff0c\u4e5f\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u4e0e -c \u9009\u9879\u7ec4\u5408\u4f7f\u7528\u3002\u5f53\u6307\u5b9a\u4e86 -c \u6216 -f \u65f6\uff0c psql \u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709 -c \u548c -f \u9009\u9879\u540e\u7ec8\u6b62\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u7b49\u4ef7\u4e8e\u5143\u547d\u4ee4 \\i \u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-FILE", "text": "-f filename --file= filename"}}, {"summary": "\u4f7f\u7528 separator \u4f5c\u4e3a\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e \\pset fieldsep \u6216\u8005 \\f \u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR", "text": "-F separator --field-separator= separator"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-FIELD-HOST", "text": "-h hostname --host= hostname"}}, {"summary": "\u5207\u6362\u5230 HTML \u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e \\pset format html \u6216\u8005 \\H \u547d\u4ee4\u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-HTML", "text": "-H --html"}}, {"summary": "\u5217\u51fa\u6240\u6709\u53ef\u7528\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u9000\u51fa\u3002\u5176\u4ed6\u975e\u8fde\u63a5\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002\u8fd9\u4e0e\u5143\u547d\u4ee4 \\list \u7c7b\u4f3c\u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-LIST", "text": "-l --list"}}, {"summary": "\u9664\u4e86\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u5199\u5230\u666e\u901a\u8f93\u51fa\u76ee\u6807\u4e4b\u5916\uff0c\u8fd8\u5199\u5230\u6587\u4ef6 filename \u4e2d\u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-LOG-FILE", "text": "-L filename --log-file= filename"}}, {"summary": "\u4e0d\u8981\u4f7f\u7528 Readline \u8fdb\u884c\u884c\u7f16\u8f91\uff0c\u4e5f\u4e0d\u8981\u4f7f\u7528\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\uff08\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684 \u201c\u547d\u4ee4\u884c\u7f16\u8f91\u201d\u4e00\u8282 \uff09\u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-NO-READLINE", "text": "-n --no-readline"}}, {"summary": "\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u653e\u5230\u6587\u4ef6 filename \u4e2d\u3002\u8fd9\u7b49\u6548\u4e8e\u547d\u4ee4 \\o \u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-OUTPUT", "text": "-o filename --output= filename"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u7684\u6587\u4ef6\u540d\u540e\u7f00\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u7684\u503c\uff1b\u672a\u8bbe\u7f6e\u65f6\uff0c\u4f7f\u7528\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u7aef\u53e3\uff0c\u901a\u5e38\u4e3a 5432\u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-PORT", "text": "-p port --port= port"}}, {"summary": "\u4ee5 \\pset \u7684\u5f62\u5f0f\u6307\u5b9a\u6253\u5370\u9009\u9879\u3002\u6ce8\u610f\uff0c\u8fd9\u91cc\u4f60\u5fc5\u987b\u7528\u4e00\u4e2a\u7b49\u53f7\u800c\u4e0d\u662f\u7a7a\u683c\u6765\u5206\u9694\u540d\u79f0\u548c\u503c\u3002\u4f8b\u5982\uff0c\u8981\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a LaTeX \uff0c\u5e94\u8be5\u5199\u6210 -P format=latex \u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-PSET", "text": "-P assignment --pset= assignment"}}, {"summary": "\u6307\u5b9a psql \u5e94\u8be5\u5b89\u9759\u5730\u5de5\u4f5c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4f1a\u6253\u5370\u51fa\u6b22\u8fce\u6d88\u606f\u548c\u5404\u79cd\u63d0\u793a\u4fe1\u606f\u3002\u5982\u679c\u4f7f\u7528\u4e86\u8fd9\u4e2a\u9009\u9879\uff0c\u4ee5\u4e0a\u90a3\u4e9b\u5c31\u90fd\u4e0d\u4f1a\u8f93\u51fa\u3002\u5728\u4f7f\u7528 -c \u9009\u9879\u65f6\uff0c\u914d\u5408\u8fd9\u4e2a\u9009\u9879\u5f88\u6709\u7528\u3002\u8fd9\u7b49\u6548\u4e8e\u8bbe\u7f6e\u53d8\u91cf QUIET \u4e3a on \u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-QUIET", "text": "-q --quiet"}}, {"summary": "\u628a separator \u7528\u4f5c\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e \\pset recordsep \u547d\u4ee4\u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR", "text": "-R separator --record-separator= separator"}}, {"summary": "\u8fd0\u884c\u5728\u5355\u6b65\u6a21\u5f0f\u4e2d\u3002\u8fd9\u610f\u5473\u7740\u5728\u6bcf\u4e2a\u547d\u4ee4\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u4e4b\u524d\u90fd\u4f1a\u63d0\u793a\u7528\u6237\uff0c\u5e76\u5141\u8bb8\u53d6\u6d88\u6267\u884c\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u8c03\u8bd5\u811a\u672c\u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-SINGLE-STEP", "text": "-s --single-step"}}, {"summary": "\u8fd0\u884c\u5728\u5355\u884c\u6a21\u5f0f\u4e2d\uff0c\u5176\u4e2d\u6362\u884c\u7b26\u4f1a\u7ec8\u6b62\u4e00\u4e2a SQL \u547d\u4ee4\uff0c\u5c31\u50cf\u5206\u53f7\u7684\u4f5c\u7528\u4e00\u6837\u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-SINGLE-LINE", "text": "-S --single-line"}}, {"summary": "\u5173\u95ed\u6253\u5370\u5217\u540d\u548c\u7ed3\u679c\u884c\u8ba1\u6570\u9875\u811a\u7b49\u3002\u8fd9\u7b49\u6548\u4e8e \\t \u6216\u8005 \\pset tuples_only \u547d\u4ee4\u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-TUPLES-ONLY", "text": "-t --tuples-only"}}, {"summary": "\u6307\u5b9a\u8981\u653e\u5728 HTML table \u6807\u7b7e\u5185\u7684\u9009\u9879\u3002\u8be6\u89c1 \\pset tableattr \u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-TABLE-ATTR", "text": "-T table_options --table-attr= table_options"}}, {"summary": "\u4f5c\u4e3a\u7528\u6237 username \u800c\u4e0d\u662f\u9ed8\u8ba4\u7528\u6237\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff08\u5f53\u7136\uff0c\u4f60\u5fc5\u987b\u5177\u6709\u8fd9\u6837\u505a\u7684\u6743\u9650\uff09\u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-USERNAME", "text": "-U username --username= username"}}, {"summary": "\u6267\u884c\u4e00\u6b21\u53d8\u91cf\u8d4b\u503c\uff0c\u548c \\set \u5143\u547d\u4ee4\u76f8\u4f3c\u3002\u6ce8\u610f\u4f60\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u7528\u7b49\u53f7\u5206\u9694\u540d\u5b57\u548c\u503c\uff08\u5982\u679c\u6709\uff09\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u7684\u8bbe\u7f6e\uff0c\u53bb\u6389\u7b49\u53f7\u5c31\u884c\u3002\u8981\u628a\u4e00\u4e2a\u53d8\u91cf\u8bbe\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u4f7f\u7528\u7b49\u53f7\u4f46\u662f\u53bb\u6389\u503c\u3002\u8fd9\u4e9b\u8d4b\u503c\u5728\u547d\u4ee4\u884c\u5904\u7406\u671f\u95f4\u88ab\u5b8c\u6210\uff0c\u56e0\u6b64\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u7684\u53d8\u91cf\u5c06\u5728\u7a0d\u540e\u88ab\u8986\u76d6\u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-VARIABLE", "text": "-v assignment --set= assignment --variable= assignment"}}, {"summary": "\u6253\u5370 psql \u7248\u672c\u5e76\u4e14\u9000\u51fa\u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-VERSION", "text": "-V --version"}}, {"summary": "\u6c38\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982 .pgpass \u6587\u4ef6\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u8fd9\u4e2a\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4efb\u52a1\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u65f6\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-NO-PASSWORD", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 psql \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\uff0c\u5373\u4f7f\u8be5\u5bc6\u7801\u5b9e\u9645\u4e0a\u4e0d\u4f1a\u88ab\u4f7f\u7528\u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-PASSWORD", "text": "-W --password"}}, {"summary": "\u6253\u5f00\u6269\u5c55\u8868\u683c\u5f0f\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e \\x \u6216\u8005 \\pset expanded \u547d\u4ee4\u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-EXPANDED", "text": "-x --expanded"}}, {"summary": "\u4e0d\u8bfb\u53d6\u542f\u52a8\u6587\u4ef6\uff08\u65e2\u4e0d\u8bfb\u53d6\u7cfb\u7edf\u8303\u56f4\u7684 psqlrc \u6587\u4ef6\uff0c\u4e5f\u4e0d\u8bfb\u53d6\u7528\u6237\u7684 ~/.psqlrc \u6587\u4ef6\uff09\u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-NO-PSQLRC", "text": "-X --no-psqlrc"}}, {"summary": "\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u8fd9\u7b49\u6548\u4e8e \\pset fieldsep_zero \u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR-ZERO", "text": "-z --field-separator-zero"}}, {"summary": "\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u4f8b\u5982\uff0c\u8fd9\u6709\u52a9\u4e8e\u4e0e xargs -0 \u914d\u5408\u4f7f\u7528\u3002\u8fd9\u7b49\u6548\u4e8e \\pset recordsep_zero \u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR-ZERO", "text": "-0 --record-separator-zero"}}, {"summary": "\u8fd9\u4e2a\u9009\u9879\u53ea\u80fd\u4e0e\u4e00\u4e2a\u6216\u591a\u4e2a -c \u548c/\u6216 -f \u9009\u9879\u7ed3\u5408\u4f7f\u7528\u3002\u5b83\u4f1a\u5bfc\u81f4 psql \u5728\u7b2c\u4e00\u4e2a\u8fd9\u6837\u7684\u9009\u9879\u4e4b\u524d\u53d1\u51fa\u4e00\u4e2a BEGIN \u547d\u4ee4\uff0c\u5e76\u5728\u6700\u540e\u4e00\u4e2a\u9009\u9879\u4e4b\u540e\u53d1\u51fa\u4e00\u4e2a COMMIT \u547d\u4ee4\uff0c\u4ece\u800c\u5c06\u6240\u6709\u547d\u4ee4\u5305\u88c5\u6210\u4e00\u4e2a\u5355\u72ec\u7684\u4e8b\u52a1\u3002\u5982\u679c\u4efb\u4f55\u547d\u4ee4\u5931\u8d25\u4e14\u53d8\u91cf ON_ERROR_STOP \u88ab\u8bbe\u7f6e\uff0c\u5219\u4f1a\u6539\u4e3a\u53d1\u9001\u4e00\u4e2a ROLLBACK \u547d\u4ee4\u3002\u8fd9\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-SINGLE-TRANSACTION", "text": "-1 --single-transaction"}}, {"summary": "\u663e\u793a\u6709\u5173 psql \u7684\u5e2e\u52a9\u5e76\u4e14\u9000\u51fa\u3002\u53ef\u9009\u7684 topic \u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a options \uff09\u9009\u62e9\u8981\u89e3\u91ca psql \u7684\u54ea\u4e00\u90e8\u5206\uff1a commands \u63cf\u8ff0 psql \u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b options \u63cf\u8ff0\u53ef\u4ee5\u88ab\u4f20\u9012\u7ed9 psql \u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c variables \u5219\u663e\u793a\u6709\u5173 psql \u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002", "signature": {"url": "/docs/16/app-psql.html#APP-PSQL-OPTION-HELP", "text": "-? --help[= topic ]"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "COLUMNS", "description": "\u5982\u679c \\pset columns \u4e3a\u96f6\uff0c\u8fd9\u4e2a\u73af\u5883\u53d8\u91cf\u63a7\u5236\u7528\u4e8e wrapped \u683c\u5f0f\u7684\u5bbd\u5ea6\u4ee5\u53ca\u7528\u6765\u786e\u5b9a\u8f83\u5bbd\u7684\u8f93\u51fa\u662f\u5426\u9700\u8981\u5206\u9875\u5668\uff0c\u6216\u8005\u662f\u5426\u5e94\u5207\u6362\u5230\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e2d\u7684\u5782\u76f4\u683c\u5f0f\u7684\u5bbd\u5ea6\u3002"}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\uff08\u89c1 \u7b2c 34.15 \u8282 \uff09\u3002"}, {"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "\\e \u3001 \\ef \u4ee5\u53ca \\ev \u547d\u4ee4\u6240\u4f7f\u7528\u7684\u7f16\u8f91\u5668\u3002\u4f1a\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u68c0\u67e5\u8fd9\u4e9b\u53d8\u91cf\uff0c\u7b2c\u4e00\u4e2a\u88ab\u8bbe\u7f6e\u7684\u5c06\u88ab\u4f7f\u7528\u3002\u5982\u679c\u90fd\u6ca1\u6709\u88ab\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u662f\u4f7f\u7528Unix\u7cfb\u7edf\u4e0a\u7684 vi \u6216\u8005Windows\u7cfb\u7edf\u4e0a\u7684 notepad.exe \u3002"}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "\u5f53 \\e \u3001 \\ef \u6216 \\ev \u5e26\u6709\u884c\u53f7\u53c2\u6570\u4f7f\u7528\u65f6\uff0c\u6b64\u53d8\u91cf\u6307\u5b9a\u5c06\u8d77\u59cb\u884c\u53f7\u4f20\u7ed9\u7528\u6237\u7f16\u8f91\u5668\u65f6\u6240\u7528\u7684\u547d\u4ee4\u884c\u53c2\u6570\u3002\u5bf9\u4e8e Emacs \u6216 vi \u4e4b\u7c7b\u7684\u7f16\u8f91\u5668\uff0c\u8fd9\u4e2a\u53c2\u6570\u662f\u4e00\u4e2a\u52a0\u53f7\u3002\u5982\u679c\u9009\u9879\u540d\u548c\u884c\u53f7\u4e4b\u95f4\u9700\u8981\u7a7a\u683c\uff0c\u8bf7\u5728\u53d8\u91cf\u503c\u4e2d\u5305\u542b\u672b\u5c3e\u7a7a\u683c\u3002\u4f8b\u5982\uff1a PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' \u5728 Unix \u7cfb\u7edf\u4e0a\u9ed8\u8ba4\u662f + \uff08\u5bf9\u5e94\u4e8e\u9ed8\u8ba4\u7f16\u8f91\u5668 vi \uff0c\u4e14\u5bf9\u5f88\u591a\u5176\u4ed6\u5e38\u89c1\u7f16\u8f91\u5668\u53ef\u7528\uff09\u3002\u5728 Windows \u7cfb\u7edf\u4e0a\u6ca1\u6709\u9ed8\u8ba4\u503c\u3002"}, {"name": "PSQL_HISTORY", "description": "\u547d\u4ee4\u5386\u53f2\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08 ~ \uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002"}, {"name": "PSQL_PAGER PAGER", "description": "\u5982\u679c\u67e5\u8be2\u7ed3\u679c\u65e0\u6cd5\u5728\u5c4f\u5e55\u4e0a\u663e\u793a\u5b8c\u6574\uff0c\u5b83\u4eec\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6b64\u547d\u4ee4\u3002\u5178\u578b\u7684\u503c\u662f more \u6216 less \u3002\u53ef\u4ee5\u901a\u8fc7\u5c06 PSQL_PAGER \u6216 PAGER \u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u6216\u901a\u8fc7\u8c03\u6574 \\pset \u547d\u4ee4\u7684\u4e0e\u5206\u9875\u76f8\u5173\u7684\u9009\u9879\u6765\u7981\u7528\u5206\u9875\u5668\u3002\u8fd9\u4e9b\u53d8\u91cf\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u8fdb\u884c\u68c0\u67e5\uff1b\u4f7f\u7528\u6309\u8be5\u987a\u5e8f\u627e\u5230\u7684\u7b2c\u4e00\u4e2a\u5df2\u8bbe\u7f6e\u7684\u53d8\u91cf\u3002\u5982\u679c\u5b83\u4eec\u90fd\u6ca1\u6709\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5728\u5927\u591a\u6570\u5e73\u53f0\u4e0a\u4f7f\u7528 more \uff0c\u4f46\u5728Cygwin\u4e0a\u4f7f\u7528 less \u3002"}, {"name": "PSQL_WATCH_PAGER", "description": "\u4f7f\u7528 \\watch \u547d\u4ee4\u53cd\u590d\u6267\u884c\u67e5\u8be2\u65f6\uff0c\u9ed8\u8ba4\u4e0d\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\u3002\u5728 Unix \u7cfb\u7edf\u4e0a\uff0c\u53ef\u4ee5\u5c06 PSQL_WATCH_PAGER \u8bbe\u4e3a\u5206\u9875\u7a0b\u5e8f\u547d\u4ee4\u6765\u6539\u53d8\u6b64\u884c\u4e3a\u3002pspg \u5206\u9875\u7a0b\u5e8f\uff08\u4e0d\u5c5e\u4e8e PostgreSQL\uff0c\u4f46\u8bb8\u591a\u5f00\u6e90\u8f6f\u4ef6\u53d1\u884c\u7248\u90fd\u63d0\u4f9b\u5b83\uff09\u4ee5 --stream \u9009\u9879\u542f\u52a8\u65f6\uff0c\u53ef\u4ee5\u663e\u793a \\watch \u7684\u8f93\u51fa\u3002"}, {"name": "PSQLRC", "description": "\u7528\u6237\u7684 .psqlrc \u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08 ~ \uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002"}, {"name": "SHELL", "description": "\u88ab \\! \u547d\u4ee4\u6267\u884c\u7684\u547d\u4ee4\u3002"}, {"name": "TMPDIR", "description": "\u5b58\u50a8\u4e34\u65f6\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u662f /tmp \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-a", "--echo-all"], "summary": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all .", "signature": "-a --echo-all", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-ECHO-ALL", "description": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all ."}, {"names": ["-A", "--no-align"], "summary": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned .", "signature": "-A --no-align", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-NO-ALIGN", "description": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned ."}, {"names": ["-b", "--echo-errors"], "summary": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors .", "signature": "-b --echo-errors", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-ECHO-ERRORS", "description": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors ."}, {"names": ["-c command", "--command= command"], "summary": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence.", "signature": "-c command --command= command", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-COMMAND", "description": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. command must be either a command string that is completely parsable by the server (i.e., it contains no psql -specific features), or a single backslash command. Thus you cannot mix SQL and psql meta-commands within a -c option. To achieve that, you could use repeated -c options or pipe the string into psql , for example: psql -c '\\x' -c 'SELECT * FROM foo;' or echo '\\x \\\\ SELECT * FROM foo;' | psql ( \\\\ is the separator meta-command.) Each SQL command string passed to -c is sent to the server as a single request. Because of this, the server executes it as a single transaction even if the string contains multiple SQL commands, unless there are explicit BEGIN / COMMIT commands included in the string to divide it into multiple transactions. (See Section 55.2.2.1 for more details about how the server handles multi-query strings.) If having several commands executed in one transaction is not desired, use repeated -c commands or feed multiple commands to psql 's standard input, either using echo as illustrated above, or via a shell here-document, for example: psql <<EOF \\x SELECT * FROM foo; EOF"}, {"names": ["--csv"], "summary": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv .", "signature": "--csv", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-CSV", "description": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv ."}, {"names": ["-d dbname", "--dbname= dbname"], "summary": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "signature": "-d dbname --dbname= dbname", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-DBNAME", "description": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--echo-queries"], "summary": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries .", "signature": "-e --echo-queries", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-ECHO-QUERIES", "description": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries ."}, {"names": ["-E", "--echo-hidden"], "summary": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on .", "signature": "-E --echo-hidden", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-ECHO-HIDDEN", "description": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on ."}, {"names": ["-f filename", "--file= filename"], "summary": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i .", "signature": "-f filename --file= filename", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-FILE", "description": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i . If filename is - (hyphen), then standard input is read until an EOF indication or \\q meta-command. This can be used to intersperse interactive input with input from files. Note however that Readline is not used in this case (much as if -n had been specified). Using this option is subtly different from writing psql < filename . In general, both will do what you expect, but using -f enables some nice features such as error messages with line numbers. There is also a slight chance that using this option will reduce the start-up overhead. On the other hand, the variant using the shell's input redirection is (in theory) guaranteed to yield exactly the same output you would have received had you entered everything by hand."}, {"names": ["-F separator", "--field-separator= separator"], "summary": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f .", "signature": "-F separator --field-separator= separator", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR", "description": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f ."}, {"names": ["-h hostname", "--host= hostname"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket.", "signature": "-h hostname --host= hostname", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-FIELD-HOST", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket."}, {"names": ["-H", "--html"], "summary": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command.", "signature": "-H --html", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-HTML", "description": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command."}, {"names": ["-l", "--list"], "summary": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list .", "signature": "-l --list", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-LIST", "description": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list . When this option is used, psql will connect to the database postgres , unless a different database is named on the command line (option -d or non-option argument, possibly via a service entry, but not via an environment variable)."}, {"names": ["-L filename", "--log-file= filename"], "summary": "Write all query output into file filename , in addition to the normal output destination.", "signature": "-L filename --log-file= filename", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-LOG-FILE", "description": "Write all query output into file filename , in addition to the normal output destination."}, {"names": ["-n", "--no-readline"], "summary": "Do not use Readline for line editing and do not use the command history (see the section called \u201cCommand-Line Editing\u201d below).", "signature": "-n --no-readline", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-NO-READLINE", "description": "Do not use Readline for line editing and do not use the command history (see the section called \u201cCommand-Line Editing\u201d below)."}, {"names": ["-o filename", "--output= filename"], "summary": "Put all query output into file filename . This is equivalent to the command \\o .", "signature": "-o filename --output= filename", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-OUTPUT", "description": "Put all query output into file filename . This is equivalent to the command \\o ."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432.", "signature": "-p port --port= port", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-PORT", "description": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432."}, {"names": ["-P assignment", "--pset= assignment"], "summary": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex .", "signature": "-P assignment --pset= assignment", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-PSET", "description": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex ."}, {"names": ["-q", "--quiet"], "summary": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on .", "signature": "-q --quiet", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-QUIET", "description": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on ."}, {"names": ["-R separator", "--record-separator= separator"], "summary": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep .", "signature": "-R separator --record-separator= separator", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR", "description": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep ."}, {"names": ["-s", "--single-step"], "summary": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts.", "signature": "-s --single-step", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-SINGLE-STEP", "description": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts."}, {"names": ["-S", "--single-line"], "summary": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does.", "signature": "-S --single-line", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-SINGLE-LINE", "description": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does. Note This mode is provided for those who insist on it, but you are not necessarily encouraged to use it. In particular, if you mix SQL and meta-commands on a line the order of execution might not always be clear to the inexperienced user."}, {"names": ["-t", "--tuples-only"], "summary": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only .", "signature": "-t --tuples-only", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-TUPLES-ONLY", "description": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only ."}, {"names": ["-T table_options", "--table-attr= table_options"], "summary": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details.", "signature": "-T table_options --table-attr= table_options", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-TABLE-ATTR", "description": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details."}, {"names": ["-U username", "--username= username"], "summary": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)", "signature": "-U username --username= username", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-USERNAME", "description": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)"}, {"names": ["-v assignment", "--set= assignment", "--variable= assignment"], "summary": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later.", "signature": "-v assignment --set= assignment --variable= assignment", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-VARIABLE", "description": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later."}, {"names": ["-V", "--version"], "summary": "Print the psql version and exit.", "signature": "-V --version", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-VERSION", "description": "Print the psql version and exit."}, {"names": ["-w", "--no-password"], "summary": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-NO-PASSWORD", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-W", "--password"], "summary": "Force psql to prompt for a password before connecting to a database, even if the password will not be used.", "signature": "-W --password", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-PASSWORD", "description": "Force psql to prompt for a password before connecting to a database, even if the password will not be used. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, psql will prompt for a password in any case. However, psql will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-x", "--expanded"], "summary": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded .", "signature": "-x --expanded", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-EXPANDED", "description": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded ."}, {"names": ["-X", "--no-psqlrc"], "summary": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file).", "signature": "-X --no-psqlrc", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-NO-PSQLRC", "description": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file)."}, {"names": ["-z", "--field-separator-zero"], "summary": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero .", "signature": "-z --field-separator-zero", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR-ZERO", "description": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero ."}, {"names": ["-0", "--record-separator-zero"], "summary": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero .", "signature": "-0 --record-separator-zero", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR-ZERO", "description": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero ."}, {"names": ["-1", "--single-transaction"], "summary": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied.", "signature": "-1 --single-transaction", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-SINGLE-TRANSACTION", "description": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied. If the commands themselves contain BEGIN , COMMIT , or ROLLBACK , this option will not have the desired effects. Also, if an individual command cannot be executed inside a transaction block, specifying this option will cause the whole transaction to fail."}, {"names": ["-?", "--help[= topic ]"], "summary": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables.", "signature": "-? --help[= topic ]", "source_url": "/docs/16/app-psql.html#APP-PSQL-OPTION-HELP", "description": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables."}], "related": [{"url": "/wiki/psql/?v=16", "label": "psql \u5143\u547d\u4ee4"}, {"url": "/wiki/conn/?v=16", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v16.15/postgresql-16.15.tar.bz2", "label": "16.15", "major": "16", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/16/postgresql-16-A4.pdf", "bytes": 15282337, "pages": 3055, "sha256": "4bb6c1f63deedac98736d8c4c7bc0fad0ac24e85b07e21ee10411872f06afd06", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/16/postgresql-16-US.pdf", "bytes": 15164148, "pages": 3220, "sha256": "5b6b6166c89991199e144bb0ae34c17a5f29826251dbf19db1abc0df3a3e771b", "built_at": "2026-09-26"}}, "tree": "16", "index": "index.html", "major": "16", "pages": 1169, "release": "16.15", "source_url": "https://ftp.postgresql.org/pub/source/v16.15/postgresql-16.15.tar.bz2", "svg_assets": 3, "source_mode": "en HTML verified against the pinned official archive", "source_sha256": "c1575341fa7bd40f5274ea465b34390f4dc64cdd0770af327005caaeb9f6b7ed"}, "revision": "3c21e58b35318021716440e67bb8bafd392b6a2b965a244d90e9e33c99e0bdef", "evidence_kind": "English manual and source declarations", "source_sha256": "c1575341fa7bd40f5274ea465b34390f4dc64cdd0770af327005caaeb9f6b7ed"}, "sources": [{"url": "https://pg.center/docs/16/app-psql.html", "file": "app-psql.html", "label": "16.15 English manual \u00b7 app-psql.html", "anchor": "", "sha256": "add25957a1dfc97db721f2958782be186ab90dc0f0a47c4b720b2b6c26172493", "language": "en", "original_url": "/docs/16/app-psql.html"}, {"url": "https://pg.center/docs/16/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "a28c30c3c0f8783e16d56413a0b6fd39487e336da1683b29b60abf1c229cef26", "language": "en", "original_url": "/docs/16/reference-client.html"}], "sections": [], "synopsis": ["psql [ option ...] [ dbname [ username ]]"], "signature": "psql [ option ...] [ dbname [ username ]]", "description": ["psql \u2014 PostgreSQL \u7684\u4ea4\u4e92\u5f0f\u7ec8\u7aef"], "environment": [{"name": "COLUMNS", "description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode."}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters (see Section 34.15 )."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems."}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems."}, {"name": "PSQL_HISTORY", "description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed."}, {"name": "PSQL_PAGER PAGER", "description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If neither of them is set, the default is to use more on most platforms, but less on Cygwin."}, {"name": "PSQL_WATCH_PAGER", "description": "When a query is executed repeatedly with the \\watch command, a pager is not used by default. This behavior can be changed by setting PSQL_WATCH_PAGER to a pager command, on Unix systems. The pspg pager (not part of PostgreSQL but available in many open source software distributions) can display the output of \\watch if started with the option --stream ."}, {"name": "PSQLRC", "description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed."}, {"name": "SHELL", "description": "Command executed by the \\! command."}, {"name": "TMPDIR", "description": "Directory for storing temporary files. The default is /tmp ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PSQL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></h2>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u2014 <span class=\"productname\">PostgreSQL</span>\u7684\u4ea4\u4e92\u5f0f\u7ec8\u7aef</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.20.4.1\"><code class=\"command\">psql</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em> [<em class=\"replaceable\"><code>username</code></em>]]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.20.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u662f<span class=\"productname\">PostgreSQL</span>\u7684\u4e00\u4e2a\u57fa\u4e8e\u7ec8\u7aef\u7684\u524d\u7aef\u3002\u5b83\u4f7f\u4f60\u80fd\u591f\u4ea4\u4e92\u5f0f\u5730\u8f93\u5165\u67e5\u8be2\uff0c\u5c06\u5176\u53d1\u9001\u7ed9<span class=\"productname\">PostgreSQL</span>\uff0c\u5e76\u67e5\u770b\u67e5\u8be2\u7ed3\u679c\u3002\u4e5f\u53ef\u4ee5\u4ece\u6587\u4ef6\u6216\u547d\u4ee4\u884c\u53c2\u6570\u63d0\u4f9b\u8f93\u5165\u3002\u6b64\u5916\uff0c<span class=\"application\">psql</span>\u8fd8\u63d0\u4f9b\u4e86\u82e5\u5e72\u5143\u547d\u4ee4\u548c\u591a\u79cd\u7c7b\u4f3c shell \u7684\u7279\u6027\uff0c\u4ee5\u4fbf\u4e8e\u7f16\u5199\u811a\u672c\u548c\u81ea\u52a8\u5316\u6267\u884c\u5404\u79cd\u4efb\u52a1\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-PSQL-3\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-OPTION-ECHO-ALL\"><span class=\"term\"><code class=\"option\">-a</code><br/></span><span class=\"term\"><code class=\"option\">--echo-all</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8bfb\u5165\u65f6\u5c06\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u884c\u8bfb\u53d6\uff09\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a <code class=\"literal\">all</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-NO-ALIGN\"><span class=\"term\"><code class=\"option\">-A</code><br/></span><span class=\"term\"><code class=\"option\">--no-align</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230\u975e\u5bf9\u9f50\u8f93\u51fa\u6a21\u5f0f\uff08\u9ed8\u8ba4\u8f93\u51fa\u6a21\u5f0f\u662f<code class=\"literal\">aligned</code>\uff09\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset format unaligned</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-ECHO-ERRORS\"><span class=\"term\"><code class=\"option\">-b</code><br/></span><span class=\"term\"><code class=\"option\">--echo-errors</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u5931\u8d25\u7684 SQL \u547d\u4ee4\u6253\u5370\u5230\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">errors</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-COMMAND\"><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>command</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--command=<em class=\"replaceable\"><code>command</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a<span class=\"application\">psql</span>\u6267\u884c\u4e00\u4e2a\u7ed9\u5b9a\u7684\u547d\u4ee4\u5b57\u7b26\u4e32<em class=\"replaceable\"><code>command</code></em>\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u591a\u6b21\u5e76\u4e14\u4ee5\u4efb\u4f55\u987a\u5e8f\u4e0e<code class=\"option\">-f</code>\u9009\u9879\u7ec4\u5408\u5728\u4e00\u8d77\u3002\u5f53<code class=\"option\">-c</code>\u6216\u8005<code class=\"option\">-f</code>\u88ab\u6307\u5b9a\u65f6\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709<code class=\"option\">-c</code>\u548c<code class=\"option\">-f</code>\u9009\u9879\u540e\u7ec8\u6b62\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>command</code></em>\u5fc5\u987b\u662f\u4e00\u4e2a\u670d\u52a1\u5668\u5b8c\u5168\u53ef\u89e3\u6790\u7684\u547d\u4ee4\u5b57\u7b26\u4e32\uff08\u5373\u4e0d\u5305\u542b<span class=\"application\">psql</span>\u4e13\u6709\u7684\u7279\u6027\uff09\u6216\u8005\u5355\u4e2a\u53cd\u659c\u7ebf\u547d\u4ee4\u3002\u56e0\u6b64\u4e0d\u80fd\u5728\u4e00\u4e2a<code class=\"option\">-c</code>\u9009\u9879\u4e2d\u6df7\u5408<acronym class=\"acronym\">SQL</acronym>\u548c<span class=\"application\">psql</span>\u5143\u547d\u4ee4\u3002\u8981\u90a3\u6837\u505a\uff0c\u53ef\u4ee5\u4f7f\u7528\u591a\u4e2a<code class=\"option\">-c</code>\u9009\u9879\u6216\u8005\u628a\u5b57\u7b26\u4e32\u7528\u7ba1\u9053\u8f93\u9001\u5230<span class=\"application\">psql</span>\u4e2d\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">psql -c '\\x' -c 'SELECT * FROM foo;'\n</pre>\n<p lang=\"zh\">\u6216\u8005</p>\n<pre class=\"programlisting\">echo '\\x \\\\ SELECT * FROM foo;' | psql\n</pre>\n<p lang=\"zh\">\uff08<code class=\"literal\">\\\\</code>\u662f\u5206\u9694\u7b26\u5143\u547d\u4ee4\uff09\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u5b57\u7b26\u4e32\u4f20\u9012\u7ed9<code class=\"option\">-c</code>\u90fd\u4f5c\u4e3a\u4e00\u4e2a\u5355\u72ec\u7684\u8bf7\u6c42\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u56e0\u6b64\uff0c\u5373\u4f7f\u5b57\u7b26\u4e32\u5305\u542b\u591a\u4e2a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\uff0c\u670d\u52a1\u5668\u4e5f\u4f1a\u5c06\u5176\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff0c\u9664\u975e\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u660e\u786e\u7684<code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code>\u547d\u4ee4\u5c06\u5176\u5206\u6210\u591a\u4e2a\u4e8b\u52a1\u3002\uff08\u6709\u5173\u670d\u52a1\u5668\u5982\u4f55\u5904\u7406\u591a\u67e5\u8be2\u5b57\u7b26\u4e32\u7684\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/16/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT\" title=\"55.2.2.1.\u00a0\u4e00\u4e2a\u7b80\u5355\u67e5\u8be2\u4e2d\u7684\u591a\u6761\u8bed\u53e5\">\u7b2c\u00a055.2.2.1\u00a0\u8282</a>\u3002\uff09</p>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u5e0c\u671b\u5728\u4e00\u4e2a\u4e8b\u52a1\u4e2d\u6267\u884c\u591a\u4e2a\u547d\u4ee4\uff0c\u53ef\u4ee5\u4f7f\u7528\u91cd\u590d\u7684<code class=\"option\">-c</code>\u547d\u4ee4\uff0c\u6216\u5c06\u591a\u4e2a\u547d\u4ee4\u8f93\u5165\u5230<span class=\"application\">psql</span>\u7684\u6807\u51c6\u8f93\u5165\uff0c\u53ef\u4ee5\u50cf\u4e0a\u9762\u793a\u4f8b\u4e2d\u4f7f\u7528<span class=\"application\">echo</span>\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7shell\u7684here-document\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">psql &lt;&lt;EOF\n\\x\nSELECT * FROM foo;\nEOF\n</pre>\n</dd>\n<dt id=\"APP-PSQL-OPTION-CSV\"><span class=\"term\"><code class=\"option\">--csv</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230<acronym class=\"acronym\">CSV</acronym>\uff08\u9017\u53f7\u5206\u9694\u503c\uff09\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u76f8\u5f53\u4e8e<code class=\"command\">\\pset format csv</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-DBNAME\"><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>dbname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>dbname</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002\u8fd9\u7b49\u6548\u4e8e\u6307\u5b9a<em class=\"replaceable\"><code>dbname</code></em>\u4e3a\u547d\u4ee4\u884c\u4e0a\u7684\u7b2c\u4e00\u4e2a\u975e\u9009\u9879\u53c2\u6570\u3002<em class=\"replaceable\"><code>dbname</code></em> \u53ef\u4ee5\u662f<a class=\"link\" href=\"/docs/16/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"34.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u5c06\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-ECHO-QUERIES\"><span class=\"term\"><code class=\"option\">-e</code><br/></span><span class=\"term\"><code class=\"option\">--echo-queries</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e5f\u628a\u53d1\u9001\u5230\u670d\u52a1\u5668\u7684\u6240\u6709 SQL \u547d\u4ee4\u590d\u5236\u5230\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">queries</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-ECHO-HIDDEN\"><span class=\"term\"><code class=\"option\">-E</code><br/></span><span class=\"term\"><code class=\"option\">--echo-hidden</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u56de\u663e<code class=\"command\">\\d</code>\u4ee5\u53ca\u5176\u4ed6\u53cd\u659c\u7ebf\u547d\u4ee4\u751f\u6210\u7684\u5b9e\u9645\u67e5\u8be2\u3002\u53ef\u4ee5\u7528\u5b83\u6765\u5b66\u4e60<span class=\"application\">psql</span>\u7684\u5185\u90e8\u64cd\u4f5c\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO_HIDDEN</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-FILE\"><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u800c\u4e0d\u662f\u6807\u51c6\u8f93\u5165\u4e2d\u8bfb\u53d6\u547d\u4ee4\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u6307\u5b9a\uff0c\u4e5f\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u4e0e<code class=\"option\">-c</code>\u9009\u9879\u7ec4\u5408\u4f7f\u7528\u3002\u5f53\u6307\u5b9a\u4e86<code class=\"option\">-c</code>\u6216<code class=\"option\">-f</code>\u65f6\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709<code class=\"option\">-c</code>\u548c<code class=\"option\">-f</code>\u9009\u9879\u540e\u7ec8\u6b62\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u7b49\u4ef7\u4e8e\u5143\u547d\u4ee4<code class=\"command\">\\i</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c<em class=\"replaceable\"><code>filename</code></em>\u662f<code class=\"literal\">-</code>\uff08\u8fde\u5b57\u7b26\uff09\uff0c\u5219\u4f1a\u8bfb\u53d6\u6807\u51c6\u8f93\u5165\uff0c\u76f4\u5230\u9047\u5230 <acronym class=\"acronym\">EOF</acronym> \u6307\u793a\u6216<code class=\"command\">\\q</code>\u5143\u547d\u4ee4\u3002\u8fd9\u53ef\u7528\u4e8e\u5c06\u4ea4\u4e92\u5f0f\u8f93\u5165\u4e0e\u6587\u4ef6\u8f93\u5165\u4ea4\u9519\u4f7f\u7528\u3002\u4e0d\u8fc7\u8bf7\u6ce8\u610f\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\u4e0d\u4f1a\u4f7f\u7528 <span class=\"application\">Readline</span>\uff08\u5f88\u50cf\u6307\u5b9a\u4e86<code class=\"option\">-n</code>\u65f6\u7684\u60c5\u51b5\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u4e0e\u5199\u6210<code class=\"literal\">psql &lt; <em class=\"replaceable\"><code>filename</code></em></code>\u6709\u7ec6\u5fae\u5dee\u522b\u3002\u901a\u5e38\u4e24\u79cd\u5f62\u5f0f\u90fd\u4f1a\u5f97\u5230\u4f60\u671f\u671b\u7684\u7ed3\u679c\uff0c\u4f46\u4f7f\u7528<code class=\"literal\">-f</code>\u53ef\u4ee5\u542f\u7528\u4e00\u4e9b\u6709\u7528\u7684\u7279\u6027\uff0c\u4f8b\u5982\u5e26\u884c\u53f7\u7684\u9519\u8bef\u6d88\u606f\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u4e5f\u8fd8\u6709\u4e00\u70b9\u673a\u4f1a\u964d\u4f4e\u542f\u52a8\u5f00\u9500\u3002\u53e6\u4e00\u65b9\u9762\uff0c\u4f7f\u7528 shell \u8f93\u5165\u91cd\u5b9a\u5411\u7684\u5f62\u5f0f\u5728\u7406\u8bba\u4e0a\u80fd\u4fdd\u8bc1\u5f97\u5230\u4e0e\u4f60\u624b\u5de5\u9010\u884c\u8f93\u5165\u65f6\u5b8c\u5168\u76f8\u540c\u7684\u8f93\u51fa\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-FIELD-SEPARATOR\"><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>separator</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--field-separator=<em class=\"replaceable\"><code>separator</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f7f\u7528<em class=\"replaceable\"><code>separator</code></em>\u4f5c\u4e3a\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset fieldsep</code>\u6216\u8005<code class=\"command\">\\f</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-FIELD-HOST\"><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>hostname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>hostname</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-HTML\"><span class=\"term\"><code class=\"option\">-H</code><br/></span><span class=\"term\"><code class=\"option\">--html</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230<acronym class=\"acronym\">HTML</acronym>\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset format html</code>\u6216\u8005<code class=\"command\">\\H</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-LIST\"><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--list</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u6240\u6709\u53ef\u7528\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u9000\u51fa\u3002\u5176\u4ed6\u975e\u8fde\u63a5\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002\u8fd9\u4e0e\u5143\u547d\u4ee4<code class=\"command\">\\list</code>\u7c7b\u4f3c\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8be5\u9009\u9879\u65f6\uff0c<span class=\"application\">psql</span>\u5c06\u8fde\u63a5\u5230\u6570\u636e\u5e93<code class=\"literal\">postgres</code>\uff0c\u9664\u975e\u547d\u4ee4\u884c\u4e0a\u6307\u5b9a\u4e86\u5176\u4ed6\u6570\u636e\u5e93\uff08\u901a\u8fc7<code class=\"option\">-d</code>\u9009\u9879\u6216\u975e\u9009\u9879\u53c2\u6570\uff0c\u4e5f\u53ef\u80fd\u901a\u8fc7\u670d\u52a1\u9879\uff0c\u4f46\u4e0d\u80fd\u901a\u8fc7\u73af\u5883\u53d8\u91cf\uff09\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-LOG-FILE\"><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--log-file=<em class=\"replaceable\"><code>filename</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9664\u4e86\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u5199\u5230\u666e\u901a\u8f93\u51fa\u76ee\u6807\u4e4b\u5916\uff0c\u8fd8\u5199\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-NO-READLINE\"><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-readline</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8981\u4f7f\u7528<span class=\"application\">Readline</span>\u8fdb\u884c\u884c\u7f16\u8f91\uff0c\u4e5f\u4e0d\u8981\u4f7f\u7528\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\uff08\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/16/app-psql.html#APP-PSQL-READLINE\" title=\"\u547d\u4ee4\u884c\u7f16\u8f91\">\u201c\u547d\u4ee4\u884c\u7f16\u8f91\u201d\u4e00\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-OUTPUT\"><span class=\"term\"><code class=\"option\">-o <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--output=<em class=\"replaceable\"><code>filename</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u653e\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u3002\u8fd9\u7b49\u6548\u4e8e\u547d\u4ee4<code class=\"command\">\\o</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-PORT\"><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u7684\u6587\u4ef6\u540d\u540e\u7f00\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u7684\u503c\uff1b\u672a\u8bbe\u7f6e\u65f6\uff0c\u4f7f\u7528\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u7aef\u53e3\uff0c\u901a\u5e38\u4e3a 5432\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-PSET\"><span class=\"term\"><code class=\"option\">-P <em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--pset=<em class=\"replaceable\"><code>assignment</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ee5<code class=\"command\">\\pset</code>\u7684\u5f62\u5f0f\u6307\u5b9a\u6253\u5370\u9009\u9879\u3002\u6ce8\u610f\uff0c\u8fd9\u91cc\u4f60\u5fc5\u987b\u7528\u4e00\u4e2a\u7b49\u53f7\u800c\u4e0d\u662f\u7a7a\u683c\u6765\u5206\u9694\u540d\u79f0\u548c\u503c\u3002\u4f8b\u5982\uff0c\u8981\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a<span class=\"application\">LaTeX</span>\uff0c\u5e94\u8be5\u5199\u6210<code class=\"literal\">-P format=latex</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-QUIET\"><span class=\"term\"><code class=\"option\">-q</code><br/></span><span class=\"term\"><code class=\"option\">--quiet</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a<span class=\"application\">psql</span>\u5e94\u8be5\u5b89\u9759\u5730\u5de5\u4f5c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4f1a\u6253\u5370\u51fa\u6b22\u8fce\u6d88\u606f\u548c\u5404\u79cd\u63d0\u793a\u4fe1\u606f\u3002\u5982\u679c\u4f7f\u7528\u4e86\u8fd9\u4e2a\u9009\u9879\uff0c\u4ee5\u4e0a\u90a3\u4e9b\u5c31\u90fd\u4e0d\u4f1a\u8f93\u51fa\u3002\u5728\u4f7f\u7528<code class=\"option\">-c</code>\u9009\u9879\u65f6\uff0c\u914d\u5408\u8fd9\u4e2a\u9009\u9879\u5f88\u6709\u7528\u3002\u8fd9\u7b49\u6548\u4e8e\u8bbe\u7f6e\u53d8\u91cf<code class=\"varname\">QUIET</code>\u4e3a<code class=\"literal\">on</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-RECORD-SEPARATOR\"><span class=\"term\"><code class=\"option\">-R <em class=\"replaceable\"><code>separator</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--record-separator=<em class=\"replaceable\"><code>separator</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a<em class=\"replaceable\"><code>separator</code></em>\u7528\u4f5c\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset recordsep</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-SINGLE-STEP\"><span class=\"term\"><code class=\"option\">-s</code><br/></span><span class=\"term\"><code class=\"option\">--single-step</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5728\u5355\u6b65\u6a21\u5f0f\u4e2d\u3002\u8fd9\u610f\u5473\u7740\u5728\u6bcf\u4e2a\u547d\u4ee4\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u4e4b\u524d\u90fd\u4f1a\u63d0\u793a\u7528\u6237\uff0c\u5e76\u5141\u8bb8\u53d6\u6d88\u6267\u884c\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u8c03\u8bd5\u811a\u672c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-SINGLE-LINE\"><span class=\"term\"><code class=\"option\">-S</code><br/></span><span class=\"term\"><code class=\"option\">--single-line</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd0\u884c\u5728\u5355\u884c\u6a21\u5f0f\u4e2d\uff0c\u5176\u4e2d\u6362\u884c\u7b26\u4f1a\u7ec8\u6b62\u4e00\u4e2a SQL \u547d\u4ee4\uff0c\u5c31\u50cf\u5206\u53f7\u7684\u4f5c\u7528\u4e00\u6837\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u79cd\u6a21\u5f0f\u662f\u4e3a\u575a\u6301\u4f7f\u7528\u5b83\u7684\u7528\u6237\u63d0\u4f9b\u7684\uff0c\u4f46\u5e76\u4e0d\u4e00\u5b9a\u503c\u5f97\u63a8\u8350\u3002\u7279\u522b\u662f\uff0c\u5982\u679c\u5728\u4e00\u884c\u4e2d\u6df7\u5408\u4e86<acronym class=\"acronym\">SQL</acronym>\u548c\u5143\u547d\u4ee4\uff0c\u5bf9\u4e8e\u6ca1\u6709\u7ecf\u9a8c\u7684\u7528\u6237\u6765\u8bf4\uff0c\u5b83\u4eec\u7684\u6267\u884c\u987a\u5e8f\u672a\u5fc5\u603b\u662f\u6e05\u695a\u7684\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-OPTION-TUPLES-ONLY\"><span class=\"term\"><code class=\"option\">-t</code><br/></span><span class=\"term\"><code class=\"option\">--tuples-only</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5173\u95ed\u6253\u5370\u5217\u540d\u548c\u7ed3\u679c\u884c\u8ba1\u6570\u9875\u811a\u7b49\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\t</code>\u6216\u8005<code class=\"command\">\\pset tuples_only</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-TABLE-ATTR\"><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>table_options</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--table-attr=<em class=\"replaceable\"><code>table_options</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u653e\u5728<acronym class=\"acronym\">HTML</acronym> <code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u9009\u9879\u3002\u8be6\u89c1<code class=\"command\">\\pset tableattr</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-USERNAME\"><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f5c\u4e3a\u7528\u6237<em class=\"replaceable\"><code>username</code></em>\u800c\u4e0d\u662f\u9ed8\u8ba4\u7528\u6237\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff08\u5f53\u7136\uff0c\u4f60\u5fc5\u987b\u5177\u6709\u8fd9\u6837\u505a\u7684\u6743\u9650\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-VARIABLE\"><span class=\"term\"><code class=\"option\">-v <em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--set=<em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--variable=<em class=\"replaceable\"><code>assignment</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6267\u884c\u4e00\u6b21\u53d8\u91cf\u8d4b\u503c\uff0c\u548c<code class=\"command\">\\set</code>\u5143\u547d\u4ee4\u76f8\u4f3c\u3002\u6ce8\u610f\u4f60\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u7528\u7b49\u53f7\u5206\u9694\u540d\u5b57\u548c\u503c\uff08\u5982\u679c\u6709\uff09\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u7684\u8bbe\u7f6e\uff0c\u53bb\u6389\u7b49\u53f7\u5c31\u884c\u3002\u8981\u628a\u4e00\u4e2a\u53d8\u91cf\u8bbe\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u4f7f\u7528\u7b49\u53f7\u4f46\u662f\u53bb\u6389\u503c\u3002\u8fd9\u4e9b\u8d4b\u503c\u5728\u547d\u4ee4\u884c\u5904\u7406\u671f\u95f4\u88ab\u5b8c\u6210\uff0c\u56e0\u6b64\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u7684\u53d8\u91cf\u5c06\u5728\u7a0d\u540e\u88ab\u8986\u76d6\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-VERSION\"><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">psql</span>\u7248\u672c\u5e76\u4e14\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-NO-PASSWORD\"><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6c38\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u8fd9\u4e2a\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4efb\u52a1\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u65f6\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u6574\u4e2a\u4f1a\u8bdd\u671f\u95f4\u90fd\u4f1a\u4fdd\u6301\u751f\u6548\uff0c\u56e0\u6b64\u5b83\u4e0d\u4ec5\u5f71\u54cd\u521d\u59cb\u8fde\u63a5\u5c1d\u8bd5\uff0c\u4e5f\u4f1a\u5f71\u54cd\u5143\u547d\u4ee4<code class=\"command\">\\connect</code>\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-PASSWORD\"><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236<span class=\"application\">psql</span>\u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\uff0c\u5373\u4f7f\u8be5\u5bc6\u7801\u5b9e\u9645\u4e0a\u4e0d\u4f1a\u88ab\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff0c\u5219<span class=\"application\">psql</span>\u65e0\u8bba\u5982\u4f55\u90fd\u4f1a\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">psql</span>\u9700\u8981\u5148\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\uff0c\u624d\u80fd\u77e5\u9053\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u663e\u5f0f\u6307\u5b9a<code class=\"option\">-W</code>\u503c\u5f97\u7528\u6765\u907f\u514d\u8fd9\u6b21\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u6574\u4e2a\u4f1a\u8bdd\u671f\u95f4\u90fd\u4f1a\u4fdd\u6301\u751f\u6548\uff0c\u56e0\u6b64\u5b83\u4e0d\u4ec5\u5f71\u54cd\u521d\u59cb\u8fde\u63a5\u5c1d\u8bd5\uff0c\u4e5f\u4f1a\u5f71\u54cd\u5143\u547d\u4ee4<code class=\"command\">\\connect</code>\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-EXPANDED\"><span class=\"term\"><code class=\"option\">-x</code><br/></span><span class=\"term\"><code class=\"option\">--expanded</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5f00\u6269\u5c55\u8868\u683c\u5f0f\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\x</code>\u6216\u8005<code class=\"command\">\\pset expanded</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-NO-PSQLRC\"><span class=\"term\"><code class=\"option\">-X</code><br/></span><span class=\"term\"><code class=\"option\">--no-psqlrc</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8bfb\u53d6\u542f\u52a8\u6587\u4ef6\uff08\u65e2\u4e0d\u8bfb\u53d6\u7cfb\u7edf\u8303\u56f4\u7684<code class=\"filename\">psqlrc</code>\u6587\u4ef6\uff0c\u4e5f\u4e0d\u8bfb\u53d6\u7528\u6237\u7684<code class=\"filename\">~/.psqlrc</code>\u6587\u4ef6\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-FIELD-SEPARATOR-ZERO\"><span class=\"term\"><code class=\"option\">-z</code><br/></span><span class=\"term\"><code class=\"option\">--field-separator-zero</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset fieldsep_zero</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-RECORD-SEPARATOR-ZERO\"><span class=\"term\"><code class=\"option\">-0</code><br/></span><span class=\"term\"><code class=\"option\">--record-separator-zero</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u4f8b\u5982\uff0c\u8fd9\u6709\u52a9\u4e8e\u4e0e<code class=\"literal\">xargs -0</code>\u914d\u5408\u4f7f\u7528\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset recordsep_zero</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-SINGLE-TRANSACTION\"><span class=\"term\"><code class=\"option\">-1</code><br/></span><span class=\"term\"><code class=\"option\">--single-transaction</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u9009\u9879\u53ea\u80fd\u4e0e\u4e00\u4e2a\u6216\u591a\u4e2a<code class=\"option\">-c</code>\u548c/\u6216<code class=\"option\">-f</code>\u9009\u9879\u7ed3\u5408\u4f7f\u7528\u3002\u5b83\u4f1a\u5bfc\u81f4<span class=\"application\">psql</span>\u5728\u7b2c\u4e00\u4e2a\u8fd9\u6837\u7684\u9009\u9879\u4e4b\u524d\u53d1\u51fa\u4e00\u4e2a<code class=\"command\">BEGIN</code>\u547d\u4ee4\uff0c\u5e76\u5728\u6700\u540e\u4e00\u4e2a\u9009\u9879\u4e4b\u540e\u53d1\u51fa\u4e00\u4e2a<code class=\"command\">COMMIT</code>\u547d\u4ee4\uff0c\u4ece\u800c\u5c06\u6240\u6709\u547d\u4ee4\u5305\u88c5\u6210\u4e00\u4e2a\u5355\u72ec\u7684\u4e8b\u52a1\u3002\u5982\u679c\u4efb\u4f55\u547d\u4ee4\u5931\u8d25\u4e14\u53d8\u91cf<code class=\"varname\">ON_ERROR_STOP</code>\u88ab\u8bbe\u7f6e\uff0c\u5219\u4f1a\u6539\u4e3a\u53d1\u9001\u4e00\u4e2a<code class=\"command\">ROLLBACK</code>\u547d\u4ee4\u3002\u8fd9\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u547d\u4ee4\u672c\u8eab\u5305\u542b<code class=\"command\">BEGIN</code>\u3001<code class=\"command\">COMMIT</code>\u6216<code class=\"command\">ROLLBACK</code>\uff0c\u8fd9\u4e2a\u9009\u9879\u5c31\u4e0d\u4f1a\u4ea7\u751f\u671f\u671b\u7684\u6548\u679c\u3002\u53e6\u5916\uff0c\u5982\u679c\u67d0\u4e2a\u5355\u72ec\u547d\u4ee4\u4e0d\u80fd\u5728\u4e8b\u52a1\u5757\u4e2d\u6267\u884c\uff0c\u6307\u5b9a\u8fd9\u4e2a\u9009\u9879\u5c06\u5bfc\u81f4\u6574\u4e2a\u4e8b\u52a1\u5931\u8d25\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-HELP\"><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help[=<em class=\"replaceable\"><code>topic</code></em>]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u6709\u5173<span class=\"application\">psql</span>\u7684\u5e2e\u52a9\u5e76\u4e14\u9000\u51fa\u3002\u53ef\u9009\u7684<em class=\"replaceable\"><code>topic</code></em>\u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a<code class=\"literal\">options</code>\uff09\u9009\u62e9\u8981\u89e3\u91ca<span class=\"application\">psql</span>\u7684\u54ea\u4e00\u90e8\u5206\uff1a<code class=\"literal\">commands</code>\u63cf\u8ff0<span class=\"application\">psql</span>\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b<code class=\"literal\">options</code>\u63cf\u8ff0\u53ef\u4ee5\u88ab\u4f20\u9012\u7ed9<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c<code class=\"literal\">variables</code>\u5219\u663e\u793a\u6709\u5173<span class=\"application\">psql</span>\u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.20.7\">\n<h2 lang=\"zh\">\u9000\u51fa\u72b6\u6001</h2>\n<p lang=\"zh\">\u5982\u679c<span class=\"application\">psql</span>\u6b63\u5e38\u7ed3\u675f\uff0c\u5b83\u4f1a\u5411 shell \u8fd4\u56de 0\uff1b\u5982\u679c\u5b83\u81ea\u8eab\u53d1\u751f\u81f4\u547d\u9519\u8bef\uff08\u4f8b\u5982\u5185\u5b58\u8017\u5c3d\u3001\u627e\u4e0d\u5230\u6587\u4ef6\uff09\uff0c\u5219\u8fd4\u56de 1\uff1b\u5982\u679c\u5230\u670d\u52a1\u5668\u7684\u8fde\u63a5\u53d1\u751f\u6545\u969c\u4e14\u8be5\u4f1a\u8bdd\u4e0d\u662f\u4ea4\u4e92\u5f0f\u7684\uff0c\u5219\u8fd4\u56de 2\uff1b\u5982\u679c\u811a\u672c\u4e2d\u53d1\u751f\u9519\u8bef\u4e14\u53d8\u91cf<code class=\"varname\">ON_ERROR_STOP</code>\u5df2\u8bbe\u7f6e\uff0c\u5219\u8fd4\u56de 3\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.20.8\">\n<h2 lang=\"zh\">\u7528\u6cd5</h2>\n<div class=\"refsect2\" id=\"R2-APP-PSQL-CONNECTING\">\n<h3 lang=\"zh\">\u8fde\u63a5\u5230\u6570\u636e\u5e93</h3>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u662f\u5e38\u89c4\u7684 <span class=\"productname\">PostgreSQL</span> \u5ba2\u6237\u7aef\u5e94\u7528\u7a0b\u5e8f\u3002\u8981\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff0c\u4f60\u9700\u8981\u77e5\u9053\u76ee\u6807\u6570\u636e\u5e93\u540d\u79f0\u3001\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u548c\u7aef\u53e3\u53f7\uff0c\u4ee5\u53ca\u8981\u4ee5\u54ea\u4e2a\u6570\u636e\u5e93\u7528\u6237\u540d\u8fde\u63a5\u3002<span class=\"application\">psql</span> \u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u9009\u9879 <code class=\"option\">-d</code>\u3001<code class=\"option\">-h</code>\u3001<code class=\"option\">-p</code> \u548c <code class=\"option\">-U</code> \u5206\u522b\u6307\u5b9a\u8fd9\u4e9b\u53c2\u6570\u3002\u5982\u679c\u9047\u5230\u4e00\u4e2a\u4e0d\u5c5e\u4e8e\u4efb\u4f55\u9009\u9879\u7684\u53c2\u6570\uff0c\u5b83\u5c06\u88ab\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u540d\uff08\u5982\u679c\u6570\u636e\u5e93\u540d\u5df2\u7ecf\u7ed9\u51fa\uff0c\u5219\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u7528\u6237\u540d\uff09\u3002\u5e76\u975e\u6240\u6709\u8fd9\u4e9b\u9009\u9879\u90fd\u662f\u5fc5\u9700\u7684\uff1b\u5b83\u4eec\u90fd\u6709\u6709\u7528\u7684\u9ed8\u8ba4\u503c\u3002\u5982\u679c\u7701\u7565\u4e3b\u673a\u540d\uff0c<span class=\"application\">psql</span> \u5728 Unix \u4e0a\u5c06\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u5230\u672c\u5730\u4e3b\u673a\u4e0a\u7684\u670d\u52a1\u5668\uff0c\u5728 Windows \u4e0a\u5219\u901a\u8fc7 TCP/IP \u8fde\u63a5\u5230 <code class=\"literal\">localhost</code>\u3002\u9ed8\u8ba4\u7aef\u53e3\u53f7\u5728\u7f16\u8bd1\u65f6\u786e\u5b9a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u670d\u52a1\u5668\u4f7f\u7528\u76f8\u540c\u7684\u9ed8\u8ba4\u503c\uff0c\u56e0\u6b64\u5728\u5927\u591a\u6570\u60c5\u51b5\u4e0b\u4e0d\u5fc5\u6307\u5b9a\u7aef\u53e3\u3002\u9ed8\u8ba4\u6570\u636e\u5e93\u7528\u6237\u540d\u662f\u4f60\u7684\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\u3002\u6570\u636e\u5e93\u7528\u6237\u540d\u786e\u5b9a\u540e\uff0c\u5b83\u4e5f\u4f1a\u88ab\u7528\u4f5c\u9ed8\u8ba4\u6570\u636e\u5e93\u540d\u3002\u8bf7\u6ce8\u610f\uff0c\u4f60\u4e0d\u80fd\u968f\u610f\u4ee5\u4efb\u610f\u6570\u636e\u5e93\u7528\u6237\u540d\u8fde\u63a5\u5230\u4efb\u610f\u6570\u636e\u5e93\u3002\u6570\u636e\u5e93\u7ba1\u7406\u5458\u5e94\u5f53\u5df2\u7ecf\u544a\u77e5\u4f60\u62e5\u6709\u7684\u8bbf\u95ee\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5f53\u9ed8\u8ba4\u503c\u4e0d\u5b8c\u5168\u5408\u9002\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7\u628a\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGDATABASE</code>\u3001<code class=\"envar\">PGHOST</code>\u3001<code class=\"envar\">PGPORT</code>\u548c<code class=\"envar\">PGUSER</code>\u8bbe\u7f6e\u4e3a\u9002\u5f53\u7684\u503c\u6765\u5c11\u6572\u4e00\u4e9b\u952e\u76d8\uff08\u989d\u5916\u7684\u73af\u5883\u53d8\u91cf\u89c1<a class=\"xref\" href=\"/docs/16/libpq-envars.html\" title=\"34.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a034.15\u00a0\u8282</a>\uff09\u3002\u53e6\u5916\uff0c\u51c6\u5907\u4e00\u4e2a<code class=\"filename\">~/.pgpass</code>\u6587\u4ef6\u4e5f\u5f88\u65b9\u4fbf\uff0c\u8fd9\u6837\u5c31\u4e0d\u5fc5\u7ecf\u5e38\u624b\u5de5\u8f93\u5165\u5bc6\u7801\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/16/libpq-pgpass.html\" title=\"34.16.\u00a0\u5bc6\u7801\u6587\u4ef6\">\u7b2c\u00a034.16\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u53e6\u4e00\u79cd\u6307\u5b9a\u8fde\u63a5\u53c2\u6570\u7684\u65b9\u6cd5\u662f\u4f7f\u7528 conninfo \u5b57\u7b26\u4e32\u6216 URI \u6765\u4ee3\u66ff\u6570\u636e\u5e93\u540d\u3002\u6b64\u673a\u5236\u5141\u8bb8\u5bf9\u8fde\u63a5\u8fdb\u884c\u975e\u5e38\u5e7f\u6cdb\u7684\u63a7\u5236\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">$ <strong class=\"userinput\"><code>psql \"service=myservice sslmode=require\"</code></strong>\n$ <strong class=\"userinput\"><code>psql postgresql://dbmaster:5433/mydb?sslmode=require</code></strong>\n</pre>\n<p lang=\"zh\">\u7528\u8fd9\u79cd\u65b9\u5f0f\uff0c\u4f60\u4e5f\u53ef\u4ee5\u628a<acronym class=\"acronym\">LDAP</acronym>\u7528\u4e8e<a class=\"xref\" href=\"/docs/16/libpq-ldap.html\" title=\"34.18.\u00a0\u8fde\u63a5\u53c2\u6570\u7684 LDAP \u67e5\u627e\">\u7b2c\u00a034.18\u00a0\u8282</a>\u4e2d\u63cf\u8ff0\u7684\u8fde\u63a5\u53c2\u6570\u67e5\u627e\u3002\u53ef\u7528\u8fde\u63a5\u9009\u9879\u7684\u66f4\u591a\u4fe1\u606f\u8bf7\u89c1<a class=\"xref\" href=\"/docs/16/libpq-connect.html#LIBPQ-PARAMKEYWORDS\" title=\"34.1.2.\u00a0\u53c2\u6570\u5173\u952e\u8bcd\">\u7b2c\u00a034.1.2\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7531\u4e8e\u4efb\u4f55\u539f\u56e0\uff08\u4f8b\u5982\u6743\u9650\u4e0d\u8db3\u3001\u670d\u52a1\u5668\u6ca1\u6709\u5728\u76ee\u6807\u4e3b\u673a\u4e0a\u8fd0\u884c\u7b49\uff09\u5bfc\u81f4\u8fde\u63a5\u65e0\u6cd5\u5efa\u7acb\uff0c<span class=\"application\">psql</span>\u5c06\u8fd4\u56de\u4e00\u4e2a\u9519\u8bef\u5e76\u4e14\u7ec8\u6b62\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6807\u51c6\u8f93\u5165\u548c\u6807\u51c6\u8f93\u51fa\u90fd\u662f\u7ec8\u7aef\uff0c\u90a3\u4e48<span class=\"application\">psql</span>\u4f1a\u628a\u5ba2\u6237\u7aef\u7f16\u7801\u8bbe\u7f6e\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">auto</span>\u201d</span>\uff0c\u4ece\u533a\u57df\u8bbe\u7f6e\u4e2d\u68c0\u6d4b\u5408\u9002\u7684\u5ba2\u6237\u7aef\u7f16\u7801\uff08\u5728 Unix \u7cfb\u7edf\u4e0a\u662f<code class=\"envar\">LC_CTYPE</code>\u73af\u5883\u53d8\u91cf\uff09\u3002\u5982\u679c\u7ed3\u679c\u4e0d\u7b26\u5408\u9884\u671f\uff0c\u53ef\u4ee5\u4f7f\u7528\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGCLIENTENCODING</code>\u8986\u76d6\u5ba2\u6237\u7aef\u7f16\u7801\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"R2-APP-PSQL-4\">\n<h3 lang=\"zh\">\u8f93\u5165 SQL \u547d\u4ee4</h3>\n<p lang=\"zh\">\u5728\u6b63\u5e38\u64cd\u4f5c\u65f6\uff0c<span class=\"application\">psql</span>\u4f1a\u63d0\u4f9b\u4e00\u4e2a\u63d0\u793a\u7b26\uff0c\u8be5\u63d0\u793a\u7b26\u662f<span class=\"application\">psql</span>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u540d\u79f0\u540e\u9762\u8ddf\u4e0a\u5b57\u7b26\u4e32<code class=\"literal\">=&gt;</code>\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">$ <strong class=\"userinput\"><code>psql testdb</code></strong>\npsql (16.15)\nType \"help\" for help.\n\ntestdb=&gt;\n</pre>\n<p lang=\"zh\">\u5728\u63d0\u793a\u7b26\u4e0b\uff0c\u7528\u6237\u53ef\u4ee5\u8f93\u5165<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u3002\u901a\u5e38\uff0c\u5f53\u9047\u5230\u8868\u793a\u547d\u4ee4\u7ed3\u675f\u7684\u5206\u53f7\u65f6\uff0c\u8f93\u5165\u7684\u5185\u5bb9\u5c31\u4f1a\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u3002\u884c\u7ed3\u675f\u5e76\u4e0d\u4f1a\u7ec8\u6b62\u4e00\u6761\u547d\u4ee4\uff0c\u56e0\u6b64\u4e3a\u4e86\u63d0\u9ad8\u6e05\u6670\u5ea6\uff0c\u547d\u4ee4\u53ef\u4ee5\u5206\u5e03\u5728\u591a\u884c\u4e0a\u3002\u5982\u679c\u547d\u4ee4\u88ab\u53d1\u9001\u5e76\u6210\u529f\u6267\u884c\uff0c\u5176\u7ed3\u679c\u5c31\u4f1a\u663e\u793a\u5728\u5c4f\u5e55\u4e0a\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u53d7\u4fe1\u4efb\u7684\u7528\u6237\u80fd\u591f\u8bbf\u95ee\u5c1a\u672a\u91c7\u7528<a class=\"link\" href=\"/docs/16/ddl-schemas.html#DDL-SCHEMAS-PATTERNS\" title=\"5.9.6.\u00a0\u4f7f\u7528\u65b9\u5f0f\">\u6a21\u5f0f\u7684\u5b89\u5168\u4f7f\u7528\u65b9\u5f0f</a>\u7684\u6570\u636e\u5e93\uff0c\u8bf7\u5728\u4f1a\u8bdd\u5f00\u59cb\u65f6\u4ece<code class=\"varname\">search_path</code>\u4e2d\u79fb\u9664\u6240\u6709\u516c\u4f17\u53ef\u5199\u7684\u6a21\u5f0f\u3002\u53ef\u4ee5\u5728\u8fde\u63a5\u5b57\u7b26\u4e32\u4e2d\u52a0\u5165<code class=\"literal\">options=-csearch_path=</code>\uff0c\u6216\u8005\u5728\u6267\u884c\u5176\u4ed6 SQL \u547d\u4ee4\u4e4b\u524d\u53d1\u51fa<code class=\"literal\">SELECT pg_catalog.set_config('search_path', '', false)</code>\u3002\u8fd9\u79cd\u8003\u8651\u5e76\u975e<span class=\"application\">psql</span>\u7279\u6709\uff1b\u5b83\u9002\u7528\u4e8e\u4efb\u4f55\u6267\u884c\u4efb\u610f SQL \u547d\u4ee4\u7684\u63a5\u53e3\u3002</p>\n<p lang=\"zh\">\u6bcf\u5f53\u6267\u884c\u547d\u4ee4\u65f6\uff0c<span class=\"application\">psql</span>\u4e5f\u4f1a\u8f6e\u8be2\u7531<a class=\"link\" href=\"/docs/16/sql-listen.html\" title=\"LISTEN\"><code class=\"command\">LISTEN</code></a>\u548c<a class=\"link\" href=\"/docs/16/sql-notify.html\" title=\"NOTIFY\"><code class=\"command\">NOTIFY</code></a>\u751f\u6210\u7684\u5f02\u6b65\u901a\u77e5\u4e8b\u4ef6\u3002</p>\n<p lang=\"zh\">\u867d\u7136 C \u98ce\u683c\u7684\u5757\u6ce8\u91ca\u4f1a\u88ab\u4f20\u7ed9\u670d\u52a1\u5668\u5904\u7406\u5e76\u79fb\u9664\uff0c\u4f46 SQL \u6807\u51c6\u6ce8\u91ca\u4f1a\u7531<span class=\"application\">psql</span>\u81ea\u884c\u79fb\u9664\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"APP-PSQL-META-COMMANDS\">\n<h3 lang=\"zh\">\u5143\u547d\u4ee4</h3>\n<p lang=\"zh\">\u4f60\u8f93\u5165\u5230<span class=\"application\">psql</span>\u4e2d\u7684\u4efb\u4f55\u4ee5\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u5f00\u59cb\u7684\u4e1c\u897f\u90fd\u662f\u4e00\u4e2a<span class=\"application\">psql</span>\u5143\u547d\u4ee4\uff0c\u5b83\u4eec\u7531<span class=\"application\">psql</span>\u81ea\u884c\u5904\u7406\u3002\u8fd9\u4e9b\u547d\u4ee4\u8ba9<span class=\"application\">psql</span>\u5bf9\u7ba1\u7406\u548c\u7f16\u5199\u811a\u672c\u66f4\u6709\u7528\u3002\u5143\u547d\u4ee4\u5e38\u5e38\u88ab\u79f0\u4f5c\u659c\u7ebf\u6216\u8005\u53cd\u659c\u7ebf\u547d\u4ee4\u3002</p>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u547d\u4ee4\u7684\u683c\u5f0f\u662f\u7528\u53cd\u659c\u7ebf\u540e\u9762\u76f4\u63a5\u8ddf\u4e0a\u4e00\u4e2a\u547d\u4ee4\u52a8\u8bcd\uff0c\u7136\u540e\u662f\u4e00\u4e9b\u53c2\u6570\u3002\u53c2\u6570\u4e0e\u547d\u4ee4\u52a8\u8bcd\u548c\u5176\u4ed6\u53c2\u6570\u4e4b\u95f4\u7528\u4efb\u610f\u591a\u4e2a\u7a7a\u767d\u5b57\u7b26\u5206\u9694\u5f00\u3002</p>\n<p lang=\"zh\">\u8981\u5728\u53c2\u6570\u4e2d\u5305\u542b\u7a7a\u767d\uff0c\u53ef\u4ee5\u7528\u5355\u5f15\u53f7\u5c06\u5b83\u62ec\u8d77\u6765\u3002\u8981\u5728\u53c2\u6570\u4e2d\u5305\u542b\u4e00\u4e2a\u5355\u5f15\u53f7\uff0c\u53ef\u4ee5\u5728\u5355\u5f15\u53f7\u6587\u672c\u5185\u5199\u4e24\u4e2a\u5355\u5f15\u53f7\u3002\u5355\u5f15\u53f7\u4e2d\u7684\u5185\u5bb9\u8fd8\u4f1a\u63a5\u53d7\u7c7b\u4f3c C \u8bed\u8a00\u7684\u66ff\u6362\uff1a<code class=\"literal\">\\n</code>\uff08\u6362\u884c\uff09\u3001<code class=\"literal\">\\t</code>\uff08\u5236\u8868\u7b26\uff09\u3001<code class=\"literal\">\\b</code>\uff08\u9000\u683c\uff09\u3001<code class=\"literal\">\\r</code>\uff08\u56de\u8f66\uff09\u3001<code class=\"literal\">\\f</code>\uff08\u6362\u9875\uff09\u3001<code class=\"literal\">\\</code><em class=\"replaceable\"><code>digits</code></em>\uff08\u516b\u8fdb\u5236\uff09\u4ee5\u53ca<code class=\"literal\">\\x</code><em class=\"replaceable\"><code>digits</code></em>\uff08\u5341\u516d\u8fdb\u5236\uff09\u3002\u5728\u5355\u5f15\u53f7\u6587\u672c\u5185\uff0c\u53cd\u659c\u7ebf\u51fa\u73b0\u5728\u4efb\u4f55\u5176\u4ed6\u5b57\u7b26\u524d\u9762\u65f6\uff0c\u53ea\u662f\u5bf9\u8be5\u5355\u4e2a\u5b57\u7b26\u8fdb\u884c\u8f6c\u4e49\uff0c\u4e0d\u8bba\u5b83\u662f\u4ec0\u4e48\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u53c2\u6570\u4e2d\u51fa\u73b0\u4e00\u4e2a\u672a\u52a0\u5f15\u53f7\u7684\u5192\u53f7\uff08<code class=\"literal\">:</code>\uff09\uff0c\u540e\u9762\u7d27\u8ddf\u4e00\u4e2a<span class=\"application\">psql</span>\u53d8\u91cf\u540d\uff0c\u5b83\u5c31\u4f1a\u88ab\u8be5\u53d8\u91cf\u7684\u503c\u66ff\u6362\uff0c\u5982\u4e0b\u9762<a class=\"xref\" href=\"/docs/16/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL \u63d2\u503c\">SQL \u63d2\u503c</a>\u6240\u8ff0\u3002\u5176\u4e2d\u4ecb\u7ecd\u7684<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u548c<code class=\"literal\">:\"<em class=\"replaceable\"><code>variable_name</code></em>\"</code>\u5f62\u5f0f\u4e5f\u540c\u6837\u9002\u7528\u3002<code class=\"literal\">:{?<em class=\"replaceable\"><code>variable_name</code></em>}</code>\u8bed\u6cd5\u5141\u8bb8\u6d4b\u8bd5\u53d8\u91cf\u662f\u5426\u5df2\u5b9a\u4e49\uff1b\u5b83\u4f1a\u88ab TRUE \u6216 FALSE \u66ff\u6362\u3002\u7528\u53cd\u659c\u7ebf\u8f6c\u4e49\u8be5\u5192\u53f7\u53ef\u4ee5\u9632\u6b62\u66ff\u6362\u53d1\u751f\u3002</p>\n<p lang=\"zh\">\u5728\u53c2\u6570\u4e2d\uff0c\u7528\u53cd\u5f15\u53f7\uff08<code class=\"literal\">`</code>\uff09\u5305\u56f4\u7684\u6587\u672c\u4f1a\u88ab\u89c6\u4e3a\u4f20\u7ed9 shell \u7684\u547d\u4ee4\u884c\u3002\u8be5\u547d\u4ee4\u7684\u8f93\u51fa\uff08\u53bb\u6389\u672b\u5c3e\u7684\u6362\u884c\u7b26\uff09\u4f1a\u66ff\u6362\u53cd\u5f15\u53f7\u4e2d\u7684\u6587\u672c\u3002\u5728\u53cd\u5f15\u53f7\u5305\u56f4\u7684\u6587\u672c\u5185\u90e8\uff0c\u4e0d\u4f1a\u8fdb\u884c\u7279\u6b8a\u7684\u5f15\u53f7\u5904\u7406\u6216\u5176\u4ed6\u5904\u7406\uff0c\u4f46\u51fa\u73b0<code class=\"literal\">:<em class=\"replaceable\"><code>variable_name</code></em></code>\u65f6\uff0c\u5982\u679c<em class=\"replaceable\"><code>variable_name</code></em>\u662f<span class=\"application\">psql</span>\u53d8\u91cf\u540d\uff0c\u5c31\u4f1a\u88ab\u66ff\u6362\u4e3a\u8be5\u53d8\u91cf\u7684\u503c\u3002\u6b64\u5916\uff0c<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u4e5f\u4f1a\u88ab\u66ff\u6362\u4e3a\u8be5\u53d8\u91cf\u7684\u503c\uff0c\u5e76\u4f1a\u9002\u5f53\u5730\u52a0\u4e0a\u5f15\u53f7\uff0c\u4f7f\u5176\u6210\u4e3a\u5355\u4e2a shell \u547d\u4ee4\u53c2\u6570\u3002\uff08\u540e\u4e00\u79cd\u5f62\u5f0f\u51e0\u4e4e\u603b\u662f\u66f4\u53ef\u53d6\uff0c\u9664\u975e\u4f60\u975e\u5e38\u786e\u5b9a\u53d8\u91cf\u4e2d\u5305\u542b\u4ec0\u4e48\u3002\uff09\u7531\u4e8e\u65e0\u6cd5\u4fdd\u8bc1\u5728\u6240\u6709\u5e73\u53f0\u4e0a\u90fd\u80fd\u5bf9\u56de\u8f66\u548c\u6362\u884c\u5b57\u7b26\u5b89\u5168\u5730\u52a0\u5f15\u53f7\uff0c\u5f53\u53d8\u91cf\u503c\u4e2d\u51fa\u73b0\u8fd9\u7c7b\u5b57\u7b26\u65f6\uff0c<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u5f62\u5f0f\u4f1a\u6253\u5370\u9519\u8bef\u6d88\u606f\uff0c\u5e76\u4e14\u4e0d\u4f1a\u66ff\u6362\u53d8\u91cf\u503c\u3002</p>\n<p lang=\"zh\">\u4e00\u4e9b\u547d\u4ee4\u63a5\u53d7 SQL \u6807\u8bc6\u7b26\uff08\u4f8b\u5982\u8868\u540d\uff09\u4f5c\u4e3a\u53c2\u6570\u3002\u8fd9\u4e9b\u53c2\u6570\u9075\u5faa SQL \u8bed\u6cd5\u89c4\u5219\uff1a\u672a\u52a0\u5f15\u53f7\u7684\u5b57\u6bcd\u4f1a\u5f3a\u5236\u8f6c\u6362\u4e3a\u5c0f\u5199\uff0c\u800c\u53cc\u5f15\u53f7\uff08\"\uff09\u4f1a\u4fdd\u62a4\u5b57\u6bcd\u4e0d\u88ab\u8f6c\u6362\u5927\u5c0f\u5199\uff0c\u5e76\u5141\u8bb8\u6807\u8bc6\u7b26\u5305\u542b\u7a7a\u767d\u5b57\u7b26\u3002\u5728\u53cc\u5f15\u53f7\u5185\u90e8\uff0c\u8fde\u7eed\u4e24\u4e2a\u53cc\u5f15\u53f7\u4f1a\u5728\u6700\u7ec8\u540d\u79f0\u4e2d\u53d8\u4e3a\u4e00\u4e2a\u53cc\u5f15\u53f7\u3002\u4f8b\u5982\uff0cFOO\"BAR\"BAZ \u4f1a\u88ab\u89e3\u91ca\u4e3a fooBARbaz\uff0c\u800c \"A weird\"\" name\" \u4f1a\u53d8\u4e3a A weird\" name\u3002</p>\n<p lang=\"zh\">\u53c2\u6570\u89e3\u6790\u4f1a\u5728\u884c\u5c3e\u6216\u9047\u5230\u53e6\u4e00\u4e2a\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u65f6\u505c\u6b62\u3002\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u4f1a\u88ab\u89c6\u4e3a\u65b0\u5143\u547d\u4ee4\u7684\u5f00\u59cb\u3002\u7279\u6b8a\u5e8f\u5217<code class=\"literal\">\\\\</code>\uff08\u4e24\u4e2a\u53cd\u659c\u7ebf\uff09\u8868\u793a\u53c2\u6570\u7ed3\u675f\uff0c\u5e76\u7ee7\u7eed\u89e3\u6790<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\uff08\u5982\u679c\u8fd8\u6709\uff09\u3002\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u548c<span class=\"application\">psql</span>\u547d\u4ee4\u53ef\u4ee5\u81ea\u7531\u5730\u6df7\u5408\u5728\u540c\u4e00\u884c\u4e2d\u3002\u4f46\u65e0\u8bba\u5982\u4f55\uff0c\u5143\u547d\u4ee4\u7684\u53c2\u6570\u90fd\u4e0d\u80fd\u5ef6\u7eed\u5230\u4e0b\u4e00\u884c\u3002</p>\n<p lang=\"zh\">\u8bb8\u591a\u5143\u547d\u4ee4\u4f5c\u7528\u4e8e<em class=\"firstterm\">\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a</em>\u3002\u8fd9\u53ea\u662f\u4e00\u4e2a\u4fdd\u5b58\u5df2\u8f93\u5165\u4f46\u5c1a\u672a\u53d1\u9001\u5230\u670d\u52a1\u5668\u6267\u884c\u7684 SQL \u547d\u4ee4\u6587\u672c\u7684\u7f13\u51b2\u533a\u3002\u5176\u4e2d\u65e2\u5305\u62ec\u5148\u524d\u8f93\u5165\u7684\u884c\uff0c\u4e5f\u5305\u62ec\u540c\u4e00\u884c\u4e0a\u4f4d\u4e8e\u5143\u547d\u4ee4\u4e4b\u524d\u7684\u6587\u672c\u3002</p>\n<p lang=\"zh\">\u5b9a\u4e49\u4e86\u4ee5\u4e0b\u5143\u547d\u4ee4\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-META-COMMAND-A\"><span class=\"term\"><code class=\"literal\">\\a</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u5f53\u524d\u8868\u683c\u8f93\u51fa\u683c\u5f0f\u662f\u975e\u5bf9\u9f50\uff0c\u5219\u5207\u6362\u4e3a\u5bf9\u9f50\uff1b\u5426\u5219\u5207\u6362\u4e3a\u975e\u5bf9\u9f50\u3002\u4fdd\u7559\u6b64\u547d\u4ee4\u662f\u4e3a\u4e86\u5411\u540e\u517c\u5bb9\u3002\u66f4\u901a\u7528\u7684\u89e3\u51b3\u65b9\u6848\u8bf7\u53c2\u89c1<code class=\"command\">\\pset</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-BIND\"><span class=\"term\"><code class=\"literal\">\\bind</code> [ <em class=\"replaceable\"><code>parameter</code></em> ] ...</span> </dt>\n<dd>\n<p lang=\"zh\">\u4e3a\u4e0b\u4e00\u6b21\u67e5\u8be2\u6267\u884c\u8bbe\u7f6e\u67e5\u8be2\u53c2\u6570\uff0c\u5e76\u5c06\u6307\u5b9a\u53c2\u6570\u4f20\u7ed9\u4efb\u610f\u53c2\u6570\u5360\u4f4d\u7b26\uff08<code class=\"literal\">$1</code> \u7b49\uff09\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">INSERT INTO tbl1 VALUES ($1, $2) \\bind 'first value' 'second value' \\g\n</pre>\n<p lang=\"zh\">\u8fd9\u5bf9\u9664 <code class=\"literal\">\\g</code> \u4e4b\u5916\u7684\u67e5\u8be2\u6267\u884c\u547d\u4ee4\u4e5f\u6709\u6548\uff0c\u4f8b\u5982 <code class=\"literal\">\\gx</code> \u548c <code class=\"literal\">\\gset</code>\u3002</p>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4f1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/16/protocol-overview.html#PROTOCOL-QUERY-CONCEPTS\" title=\"55.1.2.\u00a0\u6269\u5c55\u67e5\u8be2\u6982\u8ff0\">\u7b2c\u00a055.1.2\u00a0\u8282</a>\uff09\uff0c\u4e0d\u540c\u4e8e<span class=\"application\">psql</span>\u901a\u5e38\u4f7f\u7528\u7684\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002\u56e0\u6b64\uff0c\u53ef\u4ee5\u7528\u5b83\u5728<span class=\"application\">psql</span>\u4e2d\u6d4b\u8bd5\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002\uff08\u5373\u4f7f\u67e5\u8be2\u6ca1\u6709\u53c2\u6570\uff0c\u800c\u4e14\u6b64\u547d\u4ee4\u6307\u5b9a\u4e86\u96f6\u4e2a\u53c2\u6570\uff0c\u4e5f\u4f1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002\uff09\u6b64\u547d\u4ee4\u53ea\u5f71\u54cd\u4e0b\u4e00\u6761\u88ab\u6267\u884c\u7684\u67e5\u8be2\uff1b\u4e4b\u540e\u7684\u6240\u6709\u67e5\u8be2\u9ed8\u8ba4\u4ecd\u4f1a\u4f7f\u7528\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-C-LC\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\c</code> \u6216 <code class=\"literal\">\\connect [ -reuse-previous=<em class=\"replaceable\"><code>on|off</code></em> ] [ <em class=\"replaceable\"><code>dbname</code></em> [ <em class=\"replaceable\"><code>username</code></em> ] [ <em class=\"replaceable\"><code>host</code></em> ] [ <em class=\"replaceable\"><code>port</code></em> ] | <em class=\"replaceable\"><code>conninfo</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5efa\u7acb\u5230<span class=\"productname\">PostgreSQL</span>\u670d\u52a1\u5668\u7684\u65b0\u8fde\u63a5\u3002\u53ef\u4ee5\u4f7f\u7528\u4f4d\u7f6e\u8bed\u6cd5\uff08\u6570\u636e\u5e93\u540d\u79f0\u3001\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\u4e2d\u7684\u4e00\u4e2a\u6216\u591a\u4e2a\uff09\u6307\u5b9a\u8981\u4f7f\u7528\u7684\u8fde\u63a5\u53c2\u6570\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528<em class=\"replaceable\"><code>conninfo</code></em>\u8fde\u63a5\u5b57\u7b26\u4e32\uff0c\u8be6\u89c1<a class=\"xref\" href=\"/docs/16/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"34.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u7b2c\u00a034.1.1\u00a0\u8282</a>\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa\u53c2\u6570\uff0c\u5219\u4f7f\u7528\u4e0e\u4e4b\u524d\u76f8\u540c\u7684\u53c2\u6570\u5efa\u7acb\u65b0\u8fde\u63a5\u3002</p>\n<p lang=\"zh\">\u5c06<em class=\"replaceable\"><code>dbname</code></em>\u3001<em class=\"replaceable\"><code>username</code></em>\u3001<em class=\"replaceable\"><code>host</code></em>\u6216 <em class=\"replaceable\"><code>port</code></em>\u4e2d\u7684\u4efb\u610f\u4e00\u4e2a\u6307\u5b9a\u4e3a <code class=\"literal\">-</code>\uff0c\u7b49\u540c\u4e8e\u7701\u7565\u8be5\u53c2\u6570\u3002</p>\n<p lang=\"zh\">\u65b0\u8fde\u63a5\u53ef\u4ee5\u91cd\u7528\u524d\u4e00\u4e2a\u8fde\u63a5\u7684\u8fde\u63a5\u53c2\u6570\uff1b\u4e0d\u4ec5\u5305\u62ec\u6570\u636e\u5e93\u540d\u79f0\u3001\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\uff0c\u8fd8\u5305\u62ec\u5176\u4ed6\u8bbe\u7f6e\uff0c\u5982<em class=\"replaceable\"><code>sslmode</code></em>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53c2\u6570\u5728\u4f4d\u7f6e\u8bed\u6cd5\u4e2d\u88ab\u91cd\u7528\uff0c\u4f46\u5728\u7ed9\u5b9a<em class=\"replaceable\"><code>conninfo</code></em>\u5b57\u7b26\u4e32\u65f6\u4e0d\u4f1a\u88ab\u91cd\u7528\u3002\u4f20\u9012<code class=\"literal\">-reuse-previous=on</code>\u6216<code class=\"literal\">-reuse-previous=off</code>\u4f5c\u4e3a\u7b2c\u4e00\u4e2a\u53c2\u6570\u5c06\u8986\u76d6\u8be5\u9ed8\u8ba4\u8bbe\u7f6e\u3002\u5982\u679c\u53c2\u6570\u88ab\u91cd\u7528\uff0c\u5219\u4efb\u4f55\u672a\u660e\u786e\u6307\u5b9a\u4e3a\u4f4d\u7f6e\u53c2\u6570\u6216\u5728<em class=\"replaceable\"><code>conninfo</code></em>\u5b57\u7b26\u4e32\u4e2d\u7684\u53c2\u6570\u5c06\u4ece\u73b0\u6709\u8fde\u63a5\u7684\u53c2\u6570\u4e2d\u83b7\u53d6\u3002\u4e00\u4e2a\u4f8b\u5916\u662f\uff0c\u5982\u679c\u4f7f\u7528\u4f4d\u7f6e\u8bed\u6cd5\u66f4\u6539<em class=\"replaceable\"><code>host</code></em>\u8bbe\u7f6e\uff0c\u4f7f\u5176\u4e0d\u540c\u4e8e\u5148\u524d\u7684\u503c\uff0c\u5219\u73b0\u6709\u8fde\u63a5\u53c2\u6570\u4e2d\u5b58\u5728\u7684\u4efb\u4f55<em class=\"replaceable\"><code>hostaddr</code></em>\u8bbe\u7f6e\u5c06\u88ab\u5220\u9664\u3002\u6b64\u5916\uff0c\u4ec5\u5f53\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\u8bbe\u7f6e\u672a\u66f4\u6539\u65f6\uff0c\u624d\u4f1a\u91cd\u7528\u73b0\u6709\u8fde\u63a5\u4f7f\u7528\u7684\u4efb\u4f55\u5bc6\u7801\u3002\u5f53\u547d\u4ee4\u65e2\u4e0d\u6307\u5b9a\u4e5f\u4e0d\u91cd\u7528\u7279\u5b9a\u53c2\u6570\u65f6\uff0c\u5c06\u4f7f\u7528<span class=\"application\">libpq</span>\u7684\u9ed8\u8ba4\u503c\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u65b0\u8fde\u63a5\u6210\u529f\u5efa\u7acb\uff0c\u5219\u5173\u95ed\u5148\u524d\u7684\u8fde\u63a5\u3002\u5982\u679c\u8fde\u63a5\u5c1d\u8bd5\u5931\u8d25\uff08\u7528\u6237\u540d\u9519\u8bef\uff0c\u8bbf\u95ee\u88ab\u62d2\u7edd\u7b49\uff09\uff0c\u4e14<span class=\"application\">psql</span>\u5904\u4e8e\u4ea4\u4e92\u6a21\u5f0f\uff0c\u5219\u4fdd\u7559\u5148\u524d\u7684\u8fde\u63a5\u3002\u4f46\u5728\u6267\u884c\u975e\u4ea4\u4e92\u811a\u672c\u65f6\uff0c\u65e7\u8fde\u63a5\u5c06\u88ab\u5173\u95ed\u5e76\u62a5\u544a\u9519\u8bef\u3002\u8fd9\u53ef\u80fd\u4f1a\u6216\u53ef\u80fd\u4e0d\u4f1a\u7ec8\u6b62\u811a\u672c\uff1b\u5982\u679c\u6ca1\u6709\u7ec8\u6b62\uff0c\u76f4\u5230\u6210\u529f\u6267\u884c\u53e6\u4e00\u4e2a<code class=\"literal\">\\connect</code>\u547d\u4ee4\u4e4b\u524d\uff0c\u6240\u6709\u8bbf\u95ee\u6570\u636e\u5e93\u7684\u547d\u4ee4\u90fd\u5c06\u5931\u8d25\u3002\u91c7\u7528\u8fd9\u79cd\u533a\u522b\uff0c\u4e00\u65b9\u9762\u662f\u4e3a\u4e86\u65b9\u4fbf\u7528\u6237\u5e94\u5bf9\u8f93\u5165\u7b14\u8bef\uff0c\u53e6\u4e00\u65b9\u9762\u662f\u4e3a\u4e86\u9632\u6b62\u811a\u672c\u610f\u5916\u64cd\u4f5c\u9519\u8bef\u7684\u6570\u636e\u5e93\u3002\u8bf7\u6ce8\u610f\uff0c\u6bcf\u5f53<code class=\"literal\">\\connect</code>\u547d\u4ee4\u5c1d\u8bd5\u91cd\u65b0\u4f7f\u7528\u53c2\u6570\u65f6\uff0c\u91cd\u65b0\u4f7f\u7528\u7684\u503c\u662f\u6700\u540e\u4e00\u4e2a\u6210\u529f\u8fde\u63a5\u7684\u503c\uff0c\u800c\u4e0d\u662f\u968f\u540e\u7684\u4efb\u4f55\u5931\u8d25\u5c1d\u8bd5\u7684\u503c\u3002\u4f46\u662f\uff0c\u5728\u975e\u4ea4\u4e92<code class=\"literal\">\\connect</code>\u5931\u8d25\u7684\u60c5\u51b5\u4e0b\uff0c\u4e0d\u5141\u8bb8\u7a0d\u540e\u91cd\u65b0\u4f7f\u7528\u53c2\u6570\uff0c\u56e0\u4e3a\u811a\u672c\u53ef\u80fd\u671f\u671b\u4ece\u5931\u8d25\u7684<code class=\"literal\">\\connect</code>\u4e2d\u91cd\u65b0\u4f7f\u7528\u503c\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">=&gt; \\c mydb myuser host.dom 6432\n=&gt; \\c service=foo\n=&gt; \\c \"host=localhost port=5432 dbname=mydb connect_timeout=10 sslmode=disable\"\n=&gt; \\c -reuse-previous=on sslmode=require    -- changes only sslmode\n=&gt; \\c postgresql://tom@localhost/mydb?application_name=myapp\n</pre>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-C-UC\"><span class=\"term\"><code class=\"literal\">\\C [ <em class=\"replaceable\"><code>title</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u4f5c\u4e3a\u67e5\u8be2\u7ed3\u679c\u6253\u5370\u7684\u8868\u7684\u6807\u9898\uff0c\u6216\u53d6\u6d88\u6b64\u7c7b\u6807\u9898\u3002\u8be5\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset title <em class=\"replaceable\"><code>title</code></em></code>\u3002\uff08\u6b64\u547d\u4ee4\u7684\u540d\u79f0\u6e90\u81ea<span class=\"quote\">\u201c<span class=\"quote\">caption</span>\u201d</span>\uff0c\u56e0\u4e3a\u5b83\u8fc7\u53bb\u53ea\u7528\u4e8e\u8bbe\u7f6e<acronym class=\"acronym\">HTML</acronym>\u8868\u7684\u6807\u9898\u3002\uff09</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-CD\"><span class=\"term\"><code class=\"literal\">\\cd [ <em class=\"replaceable\"><code>directory</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u66f4\u6539\u4e3a<em class=\"replaceable\"><code>directory</code></em>\u3002\u5982\u679c\u6ca1\u6709\u53c2\u6570\uff0c\u5219\u5207\u6362\u5230\u5f53\u524d\u7528\u6237\u7684\u4e3b\u76ee\u5f55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8981\u6253\u5370\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\uff0c\u8bf7\u4f7f\u7528<code class=\"literal\">\\! pwd</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-CONNINFO\"><span class=\"term\"><code class=\"literal\">\\conninfo</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa\u5f53\u524d\u6570\u636e\u5e93\u8fde\u63a5\u7684\u4fe1\u606f\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMANDS-COPY\"><span class=\"term\"><code class=\"literal\">\\copy { <em class=\"replaceable\"><code>table</code></em> [ ( <em class=\"replaceable\"><code>column_list</code></em> ) ] } <code class=\"literal\">from</code> { <em class=\"replaceable\"><code>'filename'</code></em> | program <em class=\"replaceable\"><code>'command'</code></em> | stdin | pstdin } [ [ with ] ( <em class=\"replaceable\"><code>option</code></em> [, ...] ) ] [ where <em class=\"replaceable\"><code>condition</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\copy { <em class=\"replaceable\"><code>table</code></em> [ ( <em class=\"replaceable\"><code>column_list</code></em> ) ] | ( <em class=\"replaceable\"><code>query</code></em> ) } <code class=\"literal\">to</code> { <em class=\"replaceable\"><code>'filename'</code></em> | program <em class=\"replaceable\"><code>'command'</code></em> | stdout | pstdout } [ [ with ] ( <em class=\"replaceable\"><code>option</code></em> [, ...] ) ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6267\u884c\u524d\u7aef\uff08\u5ba2\u6237\u7aef\uff09\u590d\u5236\u3002\u8be5\u64cd\u4f5c\u4f1a\u8fd0\u884c\u4e00\u4e2a<acronym class=\"acronym\">SQL</acronym> <a class=\"link\" href=\"/docs/16/sql-copy.html\" title=\"COPY\"><code class=\"command\">COPY</code></a>\u547d\u4ee4\uff0c\u4f46\u5e76\u4e0d\u662f\u7531\u670d\u52a1\u5668\u8bfb\u53d6\u6216\u5199\u5165\u6307\u5b9a\u6587\u4ef6\uff0c\u800c\u662f\u7531<span class=\"application\">psql</span>\u8bfb\u53d6\u6216\u5199\u5165\u6587\u4ef6\uff0c\u5e76\u5728\u670d\u52a1\u5668\u4e0e\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e4b\u95f4\u8f6c\u9001\u6570\u636e\u3002\u8fd9\u610f\u5473\u7740\u6587\u4ef6\u53ef\u8bbf\u95ee\u6027\u548c\u6743\u9650\u53d6\u51b3\u4e8e\u672c\u5730\u7528\u6237\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\uff0c\u4e5f\u4e0d\u9700\u8981 SQL \u8d85\u7ea7\u7528\u6237\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5f53\u6307\u5b9a<code class=\"literal\">program</code>\u65f6\uff0c<em class=\"replaceable\"><code>command</code></em> \u7531<span class=\"application\">psql</span>\u6267\u884c\uff0c\u4f20\u7ed9<em class=\"replaceable\"><code>command</code></em>\u7684\u6570\u636e\u6216\u4ece\u5176\u4e2d\u8bfb\u51fa\u7684\u6570\u636e\u90fd\u4f1a\u5728\u670d\u52a1\u5668\u4e0e\u5ba2\u6237\u7aef\u4e4b\u95f4\u8f6c\u9001\u3002\u518d\u6b21\u5f3a\u8c03\uff0c\u6267\u884c\u6743\u9650\u5c5e\u4e8e\u672c\u5730\u7528\u6237\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\uff0c\u4e5f\u4e0d\u9700\u8981 SQL \u8d85\u7ea7\u7528\u6237\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e \\copy ... from stdin\uff0c\u4ece\u53d1\u51fa\u547d\u4ee4\u7684\u540c\u4e00\u8f93\u5165\u6e90\u8bfb\u53d6\u6570\u636e\u884c\uff0c\u76f4\u5230\u8bfb\u53d6\u5230 \\.\u6216\u8f93\u5165\u6d41\u5230\u8fbe EOF\u3002\u8fd9\u9002\u5408\u5728 SQL \u811a\u672c\u4e2d\u5185\u8054\u586b\u5145\u8868\u3002\u5bf9\u4e8e \\copy ... to stdout\uff0c\u8f93\u51fa\u53d1\u5f80\u4e0e psql \u547d\u4ee4\u8f93\u51fa\u76f8\u540c\u7684\u4f4d\u7f6e\uff0c\u4e14\u4e0d\u6253\u5370 COPY count \u547d\u4ee4\u72b6\u6001\uff0c\u4ee5\u514d\u4e0e\u6570\u636e\u884c\u6df7\u6dc6\u3002\u82e5\u8981\u59cb\u7ec8\u8bfb\u5199 psql \u7684\u6807\u51c6\u8f93\u5165\u6216\u8f93\u51fa\uff0c\u800c\u4e0d\u53d7\u5f53\u524d\u547d\u4ee4\u6765\u6e90\u6216 \\o \u9009\u9879\u5f71\u54cd\uff0c\u8bf7\u4f7f\u7528 from pstdin \u6216 to pstdout\u3002</p>\n<p lang=\"zh\">\u8be5\u547d\u4ee4\u7684\u8bed\u6cd5\u4e0e<acronym class=\"acronym\">SQL</acronym> <a class=\"link\" href=\"/docs/16/sql-copy.html\" title=\"COPY\"><code class=\"command\">COPY</code></a>\u547d\u4ee4\u7c7b\u4f3c\u3002\u9664\u6570\u636e\u6e90\u6216\u76ee\u6807\u4e4b\u5916\uff0c\u5176\u4ed6\u6240\u6709\u9009\u9879\u90fd\u4e0e<code class=\"command\">COPY</code>\u547d\u4ee4\u4e2d\u7684\u6307\u5b9a\u76f8\u540c\u3002\u56e0\u6b64\uff0c\u7279\u6b8a\u7684\u89e3\u6790\u89c4\u5219\u9002\u7528\u4e8e<code class=\"command\">\\copy</code>\u5143\u547d\u4ee4\u3002\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u5269\u4f59\u884c\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\copy</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u6267\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u53e6\u4e00\u79cd\u83b7\u5f97\u4e0e<code class=\"literal\">\\copy ... to</code>\u76f8\u540c\u7ed3\u679c\u7684\u65b9\u6cd5\u662f\u4f7f\u7528<acronym class=\"acronym\">SQL</acronym> <code class=\"literal\">COPY ... TO STDOUT</code>\u547d\u4ee4\uff0c\u5e76\u4ee5<code class=\"literal\">\\g <em class=\"replaceable\"><code>filename</code></em></code> \u6216<code class=\"literal\">\\g |<em class=\"replaceable\"><code>program</code></em></code>\u7ed3\u675f\u3002\u4e0e<code class=\"literal\">\\copy</code>\u4e0d\u540c\uff0c\u8fd9\u79cd\u65b9\u6cd5\u5141\u8bb8\u547d\u4ee4\u8de8\u8d8a\u591a\u884c\uff1b\u6b64\u5916\uff0c\u53ef\u4ee5\u4f7f\u7528\u53d8\u91cf\u63d2\u503c\u548c\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</div>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8fd9\u4e9b\u64cd\u4f5c\u4e0d\u5982\u4ee5\u6587\u4ef6\u6216\u7a0b\u5e8f\u4f5c\u4e3a\u6570\u636e\u6e90\u6216\u76ee\u6807\u7684<acronym class=\"acronym\">SQL</acronym> <code class=\"command\">COPY</code>\u547d\u4ee4\u9ad8\u6548\uff0c\u56e0\u4e3a\u6240\u6709\u6570\u636e\u90fd\u5fc5\u987b\u901a\u8fc7\u5ba2\u6237\u7aef/\u670d\u52a1\u5668\u8fde\u63a5\u4f20\u8f93\u3002\u5bf9\u4e8e\u5927\u91cf\u6570\u636e\uff0c\u4f7f\u7528<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u53ef\u80fd\u66f4\u5408\u9002\u3002\u53e6\u5916\uff0c\u7531\u4e8e\u91c7\u7528\u8fd9\u79cd\u6570\u636e\u8f6c\u9001\u65b9\u5f0f\uff0c<acronym class=\"acronym\">CSV</acronym>\u6a21\u5f0f\u4e0b\u7684<code class=\"literal\">\\copy ... from</code>\u4f1a\u9519\u8bef\u5730\u628a\u5355\u72ec\u5360\u636e\u4e00\u884c\u7684<code class=\"literal\">\\.</code>\u6570\u636e\u503c\u5f53\u4f5c\u8f93\u5165\u7ed3\u675f\u6807\u8bb0\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-COPYRIGHT\"><span class=\"term\"><code class=\"literal\">\\copyright</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"productname\">PostgreSQL</span>\u7684\u7248\u6743\u548c\u5206\u53d1\u6761\u6b3e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMANDS-CROSSTABVIEW\"><span class=\"term\"><code class=\"literal\">\\crosstabview [ <em class=\"replaceable\"><code>colV</code></em> [ <em class=\"replaceable\"><code>colH</code></em> [ <em class=\"replaceable\"><code>colD</code></em> [ <em class=\"replaceable\"><code>sortcolH</code></em> ] ] ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6267\u884c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\uff08\u4e0e<code class=\"literal\">\\g</code>\u7c7b\u4f3c\uff09\uff0c\u5e76\u4ee5\u4ea4\u53c9\u8868\u7f51\u683c\u663e\u793a\u7ed3\u679c\u3002\u67e5\u8be2\u5fc5\u987b\u8fd4\u56de\u81f3\u5c11\u4e09\u5217\u3002\u7531<em class=\"replaceable\"><code>colV</code></em>\u6807\u8bc6\u7684\u8f93\u51fa\u5217\u6210\u4e3a\u7eb5\u5411\u8868\u5934\uff0c\u7531<em class=\"replaceable\"><code>colH</code></em>\u6807\u8bc6\u7684\u8f93\u51fa\u5217\u6210\u4e3a\u6a2a\u5411\u8868\u5934\u3002<em class=\"replaceable\"><code>colD</code></em>\u6807\u8bc6\u8981\u5728\u7f51\u683c\u4e2d\u663e\u793a\u7684\u8f93\u51fa\u5217\u3002<em class=\"replaceable\"><code>sortcolH</code></em>\u6807\u8bc6\u6a2a\u5411\u8868\u5934\u7684\u53ef\u9009\u6392\u5e8f\u5217\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a\u5217\u6307\u5b9a\u9879\u53ef\u4ee5\u662f\u4ece 1 \u5f00\u59cb\u7684\u5217\u53f7\uff0c\u4e5f\u53ef\u4ee5\u662f\u5217\u540d\uff1b\u5217\u540d\u9075\u5faa\u5e38\u89c4 SQL \u5927\u5c0f\u5199\u6298\u53e0\u548c\u5f15\u53f7\u89c4\u5219\u3002\u7701\u7565\u65f6\uff0ccolV \u9ed8\u8ba4\u4e3a\u7b2c 1 \u5217\uff0ccolH \u9ed8\u8ba4\u4e3a\u7b2c 2 \u5217\u3002colH \u5fc5\u987b\u4e0e colV \u4e0d\u540c\u3002\u82e5\u4e0d\u6307\u5b9a colD\uff0c\u67e5\u8be2\u7ed3\u679c\u5fc5\u987b\u6070\u6709\u4e09\u5217\uff0c\u65e2\u975e colV \u4e5f\u975e colH \u7684\u90a3\u4e00\u5217\u4f5c\u4e3a colD\u3002</p>\n<p lang=\"zh\">\u7eb5\u5411\u8868\u5934\u663e\u793a\u4e3a\u6700\u5de6\u5217\uff0c\u5305\u542b<em class=\"replaceable\"><code>colV</code></em>\u5217\u4e2d\u7684\u503c\uff0c\u5176\u987a\u5e8f\u4e0e\u67e5\u8be2\u7ed3\u679c\u4e2d\u76f8\u540c\uff0c\u4f46\u4f1a\u79fb\u9664\u91cd\u590d\u503c\u3002</p>\n<p lang=\"zh\">\u6a2a\u5411\u8868\u5934\u663e\u793a\u4e3a\u7b2c\u4e00\u884c\uff0c\u5305\u542b<em class=\"replaceable\"><code>colH</code></em>\u5217\u4e2d\u7684\u503c\uff0c\u5e76\u79fb\u9664\u91cd\u590d\u503c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4eec\u6309\u67e5\u8be2\u7ed3\u679c\u4e2d\u7684\u76f8\u540c\u987a\u5e8f\u663e\u793a\u3002\u4f46\u5982\u679c\u7ed9\u51fa\u4e86\u53ef\u9009\u7684<em class=\"replaceable\"><code>sortcolH</code></em>\u53c2\u6570\uff0c\u5b83\u6240\u6807\u8bc6\u7684\u5217\u7684\u503c\u5fc5\u987b\u662f\u6574\u6570\uff0c\u800c<em class=\"replaceable\"><code>colH</code></em>\u4e2d\u7684\u503c\u4f1a\u6309\u7167\u5bf9\u5e94\u7684<em class=\"replaceable\"><code>sortcolH</code></em>\u503c\u6392\u5e8f\u540e\u663e\u793a\u5728\u6a2a\u5411\u8868\u5934\u4e2d\u3002</p>\n<p lang=\"zh\">\u4ea4\u53c9\u8868\u4e2d\uff0c\u5bf9\u4e8e colH \u7684\u6bcf\u4e2a\u4e0d\u540c\u503c x \u548c colV \u7684\u6bcf\u4e2a\u4e0d\u540c\u503c y\uff0c\u4ea4\u70b9 (x,y) \u7684\u5355\u5143\u683c\u4fdd\u5b58\u67e5\u8be2\u7ed3\u679c\u4e2d colH=x \u4e14 colV=y \u90a3\u4e00\u884c\u7684 colD \u503c\u3002\u6ca1\u6709\u5339\u914d\u884c\u65f6\u5355\u5143\u683c\u4e3a\u7a7a\uff1b\u5b58\u5728\u591a\u884c\u65f6\u4f1a\u62a5\u9519\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-D\"><span class=\"term\"><code class=\"literal\">\\d[S+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5bf9\u4e8e\u6bcf\u4e2a\u4e0e<em class=\"replaceable\"><code>pattern</code></em>\u5339\u914d\u7684\u5173\u7cfb\uff08\u8868\u3001\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u7d22\u5f15\u3001\u5e8f\u5217\u6216\u5916\u90e8\u8868\uff09\u6216\u590d\u5408\u7c7b\u578b\uff0c\u663e\u793a\u6240\u6709\u5217\u3001\u5b83\u4eec\u7684\u7c7b\u578b\u3001\u8868\u7a7a\u95f4\uff08\u5982\u679c\u4e0d\u662f\u9ed8\u8ba4\u7684\uff09\u4ee5\u53ca\u4efb\u4f55\u7279\u6b8a\u5c5e\u6027\uff0c\u5982<code class=\"literal\">NOT NULL</code>\u6216\u9ed8\u8ba4\u503c\u3002\u8fd8\u663e\u793a\u76f8\u5173\u7684\u7d22\u5f15\u3001\u7ea6\u675f\u3001\u89c4\u5219\u548c\u89e6\u53d1\u5668\u3002\u5bf9\u4e8e\u5916\u90e8\u8868\uff0c\u8fd8\u663e\u793a\u5173\u8054\u7684\u5916\u90e8\u670d\u52a1\u5668\u3002\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u5339\u914d\u6a21\u5f0f</span>\u201d</span>\u7684\u5b9a\u4e49\u5728\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"\u6a21\u5f0f\">\u6a21\u5f0f</a>\u4e2d\u3002\uff09</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u67d0\u4e9b\u7c7b\u578b\u7684\u5173\u7cfb\uff0c<code class=\"literal\">\\d</code>\u663e\u793a\u6bcf\u5217\u7684\u9644\u52a0\u4fe1\u606f\uff1a\u5e8f\u5217\u7684\u5217\u503c\uff0c\u7d22\u5f15\u7684\u7d22\u5f15\u8868\u8fbe\u5f0f\uff0c\u5916\u90e8\u8868\u7684\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u547d\u4ee4\u5f62\u5f0f<code class=\"literal\">\\d+</code>\u4e0e\u524d\u8005\u76f8\u540c\uff0c\u4f46\u4f1a\u663e\u793a\u66f4\u591a\u4fe1\u606f\uff1a\u8868\u5217\u5173\u8054\u7684\u6ce8\u91ca\u3001\u8868\u662f\u5426\u5305\u542b OID\u3001\u5f53\u5173\u7cfb\u4e3a\u89c6\u56fe\u65f6\u7684\u89c6\u56fe\u5b9a\u4e49\u3001\u975e\u9ed8\u8ba4\u7684<a class=\"link\" href=\"/docs/16/sql-altertable.html#SQL-ALTERTABLE-REPLICA-IDENTITY\">\u590d\u5236\u6807\u8bc6</a>\u8bbe\u7f6e\uff0c\u4ee5\u53ca\u5f53\u5173\u7cfb\u5177\u6709\u8bbf\u95ee\u65b9\u6cd5\u65f6\u7684<a class=\"link\" href=\"/docs/16/sql-create-access-method.html\" title=\"CREATE ACCESS METHOD\">\u8bbf\u95ee\u65b9\u6cd5</a>\u540d\u79f0\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u4e00\u4e2a\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u4ee5\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528<code class=\"command\">\\d</code>\u800c\u6ca1\u6709<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\uff0c\u5b83\u7b49\u540c\u4e8e<code class=\"command\">\\dtvmsE</code>\uff0c\u5b83\u5c06\u663e\u793a\u6240\u6709\u53ef\u89c1\u7684\u8868\u3001\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u7684\u5217\u8868\u3002\u8fd9\u7eaf\u7cb9\u662f\u4e00\u79cd\u4fbf\u5229\u63aa\u65bd\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DA-LC\"><span class=\"term\"><code class=\"literal\">\\da[S] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u805a\u5408\u51fd\u6570\uff0c\u4ee5\u53ca\u5b83\u4eec\u7684\u8fd4\u56de\u7c7b\u578b\u548c\u6240\u4f5c\u7528\u7684\u6570\u636e\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u805a\u5408\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DA-UC\"><span class=\"term\"><code class=\"literal\">\\dA[+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8bbf\u95ee\u65b9\u6cd5\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bbf\u95ee\u65b9\u6cd5\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u8bbf\u95ee\u65b9\u6cd5\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u7684\u5904\u7406\u5668\u51fd\u6570\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DAC\"><span class=\"term\"><code class=\"literal\">\\dAc[+] [<a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>input-type-pattern</code></em></a>]]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u64cd\u4f5c\u7b26\u7c7b\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/16/xindex.html#XINDEX-OPCLASS\" title=\"38.16.1.\u00a0\u7d22\u5f15\u65b9\u6cd5\u548c\u64cd\u4f5c\u7b26\u7c7b\">\u7b2c\u00a038.16.1\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u7c7b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>input-type-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8f93\u5165\u7c7b\u578b\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u7c7b\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u7c7b\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u548c\u6240\u6709\u8005\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DAF\"><span class=\"term\"><code class=\"literal\">\\dAf[+] [<a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>input-type-pattern</code></em></a>]]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u64cd\u4f5c\u7b26\u65cf\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/16/xindex.html#XINDEX-OPFAMILY\" title=\"38.16.5.\u00a0\u64cd\u4f5c\u7b26\u7c7b\u548c\u64cd\u4f5c\u7b26\u65cf\">\u7b2c\u00a038.16.5\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>input-type-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8f93\u5165\u7c7b\u578b\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u65cf\u90fd\u4f1a\u8fde\u540c\u5176\u6240\u6709\u8005\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DAO\"><span class=\"term\"><code class=\"literal\">\\dAo[+] [<a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>operator-family-pattern</code></em></a>]]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u4e0e\u64cd\u4f5c\u7b26\u65cf\u5173\u8054\u7684\u64cd\u4f5c\u7b26\uff08\u89c1<a class=\"xref\" href=\"/docs/16/xindex.html#XINDEX-STRATEGIES\" title=\"38.16.2.\u00a0\u7d22\u5f15\u65b9\u6cd5\u7b56\u7565\">\u7b2c\u00a038.16.2\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u5173\u8054\u8bbf\u95ee\u65b9\u6cd5\u7684\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u64cd\u4f5c\u7b26\u65cf\u6210\u5458\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>operator-family-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u64cd\u4f5c\u7b26\u65cf\u6210\u5458\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u5217\u51fa\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u7684\u6392\u5e8f\u64cd\u4f5c\u7b26\u65cf\uff08\u5982\u679c\u5b83\u662f\u4e00\u4e2a\u6392\u5e8f\u64cd\u4f5c\u7b26\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DAP\"><span class=\"term\"><code class=\"literal\">\\dAp[+] [<a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>operator-family-pattern</code></em></a>]]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u4e0e\u64cd\u4f5c\u7b26\u65cf\u5173\u8054\u7684\u652f\u6301\u51fd\u6570\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/16/xindex.html#XINDEX-SUPPORT\" title=\"38.16.3.\u00a0\u7d22\u5f15\u65b9\u6cd5\u652f\u6301\u4f8b\u7a0b\">\u7b2c\u00a038.16.3\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u6240\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u51fd\u6570\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>operator-family-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u8be5\u6a21\u5f0f\u5339\u914d\u7684\u64cd\u4f5c\u7b26\u65cf\u51fd\u6570\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u51fd\u6570\u4f1a\u4ee5\u8be6\u7ec6\u5f62\u5f0f\u663e\u793a\uff0c\u5e76\u5e26\u6709\u5176\u5b9e\u9645\u53c2\u6570\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DB\"><span class=\"term\"><code class=\"literal\">\\db[+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8868\u7a7a\u95f4\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8868\u7a7a\u95f4\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u8868\u7a7a\u95f4\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u9009\u9879\u3001\u78c1\u76d8\u5927\u5c0f\u3001\u6743\u9650\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DC-LC\"><span class=\"term\"><code class=\"literal\">\\dc[S+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5b57\u7b26\u96c6\u7f16\u7801\u4e4b\u95f4\u7684\u8f6c\u6362\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8f6c\u6362\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DCONFIG\"><span class=\"term\"><code class=\"literal\">\\dconfig[+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u670d\u52a1\u5668\u914d\u7f6e\u53c2\u6570\u53ca\u5176\u503c\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u53c2\u6570\u3002\u4e0d\u5e26 <em class=\"replaceable\"><code>pattern</code></em> \u65f6\uff0c\u53ea\u5217\u51fa\u88ab\u8bbe\u7f6e\u4e3a\u975e\u9ed8\u8ba4\u503c\u7684\u53c2\u6570\u3002\uff08\u4f7f\u7528 <code class=\"literal\">\\dconfig *</code> \u53ef\u67e5\u770b\u6240\u6709\u53c2\u6570\u3002\uff09\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u53c2\u6570\u90fd\u4f1a\u8fde\u540c\u5176\u6570\u636e\u7c7b\u578b\u3001\u8be5\u53c2\u6570\u53ef\u8bbe\u7f6e\u7684\u4e0a\u4e0b\u6587\u4ee5\u53ca\u8bbf\u95ee\u6743\u9650\uff08\u5982\u679c\u5df2\u6388\u4e88\u975e\u9ed8\u8ba4\u8bbf\u95ee\u6743\u9650\uff09\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DC-UC\"><span class=\"term\"><code class=\"literal\">\\dC[+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u7c7b\u578b\u8f6c\u6362\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u6e90\u7c7b\u578b\u6216\u76ee\u6807\u7c7b\u578b\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u7c7b\u578b\u8f6c\u6362\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u5217\u51fa\u6bcf\u4e2a\u5bf9\u8c61\u5173\u8054\u7684\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DD-LC\"><span class=\"term\"><code class=\"literal\">\\dd[S] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u663e\u793a<code class=\"literal\">constraint</code>\u3001<code class=\"literal\">operator class</code>\u3001<code class=\"literal\">operator family</code>\u3001<code class=\"literal\">rule</code>\u548c <code class=\"literal\">trigger</code>\u7c7b\u578b\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002\u5176\u4ed6\u6ce8\u91ca\u53ef\u901a\u8fc7\u5bf9\u5e94\u5bf9\u8c61\u7c7b\u578b\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u67e5\u770b\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">\\dd</code> \u663e\u793a\u4e0e <em class=\"replaceable\"><code>pattern</code></em> \u5339\u914d\u7684\u5bf9\u8c61\u63cf\u8ff0\uff1b\u5982\u679c\u6ca1\u6709\u7ed9\u51fa\u53c2\u6570\uff0c\u5219\u663e\u793a\u76f8\u5e94\u7c7b\u578b\u7684\u53ef\u89c1\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002\u4f46\u65e0\u8bba\u54ea\u79cd\u60c5\u51b5\uff0c\u53ea\u5217\u51fa\u90a3\u4e9b\u5df2\u6709\u63cf\u8ff0\u7684\u5bf9\u8c61\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528 <a class=\"link\" href=\"/docs/16/sql-comment.html\" title=\"COMMENT\"><code class=\"command\">COMMENT</code></a> <acronym class=\"acronym\">SQL</acronym> \u547d\u4ee4\u521b\u5efa\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DD-UC\"><span class=\"term\"><code class=\"literal\">\\dD[S+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u57df\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u57df\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u6743\u9650\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DDP\"><span class=\"term\"><code class=\"literal\">\\ddp [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u9ed8\u8ba4\u8bbf\u95ee\u6743\u9650\u8bbe\u7f6e\u3002\u5bf9\u4e8e\u6bcf\u4e2a\u9ed8\u8ba4\u6743\u9650\u8bbe\u7f6e\u5df2\u504f\u79bb\u5185\u7f6e\u9ed8\u8ba4\u503c\u7684\u89d2\u8272\uff08\u4ee5\u53ca\u9002\u7528\u65f6\u7684\u6a21\u5f0f\uff09\uff0c\u90fd\u4f1a\u663e\u793a\u4e00\u6761\u8bb0\u5f55\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u89d2\u8272\u540d\u6216\u6a21\u5f0f\u540d\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bb0\u5f55\u3002</p>\n<p lang=\"zh\"><a class=\"link\" href=\"/docs/16/sql-alterdefaultprivileges.html\" title=\"ALTER DEFAULT PRIVILEGES\"><code class=\"command\">ALTER DEFAULT PRIVILEGES</code></a>\u547d\u4ee4\u7528\u4e8e\u8bbe\u7f6e\u9ed8\u8ba4\u8bbf\u95ee\u6743\u9650\u3002\u6743\u9650\u663e\u793a\u7684\u542b\u4e49\u5728<a class=\"xref\" href=\"/docs/16/ddl-priv.html\" title=\"5.7.\u00a0\u6743\u9650\">\u7b2c\u00a05.7\u00a0\u8282</a>\u4e2d\u6709\u89e3\u91ca\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DE\"><span class=\"term\"><code class=\"literal\">\\dE[S+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\di[S+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dm[S+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\ds[S+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dt[S+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dv[S+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd9\u7ec4\u547d\u4ee4\u4e2d\uff0c\u5b57\u6bcd <code class=\"literal\">E</code>\u3001<code class=\"literal\">i</code>\u3001<code class=\"literal\">m</code>\u3001<code class=\"literal\">s</code>\u3001<code class=\"literal\">t</code> \u548c <code class=\"literal\">v</code> \u5206\u522b\u8868\u793a\u5916\u90e8\u8868\u3001\u7d22\u5f15\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u3001\u8868\u548c\u89c6\u56fe\u3002\u4f60\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u6307\u5b9a\u5176\u4e2d\u4efb\u610f\u4e00\u4e2a\u6216\u591a\u4e2a\u5b57\u6bcd\uff0c\u4ee5\u83b7\u53d6\u8fd9\u4e9b\u7c7b\u578b\u5bf9\u8c61\u7684\u5217\u8868\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dti</code> \u4f1a\u5217\u51fa\u8868\u548c\u7d22\u5f15\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u6301\u4e45\u6027\u72b6\u6001\uff08\u6c38\u4e45\u3001\u4e34\u65f6\u6216\u4e0d\u8bb0\u5f55 WAL\uff09\u3001\u78c1\u76d8\u4e0a\u7684\u7269\u7406\u5927\u5c0f\u4ee5\u53ca\u76f8\u5173\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u4e00\u8d77\u5217\u51fa\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u5bf9\u8c61\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DES\"><span class=\"term\"><code class=\"literal\">\\des[+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u670d\u52a1\u5668\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external servers</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u670d\u52a1\u5668\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\des+</code>\u5f62\u5f0f\uff0c\u5219\u663e\u793a\u6bcf\u4e2a\u670d\u52a1\u5668\u7684\u5b8c\u6574\u8bf4\u660e\uff0c\u5305\u62ec\u670d\u52a1\u5668\u7684\u8bbf\u95ee\u6743\u9650\u3001\u7c7b\u578b\u3001\u7248\u672c\u3001\u9009\u9879\u548c\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DET\"><span class=\"term\"><code class=\"literal\">\\det[+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u8868\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external tables</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u8868\u540d\u6216\u6a21\u5f0f\u540d\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6761\u76ee\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\det+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u901a\u7528\u9009\u9879\u548c\u5916\u90e8\u8868\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DEU\"><span class=\"term\"><code class=\"literal\">\\deu[+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u7528\u6237\u6620\u5c04\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external users</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u7528\u6237\u540d\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6620\u5c04\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\deu+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u6620\u5c04\u7684\u9644\u52a0\u4fe1\u606f\u3002</p>\n<div class=\"caution\">\n<h3 class=\"title\" lang=\"zh\">\u5c0f\u5fc3</h3>\n<p lang=\"zh\"><code class=\"literal\">\\deu+</code>\u8fd8\u53ef\u80fd\u663e\u793a\u8fdc\u7a0b\u7528\u6237\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u56e0\u6b64\u5e94\u6ce8\u610f\u4e0d\u8981\u6cc4\u9732\u5b83\u4eec\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DEW\"><span class=\"term\"><code class=\"literal\">\\dew[+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external wrappers</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dew+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u7684\u8bbf\u95ee\u6743\u9650\u3001\u9009\u9879\u548c\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DF-LC\"><span class=\"term\"><code class=\"literal\">\\df[anptwS+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> [ <em class=\"replaceable\"><code>arg_pattern</code></em> ... ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u51fd\u6570\uff0c\u4ee5\u53ca\u5b83\u4eec\u7684\u7ed3\u679c\u6570\u636e\u7c7b\u578b\u3001\u53c2\u6570\u6570\u636e\u7c7b\u578b\u548c\u51fd\u6570\u7c7b\u578b\uff0c\u51fd\u6570\u7c7b\u578b\u5206\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">agg</span>\u201d</span>\uff08\u805a\u5408\uff09\u3001<span class=\"quote\">\u201c<span class=\"quote\">normal</span>\u201d</span>\u3001<span class=\"quote\">\u201c<span class=\"quote\">procedure</span>\u201d</span>\u3001<span class=\"quote\">\u201c<span class=\"quote\">trigger</span>\u201d</span>\u6216<span class=\"quote\">\u201c<span class=\"quote\">window</span>\u201d</span>\u3002\u8981\u53ea\u663e\u793a\u7279\u5b9a\u7c7b\u578b\u7684\u51fd\u6570\uff0c\u8bf7\u5728\u547d\u4ee4\u540e\u6dfb\u52a0\u76f8\u5e94\u7684\u5b57\u6bcd <code class=\"literal\">a</code>\u3001<code class=\"literal\">n</code>\u3001<code class=\"literal\">p</code>\u3001<code class=\"literal\">t</code> \u6216 <code class=\"literal\">w</code>\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u51fd\u6570\u3002\u4efb\u4f55\u9644\u52a0\u53c2\u6570\u90fd\u662f\u7c7b\u578b\u540d\u6a21\u5f0f\uff0c\u5206\u522b\u4e0e\u51fd\u6570\u7b2c\u4e00\u3001\u7b2c\u4e8c\u7b49\u53c2\u6570\u7684\u7c7b\u578b\u540d\u5339\u914d\u3002\uff08\u5339\u914d\u5230\u7684\u51fd\u6570\u53ef\u4ee5\u6bd4\u4f60\u6307\u5b9a\u7684\u53c2\u6570\u66f4\u591a\uff1b\u82e5\u8981\u9632\u6b62\u8fd9\u79cd\u60c5\u51b5\uff0c\u53ef\u5c06\u8fde\u5b57\u7b26 <code class=\"literal\">-</code> \u5199\u6210\u6700\u540e\u4e00\u4e2a <em class=\"replaceable\"><code>arg_pattern</code></em>\u3002\uff09\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u4f7f\u7528 <code class=\"literal\">\\df+</code> \u5f62\u5f0f\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u51fd\u6570\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u6613\u53d8\u6027\u3001\u5e76\u884c\u5b89\u5168\u6027\u3001\u6240\u6709\u8005\u3001\u5b89\u5168\u5206\u7c7b\u3001\u8bbf\u95ee\u6743\u9650\u3001\u8bed\u8a00\u3001\u5185\u90e8\u540d\u79f0\uff08\u4ec5\u9002\u7528\u4e8e C \u548c internal \u51fd\u6570\uff09\u4ee5\u53ca\u63cf\u8ff0\u3002\u7279\u5b9a\u51fd\u6570\u7684\u6e90\u4ee3\u7801\u53ef\u901a\u8fc7 <code class=\"literal\">\\sf</code> \u67e5\u770b\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DF-UC\"><span class=\"term\"><code class=\"literal\">\\dF[+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u914d\u7f6e\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u914d\u7f6e\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dF+</code>\u5f62\u5f0f\uff0c\u5219\u663e\u793a\u6bcf\u4e2a\u914d\u7f6e\u7684\u5b8c\u6574\u8bf4\u660e\uff0c\u5305\u62ec\u5e95\u5c42\u5168\u6587\u68c0\u7d22\u89e3\u6790\u5668\u548c\u6bcf\u79cd\u89e3\u6790\u5668\u8bcd\u5143\u7c7b\u578b\u7684\u8bcd\u5178\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DFD\"><span class=\"term\"><code class=\"literal\">\\dFd[+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u8bcd\u5178\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bcd\u5178\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dFd+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u9009\u4e2d\u8bcd\u5178\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5e95\u5c42\u5168\u6587\u68c0\u7d22\u6a21\u677f\u548c\u9009\u9879\u503c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DFP\"><span class=\"term\"><code class=\"literal\">\\dFp[+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u89e3\u6790\u5668\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u89e3\u6790\u5668\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dFp+</code>\u5f62\u5f0f\uff0c\u5219\u663e\u793a\u6bcf\u4e2a\u89e3\u6790\u5668\u7684\u5b8c\u6574\u8bf4\u660e\uff0c\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u548c\u53ef\u8bc6\u522b\u7684\u8bcd\u5143\u7c7b\u578b\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DFT\"><span class=\"term\"><code class=\"literal\">\\dFt[+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u6a21\u677f\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6a21\u677f\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dFt+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u6a21\u677f\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u540d\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DG\"><span class=\"term\"><code class=\"literal\">\\dg[S+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u5e93\u89d2\u8272\u3002\uff08\u7531\u4e8e<span class=\"quote\">\u201c<span class=\"quote\">\u7528\u6237</span>\u201d</span>\u548c<span class=\"quote\">\u201c<span class=\"quote\">\u7ec4</span>\u201d</span>\u7684\u6982\u5ff5\u5df2\u7ecf\u7edf\u4e00\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">\u89d2\u8272</span>\u201d</span>\uff0c\u6b64\u547d\u4ee4\u73b0\u5728\u7b49\u4ef7\u4e8e<code class=\"literal\">\\du</code>\u3002\uff09\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u89d2\u8272\uff1b\u63d0\u4f9b<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u89d2\u8272\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u89d2\u8272\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dg+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u89d2\u8272\u7684\u9644\u52a0\u4fe1\u606f\uff1b\u76ee\u524d\u4f1a\u589e\u52a0\u6bcf\u4e2a\u89d2\u8272\u7684\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DL-LC\"><span class=\"term\"><code class=\"literal\">\\dl[+]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u662f <code class=\"command\">\\lo_list</code> \u7684\u522b\u540d\uff0c\u540e\u8005\u4f1a\u663e\u793a\u5927\u5bf9\u8c61\u5217\u8868\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u5217\u51fa\u6bcf\u4e2a\u5927\u5bf9\u8c61\u7684\u76f8\u5173\u6743\u9650\uff08\u5982\u679c\u6709\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DL-UC\"><span class=\"term\"><code class=\"literal\">\\dL[S+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8fc7\u7a0b\u8bed\u8a00\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bed\u8a00\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u8bed\u8a00\uff1b\u63d0\u4f9b <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u79cd\u8bed\u8a00\u90fd\u4f1a\u8fde\u540c\u5176\u8c03\u7528\u5904\u7406\u5668\u3001\u9a8c\u8bc1\u5668\u3001\u8bbf\u95ee\u6743\u9650\u4ee5\u53ca\u5b83\u662f\u5426\u4e3a\u7cfb\u7edf\u5bf9\u8c61\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DN\"><span class=\"term\"><code class=\"literal\">\\dn[S+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6a21\u5f0f\uff08\u547d\u540d\u7a7a\u95f4\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6a21\u5f0f\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u6743\u9650\u548c\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DO-LC\"><span class=\"term\"><code class=\"literal\">\\do[S+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> [ <em class=\"replaceable\"><code>arg_pattern</code></em> [ <em class=\"replaceable\"><code>arg_pattern</code></em> ] ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u64cd\u4f5c\u7b26\u53ca\u5176\u64cd\u4f5c\u6570\u7c7b\u578b\u548c\u7ed3\u679c\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u64cd\u4f5c\u7b26\u3002\u5982\u679c\u6307\u5b9a\u4e86\u4e00\u4e2a <em class=\"replaceable\"><code>arg_pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u5176\u53f3\u53c2\u6570\u7c7b\u578b\u540d\u79f0\u4e0e\u8be5\u6a21\u5f0f\u5339\u914d\u7684\u524d\u7f00\u64cd\u4f5c\u7b26\u3002\u5982\u679c\u6307\u5b9a\u4e86\u4e24\u4e2a <em class=\"replaceable\"><code>arg_pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u53c2\u6570\u7c7b\u578b\u540d\u79f0\u4e0e\u8fd9\u4e9b\u6a21\u5f0f\u5339\u914d\u7684\u4e8c\u5143\u64cd\u4f5c\u7b26\u3002\uff08\u5bf9\u4e8e\u4e00\u5143\u64cd\u4f5c\u7b26\u672a\u4f7f\u7528\u7684\u53c2\u6570\uff0c\u4e5f\u53ef\u4ee5\u5199\u6210 <code class=\"literal\">-</code>\u3002\uff09\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u76ee\u524d\u4ec5\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u540d\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DO-UC\"><span class=\"term\"><code class=\"literal\">\\dO[S+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6392\u5e8f\u89c4\u5219\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6392\u5e8f\u89c4\u5219\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u6392\u5e8f\u89c4\u5219\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u4e00\u8d77\u5217\u51fa\u3002\u8bf7\u6ce8\u610f\uff0c\u53ea\u4f1a\u663e\u793a\u4e0e\u5f53\u524d\u6570\u636e\u5e93\u7f16\u7801\u517c\u5bb9\u7684\u6392\u5e8f\u89c4\u5219\uff0c\u56e0\u6b64\u5728\u540c\u4e00\u5b89\u88c5\u4e2d\u7684\u4e0d\u540c\u6570\u636e\u5e93\u91cc\u7ed3\u679c\u53ef\u80fd\u4e0d\u540c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DP-LC\"><span class=\"term\"><code class=\"literal\">\\dp[S] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u53ca\u5176\u76f8\u5173\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n<p lang=\"zh\"><a class=\"link\" href=\"/docs/16/sql-grant.html\" title=\"GRANT\"><code class=\"command\">GRANT</code></a>\u548c <a class=\"link\" href=\"/docs/16/sql-revoke.html\" title=\"REVOKE\"><code class=\"command\">REVOKE</code></a> \u547d\u4ee4\u7528\u4e8e\u8bbe\u7f6e\u8bbf\u95ee\u6743\u9650\u3002\u6743\u9650\u663e\u793a\u7684\u542b\u4e49\u5728<a class=\"xref\" href=\"/docs/16/ddl-priv.html\" title=\"5.7.\u00a0\u6743\u9650\">\u7b2c\u00a05.7\u00a0\u8282</a>\u4e2d\u6709\u89e3\u91ca\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DP-UC\"><span class=\"term\"><code class=\"literal\">\\dP[itn+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5206\u533a\u5173\u7cfb\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6761\u76ee\u3002\u53ef\u4ee5\u5728\u547d\u4ee4\u540e\u9644\u52a0\u4fee\u9970\u7b26<code class=\"literal\">t</code>\uff08\u8868\uff09\u548c<code class=\"literal\">i</code>\uff08\u7d22\u5f15\uff09\uff0c\u7b5b\u9009\u8981\u5217\u51fa\u7684\u5173\u7cfb\u7c7b\u578b\u3002\u9ed8\u8ba4\u4f1a\u5217\u51fa\u5206\u533a\u8868\u548c\u5206\u533a\u7d22\u5f15\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528\u4e86\u4fee\u9970\u7b26<code class=\"literal\">n</code>\uff08<span class=\"quote\">\u201c<span class=\"quote\">nested</span>\u201d</span>\uff09\uff0c\u6216\u6307\u5b9a\u4e86\u6a21\u5f0f\uff0c\u5219\u4f1a\u5305\u542b\u975e\u6839\u5206\u533a\u5173\u7cfb\uff0c\u5e76\u663e\u793a\u4e00\u5217\uff0c\u5217\u51fa\u6bcf\u4e2a\u5206\u533a\u5173\u7cfb\u7684\u7236\u5173\u7cfb\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u5173\u7cfb\u7684\u5404\u4e2a\u5206\u533a\u7684\u5927\u5c0f\u4e4b\u548c\uff0c\u4ee5\u53ca\u8be5\u5173\u7cfb\u7684\u63cf\u8ff0\u3002\u5982\u679c\u5c06<code class=\"literal\">n</code>\u4e0e<code class=\"literal\">+</code>\u7ed3\u5408\u4f7f\u7528\uff0c\u5219\u663e\u793a\u4e24\u4e2a\u5927\u5c0f\uff1a\u4e00\u4e2a\u662f\u76f4\u63a5\u9644\u52a0\u7684\u53f6\u5b50\u5206\u533a\u7684\u603b\u5927\u5c0f\uff0c\u53e6\u4e00\u4e2a\u662f\u6240\u6709\u5206\u533a\u7684\u603b\u5927\u5c0f\uff0c\u5305\u62ec\u95f4\u63a5\u9644\u52a0\u7684\u5b50\u5206\u533a\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DRDS\"><span class=\"term\"><code class=\"literal\">\\drds [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>role-pattern</code></em></a> [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>database-pattern</code></em></a> ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5df2\u5b9a\u4e49\u7684\u914d\u7f6e\u8bbe\u7f6e\u3002\u8fd9\u4e9b\u8bbe\u7f6e\u53ef\u4ee5\u7279\u5b9a\u4e8e\u89d2\u8272\u3001\u7279\u5b9a\u4e8e\u6570\u636e\u5e93\uff0c\u6216\u540c\u65f6\u7279\u5b9a\u4e8e\u4e24\u8005\u3002<em class=\"replaceable\"><code>role-pattern</code></em>\u548c<em class=\"replaceable\"><code>database-pattern</code></em>\u5206\u522b\u7528\u4e8e\u9009\u62e9\u8981\u5217\u51fa\u7684\u89d2\u8272\u548c\u6570\u636e\u5e93\u3002\u7701\u7565\u67d0\u4e2a\u6a21\u5f0f\u53c2\u6570\u6216\u5c06\u5176\u6307\u5b9a\u4e3a<code class=\"literal\">*</code>\u65f6\uff0c\u4e0d\u4f1a\u6309\u8be5\u53c2\u6570\u7b5b\u9009\uff0c\u8fd8\u4f1a\u5206\u522b\u5305\u542b\u4e0d\u7279\u5b9a\u4e8e\u89d2\u8272\u6216\u4e0d\u7279\u5b9a\u4e8e\u6570\u636e\u5e93\u7684\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\"><a class=\"link\" href=\"/docs/16/sql-alterrole.html\" title=\"ALTER ROLE\"><code class=\"command\">ALTER ROLE</code></a>\u548c <a class=\"link\" href=\"/docs/16/sql-alterdatabase.html\" title=\"ALTER DATABASE\"><code class=\"command\">ALTER DATABASE</code></a> \u547d\u4ee4\u7528\u4e8e\u5b9a\u4e49\u6bcf\u4e2a\u89d2\u8272\u548c\u6bcf\u4e2a\u6570\u636e\u5e93\u7684\u914d\u7f6e\u8bbe\u7f6e\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DRG\"><span class=\"term\"><code class=\"literal\">\\drg[S] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u6bcf\u4e2a\u88ab\u6388\u4e88\u89d2\u8272\u6210\u5458\u8eab\u4efd\u7684\u4fe1\u606f\uff0c\u5305\u62ec\u88ab\u6388\u4e88\u7684\u9009\u9879\uff08<code class=\"literal\">ADMIN</code>\u3001<code class=\"literal\">INHERIT</code> \u548c/\u6216 <code class=\"literal\">SET</code>\uff09\u4ee5\u53ca\u6388\u4e88\u8005\u3002\u5173\u4e8e\u89d2\u8272\u6210\u5458\u8eab\u4efd\uff0c\u53c2\u89c1 <a class=\"link\" href=\"/docs/16/sql-grant.html\" title=\"GRANT\"><code class=\"command\">GRANT</code></a> \u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u6388\u4e88\u7528\u6237\u521b\u5efa\u89d2\u8272\u7684\u6210\u5458\u8eab\u4efd\uff1b\u63d0\u4f9b <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u89d2\u8272\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u6388\u4e88\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u89d2\u8272\u7684\u6210\u5458\u8eab\u4efd\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DRP\"><span class=\"term\"><code class=\"literal\">\\dRp[+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u903b\u8f91\u590d\u5236\u53d1\u5e03\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u53d1\u5e03\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u8fd8\u4f1a\u663e\u793a\u4e0e\u6bcf\u4e2a\u53d1\u5e03\u5173\u8054\u7684\u8868\u548c\u6a21\u5f0f\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DRS\"><span class=\"term\"><code class=\"literal\">\\dRs[+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u903b\u8f91\u590d\u5236\u8ba2\u9605\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8ba2\u9605\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u8ba2\u9605\u7684\u5176\u4ed6\u5c5e\u6027\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DT\"><span class=\"term\"><code class=\"literal\">\\dT[S+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u7c7b\u578b\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u7c7b\u578b\u90fd\u4f1a\u8fde\u540c\u5176\u5185\u90e8\u540d\u79f0\u3001\u5927\u5c0f\u4ee5\u53ca\u76f8\u5173\u6743\u9650\u4e00\u8d77\u5217\u51fa\uff1b\u5bf9\u4e8e <code class=\"type\">enum</code> \u7c7b\u578b\uff0c\u8fd8\u4f1a\u663e\u793a\u5176\u5141\u8bb8\u503c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DU\"><span class=\"term\"><code class=\"literal\">\\du[S+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u5e93\u89d2\u8272\u3002\uff08\u7531\u4e8e<span class=\"quote\">\u201c<span class=\"quote\">\u7528\u6237</span>\u201d</span>\u548c<span class=\"quote\">\u201c<span class=\"quote\">\u7ec4</span>\u201d</span>\u7684\u6982\u5ff5\u5df2\u7ecf\u7edf\u4e00\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">\u89d2\u8272</span>\u201d</span>\uff0c\u6b64\u547d\u4ee4\u73b0\u5728\u7b49\u4ef7\u4e8e<code class=\"literal\">\\dg</code>\u3002\uff09\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u89d2\u8272\uff1b\u63d0\u4f9b<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u89d2\u8272\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u89d2\u8272\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\du+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u89d2\u8272\u7684\u9644\u52a0\u4fe1\u606f\uff1b\u76ee\u524d\u4f1a\u589e\u52a0\u6bcf\u4e2a\u89d2\u8272\u7684\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DX-LC\"><span class=\"term\"><code class=\"literal\">\\dx[+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5df2\u5b89\u88c5\u7684\u6269\u5c55\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6269\u5c55\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dx+</code>\u5f62\u5f0f\uff0c\u5219\u5217\u51fa\u5c5e\u4e8e\u6bcf\u4e2a\u5339\u914d\u6269\u5c55\u7684\u6240\u6709\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DX-UC\"><span class=\"term\"><code class=\"literal\">\\dX [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u6269\u5c55\u7edf\u8ba1\u4fe1\u606f\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6269\u5c55\u7edf\u8ba1\u4fe1\u606f\u3002</p>\n<p lang=\"zh\">\u6bcf\u79cd\u6269\u5c55\u7edf\u8ba1\u7684\u72b6\u6001\u663e\u793a\u5728\u4ee5\u7edf\u8ba1\u79cd\u7c7b\u547d\u540d\u7684\u5217\u4e2d\uff0c\u4f8b\u5982 Ndistinct\u3002defined \u8868\u793a\u521b\u5efa\u7edf\u8ba1\u65f6\u8bf7\u6c42\u4e86\u8be5\u7edf\u8ba1\uff0cNULL \u8868\u793a\u672a\u8bf7\u6c42\u3002\u82e5\u8981\u5224\u65ad ANALYZE \u662f\u5426\u8fd0\u884c\u8fc7\u3001\u7edf\u8ba1\u662f\u5426\u53ef\u4f9b\u89c4\u5212\u5668\u4f7f\u7528\uff0c\u53ef\u67e5\u8be2 pg_stats_ext\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DY\"><span class=\"term\"><code class=\"literal\">\\dy[+] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u4e8b\u4ef6\u89e6\u53d1\u5668\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u4e8b\u4ef6\u89e6\u53d1\u5668\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-EDIT\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\e</code> \u6216 <code class=\"literal\">\\edit</code> <code class=\"literal\">[ <span class=\"optional\"><em class=\"replaceable\"><code>filename</code></em></span> ] [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5219\u7f16\u8f91\u8be5\u6587\u4ef6\uff1b\u7f16\u8f91\u5668\u9000\u51fa\u540e\uff0c\u6587\u4ef6\u5185\u5bb9\u5c06\u88ab\u590d\u5236\u5230\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5219\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u590d\u5236\u5230\u4e34\u65f6\u6587\u4ef6\u4e2d\uff0c\u7136\u540e\u4ee5\u76f8\u540c\u65b9\u5f0f\u8fdb\u884c\u7f16\u8f91\u3002\u6216\u8005\uff0c\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u5c06\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u590d\u5236\u5230\u4e34\u65f6\u6587\u4ef6\u4e2d\uff0c\u5e76\u4ee5\u76f8\u540c\u65b9\u5f0f\u8fdb\u884c\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7f16\u8f91\u6587\u4ef6\u6216\u4e0a\u4e00\u4e2a\u67e5\u8be2\u540e\u5728\u672a\u4fee\u6539\u6587\u4ef6\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5219\u67e5\u8be2\u7f13\u51b2\u533a\u5c06\u88ab\u6e05\u9664\u3002\u5426\u5219\uff0c\u67e5\u8be2\u7f13\u51b2\u533a\u7684\u65b0\u5185\u5bb9\u5c06\u6839\u636e<span class=\"application\">psql</span>\u7684\u6b63\u5e38\u89c4\u5219\u91cd\u65b0\u89e3\u6790\uff0c\u5c06\u6574\u4e2a\u7f13\u51b2\u533a\u89c6\u4e3a\u5355\u884c\u3002\u4efb\u4f55\u5b8c\u6574\u7684\u67e5\u8be2\u5c06\u7acb\u5373\u6267\u884c\uff1b\u4e5f\u5c31\u662f\u8bf4\uff0c\u5982\u679c\u67e5\u8be2\u7f13\u51b2\u533a\u5305\u542b\u5206\u53f7\u6216\u4ee5\u5206\u53f7\u7ed3\u5c3e\uff0c\u5219\u6267\u884c\u5e76\u4ece\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u5220\u9664\u5230\u8be5\u70b9\u7684\u6240\u6709\u5185\u5bb9\u3002\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u5269\u4f59\u7684\u5185\u5bb9\u5c06\u91cd\u65b0\u663e\u793a\u3002\u8f93\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u8f93\u5165<code class=\"literal\">\\r</code>\u901a\u8fc7\u6e05\u9664\u67e5\u8be2\u7f13\u51b2\u533a\u6765\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u5c06\u7f13\u51b2\u533a\u89c6\u4e3a\u5355\u884c\u4e3b\u8981\u5f71\u54cd\u5143\u547d\u4ee4\uff1a\u5728\u5143\u547d\u4ee4\u540e\u7684\u7f13\u51b2\u533a\u5c06\u88ab\u89c6\u4e3a\u5143\u547d\u4ee4\u7684\u53c2\u6570\uff0c\u5373\u4f7f\u5b83\u8de8\u8d8a\u591a\u884c\u3002\uff08\u56e0\u6b64\uff0c\u4e0d\u80fd\u7528\u8fd9\u79cd\u65b9\u5f0f\u521b\u5efa\u4f7f\u7528\u5143\u547d\u4ee4\u7684\u811a\u672c\u3002\u8bf7\u4f7f\u7528<code class=\"command\">\\i</code>\u3002\uff09</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u5c06\u5149\u6807\u5b9a\u4f4d\u5728\u6587\u4ef6\u6216\u67e5\u8be2\u7f13\u51b2\u533a\u7684\u6307\u5b9a\u884c\u4e0a\u3002\u8bf7\u6ce8\u610f\uff0c\u5982\u679c\u53ea\u7ed9\u51fa\u4e00\u4e2a\u5168\u662f\u6570\u5b57\u7684\u53c2\u6570\uff0c<span class=\"application\">psql</span>\u4f1a\u5047\u5b9a\u5b83\u662f\u4e00\u4e2a\u884c\u53f7\uff0c\u800c\u4e0d\u662f\u6587\u4ef6\u540d\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5173\u4e8e\u5982\u4f55\u914d\u7f6e\u548c\u81ea\u5b9a\u4e49\u7f16\u8f91\u5668\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/16/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"\u73af\u5883\">\u73af\u5883</a>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-ECHO\"><span class=\"term\"><code class=\"literal\">\\echo <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6c42\u503c\u540e\u7684\u53c2\u6570\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff0c\u7528\u7a7a\u683c\u5206\u9694\uff0c\u5e76\u5728\u672b\u5c3e\u52a0\u4e0a\u6362\u884c\u7b26\u3002\u8fd9\u5bf9\u4e8e\u5728\u811a\u672c\u8f93\u51fa\u4e2d\u7a7f\u63d2\u4fe1\u606f\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>\\echo `date`</code></strong>\nTue Oct 26 21:40:57 CEST 1999\n</pre>\n<p lang=\"zh\">\u5982\u679c\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f\u672a\u52a0\u5f15\u53f7\u7684<code class=\"literal\">-n</code>\uff0c\u5219\u4e0d\u4f1a\u5199\u5165\u5c3e\u968f\u7684\u6362\u884c\u7b26\uff08\u4e5f\u4e0d\u4f1a\u5199\u5165\u7b2c\u4e00\u4e2a\u53c2\u6570\uff09\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528<code class=\"command\">\\o</code>\u547d\u4ee4\u91cd\u5b9a\u5411\u67e5\u8be2\u8f93\u51fa\uff0c\u53ef\u80fd\u4f1a\u60f3\u7528<code class=\"command\">\\qecho</code>\u4ee3\u66ff\u8fd9\u4e2a\u547d\u4ee4\u3002\u53e6\u8bf7\u53c2\u9605<code class=\"command\">\\warn</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-EF\"><span class=\"term\"><code class=\"literal\">\\ef [ <span class=\"optional\"><em class=\"replaceable\"><code>function_description</code></em> [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</span> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u7f16\u8f91\u6307\u5b9a\u51fd\u6570\u6216\u8fc7\u7a0b\u7684\u5b9a\u4e49\uff0c\u5f62\u5f0f\u4e3a<code class=\"command\">CREATE OR REPLACE FUNCTION</code>\u6216 <code class=\"command\">CREATE OR REPLACE PROCEDURE</code>\u547d\u4ee4\u3002\u7f16\u8f91\u65b9\u5f0f\u4e0e<code class=\"literal\">\\edit</code>\u76f8\u540c\u3002\u5982\u679c\u5728\u4e0d\u4fdd\u5b58\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5219\u8be5\u8bed\u53e5\u4f1a\u88ab\u4e22\u5f03\u3002\u5982\u679c\u4fdd\u5b58\u5e76\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5e76\u5728\u5176\u4e2d\u6dfb\u52a0\u4e86\u5206\u53f7\uff0c\u5219\u66f4\u65b0\u540e\u7684\u547d\u4ee4\u4f1a\u7acb\u5373\u6267\u884c\u3002\u5426\u5219\u5b83\u4f1a\u91cd\u65b0\u663e\u793a\uff1b\u952e\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u7528<code class=\"literal\">\\r</code>\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u76ee\u6807\u51fd\u6570\u53ef\u4ec5\u7528\u540d\u79f0\u6307\u5b9a\uff0c\u4e5f\u53ef\u7528\u540d\u79f0\u548c\u53c2\u6570\u6307\u5b9a\uff0c\u4f8b\u5982 foo(integer, text)\u3002\u82e5\u6709\u591a\u4e2a\u540c\u540d\u51fd\u6570\uff0c\u5219\u5fc5\u987b\u63d0\u4f9b\u53c2\u6570\u7c7b\u578b\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u51fd\u6570\uff0c\u5219\u4f1a\u5448\u73b0\u4e00\u4e2a\u7a7a\u7684<code class=\"command\">CREATE FUNCTION</code>\u6a21\u677f\u4f9b\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u5c06\u5149\u6807\u5b9a\u4f4d\u5728\u51fd\u6570\u4f53\u7684\u6307\u5b9a\u884c\u4e0a\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u51fd\u6570\u4f53\u901a\u5e38\u4e0d\u4f1a\u4ece\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u5f00\u59cb\u3002\uff09</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\ef</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5173\u4e8e\u5982\u4f55\u914d\u7f6e\u548c\u81ea\u5b9a\u4e49\u7f16\u8f91\u5668\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/16/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"\u73af\u5883\">\u73af\u5883</a>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-ENCODING\"><span class=\"term\"><code class=\"literal\">\\encoding [ <em class=\"replaceable\"><code>encoding</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5ba2\u6237\u7aef\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u6ca1\u6709\u53c2\u6570\u65f6\uff0c\u6b64\u547d\u4ee4\u663e\u793a\u5f53\u524d\u7f16\u7801\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-ERRVERBOSE\"><span class=\"term\"><code class=\"literal\">\\errverbose</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ee5\u6700\u5927\u7684\u8be6\u7ec6\u7a0b\u5ea6\u91cd\u590d\u6700\u8fd1\u7684\u670d\u52a1\u5668\u9519\u8bef\u6d88\u606f\uff0c\u5c31\u597d\u50cf<code class=\"varname\">VERBOSITY</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">verbose</code>\uff0c<code class=\"varname\">SHOW_CONTEXT</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">always</code>\u4e00\u6837\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-EV\"><span class=\"term\"><code class=\"literal\">\\ev [ <span class=\"optional\"><em class=\"replaceable\"><code>view_name</code></em> [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</span> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u7f16\u8f91\u6307\u5b9a\u89c6\u56fe\u7684\u5b9a\u4e49\uff0c\u5f62\u5f0f\u4e3a<code class=\"command\">CREATE OR REPLACE VIEW</code>\u547d\u4ee4\u3002\u7f16\u8f91\u65b9\u5f0f\u4e0e<code class=\"literal\">\\edit</code>\u76f8\u540c\u3002\u5982\u679c\u5728\u4e0d\u4fdd\u5b58\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5219\u8be5\u8bed\u53e5\u4f1a\u88ab\u4e22\u5f03\u3002\u5982\u679c\u4fdd\u5b58\u5e76\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5e76\u5728\u5176\u4e2d\u6dfb\u52a0\u4e86\u5206\u53f7\uff0c\u5219\u66f4\u65b0\u540e\u7684\u547d\u4ee4\u4f1a\u7acb\u5373\u6267\u884c\uff1b\u5426\u5219\u5c06\u91cd\u65b0\u663e\u793a\uff1b\u8f93\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u7528<code class=\"literal\">\\r</code>\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u89c6\u56fe\uff0c\u5219\u4f1a\u5448\u73b0\u4e00\u4e2a\u7a7a\u7684<code class=\"command\">CREATE VIEW</code>\u6a21\u677f\u4f9b\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u5c06\u5149\u6807\u5b9a\u4f4d\u5728\u89c6\u56fe\u5b9a\u4e49\u7684\u6307\u5b9a\u884c\u4e0a\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\ev</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-F\"><span class=\"term\"><code class=\"literal\">\\f [ <em class=\"replaceable\"><code>string</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u67e5\u8be2\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u9ed8\u8ba4\u503c\u662f\u7ad6\u7ebf\uff08<code class=\"literal\">|</code>\uff09\u3002\u5b83\u7b49\u540c\u4e8e<code class=\"command\">\\pset fieldsep</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-G\"><span class=\"term\"><code class=\"literal\">\\g [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\g [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u6267\u884c\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728<code class=\"literal\">\\g</code>\u540e\u9762\u51fa\u73b0\u62ec\u53f7\uff0c\u5219\u62ec\u53f7\u4e2d\u662f\u7528\u7a7a\u683c\u5206\u9694\u7684<em class=\"replaceable\"><code>option</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em>\u683c\u5f0f\u9009\u9879\u5b50\u53e5\u5217\u8868\u3002\u8fd9\u4e9b\u5b50\u53e5\u7684\u89e3\u91ca\u65b9\u5f0f\u4e0e<code class=\"literal\">\\pset</code> <em class=\"replaceable\"><code>option</code></em> <em class=\"replaceable\"><code>value</code></em>\u547d\u4ee4\u76f8\u540c\uff0c\u4f46\u4ec5\u5728\u6b64\u67e5\u8be2\u6267\u884c\u671f\u95f4\u751f\u6548\u3002\u5728\u6b64\u5217\u8868\u4e2d\uff0c<code class=\"literal\">=</code>\u7b26\u53f7\u5468\u56f4\u4e0d\u5141\u8bb8\u6709\u7a7a\u683c\uff0c\u4f46\u9009\u9879\u5b50\u53e5\u4e4b\u95f4\u5fc5\u987b\u6709\u7a7a\u683c\u3002\u5982\u679c<code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em>\u88ab\u7701\u7565\uff0c\u5219\u6307\u5b9a\u7684<em class=\"replaceable\"><code>option</code></em>\u4f1a\u6309\u4ee5\u4e0b\u547d\u4ee4\u7684\u65b9\u5f0f\u66f4\u6539\uff1a<code class=\"literal\">\\pset</code> <em class=\"replaceable\"><code>option</code></em>\uff0c\u5176\u4e2d\u4e0d\u663e\u5f0f\u6307\u5b9a<em class=\"replaceable\"><code>value</code></em>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7ed9\u51fa\u4e86<em class=\"replaceable\"><code>filename</code></em>\u6216<code class=\"literal\">|</code><em class=\"replaceable\"><code>command</code></em>\u53c2\u6570\uff0c\u67e5\u8be2\u8f93\u51fa\u5c31\u4f1a\u5199\u5165\u6307\u5b9a\u6587\u4ef6\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6307\u5b9a\u7684 shell \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u7167\u5e38\u663e\u793a\u3002\u53ea\u6709\u5f53\u67e5\u8be2\u6210\u529f\u8fd4\u56de\u96f6\u4e2a\u6216\u591a\u4e2a\u5143\u7ec4\u65f6\uff0c\u624d\u4f1a\u5411\u6587\u4ef6\u6216\u547d\u4ee4\u5199\u5165\uff1b\u5982\u679c\u67e5\u8be2\u5931\u8d25\uff0c\u6216\u6267\u884c\u7684\u662f\u4e0d\u8fd4\u56de\u6570\u636e\u7684 SQL \u547d\u4ee4\uff0c\u5219\u4e0d\u4f1a\u5199\u5165\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u5c06\u88ab\u91cd\u65b0\u6267\u884c\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u6ca1\u6709\u4efb\u4f55\u53c2\u6570\u7684<code class=\"literal\">\\g</code>\u57fa\u672c\u4e0a\u7b49\u540c\u4e8e\u4e00\u4e2a\u5206\u53f7\u3002\u5e26\u6709\u53c2\u6570\u7684<code class=\"literal\">\\g</code>\u63d0\u4f9b\u4e86\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u4e00\u6b21\u6027</span>\u201d</span>\u66ff\u4ee3<code class=\"command\">\\o</code>\u547d\u4ee4\u7684\u9009\u62e9\uff0c\u5e76\u4e14\u8fd8\u5141\u8bb8\u4e00\u6b21\u6027\u8c03\u6574\u901a\u5e38\u7531<code class=\"literal\">\\pset</code>\u8bbe\u7f6e\u7684\u8f93\u51fa\u683c\u5f0f\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u5f53\u6700\u540e\u4e00\u4e2a\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\u65f6\uff0c\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u90fd\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u65e2\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\uff0c\u4e5f\u4e0d\u8fdb\u884c\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u90e8\u5206\u4f1a\u76f4\u63a5\u6309\u5b57\u9762\u4f20\u7ed9 shell\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-GDESC\"><span class=\"term\"><code class=\"literal\">\\gdesc</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u663e\u793a\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u67e5\u8be2\u7ed3\u679c\u7684\u63cf\u8ff0\uff08\u5373\u5217\u540d\u548c\u6570\u636e\u7c7b\u578b\uff09\u3002\u67e5\u8be2\u5e76\u4e0d\u4f1a\u5b9e\u9645\u6267\u884c\uff1b\u4e0d\u8fc7\uff0c\u5982\u679c\u5176\u4e2d\u5b58\u5728\u8bed\u6cd5\u9519\u8bef\uff0c\u4f1a\u6309\u901a\u5e38\u7684\u65b9\u5f0f\u62a5\u544a\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6539\u4e3a\u63cf\u8ff0\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-GETENV\"><span class=\"term\"><code class=\"literal\">\\getenv <em class=\"replaceable\"><code>psql_var</code></em> <em class=\"replaceable\"><code>env_var</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u83b7\u53d6\u73af\u5883\u53d8\u91cf<em class=\"replaceable\"><code>env_var</code></em>\u7684\u503c\uff0c\u5e76\u5c06\u5176\u8d4b\u7ed9<span class=\"application\">psql</span>\u53d8\u91cf<em class=\"replaceable\"><code>psql_var</code></em>\u3002\u5982\u679c<em class=\"replaceable\"><code>env_var</code></em>\u5728<span class=\"application\">psql</span>\u8fdb\u7a0b\u7684\u73af\u5883\u4e2d\u672a\u5b9a\u4e49\uff0c<em class=\"replaceable\"><code>psql_var</code></em>\u4e0d\u4f1a\u88ab\u6539\u53d8\u3002\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>\\getenv home HOME</code></strong>\n=&gt; <strong class=\"userinput\"><code>\\echo :home</code></strong>\n/home/postgres\n</pre>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-GEXEC\"><span class=\"term\"><code class=\"literal\">\\gexec</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u7136\u540e\u5c06\u67e5\u8be2\u8f93\u51fa\u7684\u6bcf\u884c\u6bcf\u5217\u89c6\u4e3a\u8981\u6267\u884c\u7684SQL\u8bed\u53e5\u3002\u4f8b\u5982\uff0c\u8981\u5728<code class=\"structname\">my_table</code>\u7684\u6bcf\u4e00\u5217\u4e0a\u521b\u5efa\u7d22\u5f15\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT format('create index on my_table(%I)', attname)</code></strong>\n-&gt; <strong class=\"userinput\"><code>FROM pg_attribute</code></strong>\n-&gt; <strong class=\"userinput\"><code>WHERE attrelid = 'my_table'::regclass AND attnum &gt; 0</code></strong>\n-&gt; <strong class=\"userinput\"><code>ORDER BY attnum</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gexec</code></strong>\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\n</pre>\n<p lang=\"zh\">\u751f\u6210\u7684\u67e5\u8be2\u6309\u8fd4\u56de\u884c\u7684\u987a\u5e8f\u6267\u884c\uff1b\u540c\u4e00\u884c\u6709\u591a\u5217\u65f6\u4ece\u5de6\u5230\u53f3\u6267\u884c\uff0c\u5ffd\u7565 NULL \u5b57\u6bb5\u3002\u67e5\u8be2\u539f\u6837\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u56e0\u6b64\u4e0d\u80fd\u662f psql \u5143\u547d\u4ee4\uff0c\u4e5f\u4e0d\u80fd\u5305\u542b psql \u53d8\u91cf\u5f15\u7528\u3002\u9664\u975e\u8bbe\u7f6e ON_ERROR_STOP\uff0c\u67d0\u6761\u67e5\u8be2\u5931\u8d25\u540e\u4ecd\u7ee7\u7eed\u6267\u884c\u5176\u4f59\u67e5\u8be2\u3002\u6bcf\u6761\u67e5\u8be2\u5747\u9075\u5faa ECHO \u8bbe\u7f6e\uff08\u4f7f\u7528 \\gexec \u65f6\uff0c\u901a\u5e38\u5efa\u8bae\u5c06 ECHO \u8bbe\u4e3a all \u6216 queries\uff09\uff0c\u67e5\u8be2\u65e5\u5fd7\u3001\u5355\u6b65\u6a21\u5f0f\u3001\u8ba1\u65f6\u7b49\u6267\u884c\u529f\u80fd\u4e5f\u5206\u522b\u5e94\u7528\u4e8e\u6bcf\u6761\u751f\u6210\u7684\u67e5\u8be2\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-GSET\"><span class=\"term\"><code class=\"literal\">\\gset [ <em class=\"replaceable\"><code>prefix</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u5e76\u5c06\u67e5\u8be2\u8f93\u51fa\u5b58\u5165 <span class=\"application\">psql</span> \u53d8\u91cf\uff08\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/16/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\uff09\u3002\u8981\u6267\u884c\u7684\u67e5\u8be2\u5fc5\u987b\u6070\u597d\u8fd4\u56de\u4e00\u884c\u3002\u8be5\u884c\u7684\u6bcf\u4e00\u5217\u5206\u522b\u5b58\u5165\u4e00\u4e2a\u53d8\u91cf\uff0c\u53d8\u91cf\u540d\u4e0e\u5217\u540d\u76f8\u540c\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT 'hello' AS var1, 10 AS var2</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gset</code></strong>\n=&gt; <strong class=\"userinput\"><code>\\echo :var1 :var2</code></strong>\nhello 10\n</pre>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>prefix</code></em>\uff0c\u5219\u4f1a\u5c06\u8be5\u5b57\u7b26\u4e32\u52a0\u5230\u67e5\u8be2\u7684\u5217\u540d\u524d\u9762\uff0c\u4ee5\u6784\u6210\u8981\u4f7f\u7528\u7684\u53d8\u91cf\u540d\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT 'hello' AS var1, 10 AS var2</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gset result_</code></strong>\n=&gt; <strong class=\"userinput\"><code>\\echo :result_var1 :result_var2</code></strong>\nhello 10\n</pre>\n<p lang=\"zh\">\u5982\u679c\u67d0\u4e00\u5217\u7684\u7ed3\u679c\u4e3a NULL\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u5bf9\u5e94\u7684\u53d8\u91cf\uff0c\u800c\u4e0d\u662f\u8bbe\u7f6e\u5b83\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u67e5\u8be2\u5931\u8d25\u6216\u6ca1\u6709\u6070\u597d\u8fd4\u56de\u4e00\u884c\uff0c\u5219\u4e0d\u4f1a\u66f4\u6539\u4efb\u4f55\u53d8\u91cf\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-GX\"><span class=\"term\"><code class=\"literal\">\\gx [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\gx [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\\gx \u4e0e \\g \u7b49\u4ef7\uff0c\u4f46\u4f1a\u5f3a\u5236\u6b64\u67e5\u8be2\u4f7f\u7528\u6269\u5c55\u8f93\u51fa\u6a21\u5f0f\uff0c\u76f8\u5f53\u4e8e\u5728 \\pset \u9009\u9879\u5217\u8868\u4e2d\u6307\u5b9a expanded=on\u3002\u53e6\u89c1 \\x\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-HELP\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\h</code>\u6216<code class=\"literal\">\\help</code> <code class=\"literal\">[ <em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u7ed9\u51fa\u6307\u5b9a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u7684\u8bed\u6cd5\u5e2e\u52a9\u3002\u5982\u679c\u672a\u6307\u5b9a<em class=\"replaceable\"><code>command</code></em>\uff0c\u5219<span class=\"application\">psql</span>\u5c06\u5217\u51fa\u6240\u6709\u53ef\u7528\u8bed\u6cd5\u5e2e\u52a9\u7684\u547d\u4ee4\u3002\u5982\u679c<em class=\"replaceable\"><code>command</code></em>\u662f\u661f\u53f7\uff08<code class=\"literal\">*</code>\uff09\uff0c\u5219\u663e\u793a\u6240\u6709<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u7684\u8bed\u6cd5\u5e2e\u52a9\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\help</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u4e3a\u4e86\u7b80\u5316\u8f93\u5165\uff0c\u7531\u591a\u4e2a\u5355\u8bcd\u7ec4\u6210\u7684\u547d\u4ee4\u4e0d\u9700\u8981\u52a0\u5f15\u53f7\u3002\u56e0\u6b64\uff0c\u53ef\u4ee5\u76f4\u63a5\u8f93\u5165<strong class=\"userinput\"><code>\\help alter table</code></strong>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-HTML\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\H</code> \u6216 <code class=\"literal\">\\html</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5f00<acronym class=\"acronym\">HTML</acronym>\u67e5\u8be2\u8f93\u51fa\u683c\u5f0f\u3002\u5982\u679c<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u5df2\u7ecf\u6253\u5f00\uff0c\u5219\u5207\u6362\u56de\u9ed8\u8ba4\u7684\u5bf9\u9f50\u6587\u672c\u683c\u5f0f\u3002\u6b64\u547d\u4ee4\u662f\u4e3a\u517c\u5bb9\u6027\u548c\u4fbf\u5229\u6027\u800c\u4fdd\u7559\u7684\uff1b\u8bbe\u7f6e\u5176\u4ed6\u8f93\u51fa\u9009\u9879\u7684\u65b9\u6cd5\u89c1<code class=\"command\">\\pset</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-INCLUDE\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\i</code> \u6216 <code class=\"literal\">\\include</code> <em class=\"replaceable\"><code>filename</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u8bfb\u53d6\u8f93\u5165\uff0c\u5e76\u50cf\u5728\u952e\u76d8\u4e0a\u8f93\u5165\u4e00\u6837\u6267\u884c\u5b83\u3002</p>\n<p lang=\"zh\">\u5982\u679c<em class=\"replaceable\"><code>filename</code></em>\u662f<code class=\"literal\">-</code>\uff08\u8fde\u5b57\u7b26\uff09\uff0c\u5219\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\uff0c\u76f4\u5230\u9047\u5230 EOF \u6307\u793a\u6216<code class=\"command\">\\q</code>\u5143\u547d\u4ee4\u3002\u8fd9\u53ef\u7528\u4e8e\u5c06\u4ea4\u4e92\u5f0f\u8f93\u5165\u4e0e\u6587\u4ef6\u8f93\u5165\u4ea4\u9519\u4f7f\u7528\u3002\u8bf7\u6ce8\u610f\uff0c\u53ea\u6709\u5728\u6700\u5916\u5c42\u542f\u7528\u4e86 Readline\uff0c\u6b64\u5904\u624d\u4f1a\u4f7f\u7528 Readline \u529f\u80fd\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5982\u679c\u60f3\u5728\u5c4f\u5e55\u4e0a\u770b\u5230\u88ab\u8bfb\u5165\u7684\u5404\u884c\uff0c\u8bf7\u5c06\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">all</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"PSQL-METACOMMAND-IF\"><span class=\"term\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\elif</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\else</code><br/></span><span class=\"term\"><code class=\"literal\">\\endif</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u7ec4\u547d\u4ee4\u5b9e\u73b0\u4e86\u53ef\u5d4c\u5957\u7684\u6761\u4ef6\u5757\u3002\u6761\u4ef6\u5757\u5fc5\u987b\u4ee5<code class=\"command\">\\if</code>\u5f00\u59cb\uff0c\u5e76\u4ee5<code class=\"command\">\\endif</code>\u7ed3\u675f\u3002\u5728\u4e24\u8005\u4e4b\u95f4\u53ef\u4ee5\u6709\u4efb\u610f\u6570\u91cf\u7684<code class=\"command\">\\elif</code>\u5b50\u53e5\uff0c\u540e\u9762\u53ef\u4ee5\u9009\u62e9\u6027\u5730\u8ddf\u7740\u4e00\u4e2a<code class=\"command\">\\else</code>\u5b50\u53e5\u3002\u5728\u5f62\u6210\u6761\u4ef6\u5757\u7684\u547d\u4ee4\u4e4b\u95f4\u901a\u5e38\u4f1a\u51fa\u73b0\u666e\u901a\u67e5\u8be2\u548c\u5176\u4ed6\u7c7b\u578b\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\\if \u548c \\elif \u8bfb\u53d6\u53c2\u6570\u5e76\u5c06\u5176\u4f5c\u4e3a\u5e03\u5c14\u8868\u8fbe\u5f0f\u6c42\u503c\u3002\u7ed3\u679c\u4e3a\u771f\u65f6\u7ee7\u7eed\u6b63\u5e38\u5904\u7406\uff0c\u5426\u5219\u8df3\u8fc7\u540e\u7eed\u884c\uff0c\u76f4\u5230\u9047\u5230\u5339\u914d\u7684 \\elif\u3001\\else \u6216 \\endif\u3002\u67d0\u4e2a \\if \u6216 \\elif \u6761\u4ef6\u6210\u7acb\u540e\uff0c\u540c\u4e00\u5757\u4e2d\u540e\u7eed \\elif \u7684\u53c2\u6570\u4e0d\u518d\u6c42\u503c\uff0c\u76f4\u63a5\u89c6\u4e3a\u5047\u3002\u53ea\u6709\u4e4b\u524d\u5339\u914d\u7684 \\if \u548c \\elif \u5747\u672a\u6210\u7acb\uff0c\u624d\u5904\u7406 \\else \u540e\u7684\u884c\u3002</p>\n<p lang=\"zh\">\u4e0e\u5176\u4ed6\u53cd\u659c\u6760\u547d\u4ee4\u53c2\u6570\u4e00\u6837\uff0c\\if \u6216 \\elif \u7684\u8868\u8fbe\u5f0f\u53c2\u6570\u5148\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u548c\u53cd\u5f15\u53f7\u5c55\u5f00\uff0c\u7136\u540e\u50cf\u5f00\u5173\u9009\u9879\u53d8\u91cf\u4e00\u6837\u6c42\u503c\u3002\u6709\u6548\u503c\u4e3a true\u3001false\u30011\u30010\u3001on\u3001off\u3001yes\u3001no \u7684\u4efb\u610f\u65e0\u6b67\u4e49\u3001\u4e0d\u533a\u5206\u5927\u5c0f\u5199\u7684\u5339\u914d\u3002\u4f8b\u5982 t\u3001T \u548c tR \u90fd\u4f1a\u89c6\u4e3a\u771f\u3002</p>\n<p lang=\"zh\">\u4e0d\u80fd\u6b63\u786e\u6c42\u503c\u4e3a\u771f\u6216\u5047\u7684\u8868\u8fbe\u5f0f\u4f1a\u4ea7\u751f\u8b66\u544a\uff0c\u5e76\u88ab\u89c6\u4e3a\u5047\u3002</p>\n<p lang=\"zh\">\u88ab\u8df3\u8fc7\u7684\u884c\u4f1a\u88ab\u6b63\u5e38\u89e3\u6790\u4ee5\u8bc6\u522b\u67e5\u8be2\u548c\u53cd\u659c\u7ebf\u547d\u4ee4\uff0c\u4f46\u67e5\u8be2\u4e0d\u4f1a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u4e14\u9664\u4e86\u6761\u4ef6\u547d\u4ee4\uff08<code class=\"command\">\\if</code>\u3001<code class=\"command\">\\elif</code>\u3001<code class=\"command\">\\else</code>\u3001<code class=\"command\">\\endif</code>\uff09\u4e4b\u5916\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u4f1a\u88ab\u5ffd\u7565\u3002\u4ec5\u68c0\u67e5\u8df3\u8fc7\u884c\u4e2d\u6761\u4ef6\u547d\u4ee4\u7684\u6709\u6548\u5d4c\u5957\u3002\u8df3\u8fc7\u884c\u4e2d\u7684\u53d8\u91cf\u5f15\u7528\u4e0d\u4f1a\u88ab\u5c55\u5f00\uff0c\u4e5f\u4e0d\u4f1a\u6267\u884c\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<p lang=\"zh\">\u540c\u4e00\u4e2a\u6761\u4ef6\u5757\u7684\u6240\u6709\u53cd\u659c\u7ebf\u547d\u4ee4\u5fc5\u987b\u51fa\u73b0\u5728\u540c\u4e00\u4e2a\u6e90\u6587\u4ef6\u4e2d\u3002\u5982\u679c\u4e3b\u8f93\u5165\u6587\u4ef6\u6216\u901a\u8fc7<code class=\"command\">\\include</code>\u5f15\u5165\u7684\u6587\u4ef6\u5230\u8fbe EOF \u65f6\uff0c\u4ecd\u6709\u672c\u5730<code class=\"command\">\\if</code>\u5757\u672a\u5173\u95ed\uff0c<span class=\"application\">psql</span>\u5c31\u4f1a\u62a5\u9519\u3002</p>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4e00\u4e2a\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">-- check for the existence of two separate records in the database and store\n-- the results in separate psql variables\nSELECT\n    EXISTS(SELECT 1 FROM customer WHERE customer_id = 123) as is_customer,\n    EXISTS(SELECT 1 FROM employee WHERE employee_id = 456) as is_employee\n\\gset\n\\if :is_customer\n    SELECT * FROM customer WHERE customer_id = 123;\n\\elif :is_employee\n    \\echo 'is not a customer but is an employee'\n    SELECT * FROM employee WHERE employee_id = 456;\n\\else\n    \\if yes\n        \\echo 'not a customer or employee'\n    \\else\n        \\echo 'this will never print'\n    \\endif\n\\endif\n</pre>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-INCLUDE-RELATIVE\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\ir</code> \u6216 <code class=\"literal\">\\include_relative</code> <em class=\"replaceable\"><code>filename</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"literal\">\\ir</code>\u547d\u4ee4\u4e0e<code class=\"literal\">\\i</code>\u76f8\u4f3c\uff0c\u4f46\u89e3\u6790\u76f8\u5bf9\u6587\u4ef6\u540d\u7684\u65b9\u5f0f\u4e0d\u540c\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\u6267\u884c\u65f6\uff0c\u8fd9\u4e24\u4e2a\u547d\u4ee4\u7684\u884c\u4e3a\u76f8\u540c\u3002\u4e0d\u8fc7\uff0c\u5728\u811a\u672c\u4e2d\u8c03\u7528\u65f6\uff0c<code class=\"literal\">\\ir</code>\u4f1a\u76f8\u5bf9\u4e8e\u811a\u672c\u6240\u5728\u7684\u76ee\u5f55\u6765\u89e3\u91ca\u6587\u4ef6\u540d\uff0c\u800c\u4e0d\u662f\u76f8\u5bf9\u4e8e\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-LIST\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\l[+]</code>\u6216<code class=\"literal\">\\list[+] [ <a class=\"link\" href=\"/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"\u6a21\u5f0f\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u670d\u52a1\u5668\u4e2d\u7684\u6570\u636e\u5e93\uff0c\u5e76\u663e\u793a\u5176\u540d\u79f0\u3001\u6240\u6709\u8005\u3001\u5b57\u7b26\u96c6\u7f16\u7801\u548c\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6570\u636e\u5e93\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u8fd8\u4f1a\u663e\u793a\u6570\u636e\u5e93\u5927\u5c0f\u3001\u9ed8\u8ba4\u8868\u7a7a\u95f4\u548c\u63cf\u8ff0\u3002\u5f53\u524d\u7528\u6237\u5bf9\u5176\u62e5\u6709 <code class=\"literal\">CONNECT</code> \u6743\u9650\u7684\u6570\u636e\u5e93\u53ef\u4ee5\u663e\u793a\u5927\u5c0f\u4fe1\u606f\uff1b\u5982\u679c\u5f53\u524d\u7528\u6237\u662f\u8d85\u7ea7\u7528\u6237\u6216\u5177\u6709 <code class=\"literal\">pg_read_all_stats</code> \u89d2\u8272\u7684\u6743\u9650\uff0c\u4e5f\u53ef\u4ee5\u663e\u793a\u5927\u5c0f\u4fe1\u606f\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-LO-EXPORT\"><span class=\"term\"><code class=\"literal\">\\lo_export <em class=\"replaceable\"><code>loid</code></em> <em class=\"replaceable\"><code>filename</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6570\u636e\u5e93\u4e2d\u8bfb\u53d6\u5177\u6709<acronym class=\"acronym\">OID</acronym><em class=\"replaceable\"><code>loid</code></em>\u7684\u5927\u5bf9\u8c61\uff0c\u5e76\u5c06\u5176\u5199\u5165<em class=\"replaceable\"><code>filename</code></em>\u3002\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e0e\u670d\u52a1\u5668\u51fd\u6570 <code class=\"function\">lo_export</code>\u7565\u6709\u4e0d\u540c\uff0c\u540e\u8005\u4f7f\u7528\u8fd0\u884c\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7528\u6237\u7684\u6743\u9650\uff0c\u5e76\u5728\u670d\u52a1\u5668\u7684\u6587\u4ef6\u7cfb\u7edf\u4e0a\u64cd\u4f5c\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u4f7f\u7528 \\lo_list \u67e5\u627e\u5927\u5bf9\u8c61\u7684 OID\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-LO-IMPORT\"><span class=\"term\"><code class=\"literal\">\\lo_import <em class=\"replaceable\"><code>filename</code></em> [ <em class=\"replaceable\"><code>comment</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6587\u4ef6\u5b58\u50a8\u5230\u4e00\u4e2a<span class=\"productname\">PostgreSQL</span>\u5927\u5bf9\u8c61\u4e2d\u3002\u53ef\u9009\u5730\uff0c\u5b83\u5c06\u7ed9\u5b9a\u7684\u6ce8\u91ca\u4e0e\u5bf9\u8c61\u5173\u8054\u8d77\u6765\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">foo=&gt; <strong class=\"userinput\"><code>\\lo_import '/home/peter/pictures/photo.xcf' 'a picture of me'</code></strong>\nlo_import 152801\n</pre>\n<p lang=\"zh\">\u54cd\u5e94\u8868\u660e\u5927\u5bf9\u8c61\u83b7\u5f97\u4e86\u5bf9\u8c61 ID 152801\uff0c\u8fd9\u4e2a ID \u53ef\u4ee5\u7528\u6765\u5728\u5c06\u6765\u8bbf\u95ee\u65b0\u521b\u5efa\u7684\u5927\u5bf9\u8c61\u3002\u4e3a\u4fbf\u4e8e\u9605\u8bfb\uff0c\u5efa\u8bae\u59cb\u7ec8\u4e3a\u6bcf\u4e2a\u5bf9\u8c61\u5173\u8054\u4e00\u6761\u4fbf\u4e8e\u4eba\u9605\u8bfb\u7684\u6ce8\u91ca\u3002\u67e5\u770b OID \u548c\u6ce8\u91ca\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528<code class=\"command\">\\lo_list</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u6b64\u547d\u4ee4\u4e0e\u670d\u52a1\u5668\u7aef\u7684<code class=\"function\">lo_import</code>\u7565\u6709\u4e0d\u540c\uff0c\u56e0\u4e3a\u5b83\u4f5c\u4e3a\u672c\u5730\u7528\u6237\u5728\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e0a\u64cd\u4f5c\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\u7684\u7528\u6237\u548c\u6587\u4ef6\u7cfb\u7edf\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-LO-LIST\"><span class=\"term\"><code class=\"literal\">\\lo_list[+]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5f53\u524d\u5b58\u50a8\u5728\u6570\u636e\u5e93\u4e2d\u7684\u5168\u90e8 <span class=\"productname\">PostgreSQL</span> \u5927\u5bf9\u8c61\u5217\u8868\uff0c\u4ee5\u53ca\u4e3a\u5b83\u4eec\u63d0\u4f9b\u7684\u4efb\u4f55\u6ce8\u91ca\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u5217\u51fa\u6bcf\u4e2a\u5927\u5bf9\u8c61\u7684\u76f8\u5173\u6743\u9650\uff08\u5982\u679c\u6709\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-LO-UNLINK\"><span class=\"term\"><code class=\"literal\">\\lo_unlink <em class=\"replaceable\"><code>loid</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6570\u636e\u5e93\u4e2d\u5220\u9664<acronym class=\"acronym\">OID</acronym> \u4e3a <em class=\"replaceable\"><code>loid</code></em>\u7684\u5927\u5bf9\u8c61\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u4f7f\u7528 \\lo_list \u67e5\u627e\u5927\u5bf9\u8c61\u7684 OID\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-OUT\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\o</code> \u6216 <code class=\"literal\">\\out [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\o</code> \u6216 <code class=\"literal\">\\out [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u540e\u7eed\u67e5\u8be2\u7ed3\u679c\u4fdd\u5b58\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9 shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002\u5982\u679c\u6ca1\u6709\u6307\u5b9a\u53c2\u6570\uff0c\u67e5\u8be2\u8f93\u51fa\u5c06\u6062\u590d\u4e3a\u6807\u51c6\u8f93\u51fa\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\uff0c\u5219\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u7684\u5185\u5bb9\u53ea\u4f1a\u539f\u6837\u4f20\u9012\u7ed9 shell\u3002</p>\n<p lang=\"zh\"><span class=\"quote\">\u201c<span class=\"quote\">\u67e5\u8be2\u7ed3\u679c</span>\u201d</span>\u5305\u62ec\u4ece\u6570\u636e\u5e93\u670d\u52a1\u5668\u83b7\u53d6\u7684\u6240\u6709\u8868\u683c\u3001\u547d\u4ee4\u54cd\u5e94\u548c\u901a\u77e5\uff0c\u4ee5\u53ca\u67e5\u8be2\u6570\u636e\u5e93\u7684\u5404\u79cd\u53cd\u659c\u6760\u547d\u4ee4\u7684\u8f93\u51fa\uff08\u4f8b\u5982<code class=\"command\">\\d</code>\uff09\uff1b\u4f46\u4e0d\u5305\u62ec\u9519\u8bef\u6d88\u606f\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8981\u5728\u67e5\u8be2\u7ed3\u679c\u4e4b\u95f4\u63d2\u5165\u6587\u672c\u8f93\u51fa\uff0c\u4f7f\u7528<code class=\"command\">\\qecho</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PRINT\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\p</code>\u6216<code class=\"literal\">\\print</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\u3002\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6253\u5370\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PASSWORD\"><span class=\"term\"><code class=\"literal\">\\password [ <em class=\"replaceable\"><code>username</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u66f4\u6539\u6307\u5b9a\u7528\u6237\uff08\u9ed8\u8ba4\u4e3a\u5f53\u524d\u7528\u6237\uff09\u7684\u5bc6\u7801\u3002\u6b64\u547d\u4ee4\u63d0\u793a\u8f93\u5165\u65b0\u5bc6\u7801\uff0c\u5bf9\u5176\u8fdb\u884c\u52a0\u5bc6\uff0c\u5e76\u5c06\u5176\u4f5c\u4e3a<code class=\"command\">ALTER ROLE</code>\u547d\u4ee4\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u65b0\u5bc6\u7801\u4e0d\u4f1a\u4ee5\u660e\u6587\u5f62\u5f0f\u51fa\u73b0\u5728\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\u3001\u670d\u52a1\u5668\u65e5\u5fd7\u6216\u5176\u4ed6\u5730\u65b9\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PROMPT\"><span class=\"term\"><code class=\"literal\">\\prompt [ <em class=\"replaceable\"><code>text</code></em> ] <em class=\"replaceable\"><code>name</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u63d0\u793a\u7528\u6237\u63d0\u4f9b\u6587\u672c\uff0c\u5c06\u5176\u8d4b\u503c\u7ed9\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u3002\u53ef\u4ee5\u6307\u5b9a\u4e00\u4e2a\u53ef\u9009\u7684\u63d0\u793a\u5b57\u7b26\u4e32<em class=\"replaceable\"><code>text</code></em>\u3002\uff08\u5bf9\u4e8e\u591a\u4e2a\u5355\u8bcd\u7684\u63d0\u793a\uff0c\u7528\u5355\u5f15\u53f7\u62ec\u8d77\u6587\u672c\u3002\uff09</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"literal\">\\prompt</code> \u4f7f\u7528\u7ec8\u7aef\u8fdb\u884c\u8f93\u5165\u548c\u8f93\u51fa\u3002\u7136\u800c\uff0c\u5982\u679c\u4f7f\u7528\u4e86 <code class=\"option\">-f</code> \u547d\u4ee4\u884c\u5f00\u5173\uff0c<code class=\"literal\">\\prompt</code> \u5c06\u4f7f\u7528\u6807\u51c6\u8f93\u5165\u548c\u6807\u51c6\u8f93\u51fa\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET\"><span class=\"term\"><code class=\"literal\">\\pset [ <em class=\"replaceable\"><code>option</code></em> [ <em class=\"replaceable\"><code>value</code></em> ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u8bbe\u7f6e\u5f71\u54cd\u67e5\u8be2\u7ed3\u679c\u8868\u8f93\u51fa\u7684\u9009\u9879\u3002<em class=\"replaceable\"><code>option</code></em>\u6307\u5b9a\u8981\u8bbe\u7f6e\u54ea\u4e2a\u9009\u9879\u3002<em class=\"replaceable\"><code>value</code></em>\u7684\u542b\u4e49\u53d6\u51b3\u4e8e\u6240\u9009\u7684\u9009\u9879\u3002\u5bf9\u4e8e\u67d0\u4e9b\u9009\u9879\uff0c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\u4f1a\u5207\u6362\u6216\u53d6\u6d88\u8bbe\u7f6e\u8be5\u9009\u9879\uff0c\u5177\u4f53\u89c1\u5404\u9009\u9879\u7684\u8bf4\u660e\u3002\u5982\u679c\u6ca1\u6709\u63d0\u53ca\u8fd9\u7c7b\u884c\u4e3a\uff0c\u90a3\u4e48\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\u53ea\u4f1a\u663e\u793a\u5f53\u524d\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\">\u4e0d\u5e26\u4efb\u4f55\u53c2\u6570\u7684<code class=\"command\">\\pset</code>\u4f1a\u663e\u793a\u6240\u6709\u6253\u5370\u9009\u9879\u7684\u5f53\u524d\u72b6\u6001\u3002</p>\n<p lang=\"zh\">\u53ef\u8c03\u6574\u6253\u5370\u9009\u9879\u6709\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-META-COMMAND-PSET-BORDER\"><span class=\"term\"><code class=\"literal\">border</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><em class=\"replaceable\"><code>value</code></em>\u5fc5\u987b\u662f\u6570\u5b57\u3002\u4e00\u822c\u6765\u8bf4\uff0c\u6570\u5b57\u8d8a\u5927\uff0c\u8868\u683c\u7684\u8fb9\u6846\u548c\u5206\u9694\u7ebf\u5c31\u8d8a\u591a\uff0c\u4f46\u7ec6\u8282\u53d6\u51b3\u4e8e\u5177\u4f53\u683c\u5f0f\u3002\u5728<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u4e2d\uff0c\u5b83\u4f1a\u76f4\u63a5\u8f6c\u6362\u4e3a<code class=\"literal\">border=...</code>\u5c5e\u6027\u3002\u5728\u5927\u591a\u6570\u5176\u4ed6\u683c\u5f0f\u4e2d\uff0c\u53ea\u6709\u503c 0\uff08\u65e0\u8fb9\u6846\uff09\u30011\uff08\u5185\u90e8\u5206\u9694\u7ebf\uff09\u548c 2\uff08\u8868\u683c\u5916\u6846\uff09\u6709\u610f\u4e49\uff0c\u5927\u4e8e 2 \u7684\u503c\u4f1a\u4e0e<code class=\"literal\">border = 2</code>\u4f5c\u76f8\u540c\u5904\u7406\u3002<code class=\"literal\">latex</code>\u548c<code class=\"literal\">latex-longtable</code>\u683c\u5f0f\u8fd8\u5141\u8bb8\u4f7f\u7528\u503c 3\uff0c\u4ee5\u5728\u6570\u636e\u884c\u4e4b\u95f4\u6dfb\u52a0\u5206\u9694\u7ebf\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-COLUMNS\" lang=\"zh\"><em>\u5217</em></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u76ee\u6807\u5bbd\u5ea6\uff0c\u540c\u65f6\u4e5f\u662f\u786e\u5b9a\u8f93\u51fa\u662f\u5426\u8db3\u591f\u5bbd\u4ee5\u9700\u8981\u5206\u9875\u5668\u6216\u5728\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e0b\u5207\u6362\u5230\u5782\u76f4\u663e\u793a\u7684\u5bbd\u5ea6\u9650\u5236\u3002\u96f6\uff08\u9ed8\u8ba4\u503c\uff09\u4f1a\u5bfc\u81f4\u76ee\u6807\u5bbd\u5ea6\u7531\u73af\u5883\u53d8\u91cf<code class=\"envar\">COLUMNS</code>\u63a7\u5236\uff0c\u6216\u8005\u5982\u679c\u672a\u8bbe\u7f6e <code class=\"envar\">COLUMNS</code>\u5219\u7531\u68c0\u6d4b\u5230\u7684\u5c4f\u5e55\u5bbd\u5ea6\u63a7\u5236\u3002\u53e6\u5916\uff0c\u5982\u679c<code class=\"literal\">columns</code>\u4e3a\u96f6\uff0c\u5219<code class=\"literal\">wrapped</code>\u683c\u5f0f\u4ec5\u5f71\u54cd\u5c4f\u5e55\u8f93\u51fa\u3002\u5982\u679c<code class=\"literal\">columns</code>\u4e3a\u975e\u96f6\uff0c\u5219\u6587\u4ef6\u548c\u7ba1\u9053\u8f93\u51fa\u4e5f\u4f1a\u6309\u8be5\u5bbd\u5ea6\u6298\u884c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-CSV-FIELDSEP\"><span class=\"term\"><code class=\"literal\">csv_fieldsep</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728<acronym class=\"acronym\">CSV</acronym>\u8f93\u51fa\u683c\u5f0f\u4e2d\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u5982\u679c\u5206\u9694\u7b26\u5b57\u7b26\u51fa\u73b0\u5728\u5b57\u6bb5\u7684\u503c\u4e2d\uff0c\u5219\u8be5\u5b57\u6bb5\u5c06\u6839\u636e\u6807\u51c6<acronym class=\"acronym\">CSV</acronym>\u89c4\u5219\u5728\u53cc\u5f15\u53f7\u5185\u8f93\u51fa\u3002\u9ed8\u8ba4\u503c\u662f\u9017\u53f7\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-EXPANDED\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">expanded</code>\uff08\u6216<code class=\"literal\">x</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff08\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u6269\u5c55\u6a21\u5f0f\uff09\uff0c\u6216\u8005\u662f<code class=\"literal\">auto</code>\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5f00\u542f\u548c\u5173\u95ed\u8bbe\u7f6e\u4e4b\u95f4\u5207\u6362\u3002\u542f\u7528\u6269\u5c55\u6a21\u5f0f\u65f6\uff0c\u67e5\u8be2\u7ed3\u679c\u4ee5\u4e24\u5217\u663e\u793a\uff0c\u5de6\u4fa7\u4e3a\u5217\u540d\uff0c\u53f3\u4fa7\u4e3a\u6570\u636e\u3002\u5982\u679c\u6570\u636e\u5728\u901a\u5e38\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u6a2a\u5411</span>\u201d</span>\u6a21\u5f0f\u4e0b\u65e0\u6cd5\u9002\u5e94\u5c4f\u5e55\uff0c\u8fd9\u79cd\u6a21\u5f0f\u5c31\u5f88\u6709\u7528\u3002\u5728\u81ea\u52a8\u8bbe\u7f6e\u4e0b\uff0c\u5f53\u67e5\u8be2\u8f93\u51fa\u5305\u542b\u591a\u5217\u4e14\u5bbd\u5ea6\u8d85\u8fc7\u5c4f\u5e55\u65f6\uff0c\u4f1a\u4f7f\u7528\u6269\u5c55\u6a21\u5f0f\uff1b\u5426\u5219\u4f7f\u7528\u5e38\u89c4\u6a21\u5f0f\u3002\u81ea\u52a8\u8bbe\u7f6e\u53ea\u5728\u5bf9\u9f50\u548c\u6298\u884c\u683c\u5f0f\u4e2d\u6709\u6548\u3002\u5728\u5176\u4ed6\u683c\u5f0f\u4e2d\uff0c\u5b83\u7684\u884c\u4e3a\u59cb\u7ec8\u4e0e\u5173\u95ed\u6269\u5c55\u6a21\u5f0f\u76f8\u540c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-FIELDSEP\"><span class=\"term\"><code class=\"literal\">fieldsep</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u6837\u53ef\u4ee5\u521b\u5efa\u4f8b\u5982\u5236\u8868\u7b26\u5206\u9694\u7684\u8f93\u51fa\uff0c\u8fd9\u53ef\u80fd\u66f4\u7b26\u5408\u5176\u4ed6\u7a0b\u5e8f\u7684\u9700\u8981\u3002\u8981\u5c06\u5236\u8868\u7b26\u8bbe\u7f6e\u4e3a\u5b57\u6bb5\u5206\u9694\u7b26\uff0c\u8bf7\u8f93\u5165<code class=\"literal\">\\pset fieldsep '\\t'</code>\u3002\u9ed8\u8ba4\u5b57\u6bb5\u5206\u9694\u7b26\u662f<code class=\"literal\">'|'</code>\uff08\u7ad6\u7ebf\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-FIELDSEP-ZERO\"><span class=\"term\"><code class=\"literal\">fieldsep_zero</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u8bbe\u7f6e\u4e3a\u96f6\u5b57\u8282\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-FOOTER\"><span class=\"term\"><code class=\"literal\">footer</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u8868\u683c\u9875\u811a\uff08<code class=\"literal\">(<em class=\"replaceable\"><code>n</code></em> rows)</code>\u8ba1\u6570\uff09\u7684\u663e\u793a\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5207\u6362\u9875\u811a\u663e\u793a\u7684\u5f00\u5173\u72b6\u6001\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-FORMAT\"><span class=\"term\"><code class=\"literal\">format</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a<code class=\"literal\">aligned</code>\u3001<code class=\"literal\">asciidoc</code>\u3001<code class=\"literal\">csv</code>\u3001<code class=\"literal\">html</code>\u3001<code class=\"literal\">latex</code>\u3001<code class=\"literal\">latex-longtable</code>\u3001<code class=\"literal\">troff-ms</code>\u3001<code class=\"literal\">unaligned</code>\u6216<code class=\"literal\">wrapped</code>\u3002\u5141\u8bb8\u4f7f\u7528\u552f\u4e00\u7f29\u5199\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">aligned</code>\u683c\u5f0f\u662f\u6807\u51c6\u7684\u3001\u9002\u5408\u4eba\u9605\u8bfb\u4e14\u6392\u7248\u6574\u9f50\u7684\u6587\u672c\u8f93\u51fa\uff1b\u8fd9\u662f\u9ed8\u8ba4\u683c\u5f0f\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">unaligned</code>\u683c\u5f0f\u5c06\u4e00\u884c\u4e2d\u7684\u6240\u6709\u5217\u5199\u5728\u4e00\u884c\u4e0a\uff0c\u7531\u5f53\u524d\u6d3b\u52a8\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u5206\u9694\u3002\u8fd9\u5bf9\u4e8e\u521b\u5efa\u53ef\u80fd\u88ab\u5176\u4ed6\u7a0b\u5e8f\u8bfb\u53d6\u7684\u8f93\u51fa\u5f88\u6709\u7528\uff0c\u4f8b\u5982\uff0c\u5236\u8868\u7b26\u5206\u9694\u6216\u9017\u53f7\u5206\u9694\u683c\u5f0f\u3002\u7136\u800c\uff0c\u5982\u679c\u5b57\u6bb5\u5206\u9694\u7b26\u5b57\u7b26\u51fa\u73b0\u5728\u5217\u7684\u503c\u4e2d\uff0c\u5219\u4e0d\u4f1a\u88ab\u7279\u6b8a\u5904\u7406\uff1b\u56e0\u6b64\uff0c<acronym class=\"acronym\">CSV</acronym>\u683c\u5f0f\u53ef\u80fd\u66f4\u9002\u5408\u8fd9\u4e9b\u76ee\u7684\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">csv</code>\u683c\u5f0f<a class=\"indexterm\" id=\"id-1.9.4.20.8.4.10.1.78.2.3.1.8.2.4.2\" name=\"id-1.9.4.20.8.4.10.1.78.2.3.1.8.2.4.2\"></a>\u6309\u9017\u53f7\u5206\u9694\u7684\u5217\u503c\u8f93\u51fa\uff0c\u5e76\u5e94\u7528 <a class=\"ulink\" href=\"https://datatracker.ietf.org/doc/html/rfc4180\" target=\"_top\">RFC 4180</a> \u4e2d\u63cf\u8ff0\u7684\u52a0\u5f15\u53f7\u89c4\u5219\u3002\u6b64\u8f93\u51fa\u4e0e\u670d\u52a1\u5668\u7684CSV\u683c\u5f0f\u7684 <code class=\"command\">COPY</code>\u547d\u4ee4\u517c\u5bb9\u3002\u751f\u6210\u5305\u542b\u5217\u540d\u7684\u8868\u5934\u884c\uff0c\u9664\u975e <code class=\"literal\">tuples_only</code>\u53c2\u6570\u8bbe\u7f6e\u4e3a <code class=\"literal\">on</code>\u3002\u4e0d\u6253\u5370\u8868\u683c\u6807\u9898\u548c\u9875\u811a\u3002\u6bcf\u884c\u4ee5\u7cfb\u7edf\u76f8\u5173\u7684\u884c\u7ed3\u675f\u5b57\u7b26\u7ed3\u675f\uff0c\u5bf9\u4e8e\u7c7bUnix\u7cfb\u7edf\u901a\u5e38\u662f\u5355\u4e2a\u6362\u884c\u7b26\uff08<code class=\"literal\">\\n</code>\uff09\uff0c\u5bf9\u4e8eMicrosoft Windows\u5219\u662f\u56de\u8f66\u548c\u6362\u884c\u5e8f\u5217\uff08<code class=\"literal\">\\r\\n</code>\uff09\u3002\u53ef\u4ee5\u7528<code class=\"command\">\\pset csv_fieldsep</code>\u9009\u62e9\u9017\u53f7\u4ee5\u5916\u7684\u5b57\u6bb5\u5206\u9694\u5b57\u7b26\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">wrapped</code>\u683c\u5f0f\u4e0e<code class=\"literal\">aligned</code>\u76f8\u4f3c\uff0c\u4f46\u4f1a\u5c06\u8f83\u5bbd\u7684\u6570\u636e\u503c\u6298\u6210\u591a\u884c\uff0c\u4f7f\u8f93\u51fa\u9002\u5e94\u76ee\u6807\u5217\u5bbd\u3002\u76ee\u6807\u5bbd\u5ea6\u7684\u786e\u5b9a\u65b9\u5f0f\u89c1<code class=\"literal\">columns</code>\u9009\u9879\u7684\u8bf4\u660e\u3002\u8bf7\u6ce8\u610f\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u5c1d\u8bd5\u5bf9\u5217\u6807\u9898\u6298\u884c\uff1b\u56e0\u6b64\uff0c\u5982\u679c\u5217\u6807\u9898\u6240\u9700\u7684\u603b\u5bbd\u5ea6\u8d85\u8fc7\u76ee\u6807\u5bbd\u5ea6\uff0c<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u884c\u4e3a\u5c31\u4e0e<code class=\"literal\">aligned</code>\u76f8\u540c\u3002</p>\n<p lang=\"zh\">asciidoc\u3001html\u3001latex\u3001latex-longtable \u548c troff-ms \u683c\u5f0f\u8f93\u51fa\u7684\u662f\u53ef\u5d4c\u5165\u76f8\u5e94\u6807\u8bb0\u8bed\u8a00\u6587\u6863\u7684\u8868\u683c\uff0c\u5e76\u975e\u5b8c\u6574\u6587\u6863\u3002HTML \u53ef\u80fd\u4e0d\u8981\u6c42\u5b8c\u6574\u5c01\u88c5\uff0c\u4f46 LaTeX \u5fc5\u987b\u6709\u5b8c\u6574\u6587\u6863\u7ed3\u6784\u3002latex \u4f7f\u7528 LaTeX \u7684 tabular \u73af\u5883\uff1blatex-longtable \u9700\u8981 LaTeX \u7684 longtable \u548c booktabs \u5b8f\u5305\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-LINESTYLE\"><span class=\"term\"><code class=\"literal\">linestyle</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u8fb9\u6846\u7ebf\u7ed8\u5236\u6837\u5f0f\u4e3a<code class=\"literal\">ascii</code>\u3001<code class=\"literal\">old-ascii</code>\u6216<code class=\"literal\">unicode</code>\u4e4b\u4e00\u3002\u5141\u8bb8\u4f7f\u7528\u552f\u4e00\u7f29\u5199\u3002\uff08\u8fd9\u610f\u5473\u7740\u4e00\u4e2a\u5b57\u6bcd\u5c31\u8db3\u591f\u4e86\u3002\uff09\u9ed8\u8ba4\u8bbe\u7f6e\u4e3a<code class=\"literal\">ascii</code>\u3002\u6b64\u9009\u9879\u4ec5\u5f71\u54cd<code class=\"literal\">aligned</code>\u548c<code class=\"literal\">wrapped</code>\u8f93\u51fa\u683c\u5f0f\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">ascii</code>\u6837\u5f0f\u4f7f\u7528\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u53f3\u8fb9\u7f18\u7684<code class=\"literal\">+</code>\u7b26\u53f7\u8868\u793a\u3002\u5f53<code class=\"literal\">wrapped</code>\u683c\u5f0f\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u628a\u6570\u636e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u4f1a\u5728\u7b2c\u4e00\u884c\u7684\u53f3\u8fb9\u7f18\u663e\u793a\u4e00\u4e2a\u70b9\uff08<code class=\"literal\">.</code>\uff09\uff0c\u5e76\u5728\u4e0b\u4e00\u884c\u7684\u5de6\u8fb9\u7f18\u518d\u6b21\u663e\u793a\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">old-ascii</code>\u6837\u5f0f\u4f7f\u7528\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\uff0c\u91c7\u7528<span class=\"productname\">PostgreSQL</span> 8.4 \u53ca\u66f4\u65e9\u7248\u672c\u7684\u683c\u5f0f\u6837\u5f0f\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u66ff\u4ee3\u5de6\u4fa7\u5217\u5206\u9694\u7b26\u7684<code class=\"literal\">:</code>\u7b26\u53f7\u8868\u793a\u3002\u5f53\u6570\u636e\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u5219\u7528<code class=\"literal\">;</code>\u7b26\u53f7\u66ff\u4ee3\u5de6\u4fa7\u5217\u5206\u9694\u7b26\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">unicode</code>\u6837\u5f0f\u4f7f\u7528 Unicode \u6846\u7ebf\u7ed8\u5236\u5b57\u7b26\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u53f3\u8fb9\u7f18\u7684\u56de\u8f66\u7b26\u53f7\u8868\u793a\u3002\u5f53\u6570\u636e\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u4f1a\u5728\u7b2c\u4e00\u884c\u7684\u53f3\u8fb9\u7f18\u663e\u793a\u7701\u7565\u53f7\u7b26\u53f7\uff0c\u5e76\u5728\u4e0b\u4e00\u884c\u7684\u5de6\u8fb9\u7f18\u518d\u6b21\u663e\u793a\u3002</p>\n<p lang=\"zh\">\u5f53<code class=\"literal\">border</code>\u8bbe\u7f6e\u5927\u4e8e\u96f6\u65f6\uff0c<code class=\"literal\">linestyle</code>\u9009\u9879\u8fd8\u51b3\u5b9a\u7528\u54ea\u4e9b\u5b57\u7b26\u7ed8\u5236\u8fb9\u6846\u7ebf\u3002\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\u5728\u4efb\u4f55\u73af\u5883\u4e2d\u90fd\u53ef\u7528\uff0c\u4f46\u5728\u652f\u6301 Unicode \u7684\u663e\u793a\u8bbe\u5907\u4e0a\uff0cUnicode \u5b57\u7b26\u66f4\u7f8e\u89c2\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-NULL\"><span class=\"term\"><code class=\"literal\">null</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u7528\u4e8e\u4ee3\u66ff\u7a7a\u503c\u6253\u5370\u7684\u5b57\u7b26\u4e32\u3002\u9ed8\u8ba4\u4e0d\u6253\u5370\u4efb\u4f55\u5185\u5bb9\uff0c\u8fd9\u5f88\u5bb9\u6613\u88ab\u8bef\u8ba4\u4e3a\u7a7a\u5b57\u7b26\u4e32\u3002\u4f8b\u5982\uff0c\u4f60\u53ef\u80fd\u66f4\u559c\u6b22\u4f7f\u7528<code class=\"literal\">\\pset null '(null)'</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-NUMERICLOCALE\"><span class=\"term\"><code class=\"literal\">numericlocale</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u4f7f\u7528\u533a\u57df\u8bbe\u7f6e\u7279\u5b9a\u7684\u5b57\u7b26\u6765\u5206\u9694\u5c0f\u6570\u70b9\u5de6\u4fa7\u7684\u6570\u5b57\u7ec4\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5e38\u89c4\u6570\u5b57\u8f93\u51fa\u548c\u533a\u57df\u8bbe\u7f6e\u7279\u5b9a\u7684\u6570\u5b57\u8f93\u51fa\u4e4b\u95f4\u5207\u6362\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-PAGER\"><span class=\"term\"><code class=\"literal\">pager</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u63a7\u5236\u67e5\u8be2\u7ed3\u679c\u4e0e psql \u5e2e\u52a9\u8f93\u51fa\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\u7684\u65b9\u5f0f\u3002\u5f53 pager \u4e3a off \u65f6\uff0c\u4e0d\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\uff1b\u4e3a on \u65f6\uff0c\u5728\u9002\u5f53\u60c5\u51b5\u4e0b\u4f7f\u7528\uff0c\u5373\u8f93\u51fa\u76ee\u6807\u662f\u7ec8\u7aef\u4e14\u5185\u5bb9\u65e0\u6cd5\u5728\u5c4f\u5e55\u5185\u663e\u793a\u5b8c\u3002\u8bbe\u4e3a always \u65f6\uff0c\u6240\u6709\u7ec8\u7aef\u8f93\u51fa\u5747\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\uff0c\u65e0\u8bba\u662f\u5426\u80fd\u5728\u5c4f\u5e55\u5185\u663e\u793a\u5b8c\u3002\u4e0d\u5e26\u503c\u7684 \\pset pager \u4f1a\u5207\u6362\u5206\u9875\u7684\u5f00\u5173\u72b6\u6001\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u8bbe\u7f6e\u4e86\u73af\u5883\u53d8\u91cf<code class=\"envar\">PSQL_PAGER</code>\u6216<code class=\"envar\">PAGER</code>\uff0c\u9700\u8981\u5206\u9875\u7684\u8f93\u51fa\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6307\u5b9a\u7a0b\u5e8f\u3002\u5426\u5219\uff0c\u4f7f\u7528\u4e0e\u5e73\u53f0\u6709\u5173\u7684\u9ed8\u8ba4\u7a0b\u5e8f\uff08\u5982<code class=\"filename\">more</code>\uff09\u3002</p>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 <code class=\"literal\">\\watch</code> \u547d\u4ee4\u91cd\u590d\u6267\u884c\u67e5\u8be2\u65f6\uff0c\u5728 Unix \u7cfb\u7edf\u4e0a\u4f1a\u6539\u7528\u73af\u5883\u53d8\u91cf <code class=\"envar\">PSQL_WATCH_PAGER</code> \u6765\u67e5\u627e\u5206\u9875\u5668\u7a0b\u5e8f\u3002\u4e4b\u6240\u4ee5\u5355\u72ec\u914d\u7f6e\u5b83\uff0c\u662f\u56e0\u4e3a\u8fd9\u79cd\u7528\u6cd5\u53ef\u80fd\u4f1a\u8ba9\u4f20\u7edf\u5206\u9875\u5668\u65e0\u6cd5\u6b63\u5e38\u5de5\u4f5c\uff1b\u4f46\u5b83\u53ef\u7528\u4e8e\u628a\u8f93\u51fa\u53d1\u9001\u7ed9\u80fd\u591f\u7406\u89e3 <span class=\"application\">psql</span> \u8f93\u51fa\u683c\u5f0f\u7684\u5de5\u5177\uff08\u4f8b\u5982 <code class=\"filename\">pspg --stream</code>\uff09\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-PAGER-MIN-LINES\"><span class=\"term\"><code class=\"literal\">pager_min_lines</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u82e5 pager_min_lines \u5927\u4e8e\u5c4f\u5e55\u9875\u9ad8\uff0c\u53ea\u6709\u8f93\u51fa\u884c\u6570\u8fbe\u5230\u8be5\u503c\u65f6\u624d\u8c03\u7528\u5206\u9875\u7a0b\u5e8f\u3002\u9ed8\u8ba4\u503c\u4e3a 0\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-RECORDSEP\"><span class=\"term\"><code class=\"literal\">recordsep</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u8bb0\u5f55\uff08\u884c\uff09\u5206\u9694\u7b26\u3002\u9ed8\u8ba4\u4e3a\u6362\u884c\u7b26\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-RECORDSEP-ZERO\"><span class=\"term\"><code class=\"literal\">recordsep_zero</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u8bbe\u7f6e\u4e3a\u96f6\u5b57\u8282\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-TABLEATTR\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">tableattr</code>\uff08\u6216<code class=\"literal\">T</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\u5728<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u4e2d\uff0c\u8fd9\u6307\u5b9a\u8981\u653e\u5728<code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u5c5e\u6027\uff0c\u4f8b\u5982<code class=\"literal\">cellpadding</code>\u6216<code class=\"literal\">bgcolor</code>\u3002\u8bf7\u6ce8\u610f\uff0c\u4f60\u53ef\u80fd\u4e0d\u9700\u8981\u5728\u8fd9\u91cc\u6307\u5b9a<code class=\"literal\">border</code>\uff0c\u56e0\u4e3a<code class=\"literal\">\\pset border</code>\u5df2\u7ecf\u8d1f\u8d23\u5904\u7406\u5b83\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u8868\u683c\u5c5e\u6027\u3002</p>\n<p lang=\"zh\">\u5728<code class=\"literal\">latex-longtable</code>\u683c\u5f0f\u4e2d\uff0c\u8fd9\u63a7\u5236\u6bcf\u4e2a\u5305\u542b\u5de6\u5bf9\u9f50\u6570\u636e\u7c7b\u578b\u7684\u5217\u7684\u5bbd\u5ea6\u6bd4\u4f8b\u3002\u5b83\u4ee5\u7a7a\u767d\u5206\u9694\u7684\u503c\u5217\u8868\u6307\u5b9a\uff0c\u4f8b\u5982<code class=\"literal\">'0.2 0.2 0.6'</code>\u3002\u672a\u6307\u5b9a\u7684\u8f93\u51fa\u5217\u4f7f\u7528\u6700\u540e\u6307\u5b9a\u7684\u503c\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-TITLE\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">title</code>\uff08\u6216<code class=\"literal\">C</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u968f\u540e\u6253\u5370\u7684\u6240\u6709\u8868\u683c\u7684\u6807\u9898\u3002\u8fd9\u53ef\u4ee5\u4e3a\u8f93\u51fa\u63d0\u4f9b\u63cf\u8ff0\u6027\u6807\u7b7e\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u6807\u9898\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-TUPLES-ONLY\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">tuples_only</code>\uff08\u6216<code class=\"literal\">t</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u4ec5\u5143\u7ec4\u6a21\u5f0f\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5e38\u89c4\u8f93\u51fa\u548c\u4ec5\u5143\u7ec4\u8f93\u51fa\u4e4b\u95f4\u5207\u6362\u3002\u5e38\u89c4\u8f93\u51fa\u5305\u542b\u5217\u6807\u9898\u3001\u8868\u683c\u6807\u9898\u548c\u5404\u79cd\u9875\u811a\u7b49\u9644\u52a0\u4fe1\u606f\u3002\u5728\u4ec5\u5143\u7ec4\u6a21\u5f0f\u4e0b\uff0c\u53ea\u663e\u793a\u5b9e\u9645\u7684\u8868\u683c\u6570\u636e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-UNICODE-BORDER-LINESTYLE\"><span class=\"term\"><code class=\"literal\">unicode_border_linestyle</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u8fb9\u6846\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-UNICODE-COLUMN-LINESTYLE\"><span class=\"term\"><code class=\"literal\">unicode_column_linestyle</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u5217\u5206\u9694\u7ebf\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-UNICODE-HEADER-LINESTYLE\"><span class=\"term\"><code class=\"literal\">unicode_header_linestyle</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u8868\u5934\u5206\u9694\u7ebf\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-XHEADER-WIDTH\"><span class=\"term\"><code class=\"literal\">xheader_width</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6269\u5c55\u8f93\u51fa\u6807\u9898\u7684\u6700\u5927\u5bbd\u5ea6\u8bbe\u4e3a full\uff08\u9ed8\u8ba4\u503c\uff09\u3001column\u3001page \u6216\u4e00\u4e2a\u6574\u6570\u503c\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">full</code>\uff1a\u6269\u5c55\u8868\u5934\u4e0d\u622a\u65ad\uff0c\u5176\u5bbd\u5ea6\u4e0e\u6700\u5bbd\u7684\u8f93\u51fa\u884c\u76f8\u540c\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">column</code>\uff1a\u5c06\u8868\u5934\u884c\u622a\u65ad\u4e3a\u7b2c\u4e00\u5217\u7684\u5bbd\u5ea6\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">page</code>\uff1a\u5c06\u8868\u5934\u884c\u622a\u65ad\u4e3a\u7ec8\u7aef\u5bbd\u5ea6\u3002</p>\n<p lang=\"zh\">\u6574\u6570\u503c\uff1a\u7cbe\u786e\u6307\u5b9a\u6807\u9898\u884c\u7684\u6700\u5927\u5bbd\u5ea6\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8fd9\u4e9b\u4e0d\u540c\u683c\u5f0f\u7684\u5916\u89c2\u793a\u4f8b\u53ef\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/16/app-psql.html#APP-PSQL-EXAMPLES\" title=\"\u793a\u4f8b\">\u793a\u4f8b</a>\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u6709\u5404\u79cd\u5feb\u6377\u547d\u4ee4\u7528\u4e8e<code class=\"command\">\\pset</code>\u3002\u8bf7\u53c2\u89c1<code class=\"command\">\\a</code>\u3001<code class=\"command\">\\C</code>\u3001<code class=\"command\">\\f</code>\u3001<code class=\"command\">\\H</code>\u3001<code class=\"command\">\\t</code>\u3001<code class=\"command\">\\T</code>\u548c<code class=\"command\">\\x</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-QUIT\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\q</code>\u6216<code class=\"literal\">\\quit</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9000\u51fa<span class=\"application\">psql</span>\u7a0b\u5e8f\u3002\u5728\u811a\u672c\u6587\u4ef6\u4e2d\uff0c\u53ea\u4f1a\u7ec8\u6b62\u8be5\u811a\u672c\u7684\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-QECHO\"><span class=\"term\"><code class=\"literal\">\\qecho <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u547d\u4ee4\u4e0e<code class=\"command\">\\echo</code>\u76f8\u540c\uff0c\u53ea\u662f\u8f93\u51fa\u4f1a\u5199\u5165\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u7684\u67e5\u8be2\u8f93\u51fa\u901a\u9053\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-RESET\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\r</code>\u6216<code class=\"literal\">\\reset</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u91cd\u7f6e\uff08\u6e05\u7a7a\uff09\u67e5\u8be2\u7f13\u51b2\u533a\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-RESTRICT\"><span class=\"term\"><code class=\"literal\">\\restrict <em class=\"replaceable\"><code>restrict_key</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528\u7ed9\u5b9a\u7684\u5bc6\u94a5\u8fdb\u5165<span class=\"quote\">\u201c<span class=\"quote\">\u53d7\u9650</span>\u201d</span>\u6a21\u5f0f\u3002\u5728\u8be5\u6a21\u5f0f\u4e0b\uff0c\u552f\u4e00\u5141\u8bb8\u7684\u5143\u547d\u4ee4\u662f\u7528\u4e8e\u9000\u51fa\u53d7\u9650\u6a21\u5f0f\u7684<code class=\"command\">\\unrestrict</code>\u3002\u5bc6\u94a5\u53ea\u80fd\u5305\u542b\u5b57\u6bcd\u6570\u5b57\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4e3b\u8981\u7528\u4e8e pg_dump\u3001pg_dumpall \u548c pg_restore \u751f\u6210\u7684\u7eaf\u6587\u672c\u8f6c\u50a8\uff0c\u4e5f\u53ef\u80fd\u9002\u7528\u4e8e\u5176\u4ed6\u573a\u666f\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-S\"><span class=\"term\"><code class=\"literal\">\\s [ <em class=\"replaceable\"><code>filename</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u5386\u53f2\u8bb0\u5f55\u5230<em class=\"replaceable\"><code>filename</code></em>\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5386\u53f2\u8bb0\u5f55\u5c06\u88ab\u5199\u5165\u6807\u51c6\u8f93\u51fa\uff08\u5982\u679c\u9002\u7528\uff0c\u5c06\u4f7f\u7528\u5206\u9875\u5668\uff09\u3002\u5982\u679c<span class=\"application\">psql</span>\u5728\u6784\u5efa\u65f6\u6ca1\u6709\u4f7f\u7528<span class=\"application\">Readline</span>\u652f\u6301\uff0c\u5219\u6b64\u547d\u4ee4\u4e0d\u53ef\u7528\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-SET\"><span class=\"term\"><code class=\"literal\">\\set [ <em class=\"replaceable\"><code>name</code></em> [ <em class=\"replaceable\"><code>value</code></em> [ ... ] ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e<span class=\"application\">psql</span>\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u4e3a<em class=\"replaceable\"><code>value</code></em>\uff0c\u5982\u679c\u7ed9\u51fa\u591a\u4e2a\u503c\uff0c\u5219\u8bbe\u7f6e\u4e3a\u6240\u6709\u503c\u7684\u8fde\u63a5\u3002\u5982\u679c\u53ea\u7ed9\u51fa\u4e00\u4e2a\u53c2\u6570\uff0c\u5219\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\u503c\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u8bbe\u7f6e\uff0c\u8bf7\u4f7f\u7528<code class=\"command\">\\unset</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\"><code class=\"command\">\\set</code>\u6ca1\u6709\u4efb\u4f55\u53c2\u6570\u65f6\uff0c\u663e\u793a\u5f53\u524d\u8bbe\u7f6e\u7684\u6240\u6709<span class=\"application\">psql</span>\u53d8\u91cf\u7684\u540d\u79f0\u548c\u503c\u3002</p>\n<p lang=\"zh\">\u6709\u6548\u7684\u53d8\u91cf\u540d\u53ef\u4ee5\u5305\u542b\u5b57\u6bcd\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u3002\u6709\u5173\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/16/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002\u53d8\u91cf\u540d\u533a\u5206\u5927\u5c0f\u5199\u3002</p>\n<p lang=\"zh\">\u67d0\u4e9b\u53d8\u91cf\u662f\u7279\u6b8a\u7684\uff0c\u5b83\u4eec\u63a7\u5236<span class=\"application\">psql</span>\u7684\u884c\u4e3a\u6216\u8005\u81ea\u52a8\u8bbe\u7f6e\u4ee5\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u3002\u8fd9\u4e9b\u53d8\u91cf\u5728\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/16/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u4e2d\u6709\u6587\u6863\u8bb0\u5f55\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u4e0e<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4<a class=\"link\" href=\"/docs/16/sql-set.html\" title=\"SET\"><code class=\"command\">SET</code></a>\u65e0\u5173\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-SETENV\"><span class=\"term\"><code class=\"literal\">\\setenv <em class=\"replaceable\"><code>name</code></em> [ <em class=\"replaceable\"><code>value</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u4e3a<em class=\"replaceable\"><code>value</code></em>\uff0c\u6216\u8005\u5982\u679c\u672a\u63d0\u4f9b<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3002\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\setenv PAGER less</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>\\setenv LESS -imx4F</code></strong>\n</pre>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-SF\"><span class=\"term\"><code class=\"literal\">\\sf[+] <em class=\"replaceable\"><code>function_description</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u663e\u793a\u6307\u5b9a\u51fd\u6570\u6216\u8fc7\u7a0b\u7684\u5b9a\u4e49\uff0c\u4ee5<code class=\"command\">CREATE OR REPLACE FUNCTION</code>\u6216 <code class=\"command\">CREATE OR REPLACE PROCEDURE</code>\u547d\u4ee4\u7684\u5f62\u5f0f\u5448\u73b0\u3002\u5b9a\u4e49\u5c06\u6253\u5370\u5230\u5f53\u524d\u67e5\u8be2\u8f93\u51fa\u901a\u9053\uff0c\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\">\u76ee\u6807\u51fd\u6570\u53ef\u4ec5\u7528\u540d\u79f0\u6307\u5b9a\uff0c\u4e5f\u53ef\u7528\u540d\u79f0\u548c\u53c2\u6570\u6307\u5b9a\uff0c\u4f8b\u5982 foo(integer, text)\u3002\u82e5\u6709\u591a\u4e2a\u540c\u540d\u51fd\u6570\uff0c\u5219\u5fc5\u987b\u63d0\u4f9b\u53c2\u6570\u7c7b\u578b\u3002</p>\n<p lang=\"zh\">\u5728\u547d\u4ee4\u540d\u540e\u6dfb\u52a0 +\uff0c\u4f1a\u4e3a\u8f93\u51fa\u884c\u7f16\u53f7\uff0c\u51fd\u6570\u4f53\u7b2c\u4e00\u884c\u4e3a\u7b2c 1 \u884c\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\sf</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-SV\"><span class=\"term\"><code class=\"literal\">\\sv[+] <em class=\"replaceable\"><code>view_name</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u6307\u5b9a\u89c6\u56fe\u7684\u5b9a\u4e49\uff0c\u5e76\u4ee5<code class=\"command\">CREATE OR REPLACE VIEW</code>\u547d\u4ee4\u7684\u5f62\u5f0f\u663e\u793a\u3002\u5b9a\u4e49\u4f1a\u6253\u5370\u5230\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u7684\u5f53\u524d\u67e5\u8be2\u8f93\u51fa\u901a\u9053\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u547d\u4ee4\u540d\u79f0\u540e\u6dfb\u52a0<code class=\"literal\">+</code>\uff0c\u90a3\u4e48\u8f93\u51fa\u884c\u5c06\u4ece1\u5f00\u59cb\u7f16\u53f7\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\sv</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-T-LC\"><span class=\"term\"><code class=\"literal\">\\t</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u8f93\u51fa\u4e2d\u7684\u5217\u540d\u6807\u9898\u548c\u884c\u6570\u9875\u811a\u7684\u663e\u793a\u72b6\u6001\u3002\u8fd9\u4e2a\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset tuples_only</code>\uff0c\u63d0\u4f9b\u5b83\u662f\u4e3a\u4e86\u4f7f\u7528\u65b9\u4fbf\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-T-UC\"><span class=\"term\"><code class=\"literal\">\\T <em class=\"replaceable\"><code>table_options</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728<acronym class=\"acronym\">HTML</acronym>\u8f93\u51fa\u683c\u5f0f\u4e2d\u653e\u5728<code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u5c5e\u6027\u3002\u8fd9\u4e2a\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset tableattr <em class=\"replaceable\"><code>table_options</code></em></code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-TIMING\"><span class=\"term\"><code class=\"literal\">\\timing [ <em class=\"replaceable\"><code>on</code></em> | <em class=\"replaceable\"><code>off</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5e26\u53c2\u6570\u65f6\uff0c\u5f00\u542f\u6216\u5173\u95ed\u6bcf\u6761 SQL \u8bed\u53e5\u6267\u884c\u8017\u65f6\u7684\u663e\u793a\u3002\u4e0d\u5e26\u53c2\u6570\u65f6\uff0c\u5207\u6362\u663e\u793a\u7684\u5f00\u5173\u72b6\u6001\u3002\u8017\u65f6\u4ee5\u6beb\u79d2\u663e\u793a\uff1b\u8d85\u8fc7 1 \u79d2\u7684\u65f6\u95f4\u95f4\u9694\u8fd8\u4f1a\u4ee5\u5206\u949f:\u79d2\u7684\u683c\u5f0f\u663e\u793a\uff0c\u5fc5\u8981\u65f6\u6dfb\u52a0\u5c0f\u65f6\u548c\u5929\u5b57\u6bb5\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-UNRESTRICT\"><span class=\"term\"><code class=\"literal\">\\unrestrict <em class=\"replaceable\"><code>restrict_key</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u9000\u51fa<span class=\"quote\">\u201c<span class=\"quote\">\u53d7\u9650</span>\u201d</span>\u6a21\u5f0f\uff08\u5373\u6240\u6709\u5176\u4ed6\u5143\u547d\u4ee4\u90fd\u88ab\u963b\u6b62\u7684\u6a21\u5f0f\uff09\uff0c\u524d\u63d0\u662f\u6307\u5b9a\u7684\u5bc6\u94a5\u4e0e\u8fdb\u5165\u53d7\u9650\u6a21\u5f0f\u65f6\u4f20\u7ed9<code class=\"command\">\\restrict</code>\u7684\u5bc6\u94a5\u5339\u914d\u3002</p>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4e3b\u8981\u7528\u4e8e pg_dump\u3001pg_dumpall \u548c pg_restore \u751f\u6210\u7684\u7eaf\u6587\u672c\u8f6c\u50a8\uff0c\u4e5f\u53ef\u80fd\u9002\u7528\u4e8e\u5176\u4ed6\u573a\u666f\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u5269\u4f59\u884c\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\unrestrict</code>\u7684\u53c2\u6570\uff0c\u5e76\u4e14\u4e0d\u4f1a\u6267\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-UNSET\"><span class=\"term\"><code class=\"literal\">\\unset <em class=\"replaceable\"><code>name</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u53d6\u6d88\u8bbe\u7f6e\uff08\u5220\u9664\uff09<span class=\"application\">psql</span>\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u3002</p>\n<p lang=\"zh\">\u5927\u591a\u6570\u63a7\u5236<span class=\"application\">psql</span>\u884c\u4e3a\u7684\u53d8\u91cf\u4e0d\u80fd\u53d6\u6d88\u8bbe\u7f6e\uff1b\u5bf9\u4e8e\u8fd9\u4e9b\u53d8\u91cf\uff0c<code class=\"literal\">\\unset</code>\u547d\u4ee4\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u5176\u8bbe\u7f6e\u4e3a\u9ed8\u8ba4\u503c\u3002\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/16/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-WRITE\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\w</code> \u6216 <code class=\"literal\">\\write</code> <em class=\"replaceable\"><code>filename</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\w</code> \u6216 <code class=\"literal\">\\write</code> <code class=\"literal\">|</code><em class=\"replaceable\"><code>command</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u5199\u5165\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u9012\u7ed9 shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6539\u4e3a\u5199\u5165\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\uff0c\u5219\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u7684\u5185\u5bb9\u53ea\u4f1a\u539f\u6837\u4f20\u9012\u7ed9 shell\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-WARN\"><span class=\"term\"><code class=\"literal\">\\warn <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u547d\u4ee4\u4e0e<code class=\"command\">\\echo</code>\u547d\u4ee4\u76f8\u540c\uff0c\u53ea\u662f\u8f93\u51fa\u5c06\u88ab\u5199\u5165<span class=\"application\">psql</span>\u7684\u6807\u51c6\u9519\u8bef\u901a\u9053\uff0c\u800c\u4e0d\u662f\u6807\u51c6\u8f93\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-WATCH\"><span class=\"term\"><code class=\"literal\">\\watch [ i[nterval]=<em class=\"replaceable\"><code>seconds</code></em> ] [ c[ount]=<em class=\"replaceable\"><code>times</code></em> ] [ <em class=\"replaceable\"><code>seconds</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u91cd\u590d\u6267\u884c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\uff08\u5982\u540c <code class=\"literal\">\\g</code> \u4e00\u6837\uff09\uff0c\u76f4\u5230\u88ab\u4e2d\u65ad\u3001\u67e5\u8be2\u5931\u8d25\u6216\u8fbe\u5230\u6267\u884c\u6b21\u6570\u4e0a\u9650\uff08\u5982\u679c\u7ed9\u5b9a\uff09\u3002\u4e24\u6b21\u6267\u884c\u4e4b\u95f4\u7b49\u5f85\u6307\u5b9a\u7684\u79d2\u6570\uff08\u9ed8\u8ba4 2 \u79d2\uff09\u3002\u4e3a\u4fdd\u6301\u5411\u540e\u517c\u5bb9\uff0c<em class=\"replaceable\"><code>seconds</code></em> \u53ef\u4ee5\u5e26\u6216\u4e0d\u5e26 <code class=\"literal\">interval=</code> \u524d\u7f00\u3002\u6bcf\u6b21\u67e5\u8be2\u7ed3\u679c\u90fd\u4f1a\u5e26\u6709\u4e00\u4e2a\u5934\u90e8\uff0c\u5176\u4e2d\u5305\u542b <code class=\"literal\">\\pset title</code> \u5b57\u7b26\u4e32\uff08\u5982\u679c\u6709\uff09\u3001\u67e5\u8be2\u5f00\u59cb\u65f6\u7684\u65f6\u95f4\u4ee5\u53ca\u5ef6\u8fdf\u95f4\u9694\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-X\"><span class=\"term\"><code class=\"literal\">\\x [ <em class=\"replaceable\"><code>on</code></em> | <em class=\"replaceable\"><code>off</code></em> | <em class=\"replaceable\"><code>auto</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u6216\u5207\u6362\u6269\u5c55\u8868\u683c\u683c\u5f0f\u6a21\u5f0f\u3002\u5b83\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset expanded</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-Z\"><span class=\"term\"><code class=\"literal\">\\z[S] [ <a class=\"link\" href=\"https://pg.center/docs/16/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u53ca\u5176\u76f8\u5173\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n<p lang=\"zh\">\u8fd9\u662f<code class=\"command\">\\dp</code>\u7684\u522b\u540d\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u663e\u793a\u6743\u9650</span>\u201d</span>\uff09\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-EXCLAMATION-MARK\"><span class=\"term\"><code class=\"literal\">\\! [ <em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u5e26\u53c2\u6570\u65f6\uff0c\u8fdb\u5165\u4e00\u4e2a\u5b50 shell\uff1b\u5b50 shell \u9000\u51fa\u540e\uff0c<span class=\"application\">psql</span>\u6062\u590d\u8fd0\u884c\u3002\u5e26\u53c2\u6570\u65f6\uff0c\u6267\u884c shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\!</code>\u7684\u53c2\u6570\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u5185\u5bb9\u4f1a\u539f\u6837\u4f20\u7ed9 shell\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-QUESTION-MARK\"><span class=\"term\"><code class=\"literal\">\\? [ <em class=\"replaceable\"><code>topic</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5e2e\u52a9\u4fe1\u606f\u3002\u53ef\u9009\u7684<em class=\"replaceable\"><code>topic</code></em>\u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a<code class=\"literal\">commands</code>\uff09\u9009\u62e9\u8981\u89e3\u91ca\u7684<span class=\"application\">psql</span>\u7684\u54ea\u4e2a\u90e8\u5206\uff1a<code class=\"literal\">commands</code>\u63cf\u8ff0<span class=\"application\">psql</span>\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b<code class=\"literal\">options</code>\u63cf\u8ff0\u53ef\u4ee5\u4f20\u9012\u7ed9<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c<code class=\"literal\">variables</code>\u663e\u793a\u5173\u4e8e<span class=\"application\">psql</span>\u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-SEMICOLON\"><span class=\"term\"><code class=\"literal\">\\;</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u53cd\u659c\u7ebf\u5206\u53f7\u4e0d\u50cf\u524d\u9762\u7684\u547d\u4ee4\u90a3\u6837\u662f\u4e00\u4e2a\u5143\u547d\u4ee4\uff1b\u76f8\u53cd\uff0c\u5b83\u53ea\u662f\u5728\u4e0d\u8fdb\u884c\u8fdb\u4e00\u6b65\u5904\u7406\u7684\u60c5\u51b5\u4e0b\u5c06\u4e00\u4e2a\u5206\u53f7\u6dfb\u52a0\u5230\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u3002</p>\n<p lang=\"zh\">\u901a\u5e38\uff0c<span class=\"application\">psql</span>\u4f1a\u5728\u5230\u8fbe\u547d\u4ee4\u7ed3\u675f\u7684\u5206\u53f7\u65f6\u7acb\u5373\u5c06SQL\u547d\u4ee4\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u5373\u4f7f\u5f53\u524d\u884c\u8fd8\u6709\u66f4\u591a\u8f93\u5165\u3002\u56e0\u6b64\uff0c\u4f8b\u5982\u8f93\u5165</p>\n<pre class=\"programlisting\">select 1; select 2; select 3;\n</pre>\n<p lang=\"zh\">\u5c06\u5bfc\u81f4\u4e09\u4e2aSQL\u547d\u4ee4\u5206\u522b\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u6bcf\u4e2a\u547d\u4ee4\u7684\u7ed3\u679c\u5728\u7ee7\u7eed\u4e0b\u4e00\u4e2a\u547d\u4ee4\u4e4b\u524d\u663e\u793a\u3002\u7136\u800c\uff0c\u8f93\u5165\u4e3a<code class=\"literal\">\\;</code>\u7684\u5206\u53f7\u4e0d\u4f1a\u89e6\u53d1\u547d\u4ee4\u5904\u7406\uff0c\u56e0\u6b64\u5b83\u4e4b\u524d\u548c\u4e4b\u540e\u7684\u547d\u4ee4\u5b9e\u9645\u4e0a\u88ab\u5408\u5e76\u5e76\u4f5c\u4e3a\u4e00\u4e2a\u8bf7\u6c42\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u56e0\u6b64\uff0c\u4f8b\u5982</p>\n<pre class=\"programlisting\">select 1\\; select 2\\; select 3;\n</pre>\n<p lang=\"zh\">\u4f1a\u5728\u9047\u5230\u524d\u9762\u6ca1\u6709\u53cd\u659c\u7ebf\u7684\u5206\u53f7\u65f6\uff0c\u5c06\u8fd9\u4e09\u4e2a SQL \u547d\u4ee4\u4f5c\u4e3a\u5355\u4e2a\u8bf7\u6c42\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u670d\u52a1\u5668\u4f1a\u5c06\u6b64\u7c7b\u8bf7\u6c42\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff0c\u9664\u975e\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u663e\u5f0f\u7684<code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code>\u547d\u4ee4\u5c06\u5176\u5206\u6210\u591a\u4e2a\u4e8b\u52a1\u3002\uff08\u6709\u5173\u670d\u52a1\u5668\u5982\u4f55\u5904\u7406\u591a\u67e5\u8be2\u5b57\u7b26\u4e32\u7684\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/16/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT\" title=\"55.2.2.1.\u00a0\u4e00\u4e2a\u7b80\u5355\u67e5\u8be2\u4e2d\u7684\u591a\u6761\u8bed\u53e5\">\u7b2c\u00a055.2.2.1\u00a0\u8282</a>\u3002\uff09</p>\n</dd>\n</dl>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-PATTERNS\">\n<h4 lang=\"zh\">\u6a21\u5f0f</h4>\n<p lang=\"zh\">\u5f88\u591a<code class=\"literal\">\\d</code>\u547d\u4ee4\u90fd\u53ef\u4ee5\u7528\u4e00\u4e2a<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\u6765\u6307\u5b9a\u8981\u88ab\u663e\u793a\u7684\u5bf9\u8c61\u540d\u79f0\u3002\u5728\u6700\u7b80\u5355\u7684\u60c5\u51b5\u4e0b\uff0c\u6a21\u5f0f\u6b63\u597d\u5c31\u662f\u8be5\u5bf9\u8c61\u7684\u51c6\u786e\u540d\u79f0\u3002\u5728\u6a21\u5f0f\u4e2d\u7684\u5b57\u7b26\u901a\u5e38\u4f1a\u88ab\u53d8\u6210\u5c0f\u5199\u5f62\u5f0f\uff08\u5c31\u50cf\u5728 SQL \u540d\u79f0\u4e2d\u90a3\u6837\uff09\uff0c\u4f8b\u5982<code class=\"literal\">\\dt FOO</code>\u5c06\u4f1a\u663e\u793a\u540d\u4e3a<code class=\"literal\">foo</code>\u7684\u8868\u3002\u5c31\u50cf\u5728 SQL \u540d\u79f0\u4e2d\u90a3\u6837\uff0c\u628a\u6a21\u5f0f\u653e\u5728\u53cc\u5f15\u53f7\u4e2d\u53ef\u4ee5\u963b\u6b62\u5b83\u88ab\u8f6c\u6362\u6210\u5c0f\u5199\u5f62\u5f0f\u3002\u5982\u679c\u9700\u8981\u5728\u4e00\u4e2a\u6a21\u5f0f\u4e2d\u5305\u62ec\u4e00\u4e2a\u771f\u6b63\u7684\u53cc\u5f15\u53f7\u5b57\u7b26\uff0c\u5219\u9700\u8981\u5728\u53cc\u5f15\u53f7\u5305\u56f4\u7684\u6587\u672c\u5185\u628a\u5b83\u5199\u6210\u4e24\u4e2a\u76f8\u90bb\u7684\u53cc\u5f15\u53f7\uff0c\u8fd9\u540c\u6837\u662f\u7b26\u5408 SQL \u52a0\u5f15\u53f7\u6807\u8bc6\u7b26\u7684\u89c4\u5219\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dt \"FOO\"\"BAR\"</code>\u5c06\u663e\u793a\u540d\u4e3a<code class=\"literal\">FOO\"BAR</code>\uff08\u4e0d\u662f<code class=\"literal\">foo\"bar</code>\uff09\u7684\u8868\u3002\u548c\u666e\u901a\u7684 SQL \u540d\u79f0\u89c4\u5219\u4e0d\u540c\uff0c\u4f60\u53ef\u4ee5\u53ea\u5728\u6a21\u5f0f\u7684\u4e00\u90e8\u5206\u5468\u56f4\u653e\u4e0a\u53cc\u5f15\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">\\dt FOO\"FOO\"BAR</code>\u5c06\u4f1a\u663e\u793a\u540d\u4e3a<code class=\"literal\">fooFOObar</code>\u7684\u8868\u3002</p>\n<p lang=\"zh\">\u53ea\u8981\u5b8c\u5168\u7701\u7565<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\uff0c<code class=\"literal\">\\d</code>\u547d\u4ee4\u5c31\u4f1a\u663e\u793a\u5f53\u524d\u6a21\u5f0f\u641c\u7d22\u8def\u5f84\u4e2d\u53ef\u89c1\u7684\u5168\u90e8\u5bf9\u8c61 \u2014 \u8fd9\u7b49\u4ef7\u4e8e\u7528<code class=\"literal\">*</code>\u4f5c\u4e3a\u6a21\u5f0f\uff08\u5982\u679c\u4e00\u4e2a\u5bf9\u8c61\u6240\u5728\u7684\u6a21\u5f0f\u4f4d\u4e8e\u641c\u7d22\u8def\u5f84\u4e2d\uff0c\u5e76\u4e14\u5728\u641c\u7d22\u8def\u5f84\u4e2d\u8be5\u6a21\u5f0f\u4e4b\u524d\u6ca1\u6709\u540c\u7c7b\u4e14\u540c\u540d\u7684\u5bf9\u8c61\uff0c\u5219\u8be5\u5bf9\u8c61\u5c31\u662f<em class=\"firstterm\">\u53ef\u89c1</em>\u7684\u3002\u8fd9\u8868\u793a\u53ef\u4ee5\u76f4\u63a5\u7528\u540d\u79f0\u5f15\u7528\u8be5\u5bf9\u8c61\uff0c\u800c\u4e0d\u9700\u8981\u7528\u6a21\u5f0f\u6765\u9650\u5b9a\uff09\u3002\u8981\u67e5\u770b\u6570\u636e\u5e93\u4e2d\u6240\u6709\u5bf9\u8c61\u800c\u4e0d\u8003\u8651\u5176\u53ef\u89c1\u6027\uff0c\u53ef\u4ee5\u628a<code class=\"literal\">*.*</code>\u7528\u4f5c\u6a21\u5f0f\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u653e\u5728\u4e00\u4e2a\u6a21\u5f0f\u4e2d\uff0c<code class=\"literal\">*</code>\u5c06\u5339\u914d\u4efb\u610f\u5b57\u7b26\u5e8f\u5217\uff08\u5305\u62ec\u7a7a\u5e8f\u5217\uff09\uff0c\u800c<code class=\"literal\">?</code>\u4f1a\u5339\u914d\u4efb\u610f\u7684\u5355\u4e2a\u5b57\u7b26\uff08\u8fd9\u79cd\u8bb0\u53f7\u65b9\u6cd5\u5c31\u50cf Unix shell \u7684\u6587\u4ef6\u540d\u6a21\u5f0f\u4e00\u6837\uff09\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dt int*</code>\u4f1a\u663e\u793a\u540d\u79f0\u4ee5<code class=\"literal\">int</code>\u5f00\u59cb\u7684\u8868\u3002\u4f46\u662f\u5982\u679c\u88ab\u653e\u5728\u53cc\u5f15\u53f7\u5185\uff0c<code class=\"literal\">*</code>\u548c<code class=\"literal\">?</code>\u5c31\u4f1a\u5931\u53bb\u8fd9\u4e9b\u7279\u6b8a\u542b\u4e49\u800c\u53d8\u6210\u666e\u901a\u7684\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u5305\u542b\u70b9\u53f7\uff08.\uff09\u7684\u5173\u7cfb\u540d\u6a21\u5f0f\u4f1a\u88ab\u89e3\u91ca\u4e3a\u6a21\u5f0f\u540d\u5339\u914d\u6a21\u5f0f\uff0c\u540e\u63a5\u5bf9\u8c61\u540d\u5339\u914d\u6a21\u5f0f\u3002\u4f8b\u5982\uff0c\\dt foo*.*bar* \u4f1a\u663e\u793a\u6240\u6709\u6a21\u5f0f\u540d\u4ee5 foo \u5f00\u5934\u3001\u8868\u540d\u5305\u542b bar \u7684\u8868\u3002\u6ca1\u6709\u70b9\u53f7\u65f6\uff0c\u53ea\u5339\u914d\u5f53\u524d\u6a21\u5f0f\u641c\u7d22\u8def\u5f84\u4e2d\u53ef\u89c1\u7684\u5bf9\u8c61\u3002\u540c\u6837\uff0c\u53cc\u5f15\u53f7\u5185\u7684\u70b9\u53f7\u4e0d\u5177\u6709\u7279\u6b8a\u542b\u4e49\uff0c\u6309\u5b57\u9762\u5339\u914d\u3002\u5305\u542b\u4e24\u4e2a\u70b9\u53f7\uff08.\uff09\u7684\u5173\u7cfb\u540d\u6a21\u5f0f\u4f1a\u88ab\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u540d\uff0c\u540e\u63a5\u6a21\u5f0f\u540d\u5339\u914d\u6a21\u5f0f\uff0c\u518d\u63a5\u5bf9\u8c61\u540d\u5339\u914d\u6a21\u5f0f\u3002\u6570\u636e\u5e93\u540d\u90e8\u5206\u4e0d\u4f5c\u4e3a\u5339\u914d\u6a21\u5f0f\uff0c\u5fc5\u987b\u4e0e\u5f53\u524d\u8fde\u63a5\u7684\u6570\u636e\u5e93\u540d\u79f0\u76f8\u540c\uff0c\u5426\u5219\u4f1a\u62a5\u9519\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7528\u4e8e\u5339\u914d\u6a21\u5f0f\u540d\u7684\u6a21\u5f0f\u5305\u542b\u4e00\u4e2a\u70b9\uff08<code class=\"literal\">.</code>\uff09\uff0c\u5219\u4f1a\u88ab\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u540d\uff0c\u540e\u63a5\u6a21\u5f0f\u540d\u7684\u5339\u914d\u6a21\u5f0f\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dn mydb.*foo*</code>\u4f1a\u663e\u793a\u540d\u79f0\u4e2d\u5305\u542b<code class=\"literal\">foo</code>\u7684\u6240\u6709\u6a21\u5f0f\u3002\u6570\u636e\u5e93\u540d\u90e8\u5206\u4e0d\u4f1a\u88ab\u5f53\u4f5c\u5339\u914d\u6a21\u5f0f\uff0c\u5fc5\u987b\u4e0e\u5f53\u524d\u8fde\u63a5\u7684\u6570\u636e\u5e93\u540d\u76f8\u540c\uff0c\u5426\u5219\u4f1a\u62a5\u9519\u3002</p>\n<p lang=\"zh\">\u9ad8\u7ea7\u7528\u6237\u53ef\u4ee5\u4f7f\u7528\u5b57\u7b26\u7c7b\u7b49\u6b63\u5219\u8868\u8fbe\u5f0f\u8bb0\u6cd5\uff0c\u5982<code class=\"literal\">[0-9]</code>\u53ef\u4ee5\u5339\u914d\u4efb\u610f\u6570\u5b57\u3002\u6240\u6709\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u90fd\u6309\u7167<a class=\"xref\" href=\"/docs/16/functions-matching.html#FUNCTIONS-POSIX-REGEXP\" title=\"9.7.3.\u00a0POSIX\u6b63\u5219\u8868\u8fbe\u5f0f\">\u7b2c\u00a09.7.3\u00a0\u8282</a>\u6240\u8bf4\u7684\u5de5\u4f5c\uff0c\u4ee5\u4e0b\u5b57\u7b26\u9664\u5916\uff1a<code class=\"literal\">.</code>\u4f1a\u6309\u7167\u4e0a\u9762\u6240\u8bf4\u7684\u4f5c\u4e3a\u4e00\u79cd\u5206\u9694\u7b26\uff0c<code class=\"literal\">*</code>\u4f1a\u88ab\u7ffb\u8bd1\u6210\u6b63\u5219\u8868\u8fbe\u5f0f\u8bb0\u53f7<code class=\"literal\">.*</code>\uff0c<code class=\"literal\">?</code>\u4f1a\u88ab\u7ffb\u8bd1\u6210<code class=\"literal\">.</code>\uff0c\u800c<code class=\"literal\">$</code>\u5219\u6309\u5b57\u9762\u610f\u601d\u5339\u914d\u3002\u6839\u636e\u9700\u8981\uff0c\u53ef\u4ee5\u7528<code class=\"literal\">?</code>\u6a21\u62df<code class=\"literal\">.</code>\uff0c\u7528<code class=\"literal\">(<em class=\"replaceable\"><code>R</code></em>+|)</code>\u6a21\u62df<code class=\"literal\"><em class=\"replaceable\"><code>R</code></em>*</code>\uff0c\u6216\u7528<code class=\"literal\">(<em class=\"replaceable\"><code>R</code></em>|)</code>\u6a21\u62df<code class=\"literal\"><em class=\"replaceable\"><code>R</code></em>?</code>\u3002<code class=\"literal\">$</code>\u4e0d\u9700\u8981\u4f5c\u4e3a\u4e00\u4e2a\u6b63\u5219\u8868\u8fbe\u5f0f\u5b57\u7b26\uff0c\u56e0\u4e3a\u6a21\u5f0f\u5fc5\u987b\u5339\u914d\u6574\u4e2a\u540d\u79f0\uff0c\u800c\u4e0d\u662f\u50cf\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5e38\u89c4\u7528\u6cd5\u90a3\u6837\u89e3\u91ca\uff08\u6362\u53e5\u8bdd\u8bf4\uff0c<code class=\"literal\">$</code>\u4f1a\u88ab\u81ea\u52a8\u5730\u8ffd\u52a0\u5230\u6a21\u5f0f\u4e0a\uff09\u3002\u5982\u679c\u4e0d\u5e0c\u671b\u8be5\u6a21\u5f0f\u7684\u5339\u914d\u4f4d\u7f6e\u88ab\u56fa\u5b9a\uff0c\u53ef\u4ee5\u5728\u5f00\u5934\u6216\u8005\u7ed3\u5c3e\u5199\u4e0a<code class=\"literal\">*</code>\u3002\u6ce8\u610f\u5728\u53cc\u5f15\u53f7\u5185\uff0c\u6240\u6709\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u4f1a\u5931\u53bb\u5176\u7279\u6b8a\u542b\u4e49\u5e76\u4e14\u6309\u7167\u5176\u5b57\u9762\u610f\u601d\u8fdb\u884c\u5339\u914d\u3002\u8fd8\u6709\uff0c\u5728\u64cd\u4f5c\u7b26\u540d\u79f0\u6a21\u5f0f\u4e2d\uff08\u5373\u4f5c\u4e3a<code class=\"literal\">\\do</code>\u7684\u53c2\u6570\uff09\uff0c\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u4e5f\u6309\u7167\u5b57\u9762\u610f\u601d\u8fdb\u884c\u5339\u914d\u3002</p>\n</div>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.20.8.5\">\n<h3 lang=\"zh\">\u9ad8\u7ea7\u7279\u6027</h3>\n<div class=\"refsect3\" id=\"APP-PSQL-VARIABLES\">\n<h4 lang=\"zh\">\u53d8\u91cf</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u63d0\u4f9b\u4e86\u548c\u666e\u901a Unix \u547d\u4ee4 shell \u76f8\u4f3c\u7684\u53d8\u91cf\u66ff\u6362\u7279\u6027\u3002\u53d8\u91cf\u7b80\u5355\u6765\u8bf4\u5c31\u662f\u4e00\u5bf9\u540d\u79f0/\u503c\uff0c\u5176\u4e2d\u503c\u53ef\u4ee5\u662f\u4efb\u610f\u957f\u5ea6\u7684\u4efb\u610f\u5b57\u7b26\u4e32\u3002\u540d\u79f0\u5fc5\u987b\u7531\u5b57\u6bcd\uff08\u5305\u62ec\u975e\u62c9\u4e01\u5b57\u6bcd\uff09\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u6784\u6210\u3002</p>\n<p lang=\"zh\">\u8981\u8bbe\u7f6e\u4e00\u4e2a\u53d8\u91cf\uff0c\u53ef\u4ee5\u4f7f\u7528<span class=\"application\">psql</span>\u7684\u5143\u547d\u4ee4<code class=\"command\">\\set</code>\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo bar</code></strong>\n</pre>\n<p lang=\"zh\">\u4f1a\u5c06<code class=\"literal\">foo</code>\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">bar</code>\u3002\u8981\u68c0\u7d22\u8be5\u53d8\u91cf\u7684\u5185\u5bb9\uff0c\u53ef\u4ee5\u5728\u540d\u79f0\u524d\u653e\u4e00\u4e2a\u5192\u53f7\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\echo :foo</code></strong>\nbar\n</pre>\n<p lang=\"zh\">\u8fd9\u5728\u5e38\u89c4 SQL \u547d\u4ee4\u548c\u5143\u547d\u4ee4\u4e2d\u5747\u6709\u6548\uff0c\u4e0b\u6587\u7684<a class=\"xref\" href=\"/docs/16/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL \u63d2\u503c\">SQL \u63d2\u503c</a>\u4e2d\u6709\u66f4\u591a\u7ec6\u8282\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u8c03\u7528<code class=\"command\">\\set</code>\u65f6\u6ca1\u6709\u7b2c\u4e8c\u4e2a\u53c2\u6570\uff0c\u8be5\u53d8\u91cf\u4f1a\u88ab\u8bbe\u7f6e\u4e3a\u4e00\u4e2a\u7a7a\u5b57\u7b26\u4e32\u503c\u3002\u8981\u53d6\u6d88\u8bbe\u7f6e\uff08\u5373\u5220\u9664\uff09\u4e00\u4e2a\u53d8\u91cf\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4<code class=\"command\">\\unset</code>\u3002\u8981\u663e\u793a\u6240\u6709\u53d8\u91cf\u7684\u503c\uff0c\u5728\u8c03\u7528<code class=\"command\">\\set</code>\u65f6\u4e0d\u5e26\u4efb\u4f55\u53c2\u6570\u5373\u53ef\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\"><code class=\"command\">\\set</code>\u7684\u53c2\u6570\u670d\u4ece\u4e0e\u5176\u4ed6\u547d\u4ee4\u76f8\u540c\u7684\u66ff\u6362\u89c4\u5219\u3002\u56e0\u6b64\u53ef\u4ee5\u6784\u9020\u6709\u8da3\u7684\u5f15\u7528\uff0c\u4f8b\u5982<code class=\"literal\">\\set :foo 'something'</code>\u4ee5\u53ca\u5206\u522b\u5f97\u5230<span class=\"productname\">Perl</span>\u6216\u8005<span class=\"productname\"><acronym class=\"acronym\">PHP</acronym></span>\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u8f6f\u94fe\u63a5</span>\u201d</span>\u6216\u8005<span class=\"quote\">\u201c<span class=\"quote\">\u53ef\u53d8\u53d8\u91cf</span>\u201d</span>\u3002\u4e0d\u5e78\u7684\u662f\uff08\u6216\u8005\u5e78\u8fd0\u7684\u662f\uff1f\uff09\uff0c\u8fd9\u4e9b\u6784\u9020\u51fa\u6765\u7684\u4e1c\u897f\u5e76\u6ca1\u6709\u4ec0\u4e48\u7528\u5904\u3002\u5728\u53e6\u4e00\u65b9\u9762\uff0c<code class=\"literal\">\\set bar :foo</code>\u662f\u4e00\u79cd\u5f88\u597d\u7684\u62f7\u8d1d\u53d8\u91cf\u7684\u65b9\u6cd5\u3002</p>\n</div>\n<p lang=\"zh\">\u6709\u4e00\u4e9b\u53d8\u91cf\u4f1a\u88ab<span class=\"application\">psql</span>\u7279\u6b8a\u5bf9\u5f85\u3002\u5b83\u4eec\u8868\u793a\u7279\u5b9a\u7684\u9009\u9879\u8bbe\u7f6e\uff0c\u8fd0\u884c\u65f6\u8fd9\u7c7b\u9009\u9879\u8bbe\u7f6e\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539\u8be5\u53d8\u91cf\u7684\u503c\u6765\u6539\u53d8\uff0c\u6216\u8005\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u5b83\u4eec\u8868\u793a<span class=\"application\">psql</span>\u7684\u53ef\u66f4\u6539\u7684\u72b6\u6001\u3002\u6309\u7167\u60ef\u4f8b\uff0c\u6240\u6709\u88ab\u7279\u6b8a\u5bf9\u5f85\u7684\u53d8\u91cf\u7684\u540d\u79f0\u7531\u5168\u90e8\u5927\u5199\u5f62\u5f0f\u7684 ASCII \u5b57\u6bcd\uff08\u8fd8\u6709\u53ef\u80fd\u662f\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\uff09\u7ec4\u6210\u3002\u4e3a\u4e86\u786e\u4fdd\u672a\u6765\u6700\u5927\u7684\u517c\u5bb9\u6027\uff0c\u6700\u597d\u907f\u514d\u628a\u8fd9\u7c7b\u53d8\u91cf\u540d\u7528\u4e8e\u81ea\u5df1\u7684\u76ee\u7684\u3002</p>\n<p lang=\"zh\">\u63a7\u5236<span class=\"application\">psql</span>\u884c\u4e3a\u7684\u53d8\u91cf\u901a\u5e38\u4e0d\u80fd\u88ab\u53d6\u6d88\u8bbe\u7f6e\u6216\u8005\u8bbe\u7f6e\u4e3a\u65e0\u6548\u503c\u3002\u5141\u8bb8<code class=\"literal\">\\unset</code>\u547d\u4ee4\uff0c\u4f46\u5b83\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u5b83\u7684\u9ed8\u8ba4\u503c\u3002\u6ca1\u6709\u7b2c\u4e8c\u53c2\u6570\u7684<code class=\"literal\">\\set</code>\u547d\u4ee4\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\uff08\u5bf9\u4e8e\u63a5\u53d7\u8be5\u503c\u7684\u63a7\u5236\u53d8\u91cf\uff09\uff0c\u5bf9\u4e0d\u63a5\u53d7\u8be5\u503c\u7684\u53d8\u91cf\u5219\u4f1a\u62d2\u7edd\u8fd9\u4e2a\u547d\u4ee4\u3002\u6b64\u5916\uff0c\u63a5\u53d7\u503c<code class=\"literal\">on</code>\u548c<code class=\"literal\">off</code>\u7684\u63a7\u5236\u53d8\u91cf\u4e5f\u80fd\u63a5\u53d7\u5176\u4ed6\u5e38\u89c1\u7684\u5e03\u5c14\u503c\u62fc\u5199\u65b9\u5f0f\uff0c\u4f8b\u5982<code class=\"literal\">true</code>\u548c<code class=\"literal\">false</code>\u3002</p>\n<p lang=\"zh\">\u88ab\u7279\u6b8a\u5bf9\u5f85\u7684\u53d8\u91cf\u662f\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-VARIABLES-AUTOCOMMIT\"><span class=\"term\"><code class=\"varname\">AUTOCOMMIT</code> </span> </dt>\n<dd>\n<p lang=\"zh\">\u5728\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\uff08\u9ed8\u8ba4\uff09\u65f6\uff0c\u6bcf\u4e00\u4e2a SQL \u547d\u4ee4\u5728\u6210\u529f\u5b8c\u6210\u65f6\u4f1a\u88ab\u81ea\u52a8\u63d0\u4ea4\u3002\u5728\u8fd9\u79cd\u6a21\u5f0f\u4e2d\u8981\u63a8\u8fdf\u63d0\u4ea4\uff0c\u5fc5\u987b\u8f93\u5165\u4e00\u4e2a<code class=\"command\">BEGIN</code>\u6216\u8005<code class=\"command\">START TRANSACTION</code> SQL \u547d\u4ee4\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">off</code>\u6216\u8005\u88ab\u53d6\u6d88\u8bbe\u7f6e\u65f6\uff0c\u5728\u663e\u5f0f\u53d1\u51fa<code class=\"command\">COMMIT</code>\u6216\u8005<code class=\"command\">END</code>\u4e4b\u524d\uff0cSQL \u547d\u4ee4\u4e0d\u4f1a\u88ab\u63d0\u4ea4\u3002\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u4f1a\u4e3a\u4f60\u53d1\u51fa\u4e00\u4e2a\u9690\u5f0f\u7684<code class=\"command\">BEGIN</code>\uff0c\u8fd9\u4f1a\u53d1\u751f\u5728\u547d\u4ee4\u6267\u884c\u4e4b\u524d\uff0c\u524d\u63d0\u662f\u8be5\u547d\u4ee4\u4e0d\u5728\u4e8b\u52a1\u5757\u4e2d\uff0c\u4e14\u5176\u672c\u8eab\u65e2\u4e0d\u662f<code class=\"command\">BEGIN</code>\u6216\u5176\u4ed6\u4e8b\u52a1\u63a7\u5236\u547d\u4ee4\uff0c\u4e5f\u4e0d\u662f\u65e0\u6cd5\u5728\u4e8b\u52a1\u5757\u4e2d\u6267\u884c\u7684\u547d\u4ee4\uff08\u4f8b\u5982<code class=\"command\">VACUUM</code>\uff09\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u4e2d\uff0c\u5fc5\u987b\u901a\u8fc7<code class=\"command\">ABORT</code>\u6216\u8005<code class=\"command\">ROLLBACK</code>\u663e\u5f0f\u5730\u653e\u5f03\u4efb\u4f55\u5931\u8d25\u7684\u4e8b\u52a1\u3002\u8fd8\u8981\u8bb0\u4f4f\uff0c\u5982\u679c\u9000\u51fa\u4f1a\u8bdd\u65f6\u6ca1\u6709\u63d0\u4ea4\uff0c\u5219\u6240\u6709\u7684\u5de5\u4f5c\u90fd\u4f1a\u4e22\u5931\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u81ea\u52a8\u63d0\u4ea4\u6253\u5f00\u6a21\u5f0f\u662f<span class=\"productname\">PostgreSQL</span>\u7684\u4f20\u7edf\u884c\u4e3a\uff0c\u4f46\u662f\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u66f4\u63a5\u8fd1\u4e8e SQL \u7684\u89c4\u8303\u3002\u5982\u679c\u66f4\u559c\u6b22\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\uff0c\u53ef\u4ee5\u5728\u7cfb\u7edf\u7ea7\u7684<code class=\"filename\">psqlrc</code>\u6587\u4ef6\u6216\u8005\u4e2a\u4eba\u7684<code class=\"filename\">~/.psqlrc</code>\u6587\u4ef6\u4e2d\u8bbe\u7f6e\u5b83\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-COMP-KEYWORD-CASE\"><span class=\"term\"><code class=\"varname\">COMP_KEYWORD_CASE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u786e\u5b9a\u5728\u8865\u5168\u4e00\u4e2a SQL \u5173\u952e\u8bcd\u65f6\u8981\u4f7f\u7528\u7684\u5927\u5c0f\u5199\u5f62\u5f0f\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">lower</code>\u6216\u8005<code class=\"literal\">upper</code>\uff0c\u8865\u5168\u540e\u7684\u8bcd\u5c06\u5206\u522b\u662f\u5c0f\u5199\u6216\u8005\u5927\u5199\u5f62\u5f0f\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">preserve-lower</code>\u6216\u8005<code class=\"literal\">preserve-upper</code>\uff08\u9ed8\u8ba4\uff09\uff0c\u8865\u5168\u540e\u7684\u8bcd\u5c06\u4f1a\u4fdd\u6301\u8be5\u8bcd\u5df2\u8f93\u5165\u90e8\u5206\u7684\u5927\u5c0f\u5199\u5f62\u5f0f\uff0c\u4f46\u662f\u5982\u679c\u88ab\u8865\u5168\u7684\u8bcd\u8fd8\u6ca1\u6709\u88ab\u8f93\u5165\uff0c\u5219\u5b83\u4f1a\u88ab\u5206\u522b\u8865\u5168\u6210\u5c0f\u5199\u6216\u8005\u5927\u5199\u5f62\u5f0f\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-DBNAME\"><span class=\"term\"><code class=\"varname\">DBNAME</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u5df2\u8fde\u63a5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u662f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ECHO\"><span class=\"term\"><code class=\"varname\">ECHO</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">all</code>\uff0c\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u4f1a\u5728\u8bfb\u5165\u65f6\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u8bfb\u53d6\u7684\u884c\uff09\u3002\u8981\u5728\u7a0b\u5e8f\u5f00\u59cb\u65f6\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\uff0c\u53ef\u4ee5\u4f7f\u7528\u5f00\u5173<code class=\"option\">-a</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">queries</code>\uff0c<span class=\"application\">psql</span>\u4f1a\u5728\u53d1\u9001\u6bcf\u4e2a\u67e5\u8be2\u7ed9\u670d\u52a1\u5668\u65f6\u5c06\u5b83\u4eec\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\u3002\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\u7684\u5f00\u5173\u662f<code class=\"option\">-e</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">errors</code>\uff0c\u90a3\u4e48\u53ea\u6709\u5931\u8d25\u7684\u67e5\u8be2\u4f1a\u88ab\u663e\u793a\u5728\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u4e0a\u3002\u8fd9\u79cd\u884c\u4e3a\u7684\u5f00\u5173\u662f<code class=\"option\">-b</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">none</code>\uff08\u9ed8\u8ba4\u503c\uff09\u5219\u4e0d\u4f1a\u663e\u793a\u4efb\u4f55\u67e5\u8be2\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ECHO-HIDDEN\"><span class=\"term\"><code class=\"varname\">ECHO_HIDDEN</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u4e14\u4e00\u4e2a\u53cd\u659c\u7ebf\u547d\u4ee4\u67e5\u8be2\u6570\u636e\u5e93\u65f6\uff0c\u76f8\u5e94\u7684\u67e5\u8be2\u4f1a\u88ab\u5148\u663e\u793a\u3002\u8fd9\u79cd\u7279\u6027\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u5b66\u4e60<span class=\"productname\">PostgreSQL</span>\u7684\u5185\u90e8\u5e76\u4e14\u5728\u81ea\u5df1\u7684\u7a0b\u5e8f\u4e2d\u63d0\u4f9b\u7c7b\u4f3c\u7684\u529f\u80fd\uff08\u8981\u5728\u7a0b\u5e8f\u5f00\u59cb\u65f6\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\uff0c\u53ef\u4ee5\u4f7f\u7528\u5f00\u5173<code class=\"option\">-E</code>\uff09\u3002\u5982\u679c\u628a\u8fd9\u4e2a\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">noexec</code>\uff0c\u5219\u5bf9\u5e94\u7684\u67e5\u8be2\u53ea\u4f1a\u88ab\u663e\u793a\u800c\u5e76\u4e0d\u771f\u6b63\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u6267\u884c\u3002\u9ed8\u8ba4\u503c\u662f<code class=\"literal\">off</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ENCODING\"><span class=\"term\"><code class=\"varname\">ENCODING</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u7684\u5ba2\u6237\u7aef\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u6bcf\u4e00\u6b21\u4f60\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\uff09\u65f6\u4ee5\u53ca\u5f53\u4f60\u7528<code class=\"literal\">\\encoding</code>\u66f4\u6539\u7f16\u7801\u65f6\uff0c\u8fd9\u4e2a\u53d8\u91cf\u90fd\u4f1a\u88ab\u8bbe\u7f6e\uff0c\u4f46\u5b83\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ERROR\"><span class=\"term\"><code class=\"varname\">ERROR</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u4e0a\u4e00\u4e2aSQL\u67e5\u8be2\u5931\u8d25\u5219\u4e3a<code class=\"literal\">true</code>\uff0c\u5982\u679c\u6210\u529f\u5219\u662f<code class=\"literal\">false</code>\u3002\u53e6\u89c1<code class=\"varname\">SQLSTATE</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-FETCH-COUNT\"><span class=\"term\"><code class=\"varname\">FETCH_COUNT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a\u4e00\u4e2a\u5927\u4e8e\u96f6\u7684\u6574\u6570\u503c\uff0c<code class=\"command\">SELECT</code>\u67e5\u8be2\u7684\u7ed3\u679c\u4f1a\u4ee5\u4e00\u7ec4\u4e00\u7ec4\u7684\u65b9\u5f0f\u53d6\u51fa\u5e76\u4e14\u663e\u793a\uff08\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u7684\u90a3\u6837\u628a\u6574\u4e2a\u7ed3\u679c\u96c6\u62ff\u5230\u4ee5\u540e\u518d\u663e\u793a\uff09\uff0c\u6bcf\u7ec4\u5305\u542b\u7684\u884c\u6570\u7b49\u4e8e\u8be5\u6574\u6570\u503c\u3002\u56e0\u6b64\uff0c\u8fd9\u79cd\u65b9\u5f0f\u53ea\u4f1a\u4f7f\u7528\u6709\u9650\u7684\u5185\u5b58\u91cf\uff0c\u800c\u4e0d\u7ba1\u6574\u4e2a\u7ed3\u679c\u96c6\u7684\u5927\u5c0f\u3002\u5728\u542f\u7528\u8fd9\u4e2a\u7279\u6027\u65f6\uff0c\u901a\u5e38\u4f1a\u4f7f\u7528 100 \u5230 1000 \u7684\u8bbe\u7f6e\u3002\u8bb0\u4f4f\u5728\u4f7f\u7528\u8fd9\u79cd\u7279\u6027\u65f6\uff0c\u4e00\u4e2a\u67e5\u8be2\u53ef\u80fd\u4f1a\u5728\u5df2\u7ecf\u663e\u793a\u4e86\u4e00\u4e9b\u884c\u4e4b\u540e\u5931\u8d25\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5c3d\u7ba1\u53ef\u4ee5\u628a\u8fd9\u79cd\u7279\u6027\u7528\u4e8e\u4efb\u4f55\u7684\u8f93\u51fa\u683c\u5f0f\uff0c\u4f46\u662f\u9ed8\u8ba4\u7684<code class=\"literal\">aligned</code>\u683c\u5f0f\u770b\u8d77\u6765\u4f1a\u6bd4\u8f83\u7cdf\u7cd5\uff0c\u56e0\u4e3a\u6bcf\u4e00\u7ec4\u7684<code class=\"varname\">FETCH_COUNT</code>\u884c\u5c06\u88ab\u5355\u72ec\u683c\u5f0f\u5316\uff0c\u8fd9\u5c31\u4f1a\u5bfc\u81f4\u4e0d\u540c\u7684\u884c\u7ec4\u7684\u5217\u5bbd\u4e0d\u540c\u3002\u5176\u4ed6\u7684\u8f93\u51fa\u683c\u5f0f\u4f1a\u66f4\u597d\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HIDE-TABLEAM\"><span class=\"term\"><code class=\"varname\">HIDE_TABLEAM</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6b64\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">true</code>\uff0c\u5219\u4e0d\u663e\u793a\u8868\u7684\u8bbf\u95ee\u65b9\u6cd5\u7684\u8be6\u7ec6\u4fe1\u606f\u3002\u8fd9\u4e3b\u8981\u7528\u4e8e\u56de\u5f52\u6d4b\u8bd5\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HIDE-TOAST-COMPRESSION\"><span class=\"term\"><code class=\"varname\">HIDE_TOAST_COMPRESSION</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">true</code>\uff0c\u4e0d\u663e\u793a\u5217\u538b\u7f29\u65b9\u6cd5\u7684\u7ec6\u8282\u3002\u8fd9\u4e3b\u8981\u7528\u4e8e\u56de\u5f52\u6d4b\u8bd5\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HISTCONTROL\"><span class=\"term\"><code class=\"varname\">HISTCONTROL</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">ignorespace</code>\uff0c\u5219\u4ee5\u4e00\u4e2a\u7a7a\u683c\u5f00\u59cb\u7684\u884c\u4e0d\u4f1a\u88ab\u653e\u5165\u5230\u5386\u53f2\u5217\u8868\u4e2d\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">ignoredups</code>\uff0c\u5219\u4e0e\u4e0a\u4e00\u6761\u5386\u53f2\u8bb0\u5f55\u76f8\u540c\u7684\u884c\u4e0d\u4f1a\u88ab\u653e\u5165\u3002\u503c<code class=\"literal\">ignoreboth</code>\u7ec4\u5408\u4e86\u4e0a\u8ff0\u4e24\u79cd\u503c\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">none</code>\uff08\u9ed8\u8ba4\u503c\uff09\uff0c\u6240\u6709\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e2d\u88ab\u8bfb\u5165\u7684\u884c\u90fd\u4f1a\u4fdd\u5b58\u5728\u5386\u53f2\u5217\u8868\u4e2d\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HISTFILE\"><span class=\"term\"><code class=\"varname\">HISTFILE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8be5\u6587\u4ef6\u540d\u5c06\u88ab\u7528\u4e8e\u5b58\u50a8\u5386\u53f2\u5217\u8868\u3002\u5982\u679c\u672a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff0c\u6587\u4ef6\u540d\u5c06\u4ece<code class=\"envar\">PSQL_HISTORY</code>\u73af\u5883\u53d8\u91cf\u4e2d\u53d6\u5f97\u3002\u5982\u679c\u8be5\u73af\u5883\u53d8\u91cf\u4e5f\u6ca1\u6709\u88ab\u8bbe\u7f6e\uff0c\u5219\u9ed8\u8ba4\u503c\u662f<code class=\"filename\">~/.psql_history</code>\uff0c\u5728Windows\u4e0a\u662f<code class=\"filename\">%APPDATA%\\postgresql\\psql_history</code>\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">\\set HISTFILE ~/.psql_history-:DBNAME\n</pre>\n<p lang=\"zh\">\u653e\u5728<code class=\"filename\">~/.psqlrc</code>\u4e2d\u5c06\u4f1a\u5bfc\u81f4<span class=\"application\">psql</span>\u4e3a\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u7ef4\u62a4\u4e00\u4e2a\u5355\u72ec\u7684\u5386\u53f2\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HISTSIZE\"><span class=\"term\"><code class=\"varname\">HISTSIZE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u547d\u4ee4\u5386\u53f2\u4e2d\u6700\u591a\u4fdd\u5b58\u7684\u547d\u4ee4\u6570\uff08\u9ed8\u8ba4 500\uff09\u3002\u8bbe\u4e3a\u8d1f\u503c\u65f6\uff0c\u4e0d\u8bbe\u4e0a\u9650\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HOST\"><span class=\"term\"><code class=\"varname\">HOST</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e3b\u673a\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u4e5f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-IGNOREEOF\"><span class=\"term\"><code class=\"varname\">IGNOREEOF</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8bbe\u4e3a 1 \u6216\u66f4\u5c0f\u7684\u503c\uff0c\u5411 psql \u4ea4\u4e92\u4f1a\u8bdd\u53d1\u9001 EOF \u5b57\u7b26\uff08\u901a\u5e38\u4e3a Control + D\uff09\u5c31\u4f1a\u7ec8\u6b62\u5e94\u7528\u3002\u5982\u679c\u8bbe\u4e3a\u66f4\u5927\u7684\u6570\u503c\uff0c\u5219\u5fc5\u987b\u8fde\u7eed\u8f93\u5165\u76f8\u5e94\u6b21\u6570\u7684 EOF \u5b57\u7b26\u624d\u4f1a\u7ec8\u6b62\u4ea4\u4e92\u4f1a\u8bdd\u3002\u5982\u679c\u53d8\u91cf\u8bbe\u4e3a\u975e\u6570\u503c\uff0c\u4f1a\u88ab\u89e3\u91ca\u4e3a 10\u3002\u9ed8\u8ba4\u503c\u4e3a 0\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-LASTOID\"><span class=\"term\"><code class=\"varname\">LASTOID</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6700\u8fd1\u4e00\u6b21\u53d7\u5f71\u54cd\u7684 OID \u503c\uff0c\u7531 INSERT \u6216 \\lo_import \u547d\u4ee4\u8fd4\u56de\u3002\u6b64\u53d8\u91cf\u4ec5\u4fdd\u8bc1\u5728\u4e0b\u4e00\u6761 SQL \u547d\u4ee4\u7684\u7ed3\u679c\u663e\u793a\u4e4b\u524d\u6709\u6548\u3002\u4ece\u7248\u672c 12 \u8d77\uff0cPostgreSQL \u670d\u52a1\u5668\u4e0d\u518d\u652f\u6301 OID \u7cfb\u7edf\u5217\uff0c\u56e0\u6b64\u8fde\u63a5\u5230\u8fd9\u4e9b\u670d\u52a1\u5668\u65f6\uff0c\u6267\u884c INSERT \u540e LASTOID \u59cb\u7ec8\u4e3a 0\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-LAST-ERROR-MESSAGE\"><span class=\"term\"><code class=\"varname\">LAST_ERROR_MESSAGE</code><br/></span><span class=\"term\"><code class=\"varname\">LAST_ERROR_SQLSTATE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d<span class=\"application\">psql</span>\u4f1a\u8bdd\u4e2d\u6700\u8fd1\u4e00\u4e2a\u5931\u8d25\u67e5\u8be2\u7684\u4e3b\u9519\u8bef\u6d88\u606f\u548c\u76f8\u5173\u7684SQLSTATE\u4ee3\u7801\uff0c\u5982\u679c\u5728\u5f53\u524d\u4f1a\u8bdd\u4e2d\u6ca1\u6709\u53d1\u751f\u9519\u8bef\uff0c\u5219\u662f\u4e00\u4e2a\u7a7a\u5b57\u7b26\u4e32\u548c<code class=\"literal\">00000</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ON-ERROR-ROLLBACK\"><span class=\"term\"><code class=\"varname\">ON_ERROR_ROLLBACK</code> </span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u65f6\uff0c\u5982\u679c\u4e8b\u52a1\u5757\u4e2d\u7684\u4e00\u4e2a\u8bed\u53e5\u4ea7\u751f\u4e00\u4e2a\u9519\u8bef\uff0c\u8be5\u9519\u8bef\u4f1a\u88ab\u5ffd\u7565\u5e76\u4e14\u8be5\u4e8b\u52a1\u4f1a\u7ee7\u7eed\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">interactive</code>\u65f6\uff0c\u53ea\u5728\u4ea4\u4e92\u5f0f\u4f1a\u8bdd\u4e2d\u5ffd\u7565\u8fd9\u7c7b\u9519\u8bef\uff0c\u800c\u8bfb\u53d6\u811a\u672c\u6587\u4ef6\u65f6\u5219\u4e0d\u4f1a\u5ffd\u7565\u9519\u8bef\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">off</code>\uff08\u9ed8\u8ba4\u503c\uff09\u65f6\uff0c\u4e8b\u52a1\u5757\u4e2d\u4ea7\u751f\u9519\u8bef\u7684\u4e00\u4e2a\u8bed\u53e5\u4f1a\u4e2d\u6b62\u6574\u4e2a\u4e8b\u52a1\u3002\u9519\u8bef\u56de\u6eda\u6a21\u5f0f\u7684\u5de5\u4f5c\u539f\u7406\u662f\u5728\u4e8b\u52a1\u5757\u7684\u6bcf\u4e2a\u547d\u4ee4\u4e4b\u524d\u90fd\u4e3a\u4f60\u53d1\u51fa\u4e00\u4e2a\u9690\u5f0f\u7684<code class=\"command\">SAVEPOINT</code>\uff0c\u7136\u540e\u5728\u8be5\u547d\u4ee4\u5931\u8d25\u65f6\u56de\u6eda\u5230\u8be5\u4fdd\u5b58\u70b9\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ON-ERROR-STOP\"><span class=\"term\"><code class=\"varname\">ON_ERROR_STOP</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u51fa\u9519\u540e\u4ecd\u4f1a\u7ee7\u7eed\u5904\u7406\u547d\u4ee4\u3002\u5c06\u6b64\u53d8\u91cf\u8bbe\u4e3a on \u540e\uff0c\u5904\u7406\u4f1a\u7acb\u5373\u505c\u6b62\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\uff0cpsql \u4f1a\u8fd4\u56de\u547d\u4ee4\u63d0\u793a\u7b26\uff1b\u5426\u5219\uff0cpsql \u4f1a\u9000\u51fa\u5e76\u8fd4\u56de\u9519\u8bef\u7801 3\uff0c\u4ee5\u533a\u522b\u4e8e\u9519\u8bef\u7801 1 \u6240\u8868\u793a\u7684\u81f4\u547d\u9519\u8bef\u3002\u65e0\u8bba\u54ea\u79cd\u60c5\u51b5\uff0c\u5f53\u524d\u6b63\u5728\u8fd0\u884c\u7684\u6240\u6709\u811a\u672c\uff08\u5982\u679c\u5b58\u5728\u9876\u5c42\u811a\u672c\uff0c\u5219\u5305\u62ec\u8be5\u811a\u672c\u53ca\u5176\u8c03\u7528\u7684\u5176\u4ed6\u811a\u672c\uff09\u90fd\u4f1a\u7acb\u5373\u7ec8\u6b62\u3002\u5982\u679c\u9876\u5c42\u547d\u4ee4\u5b57\u7b26\u4e32\u5305\u542b\u591a\u6761 SQL \u547d\u4ee4\uff0c\u5219\u4f1a\u5728\u5f53\u524d\u547d\u4ee4\u5904\u505c\u6b62\u5904\u7406\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-PORT\"><span class=\"term\"><code class=\"varname\">PORT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u7aef\u53e3\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u4e5f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-PROMPT\"><span class=\"term\"><code class=\"varname\">PROMPT1</code><br/></span><span class=\"term\"><code class=\"varname\">PROMPT2</code><br/></span><span class=\"term\"><code class=\"varname\">PROMPT3</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e9b\u53d8\u91cf\u6307\u5b9a<span class=\"application\">psql</span>\u53d1\u51fa\u7684\u63d0\u793a\u7b26\u7684\u6a21\u6837\u3002\u89c1\u4e0b\u6587\u7684<a class=\"xref\" href=\"/docs/16/app-psql.html#APP-PSQL-PROMPTING\" title=\"\u63d0\u793a\u7b26\">\u63d0\u793a\u7b26</a>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-QUIET\"><span class=\"term\"><code class=\"varname\">QUIET</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u8fd9\u4e2a\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-q</code>\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\u53ef\u80fd\u7528\u5904\u4e0d\u5927\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ROW-COUNT\"><span class=\"term\"><code class=\"varname\">ROW_COUNT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6700\u8fd1\u4e00\u6761 SQL \u67e5\u8be2\u8fd4\u56de\u6216\u5f71\u54cd\u7684\u884c\u6570\uff1b\u5982\u679c\u67e5\u8be2\u5931\u8d25\u6216\u6ca1\u6709\u62a5\u544a\u884c\u6570\uff0c\u5219\u4e3a 0\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SERVER-VERSION-NAME\"><span class=\"term\"><code class=\"varname\">SERVER_VERSION_NAME</code><br/></span><span class=\"term\"><code class=\"varname\">SERVER_VERSION_NUM</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b57\u7b26\u4e32\u5f62\u5f0f\u7684\u670d\u52a1\u5668\u7248\u672c\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">9.6.2</code>\u3001<code class=\"literal\">10.1</code>\u6216\u8005<code class=\"literal\">11beta1</code>\uff0c\u4ee5\u53ca\u6570\u5b57\u5f62\u5f0f\u7684\u670d\u52a1\u5668\u7248\u672c\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">90602</code>\u6216\u8005<code class=\"literal\">100001</code>\u3002\u6bcf\u6b21\u4f60\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\uff09\u65f6\uff0c\u8fd9\u4e9b\u90fd\u4f1a\u88ab\u8bbe\u7f6e\uff0c\u4f46\u53ef\u4ee5\u88ab\u6539\u53d8\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SHELL-ERROR\"><span class=\"term\"><code class=\"varname\">SHELL_ERROR</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6700\u540e\u4e00\u4e2a shell \u547d\u4ee4\u5931\u8d25\uff0c\u5219\u4e3a <code class=\"literal\">true</code>\uff1b\u5982\u679c\u6210\u529f\uff0c\u5219\u4e3a <code class=\"literal\">false</code>\u3002\u8fd9\u9002\u7528\u4e8e\u901a\u8fc7 <code class=\"literal\">\\!</code>\u3001<code class=\"literal\">\\g</code>\u3001<code class=\"literal\">\\o</code>\u3001<code class=\"literal\">\\w</code> \u548c <code class=\"literal\">\\copy</code> \u5143\u547d\u4ee4\u8c03\u7528\u7684 shell \u547d\u4ee4\uff0c\u4e5f\u9002\u7528\u4e8e\u53cd\u5f15\u53f7\uff08<code class=\"literal\">`</code>\uff09\u6269\u5c55\u3002\u8bf7\u6ce8\u610f\uff0c\u5bf9\u4e8e <code class=\"literal\">\\o</code>\uff0c\u8be5\u53d8\u91cf\u4f1a\u5728\u4e0b\u4e00\u4e2a <code class=\"literal\">\\o</code> \u547d\u4ee4\u5173\u95ed\u8f93\u51fa\u7ba1\u9053\u65f6\u66f4\u65b0\u3002\u53e6\u89c1 <code class=\"varname\">SHELL_EXIT_CODE</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SHELL-EXIT-CODE\"><span class=\"term\"><code class=\"varname\">SHELL_EXIT_CODE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u540e\u4e00\u4e2a shell \u547d\u4ee4\u8fd4\u56de\u7684\u9000\u51fa\u72b6\u6001\u30020\u2013127 \u8868\u793a\u7a0b\u5e8f\u9000\u51fa\u7801\uff0c128\u2013255 \u8868\u793a\u56e0\u4fe1\u53f7\u800c\u7ec8\u6b62\uff0c-1 \u8868\u793a\u672a\u80fd\u542f\u52a8\u7a0b\u5e8f\u6216\u672a\u80fd\u53d6\u5f97\u5176\u9000\u51fa\u72b6\u6001\u3002\u8fd9\u9002\u7528\u4e8e\u901a\u8fc7 <code class=\"literal\">\\!</code>\u3001<code class=\"literal\">\\g</code>\u3001<code class=\"literal\">\\o</code>\u3001<code class=\"literal\">\\w</code> \u548c <code class=\"literal\">\\copy</code> \u5143\u547d\u4ee4\u8c03\u7528\u7684 shell \u547d\u4ee4\uff0c\u4e5f\u9002\u7528\u4e8e\u53cd\u5f15\u53f7\uff08<code class=\"literal\">`</code>\uff09\u6269\u5c55\u3002\u8bf7\u6ce8\u610f\uff0c\u5bf9\u4e8e <code class=\"literal\">\\o</code>\uff0c\u8be5\u53d8\u91cf\u4f1a\u5728\u4e0b\u4e00\u4e2a <code class=\"literal\">\\o</code> \u547d\u4ee4\u5173\u95ed\u8f93\u51fa\u7ba1\u9053\u65f6\u66f4\u65b0\u3002\u53e6\u89c1 <code class=\"varname\">SHELL_ERROR</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SHOW-ALL-RESULTS\"><span class=\"term\"><code class=\"varname\">SHOW_ALL_RESULTS</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u6b64\u53d8\u91cf\u88ab\u8bbe\u4e3a <code class=\"literal\">off</code> \u65f6\uff0c\u7ec4\u5408\u67e5\u8be2\uff08<code class=\"literal\">\\;</code>\uff09\u53ea\u663e\u793a\u6700\u540e\u4e00\u4e2a\u7ed3\u679c\uff0c\u800c\u4e0d\u662f\u663e\u793a\u5168\u90e8\u7ed3\u679c\u3002\u9ed8\u8ba4\u503c\u4e3a <code class=\"literal\">on</code>\u3002\u8bbe\u4e3a off \u7684\u884c\u4e3a\u662f\u4e3a\u4e86\u517c\u5bb9\u65e7\u7248\u672c\u7684 <span class=\"application\">psql</span>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SHOW-CONTEXT\"><span class=\"term\"><code class=\"varname\">SHOW_CONTEXT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u53d8\u91cf\u53ef\u4ee5\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">never</code>\u3001<code class=\"literal\">errors</code>\u6216\u8005<code class=\"literal\">always</code>\u6765\u63a7\u5236\u662f\u5426\u5728\u6765\u81ea\u670d\u52a1\u5668\u7684\u6d88\u606f\u4e2d\u663e\u793a<code class=\"literal\">CONTEXT</code>\u5b57\u6bb5\u3002\u9ed8\u8ba4\u662f<code class=\"literal\">errors</code>\uff08\u8868\u793a\u5728\u9519\u8bef\u6d88\u606f\u4e2d\u663e\u793a\u4e0a\u4e0b\u6587\uff0c\u4f46\u5728\u901a\u77e5\u548c\u8b66\u544a\u6d88\u606f\u4e2d\u4e0d\u663e\u793a\uff09\u3002\u5f53<code class=\"varname\">VERBOSITY</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">terse</code>\u6216<code class=\"literal\">sqlstate</code>\u65f6\uff0c\u8fd9\u4e2a\u8bbe\u7f6e\u65e0\u6548\uff08\u53e6\u89c1<code class=\"command\">\\errverbose</code>\uff0c\u5b83\u53ef\u4ee5\u7528\u6765\u5f97\u5230\u521a\u9047\u5230\u7684\u9519\u8bef\u7684\u8be6\u7ec6\u4fe1\u606f\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SINGLELINE\"><span class=\"term\"><code class=\"varname\">SINGLELINE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u8fd9\u4e2a\u53d8\u91cf\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-S</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SINGLESTEP\"><span class=\"term\"><code class=\"varname\">SINGLESTEP</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u8fd9\u4e2a\u53d8\u91cf\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-s</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SQLSTATE\"><span class=\"term\"><code class=\"varname\">SQLSTATE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0e\u4e0a\u4e00\u4e2aSQL\u67e5\u8be2\u7684\u5931\u8d25\u76f8\u5173\u7684\u9519\u8bef\u4ee3\u7801\uff08\u89c1<a class=\"xref\" href=\"/docs/16/errcodes-appendix.html\" title=\"\u9644\u5f55\u00a0A.\u00a0PostgreSQL\u9519\u8bef\u4ee3\u7801\">\u9644\u5f55\u00a0A</a>\uff09\uff0c\u5982\u679c\u4e0a\u4e00\u4e2a\u67e5\u8be2\u6210\u529f\u5219\u4e3a<code class=\"literal\">00000</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-USER\"><span class=\"term\"><code class=\"varname\">USER</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7528\u6237\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u662f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-VERBOSITY\"><span class=\"term\"><code class=\"varname\">VERBOSITY</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u53d8\u91cf\u53ef\u4ee5\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">default</code>\u3001<code class=\"literal\">verbose</code>\u3001<code class=\"literal\">terse</code>\u6216\u8005<code class=\"literal\">sqlstate</code>\u6765\u63a7\u5236\u9519\u8bef\u62a5\u544a\u7684\u8be6\u7ec6\u7a0b\u5ea6\uff08\u53e6\u89c1<code class=\"command\">\\errverbose</code>\uff0c\u5728\u60f3\u5f97\u5230\u521a\u9047\u5230\u7684\u9519\u8bef\u7684\u8be6\u7ec6\u4fe1\u606f\u65f6\u4f7f\u7528\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-VERSION\"><span class=\"term\"><code class=\"varname\">VERSION</code><br/></span><span class=\"term\"><code class=\"varname\">VERSION_NAME</code><br/></span><span class=\"term\"><code class=\"varname\">VERSION_NUM</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e9b\u53d8\u91cf\u5728\u7a0b\u5e8f\u542f\u52a8\u65f6\u88ab\u8bbe\u7f6e\u4ee5\u53cd\u6620<span class=\"application\">psql</span>\u7684\u7248\u672c\uff0c\u5206\u522b\u662f\u4e00\u4e2a\u8be6\u7ec6\u7684\u5b57\u7b26\u4e32\u3001\u4e00\u4e2a\u77ed\u5b57\u7b26\u4e32\uff08\u4f8b\u5982<code class=\"literal\">9.6.2</code>\u3001<code class=\"literal\">10.1</code>\u6216\u8005<code class=\"literal\">11beta1</code>\uff09\u4ee5\u53ca\u4e00\u4e2a\u6570\u5b57\uff08\u4f8b\u5982<code class=\"literal\">90602</code>\u6216\u8005<code class=\"literal\">100001</code>\uff09\u3002\u5b83\u4eec\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-INTERPOLATION\">\n<h4 lang=\"zh\">SQL \u63d2\u503c</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u53d8\u91cf\u7684\u4e00\u4e2a\u5173\u952e\u7279\u6027\u662f\u53ef\u4ee5\u628a\u5b83\u4eec\u66ff\u6362\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u63d2\u503c</span>\u201d</span>\uff09\u5230\u5e38\u89c4<acronym class=\"acronym\">SQL</acronym>\u8bed\u53e5\u4e2d\uff0c\u4e5f\u53ef\u4ee5\u628a\u5b83\u4eec\u66ff\u6362\u5230\u5143\u547d\u4ee4\u7684\u53c2\u6570\u4e2d\u3002\u6b64\u5916\uff0c<span class=\"application\">psql</span>\u8fd8\u63d0\u4f9b\u4e86\u529f\u80fd\u6765\u786e\u4fdd\u88ab\u7528\u4f5c SQL \u5b57\u9762\u91cf\u548c\u6807\u8bc6\u7b26\u7684\u53d8\u91cf\u503c\u4f1a\u88ab\u6b63\u786e\u5730\u52a0\u5f15\u53f7\u3002\u4e0d\u52a0\u5f15\u53f7\u5730\u63d2\u503c\u4e00\u4e2a\u503c\u7684\u8bed\u6cd5\u662f\u5728\u53d8\u91cf\u540d\u524d\u9762\u52a0\u4e0a\u4e00\u4e2a\u5192\u53f7\uff08<code class=\"literal\">:</code>\uff09\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo 'my_table'</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM :foo;</code></strong>\n</pre>\n<p lang=\"zh\">\u5c06\u67e5\u8be2\u8868<code class=\"literal\">my_table</code>\u3002\u6ce8\u610f\u8fd9\u53ef\u80fd\u4f1a\u4e0d\u5b89\u5168\uff1a\u8be5\u53d8\u91cf\u7684\u503c\u4f1a\u88ab\u6309\u5b57\u9762\u62f7\u8d1d\uff0c\u56e0\u6b64\u5b83\u53ef\u80fd\u5305\u542b\u4e0d\u5e73\u8861\u7684\u5f15\u53f7\u751a\u81f3\u53cd\u659c\u7ebf\u547d\u4ee4\u3002\u5fc5\u987b\u786e\u4fdd\u628a\u5b83\u653e\u5728\u90a3\u91cc\u662f\u6709\u610f\u4e49\u7684\u3002</p>\n<p lang=\"zh\">\u5f53\u4e00\u4e2a\u503c\u8981\u7528\u4f5c SQL \u5b57\u9762\u91cf\u6216\u6807\u8bc6\u7b26\u65f6\uff0c\u6700\u5b89\u5168\u7684\u505a\u6cd5\u662f\u4e3a\u5b83\u52a0\u4e0a\u5f15\u53f7\u3002\u8981\u5c06\u53d8\u91cf\u503c\u4f5c\u4e3a SQL \u5b57\u9762\u91cf\u52a0\u5f15\u53f7\uff0c\u5e94\u5199\u4e00\u4e2a\u5192\u53f7\uff0c\u540e\u9762\u8ddf\u7528\u5355\u5f15\u53f7\u62ec\u8d77\u6765\u7684\u53d8\u91cf\u540d\u3002\u8981\u5c06\u53d8\u91cf\u503c\u4f5c\u4e3a SQL \u6807\u8bc6\u7b26\u52a0\u5f15\u53f7\uff0c\u5219\u5728\u5192\u53f7\u540e\u9762\u7528\u53cc\u5f15\u53f7\u62ec\u8d77\u53d8\u91cf\u540d\u3002\u8fd9\u4e9b\u5199\u6cd5\u80fd\u6b63\u786e\u5904\u7406\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165\u7684\u5f15\u53f7\u548c\u5176\u4ed6\u7279\u6b8a\u5b57\u7b26\u3002\u524d\u9762\u7684\u793a\u4f8b\u53ef\u7528\u4ee5\u4e0b\u66f4\u5b89\u5168\u7684\u5199\u6cd5\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo 'my_table'</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM :\"foo\";</code></strong>\n</pre>\n<p lang=\"zh\">\u5728\u52a0\u5f15\u53f7\u7684<acronym class=\"acronym\">SQL</acronym>\u5b57\u9762\u91cf\u548c\u6807\u8bc6\u7b26\u5185\u90e8\uff0c\u4e0d\u4f1a\u6267\u884c\u53d8\u91cf\u63d2\u503c\u3002\u56e0\u6b64\uff0c<code class=\"literal\">':foo'</code>\u8fd9\u6837\u7684\u5199\u6cd5\u4e0d\u80fd\u6839\u636e\u53d8\u91cf\u503c\u751f\u6210\u52a0\u5f15\u53f7\u7684\u5b57\u9762\u91cf\uff08\u5373\u4f7f\u80fd\u591f\u751f\u6548\uff0c\u4e5f\u4e0d\u5b89\u5168\uff0c\u56e0\u4e3a\u5b83\u65e0\u6cd5\u6b63\u786e\u5904\u7406\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165\u7684\u5f15\u53f7\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8fd9\u79cd\u673a\u5236\u7684\u4e00\u4e2a\u793a\u4f8b\u662f\u628a\u4e00\u4e2a\u6587\u4ef6\u7684\u5185\u5bb9\u62f7\u8d1d\u5230\u4e00\u4e2a\u8868\u5217\u4e2d\u3002\u9996\u5148\u628a\u8be5\u6587\u4ef6\u8f7d\u5165\u5230\u4e00\u4e2a\u53d8\u91cf\uff0c\u7136\u540e\u628a\u8be5\u53d8\u91cf\u7684\u503c\u4f5c\u4e3a\u4e00\u4e2a\u52a0\u5f15\u53f7\u7684\u5b57\u7b26\u4e32\u8fdb\u884c\u63d2\u503c\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set content `cat my_file.txt`</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>INSERT INTO my_table VALUES (:'content');</code></strong>\n</pre>\n<p lang=\"zh\">\uff08\u6ce8\u610f\u5982\u679c<code class=\"filename\">my_file.txt</code>\u5305\u542b NUL \u5b57\u8282\uff0c\u8fd9\u6837\u4e5f\u4e0d\u884c\u3002<span class=\"application\">psql</span>\u4e0d\u652f\u6301\u5728\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165 NUL \u5b57\u8282\uff09\u3002</p>\n<p lang=\"zh\">\u56e0\u4e3a\u5192\u53f7\u53ef\u4ee5\u5408\u6cd5\u5730\u51fa\u73b0\u5728 SQL \u547d\u4ee4\u4e2d\uff0c\u770b\u4f3c\u63d2\u503c\u7684\u5199\u6cd5\uff08\u5373<code class=\"literal\">:name</code>\u3001<code class=\"literal\">:'name'</code>\u6216\u8005<code class=\"literal\">:\"name\"</code>\uff09\u4e0d\u4f1a\u88ab\u66ff\u6362\uff0c\u9664\u975e\u6240\u6307\u7684\u53d8\u91cf\u5f53\u524d\u5df2\u8bbe\u7f6e\u3002\u5728\u4efb\u4f55\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u7528\u4e00\u4e2a\u53cd\u659c\u7ebf\u5bf9\u5192\u53f7\u8fdb\u884c\u8f6c\u4e49\u4ee5\u907f\u514d\u5b83\u88ab\u66ff\u6362\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">:{?<em class=\"replaceable\"><code>name</code></em>}</code>\u7279\u6b8a\u8bed\u6cd5\u4f1a\u6839\u636e\u8be5\u53d8\u91cf\u662f\u5426\u5b58\u5728\u8fd4\u56de TRUE \u6216 FALSE\uff0c\u56e0\u6b64\u603b\u662f\u4f1a\u88ab\u66ff\u6362\uff0c\u9664\u975e\u5192\u53f7\u88ab\u53cd\u659c\u7ebf\u8f6c\u4e49\u3002</p>\n<p lang=\"zh\">\u53d8\u91cf\u7684\u5192\u53f7\u8bed\u6cd5\u5bf9\u5d4c\u5165\u5f0f\u67e5\u8be2\u8bed\u8a00\uff08\u4f8b\u5982<span class=\"application\">ECPG</span>\uff09\u6765\u8bf4\u662f\u6807\u51c6\u7684<acronym class=\"acronym\">SQL</acronym>\u3002\u7528\u4e8e\u6570\u7ec4\u5207\u7247\u548c\u7c7b\u578b\u8f6c\u6362\u7684\u5192\u53f7\u8bed\u6cd5\u662f<span class=\"productname\">PostgreSQL</span>\u6269\u5c55\uff0c\u5b83\u6709\u65f6\u53ef\u80fd\u4f1a\u4e0e\u6807\u51c6\u7528\u6cd5\u51b2\u7a81\u3002\u628a\u4e00\u4e2a\u53d8\u91cf\u503c\u8f6c\u4e49\u6210 SQL \u5b57\u9762\u91cf\u6216\u8005\u6807\u8bc6\u7b26\u7684\u5192\u53f7\u52a0\u5f15\u53f7\u8bed\u6cd5\u662f\u4e00\u79cd<span class=\"application\">psql</span>\u6269\u5c55\u3002</p>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-PROMPTING\">\n<h4 lang=\"zh\">\u63d0\u793a\u7b26</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u53d1\u51fa\u7684\u63d0\u793a\u7b26\u53ef\u4ee5\u6309\u4f60\u7684\u559c\u597d\u8fdb\u884c\u5b9a\u5236\u3002<code class=\"varname\">PROMPT1</code>\u3001<code class=\"varname\">PROMPT2</code> \u548c <code class=\"varname\">PROMPT3</code> \u8fd9\u4e09\u4e2a\u53d8\u91cf\u5305\u542b\u63cf\u8ff0\u63d0\u793a\u7b26\u5916\u89c2\u7684\u5b57\u7b26\u4e32\u548c\u7279\u6b8a\u8f6c\u4e49\u5e8f\u5217\u3002\u63d0\u793a\u7b26 1 \u662f <span class=\"application\">psql</span> \u8bf7\u6c42\u65b0\u547d\u4ee4\u65f6\u53d1\u51fa\u7684\u5e38\u89c4\u63d0\u793a\u7b26\u3002\u63d0\u793a\u7b26 2 \u4f1a\u5728\u5f55\u5165\u547d\u4ee4\u671f\u95f4\u8fd8\u9700\u8981\u66f4\u591a\u8f93\u5165\u65f6\u53d1\u51fa\uff0c\u4f8b\u5982\u547d\u4ee4\u5c1a\u672a\u4ee5\u5206\u53f7\u7ed3\u675f\uff0c\u6216\u8005\u5f15\u53f7\u5c1a\u672a\u95ed\u5408\u65f6\u3002\u5728\u6267\u884c <acronym class=\"acronym\">SQL</acronym> <code class=\"command\">COPY FROM STDIN</code> \u547d\u4ee4\u5e76\u9700\u8981\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4e00\u884c\u503c\u65f6\uff0c\u4f1a\u53d1\u51fa\u63d0\u793a\u7b26 3\u3002</p>\n<p lang=\"zh\">\u9009\u4e2d\u7684\u63d0\u793a\u7b26\u53d8\u91cf\u503c\u4f1a\u6309\u5b57\u9762\u8f93\u51fa\uff0c\u9664\u975e\u9047\u5230\u767e\u5206\u53f7\uff08<code class=\"literal\">%</code>\uff09\u3002\u6839\u636e\u4e0b\u4e00\u4e2a\u5b57\u7b26\u7684\u4e0d\u540c\uff0c\u4f1a\u66ff\u6362\u6210\u67d0\u4e9b\u5176\u4ed6\u6587\u672c\u3002\u5df2\u5b9a\u4e49\u7684\u66ff\u6362\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-PROMPTING-M-UC\"><span class=\"term\"><code class=\"literal\">%M</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5b8c\u6574\u4e3b\u673a\u540d\uff08\u542b\u57df\u540d\uff09\uff1b\u5982\u679c\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\uff0c\u5219\u4e3a<code class=\"literal\">[local]</code>\uff1b\u5982\u679c Unix \u57df\u5957\u63a5\u5b57\u4e0d\u5728\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u9ed8\u8ba4\u4f4d\u7f6e\uff0c\u5219\u4e3a<code class=\"literal\">[local:<em class=\"replaceable\"><code>/dir/name</code></em>]</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-M-LC\"><span class=\"term\"><code class=\"literal\">%m</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\uff0c\u5728\u7b2c\u4e00\u4e2a\u70b9\u53f7\u5904\u622a\u65ad\uff1b\u5982\u679c\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\uff0c\u5219\u4e3a<code class=\"literal\">[local]</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-GT\"><span class=\"term\"><code class=\"literal\">%&gt;</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u76d1\u542c\u7684\u7aef\u53e3\u53f7\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-N\"><span class=\"term\"><code class=\"literal\">%n</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u4f1a\u8bdd\u7528\u6237\u540d\u3002\uff08\u5728\u6570\u636e\u5e93\u4f1a\u8bdd\u671f\u95f4\uff0c<code class=\"command\">SET SESSION AUTHORIZATION</code>\u547d\u4ee4\u53ef\u80fd\u6539\u53d8\u8be5\u503c\u7684\u6269\u5c55\u7ed3\u679c\u3002\uff09</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-SLASH\"><span class=\"term\"><code class=\"literal\">%/</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-TILDE\"><span class=\"term\"><code class=\"literal\">%~</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7c7b\u4f3c <code class=\"literal\">%/</code>\uff0c\u4f46\u5982\u679c\u8be5\u6570\u636e\u5e93\u662f\u4f60\u7684\u9ed8\u8ba4\u6570\u636e\u5e93\uff0c\u5219\u8f93\u51fa <code class=\"literal\">~</code>\uff08\u6ce2\u6d6a\u53f7\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-NUMBERSIGN\"><span class=\"term\"><code class=\"literal\">%#</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u4f1a\u8bdd\u7528\u6237\u662f\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\uff0c\u5219\u4e3a<code class=\"literal\">#</code>\uff0c\u5426\u5219\u4e3a<code class=\"literal\">&gt;</code>\u3002\uff08\u5728\u6570\u636e\u5e93\u4f1a\u8bdd\u671f\u95f4\uff0c<code class=\"command\">SET SESSION AUTHORIZATION</code>\u547d\u4ee4\u53ef\u80fd\u6539\u53d8\u8be5\u503c\u7684\u6269\u5c55\u7ed3\u679c\u3002\uff09</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-P\"><span class=\"term\"><code class=\"literal\">%p</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u6240\u8fde\u63a5\u540e\u7aef\u7684\u8fdb\u7a0b ID\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-R\"><span class=\"term\"><code class=\"literal\">%R</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5728\u63d0\u793a\u7b26 1 \u4e2d\uff0c\u901a\u5e38\u663e\u793a =\uff1b\u4f46\u5982\u679c\u4f1a\u8bdd\u5904\u4e8e\u6761\u4ef6\u5757\u4e2d\u672a\u6fc0\u6d3b\u7684\u5206\u652f\uff0c\u5219\u663e\u793a @\uff1b\u5982\u679c\u5904\u4e8e\u5355\u884c\u6a21\u5f0f\uff0c\u5219\u663e\u793a ^\uff1b\u5982\u679c\u4f1a\u8bdd\u5df2\u65ad\u5f00\u6570\u636e\u5e93\u8fde\u63a5\uff08\u4f8b\u5982 \\connect \u5931\u8d25\u65f6\uff09\uff0c\u5219\u663e\u793a !\u3002\u5728\u63d0\u793a\u7b26 2 \u4e2d\uff0c%R \u4f1a\u66ff\u6362\u4e3a\u8868\u793a psql \u7b49\u5f85\u66f4\u591a\u8f93\u5165\u539f\u56e0\u7684\u5b57\u7b26\uff1a\u547d\u4ee4\u5c1a\u672a\u7ed3\u675f\u65f6\u4e3a -\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684 /* ... */ \u6ce8\u91ca\u65f6\u4e3a *\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u5e26\u5f15\u53f7\u5b57\u7b26\u4e32\u65f6\u4e3a\u5355\u5f15\u53f7\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u5e26\u5f15\u53f7\u6807\u8bc6\u7b26\u65f6\u4e3a\u53cc\u5f15\u53f7\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u7f8e\u5143\u5f15\u7528\u5b57\u7b26\u4e32\u65f6\u4e3a\u7f8e\u5143\u7b26\u53f7\uff1b\u5b58\u5728\u672a\u5339\u914d\u7684\u5de6\u62ec\u53f7\u65f6\u4e3a (\u3002\u5728\u63d0\u793a\u7b26 3 \u4e2d\uff0c%R \u4e0d\u4ea7\u751f\u4efb\u4f55\u5185\u5bb9\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-X\"><span class=\"term\"><code class=\"literal\">%x</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u72b6\u6001\uff1a\u5982\u679c\u5f53\u524d\u4e0d\u5728\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff1b\u5982\u679c\u5904\u4e8e\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a <code class=\"literal\">*</code>\uff1b\u5982\u679c\u5904\u4e8e\u5931\u8d25\u7684\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a <code class=\"literal\">!</code>\uff1b\u5982\u679c\u4e8b\u52a1\u72b6\u6001\u4e0d\u786e\u5b9a\uff08\u4f8b\u5982\u56e0\u4e3a\u5f53\u524d\u6ca1\u6709\u8fde\u63a5\uff09\uff0c\u5219\u4e3a <code class=\"literal\">?</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-L\"><span class=\"term\"><code class=\"literal\">%l</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8bed\u53e5\u4e2d\u7684\u884c\u53f7\uff0c\u4ece <code class=\"literal\">1</code> \u5f00\u59cb\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-DIGITS\"><span class=\"term\"><code class=\"literal\">%</code><em class=\"replaceable\"><code>digits</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u66ff\u6362\u4e3a\u6307\u5b9a\u516b\u8fdb\u5236\u4ee3\u7801\u5bf9\u5e94\u7684\u5b57\u7b26\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-NAME\"><span class=\"term\"><code class=\"literal\">%:</code><em class=\"replaceable\"><code>name</code></em><code class=\"literal\">:</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><span class=\"application\">psql</span> \u53d8\u91cf <em class=\"replaceable\"><code>name</code></em> \u7684\u503c\u3002\u8be6\u89c1\u4e0a\u9762\u7684<a class=\"xref\" href=\"/docs/16/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-COMMAND\"><span class=\"term\"><code class=\"literal\">%`</code><em class=\"replaceable\"><code>command</code></em><code class=\"literal\">`</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><em class=\"replaceable\"><code>command</code></em> \u7684\u8f93\u51fa\uff0c\u7c7b\u4f3c\u666e\u901a\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u53cd\u5f15\u53f7</span>\u201d</span>\u66ff\u6362\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-SQUARE-BRACKETS\"><span class=\"term\"><code class=\"literal\">%[</code> ... <code class=\"literal\">%]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u63d0\u793a\u7b26\u4e2d\u53ef\u4ee5\u5305\u542b\u7ec8\u7aef\u63a7\u5236\u5b57\u7b26\uff0c\u4f8b\u5982\u6539\u53d8\u63d0\u793a\u6587\u672c\u7684\u989c\u8272\u3001\u80cc\u666f\u6216\u6837\u5f0f\uff0c\u6216\u8005\u6539\u53d8\u7ec8\u7aef\u7a97\u53e3\u6807\u9898\u3002\u4e3a\u4e86\u8ba9 <span class=\"application\">Readline</span> \u7684\u884c\u7f16\u8f91\u529f\u80fd\u6b63\u5e38\u5de5\u4f5c\uff0c\u8fd9\u4e9b\u4e0d\u53ef\u6253\u5370\u7684\u63a7\u5236\u5b57\u7b26\u5fc5\u987b\u7528 <code class=\"literal\">%[</code> \u548c <code class=\"literal\">%]</code> \u5305\u56f4\u8d77\u6765\uff0c\u4ee5\u6807\u8bb0\u4e3a\u4e0d\u53ef\u89c1\u5b57\u7b26\u3002\u63d0\u793a\u7b26\u4e2d\u53ef\u4ee5\u51fa\u73b0\u591a\u7ec4\u8fd9\u6837\u7684\u6807\u8bb0\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; \\set PROMPT1 '%[%033[1;33;40m%]%n@%/%R%[%033[0m%]%# '\n</pre>\n<p lang=\"zh\">\u5176\u6548\u679c\u662f\u5728\u517c\u5bb9 VT100 \u4e14\u652f\u6301\u989c\u8272\u7684\u7ec8\u7aef\u4e0a\uff0c\u751f\u6210\u4e00\u4e2a\u7c97\u4f53\uff08<code class=\"literal\">1;</code>\uff09\u7684\u9ed1\u5e95\u9ec4\u5b57\u63d0\u793a\u7b26\uff08<code class=\"literal\">33;40</code>\uff09\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-W\"><span class=\"term\"><code class=\"literal\">%w</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0e\u6700\u8fd1\u4e00\u6b21\u8f93\u51fa\u7684 <code class=\"varname\">PROMPT1</code> \u5177\u6709\u76f8\u540c\u5bbd\u5ea6\u7684\u7a7a\u767d\u3002\u8fd9\u53ef\u7528\u4f5c <code class=\"varname\">PROMPT2</code> \u7684\u8bbe\u7f6e\uff0c\u4f7f\u591a\u884c\u8bed\u53e5\u4e0e\u7b2c\u4e00\u884c\u5bf9\u9f50\uff0c\u4f46\u4e0d\u663e\u793a\u53ef\u89c1\u7684\u4e8c\u7ea7\u63d0\u793a\u7b26\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8981\u5728\u63d0\u793a\u7b26\u4e2d\u63d2\u5165\u767e\u5206\u53f7\uff0c\u8bf7\u5199 %%\u3002\u63d0\u793a\u7b26 1 \u548c 2 \u7684\u9ed8\u8ba4\u503c\u4e3a '%/%R%x%# '\uff0c\u63d0\u793a\u7b26 3 \u7684\u9ed8\u8ba4\u503c\u4e3a '&gt;&gt; '\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">tcsh</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-READLINE\">\n<h4 lang=\"zh\">\u547d\u4ee4\u884c\u7f16\u8f91</h4>\n<p lang=\"zh\">\u5982\u679c\u53ef\u7528\uff0c<span class=\"application\">psql</span> \u4f1a\u4f7f\u7528<span class=\"application\">Readline</span>\u6216<span class=\"application\">libedit</span>\u5e93\uff0c\u4ee5\u4fbf\u8fdb\u884c\u4fbf\u6377\u7684\u884c\u7f16\u8f91\u548c\u5386\u53f2\u68c0\u7d22\u3002\u5f53<span class=\"application\">psql</span>\u9000\u51fa\u65f6\uff0c\u547d\u4ee4\u5386\u53f2\u4f1a\u81ea\u52a8\u4fdd\u5b58\uff1b\u5f53<span class=\"application\">psql</span>\u542f\u52a8\u65f6\uff0c\u53c8\u4f1a\u91cd\u65b0\u8f7d\u5165\u3002\u8f93\u5165\u4e0a\u7bad\u5934\u6216 control-P \u53ef\u4ee5\u53d6\u56de\u4e4b\u524d\u7684\u884c\u3002</p>\n<p lang=\"zh\">\u5728\u8bb8\u591a\uff08\u7edd\u975e\u5168\u90e8\uff09\u4e0a\u4e0b\u6587\u4e2d\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528 TAB \u8865\u5168\u90e8\u5206\u8f93\u5165\u7684\u5173\u952e\u5b57\u548c SQL \u5bf9\u8c61\u540d\u3002\u4f8b\u5982\uff0c\u5728\u547d\u4ee4\u5f00\u5934\u8f93\u5165<code class=\"literal\">ins</code>\u5e76\u6309\u4e0b TAB \u952e\uff0c\u4f1a\u8865\u5168\u4e3a<code class=\"literal\">insert into</code> \u3002\u7136\u540e\u8f93\u5165\u8868\u540d\u6216\u6a21\u5f0f\u540d\u7684\u51e0\u4e2a\u5b57\u7b26\uff0c\u518d\u6309\u4e0b<code class=\"literal\">TAB</code>\u952e\uff0c\u5c31\u4f1a\u8865\u5168\u5c1a\u672a\u8f93\u5b8c\u7684\u540d\u79f0\uff1b\u5982\u679c\u6709\u591a\u4e2a\u5019\u9009\u9879\uff0c\u5219\u4f1a\u7ed9\u51fa\u53ef\u80fd\u7684\u8865\u5168\u83dc\u5355\u3002\uff08\u5177\u4f53\u53d6\u51b3\u4e8e\u6240\u4f7f\u7528\u7684\u5e93\uff0c\u53ef\u80fd\u9700\u8981\u6309\u591a\u6b21<code class=\"literal\">TAB</code>\u952e\u624d\u80fd\u770b\u5230\u83dc\u5355\u3002\uff09</p>\n<p lang=\"zh\">\u5bf9 SQL \u5bf9\u8c61\u540d\u8fdb\u884c TAB \u8865\u5168\u65f6\uff0c\u9700\u8981\u5411\u670d\u52a1\u5668\u53d1\u9001\u67e5\u8be2\u6765\u67e5\u627e\u53ef\u80fd\u7684\u5339\u914d\u9879\u3002\u5728\u67d0\u4e9b\u4e0a\u4e0b\u6587\u4e2d\uff0c\u8fd9\u53ef\u80fd\u4f1a\u5e72\u6270\u5176\u4ed6\u64cd\u4f5c\u3002\u4f8b\u5982\uff0c\u5728<code class=\"command\">BEGIN</code>\u4e4b\u540e\uff0c\u5982\u679c\u4e2d\u95f4\u53d1\u51fa\u4e86\u4e00\u6b21 TAB \u8865\u5168\u67e5\u8be2\uff0c\u90a3\u4e48\u518d\u53d1\u51fa<code class=\"command\">SET TRANSACTION ISOLATION LEVEL</code>\u5c31\u4e3a\u65f6\u5df2\u665a\u4e86\u3002\u5982\u679c\u6839\u672c\u4e0d\u60f3\u4f7f\u7528 TAB \u8865\u5168\uff0c\u53ef\u4ee5\u628a\u4e0b\u9762\u7684\u5185\u5bb9\u653e\u5230\u4e3b\u76ee\u5f55\u4e2d\u540d\u4e3a<code class=\"filename\">.inputrc</code>\u7684\u6587\u4ef6\u91cc\uff0c\u4ece\u800c\u6c38\u4e45\u5173\u95ed\u5b83\uff1a</p>\n<pre class=\"programlisting\">$if psql\nset disable-completion on\n$endif\n</pre>\n<p lang=\"zh\">\uff08\u8fd9\u4e0d\u662f<span class=\"application\">psql</span>\u800c\u662f\u4e00\u4e2a<span class=\"application\">Readline</span>\u529f\u80fd\u3002\u9605\u8bfb\u5176\u6587\u6863\u4ee5\u83b7\u53d6\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\u3002\uff09</p>\n<p lang=\"zh\"><code class=\"option\">-n</code>\uff08<code class=\"option\">--no-readline</code>\uff09\u547d\u4ee4\u884c\u9009\u9879\u4e5f\u53ef\u7528\u4e8e\u5728\u5355\u6b21\u8fd0\u884c<span class=\"application\">psql</span>\u65f6\u7981\u7528 <span class=\"application\">Readline</span>\u3002\u8fd9\u4f1a\u963b\u6b62TAB \u8865\u5168\u3001\u547d\u4ee4\u884c\u5386\u53f2\u7684\u4f7f\u7528\u6216\u8bb0\u5f55\uff0c\u4ee5\u53ca\u591a\u884c\u547d\u4ee4\u7684\u7f16\u8f91\u3002\u5f53\u4f60\u9700\u8981\u590d\u5236\u7c98\u8d34\u5305\u542b <code class=\"literal\">TAB</code> \u5b57\u7b26\u7684\u6587\u672c\u65f6\uff0c\u5b83\u5c24\u5176\u6709\u7528\u3002</p>\n</div>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PSQL-ENVIRONMENT\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-ENVIRONMENT-COLUMNS\"><span class=\"term\"><code class=\"envar\">COLUMNS</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c<code class=\"literal\">\\pset columns</code>\u4e3a\u96f6\uff0c\u8fd9\u4e2a\u73af\u5883\u53d8\u91cf\u63a7\u5236\u7528\u4e8e<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u5bbd\u5ea6\u4ee5\u53ca\u7528\u6765\u786e\u5b9a\u8f83\u5bbd\u7684\u8f93\u51fa\u662f\u5426\u9700\u8981\u5206\u9875\u5668\uff0c\u6216\u8005\u662f\u5426\u5e94\u5207\u6362\u5230\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e2d\u7684\u5782\u76f4\u683c\u5f0f\u7684\u5bbd\u5ea6\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PGDATABASE\"><span class=\"term\"><code class=\"envar\">PGDATABASE</code><br/></span><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\uff08\u89c1<a class=\"xref\" href=\"/docs/16/libpq-envars.html\" title=\"34.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a034.15\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PG-COLOR\"><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PSQL-EDITOR\"><span class=\"term\"><code class=\"envar\">PSQL_EDITOR</code><br/></span><span class=\"term\"><code class=\"envar\">EDITOR</code><br/></span><span class=\"term\"><code class=\"envar\">VISUAL</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"command\">\\e</code>\u3001<code class=\"command\">\\ef</code>\u4ee5\u53ca<code class=\"command\">\\ev</code>\u547d\u4ee4\u6240\u4f7f\u7528\u7684\u7f16\u8f91\u5668\u3002\u4f1a\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u68c0\u67e5\u8fd9\u4e9b\u53d8\u91cf\uff0c\u7b2c\u4e00\u4e2a\u88ab\u8bbe\u7f6e\u7684\u5c06\u88ab\u4f7f\u7528\u3002\u5982\u679c\u90fd\u6ca1\u6709\u88ab\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u662f\u4f7f\u7528Unix\u7cfb\u7edf\u4e0a\u7684<code class=\"filename\">vi</code>\u6216\u8005Windows\u7cfb\u7edf\u4e0a\u7684<code class=\"filename\">notepad.exe</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PSQL-EDITOR-LINENUMBER-ARG\"><span class=\"term\"><code class=\"envar\">PSQL_EDITOR_LINENUMBER_ARG</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5f53 <code class=\"command\">\\e</code>\u3001<code class=\"command\">\\ef</code> \u6216 <code class=\"command\">\\ev</code> \u5e26\u6709\u884c\u53f7\u53c2\u6570\u4f7f\u7528\u65f6\uff0c\u6b64\u53d8\u91cf\u6307\u5b9a\u5c06\u8d77\u59cb\u884c\u53f7\u4f20\u7ed9\u7528\u6237\u7f16\u8f91\u5668\u65f6\u6240\u7528\u7684\u547d\u4ee4\u884c\u53c2\u6570\u3002\u5bf9\u4e8e <span class=\"productname\">Emacs</span> \u6216 <span class=\"productname\">vi</span> \u4e4b\u7c7b\u7684\u7f16\u8f91\u5668\uff0c\u8fd9\u4e2a\u53c2\u6570\u662f\u4e00\u4e2a\u52a0\u53f7\u3002\u5982\u679c\u9009\u9879\u540d\u548c\u884c\u53f7\u4e4b\u95f4\u9700\u8981\u7a7a\u683c\uff0c\u8bf7\u5728\u53d8\u91cf\u503c\u4e2d\u5305\u542b\u672b\u5c3e\u7a7a\u683c\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">PSQL_EDITOR_LINENUMBER_ARG='+'\nPSQL_EDITOR_LINENUMBER_ARG='--line '\n</pre>\n<p lang=\"zh\">\u5728 Unix \u7cfb\u7edf\u4e0a\u9ed8\u8ba4\u662f<code class=\"literal\">+</code>\uff08\u5bf9\u5e94\u4e8e\u9ed8\u8ba4\u7f16\u8f91\u5668<code class=\"filename\">vi</code>\uff0c\u4e14\u5bf9\u5f88\u591a\u5176\u4ed6\u5e38\u89c1\u7f16\u8f91\u5668\u53ef\u7528\uff09\u3002\u5728 Windows \u7cfb\u7edf\u4e0a\u6ca1\u6709\u9ed8\u8ba4\u503c\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PSQL-HISTORY\"><span class=\"term\"><code class=\"envar\">PSQL_HISTORY</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u547d\u4ee4\u5386\u53f2\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08<code class=\"literal\">~</code>\uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PAGER\"><span class=\"term\"><code class=\"envar\">PSQL_PAGER</code><br/></span><span class=\"term\"><code class=\"envar\">PAGER</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u67e5\u8be2\u7ed3\u679c\u65e0\u6cd5\u5728\u5c4f\u5e55\u4e0a\u663e\u793a\u5b8c\u6574\uff0c\u5b83\u4eec\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6b64\u547d\u4ee4\u3002\u5178\u578b\u7684\u503c\u662f<code class=\"literal\">more</code>\u6216<code class=\"literal\">less</code>\u3002\u53ef\u4ee5\u901a\u8fc7\u5c06<code class=\"envar\">PSQL_PAGER</code>\u6216<code class=\"envar\">PAGER</code>\u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u6216\u901a\u8fc7\u8c03\u6574<code class=\"command\">\\pset</code>\u547d\u4ee4\u7684\u4e0e\u5206\u9875\u76f8\u5173\u7684\u9009\u9879\u6765\u7981\u7528\u5206\u9875\u5668\u3002\u8fd9\u4e9b\u53d8\u91cf\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u8fdb\u884c\u68c0\u67e5\uff1b\u4f7f\u7528\u6309\u8be5\u987a\u5e8f\u627e\u5230\u7684\u7b2c\u4e00\u4e2a\u5df2\u8bbe\u7f6e\u7684\u53d8\u91cf\u3002\u5982\u679c\u5b83\u4eec\u90fd\u6ca1\u6709\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5728\u5927\u591a\u6570\u5e73\u53f0\u4e0a\u4f7f\u7528<code class=\"literal\">more</code>\uff0c\u4f46\u5728Cygwin\u4e0a\u4f7f\u7528<code class=\"literal\">less</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PSQL-WATCH-PAGER\"><span class=\"term\"><code class=\"envar\">PSQL_WATCH_PAGER</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528 \\watch \u547d\u4ee4\u53cd\u590d\u6267\u884c\u67e5\u8be2\u65f6\uff0c\u9ed8\u8ba4\u4e0d\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\u3002\u5728 Unix \u7cfb\u7edf\u4e0a\uff0c\u53ef\u4ee5\u5c06 PSQL_WATCH_PAGER \u8bbe\u4e3a\u5206\u9875\u7a0b\u5e8f\u547d\u4ee4\u6765\u6539\u53d8\u6b64\u884c\u4e3a\u3002pspg \u5206\u9875\u7a0b\u5e8f\uff08\u4e0d\u5c5e\u4e8e PostgreSQL\uff0c\u4f46\u8bb8\u591a\u5f00\u6e90\u8f6f\u4ef6\u53d1\u884c\u7248\u90fd\u63d0\u4f9b\u5b83\uff09\u4ee5 --stream \u9009\u9879\u542f\u52a8\u65f6\uff0c\u53ef\u4ee5\u663e\u793a \\watch \u7684\u8f93\u51fa\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PSQLRC\"><span class=\"term\"><code class=\"envar\">PSQLRC</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7528\u6237\u7684<code class=\"filename\">.psqlrc</code>\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08<code class=\"literal\">~</code>\uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-SHELL\"><span class=\"term\"><code class=\"envar\">SHELL</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u88ab<code class=\"command\">\\!</code>\u547d\u4ee4\u6267\u884c\u7684\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-TMPDIR\"><span class=\"term\"><code class=\"envar\">TMPDIR</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b58\u50a8\u4e34\u65f6\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u662f<code class=\"filename\">/tmp</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6 <span class=\"productname\">PostgreSQL</span> \u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528 <span class=\"application\">libpq</span> \u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/16/libpq-envars.html\" title=\"34.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a034.15\u00a0\u8282</a>\uff09\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.20.10\">\n<h2 lang=\"zh\">\u6587\u4ef6</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-FILES-PSQLRC\" lang=\"zh\"><span class=\"term\"><code class=\"filename\">psqlrc</code> \u548c <code class=\"filename\">~/.psqlrc</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u6ca1\u6709<code class=\"option\">-X</code>\u9009\u9879\uff0c\u5728\u8fde\u63a5\u5230\u6570\u636e\u5e93\u540e\u4f46\u5728\u63a5\u6536\u6b63\u5e38\u7684\u547d\u4ee4\u4e4b\u524d\uff0c<span class=\"application\">psql</span>\u4f1a\u5c1d\u8bd5\u4f9d\u6b21\u4ece\u7cfb\u7edf\u7ea7\u7684\u542f\u52a8\u6587\u4ef6\uff08<code class=\"filename\">psqlrc</code>\uff09\u548c\u7528\u6237\u7684\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\uff08<code class=\"filename\">~/.psqlrc</code>\uff09\u4e2d\u8bfb\u53d6\u5e76\u4e14\u6267\u884c\u547d\u4ee4\u3002\u8fd9\u4e9b\u6587\u4ef6\u53ef\u4ee5\u88ab\u7528\u6765\u8bbe\u7f6e\u5ba2\u6237\u7aef\u6216\u8005\u670d\u52a1\u5668\uff0c\u901a\u5e38\u662f\u4e00\u4e9b<code class=\"command\">\\set</code>\u548c<code class=\"command\">SET</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u7cfb\u7edf\u8303\u56f4\u7684\u542f\u52a8\u6587\u4ef6\u540d\u4e3a <code class=\"filename\">psqlrc</code>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4f1a\u5728\u5b89\u88c5\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u7cfb\u7edf\u914d\u7f6e</span>\u201d</span>\u76ee\u5f55\u4e2d\u67e5\u627e\u5b83\uff0c\u6700\u53ef\u9760\u7684\u8bc6\u522b\u65b9\u5f0f\u662f\u8fd0\u884c <code class=\"literal\">pg_config --sysconfdir</code>\u3002\u901a\u5e38\u8fd9\u4e2a\u76ee\u5f55\u662f\u76f8\u5bf9\u4e8e\u5305\u542b <span class=\"productname\">PostgreSQL</span> \u53ef\u6267\u884c\u6587\u4ef6\u7684\u76ee\u5f55\u7684 <code class=\"filename\">../etc/</code>\u3002\u4e5f\u53ef\u4ee5\u901a\u8fc7 <code class=\"envar\">PGSYSCONFDIR</code> \u73af\u5883\u53d8\u91cf\u663e\u5f0f\u6307\u5b9a\u67e5\u627e\u76ee\u5f55\u3002</p>\n<p lang=\"zh\">\u7528\u6237\u7684\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\u540d\u4e3a<code class=\"filename\">.psqlrc</code>\uff0c\u5e76\u4e14\u5728\u8c03\u7528\u7528\u6237\u7684\u4e3b\u76ee\u5f55\u4e2d\u5bfb\u627e\u3002\u5728Windows\u4e0a\uff0c\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\u7684\u540d\u79f0\u6539\u4e3a<code class=\"filename\">%APPDATA%\\postgresql\\psqlrc.conf</code>\u3002\u5728\u4efb\u4f55\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e<code class=\"envar\">PSQLRC</code>\u73af\u5883\u53d8\u91cf\u6765\u8986\u76d6\u6b64\u9ed8\u8ba4\u6587\u4ef6\u8def\u5f84\u3002</p>\n<p lang=\"zh\">\u7cfb\u7edf\u8303\u56f4\u7684\u542f\u52a8\u6587\u4ef6\u548c\u7528\u6237\u4e2a\u4eba\u7684\u542f\u52a8\u6587\u4ef6\u90fd\u53ef\u4ee5\u901a\u8fc7\u5728\u6587\u4ef6\u540d\u540e\u9644\u52a0\u8fde\u5b57\u7b26\u548c<span class=\"productname\">PostgreSQL</span>\u7684\u5927\u7248\u672c\u6216\u5c0f\u7248\u672c\u6807\u8bc6\u7b26\u6765\u4f7f\u5176\u4e0e<span class=\"application\">psql</span>\u7248\u672c\u76f8\u5173\uff0c\u4f8b\u5982<code class=\"filename\">~/.psqlrc-16</code>\u6216<code class=\"filename\">~/.psqlrc-16.15</code>\u3002\u6700\u5177\u4f53\u7248\u672c\u5339\u914d\u7684\u6587\u4ef6\u5c06\u4f18\u5148\u8bfb\u53d6\uff0c\u800c\u4e0d\u662f\u975e\u7279\u5b9a\u7248\u672c\u7684\u6587\u4ef6\u3002\u8fd9\u4e9b\u7248\u672c\u540e\u7f00\u662f\u5728\u786e\u5b9a\u6587\u4ef6\u8def\u5f84\u540e\u6dfb\u52a0\u7684\uff0c\u5982\u4e0a\u6240\u8ff0\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-FILES-PSQL-HISTORY\"><span class=\"term\"><code class=\"filename\">.psql_history</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u547d\u4ee4\u884c\u5386\u53f2\u88ab\u5b58\u50a8\u5728\u6587\u4ef6<code class=\"filename\">~/.psql_history</code>\u4e2d\uff0c\u5728 Windows \u4e0a\u5219\u5b58\u50a8\u5728\u6587\u4ef6<code class=\"filename\">%APPDATA%\\postgresql\\psql_history</code>\u4e2d\u3002</p>\n<p lang=\"zh\">\u5386\u53f2\u6587\u4ef6\u7684\u4f4d\u7f6e\u53ef\u4ee5\u901a\u8fc7<code class=\"varname\">HISTFILE</code> <span class=\"application\">psql</span>\u53d8\u91cf\u6216\u8005<code class=\"envar\">PSQL_HISTORY</code>\u73af\u5883\u53d8\u91cf\u663e\u5f0f\u8bbe\u7f6e\u3002</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.20.11\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">psql</span>\u6700\u9002\u5408\u4e0e\u76f8\u540c\u6216\u8f83\u65e7\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\u914d\u5408\u4f7f\u7528\u3002\u5982\u679c\u670d\u52a1\u5668\u7684\u7248\u672c\u6bd4<span class=\"application\">psql</span>\u672c\u8eab\u66f4\u65b0\uff0c\u53cd\u659c\u7ebf\u547d\u4ee4\u7279\u522b\u5bb9\u6613\u5931\u8d25\u3002\u7136\u800c\uff0c<code class=\"literal\">\\d</code>\u7cfb\u5217\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u5e94\u8be5\u53ef\u4ee5\u5728\u6700\u4f4e\u81f3 9.2 \u7248\u672c\u7684\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\uff0c\u4f46\u4e0d\u4e00\u5b9a\u9002\u7528\u4e8e\u6bd4<span class=\"application\">psql</span>\u672c\u8eab\u66f4\u65b0\u7684\u670d\u52a1\u5668\u3002\u8fd0\u884cSQL\u547d\u4ee4\u548c\u663e\u793a\u67e5\u8be2\u7ed3\u679c\u7684\u4e00\u822c\u529f\u80fd\u4e5f\u5e94\u8be5\u53ef\u4ee5\u5728\u66f4\u65b0\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\uff0c\u4f46\u4e0d\u80fd\u4fdd\u8bc1\u5728\u6240\u6709\u60c5\u51b5\u4e0b\u90fd\u80fd\u5b9e\u73b0\u3002</p>\n<p>\u5982\u679c\u4f60\u60f3\u7528<span class=\"application\">psql</span>\u8fde\u63a5\u5230\u591a\u4e2a\u5177\u6709\u4e0d\u540c\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\uff0c\u63a8\u8350\u4f7f\u7528\u6700\u65b0\u7248\u672c\u7684<span class=\"application\">psql</span>\u3002\u6216\u8005\uff0c\u4f60\u53ef\u4ee5\u4e3a\u6bcf\u4e00\u4e2a\u5927\u7248\u672c\u4fdd\u7559\u4e00\u4efd<span class=\"application\">psql</span>\u62f7\u8d1d\uff0c\u5e76\u4e14\u9488\u5bf9\u76f8\u5e94\u7684\u670d\u52a1\u5668\u4f7f\u7528\u5339\u914d\u7684\u7248\u672c\u3002\u4f46\u5b9e\u9645\u4e0a\uff0c\u8fd9\u79cd\u989d\u5916\u7684\u9ebb\u70e6\u662f\u4e0d\u5fc5\u8981\u7684\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5728 <span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\uff0c<code class=\"option\">-c</code> \u9009\u9879\u610f\u5473\u7740 <code class=\"option\">-X</code>\uff08<code class=\"option\">--no-psqlrc</code>\uff09\uff1b\u73b0\u5728\u5df2\u7ecf\u4e0d\u662f\u8fd9\u6837\u4e86\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5728<span class=\"productname\">PostgreSQL</span> 8.4 \u4e4b\u524d\uff0c<span class=\"application\">psql</span>\u5141\u8bb8\u4e00\u4e2a\u5355\u5b57\u6bcd\u53cd\u659c\u7ebf\u547d\u4ee4\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u76f4\u63a5\u5199\u5728\u8be5\u547d\u4ee4\u540e\u9762\uff0c\u4e2d\u95f4\u4e0d\u9700\u8981\u7a7a\u767d\u3002\u73b0\u5728\u5219\u8981\u6c42\u7528\u7a7a\u767d\u5206\u9694\u3002</p>\n</li>\n</ul>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.20.12\">\n<h2 lang=\"zh\">\u7ed9 Windows \u7528\u6237\u7684\u6ce8\u89e3</h2>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u662f\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u63a7\u5236\u53f0\u5e94\u7528</span>\u201d</span>\u3002\u7531\u4e8e Windows \u7684\u63a7\u5236\u53f0\u7a97\u53e3\u4f7f\u7528\u7684\u662f\u4e00\u79cd\u548c\u7cfb\u7edf\u4e2d\u5176\u4ed6\u5e94\u7528\u4e0d\u540c\u7684\u7f16\u7801\uff0c\u5728<span class=\"application\">psql</span>\u4e2d\u4f7f\u7528 8 \u4f4d\u5b57\u7b26\u65f6\u8981\u7279\u522b\u6ce8\u610f\u3002\u5982\u679c<span class=\"application\">psql</span>\u68c0\u6d4b\u5230\u4e00\u4e2a\u6709\u95ee\u9898\u7684\u63a7\u5236\u53f0\u4ee3\u7801\u9875\uff0c\u5b83\u5c06\u4f1a\u5728\u542f\u52a8\u65f6\u8b66\u544a\u4f60\u3002\u8981\u66f4\u6539\u63a7\u5236\u53f0\u4ee3\u7801\u9875\uff0c\u6709\u4e24\u4ef6\u4e8b\u662f\u5fc5\u8981\u7684\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u8f93\u5165<strong class=\"userinput\"><code>cmd.exe /c chcp 1252</code></strong>\u53ef\u4ee5\u8bbe\u7f6e\u4ee3\u7801\u9875\uff081252 \u662f\u9002\u7528\u4e8e\u5fb7\u8bed\u7684\u4e00\u4e2a\u4ee3\u7801\u9875\uff0c\u8bf7\u5728\u8fd9\u91cc\u66ff\u6362\u6210\u4f60\u7684\u503c\uff09\u3002\u5982\u679c\u6b63\u5728\u4f7f\u7528 Cygwin\uff0c\u53ef\u4ee5\u628a\u8fd9\u4e2a\u547d\u4ee4\u653e\u5728<code class=\"filename\">/etc/profile</code>\u4e2d\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u628a\u63a7\u5236\u53f0\u5b57\u4f53\u8bbe\u7f6e\u4e3a<code class=\"literal\">Lucida Console</code>\uff0c\u56e0\u4e3a\u6805\u683c\u5b57\u4f53\u65e0\u6cd5\u4e0e ANSI \u4ee3\u7801\u9875\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</li>\n</ul>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PSQL-EXAMPLES\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u7b2c\u4e00\u4e2a\u793a\u4f8b\u5c55\u793a\u4e86\u5982\u4f55\u628a\u4e00\u6761\u547d\u4ee4\u5206\u6563\u5230\u591a\u884c\u8f93\u5165\u4e2d\u3002\u6ce8\u610f\u63d0\u793a\u7b26\u7684\u53d8\u5316\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>CREATE TABLE my_table (</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code> first integer not null default 0,</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code> second text)</code></strong>\ntestdb-&gt; <strong class=\"userinput\"><code>;</code></strong>\nCREATE TABLE\n</pre>\n<p lang=\"zh\">\u73b0\u5728\u518d\u6765\u770b\u4e00\u4e0b\u8fd9\u4e2a\u8868\u7684\u5b9a\u4e49\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\d my_table</code></strong>\n              Table \"public.my_table\"\n Column |  Type   | Collation | Nullable | Default\n--------+---------+-----------+----------+---------\n first  | integer |           | not null | 0\n second | text    |           |          |\n</pre>\n<p lang=\"zh\">\u73b0\u5728\u6211\u4eec\u628a\u63d0\u793a\u7b26\u6539\u6210\u66f4\u6709\u8da3\u7684\u5f62\u5f0f\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set PROMPT1 '%n@%m %~%R%# '</code></strong>\npeter@localhost testdb=&gt;\n</pre>\n<p lang=\"zh\">\u5047\u8bbe\u4f60\u5df2\u7ecf\u5411\u8868\u4e2d\u586b\u5165\u6570\u636e\uff0c\u5e76\u60f3\u770b\u4e00\u770b\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; SELECT * FROM my_table;\n first | second\n-------+--------\n     1 | one\n     2 | two\n     3 | three\n     4 | four\n(4 rows)\n</pre>\n<p lang=\"zh\">\u4f60\u53ef\u4ee5\u4f7f\u7528 <code class=\"command\">\\pset</code> \u547d\u4ee4\u4ee5\u4e0d\u540c\u65b9\u5f0f\u663e\u793a\u8868\u683c\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 2</code></strong>\nBorder style is 2.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\n+-------+--------+\n| first | second |\n+-------+--------+\n|     1 | one    |\n|     2 | two    |\n|     3 | three  |\n|     4 | four   |\n+-------+--------+\n(4 rows)\n\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 0</code></strong>\nBorder style is 0.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\nfirst second\n----- ------\n    1 one\n    2 two\n    3 three\n    4 four\n(4 rows)\n\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 1</code></strong>\nBorder style is 1.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset format csv</code></strong>\nOutput format is csv.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset tuples_only</code></strong>\nTuples only is on.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT second, first FROM my_table;</code></strong>\none,1\ntwo,2\nthree,3\nfour,4\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset format unaligned</code></strong>\nOutput format is unaligned.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset fieldsep '\\t'</code></strong>\nField separator is \"    \".\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT second, first FROM my_table;</code></strong>\none     1\ntwo     2\nthree   3\nfour    4\n</pre>\n<p lang=\"zh\">\u6216\u8005\u4f7f\u7528\u77ed\u547d\u4ee4\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\a \\t \\x</code></strong>\nOutput format is aligned.\nTuples only is off.\nExpanded display is on.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\n-[ RECORD 1 ]-\nfirst  | 1\nsecond | one\n-[ RECORD 2 ]-\nfirst  | 2\nsecond | two\n-[ RECORD 3 ]-\nfirst  | 3\nsecond | three\n-[ RECORD 4 ]-\nfirst  | 4\nsecond | four\n</pre>\n<p lang=\"zh\">\u6b64\u5916\uff0c\u53ef\u4ee5\u4f7f\u7528<code class=\"literal\">\\g</code>\u4e3a\u4e00\u4e2a\u67e5\u8be2\u8bbe\u7f6e\u8fd9\u4e9b\u8f93\u51fa\u683c\u5f0f\u9009\u9879\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table</code></strong>\npeter@localhost testdb-&gt; <strong class=\"userinput\"><code>\\g (format=aligned tuples_only=off expanded=on)</code></strong>\n-[ RECORD 1 ]-\nfirst  | 1\nsecond | one\n-[ RECORD 2 ]-\nfirst  | 2\nsecond | two\n-[ RECORD 3 ]-\nfirst  | 3\nsecond | three\n-[ RECORD 4 ]-\nfirst  | 4\nsecond | four\n</pre>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4e00\u4e2a\u4f7f\u7528 <code class=\"command\">\\df</code> \u547d\u4ee4\u53ea\u67e5\u627e\u540d\u79f0\u5339\u914d <code class=\"literal\">int*pl</code> \u4e14\u7b2c\u4e8c\u4e2a\u53c2\u6570\u7c7b\u578b\u4e3a <code class=\"type\">bigint</code> \u7684\u51fd\u6570\u7684\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\df int*pl * bigint</code></strong>\n                          List of functions\n   Schema   |  Name   | Result data type | Argument data types | Type\n------------+---------+------------------+---------------------+------\n pg_catalog | int28pl | bigint           | smallint, bigint    | func\n pg_catalog | int48pl | bigint           | integer, bigint     | func\n pg_catalog | int8pl  | bigint           | bigint, bigint      | func\n(3 rows)\n</pre>\n<p lang=\"zh\">\u5728\u9002\u5408\u7684\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u4f7f\u7528 <code class=\"command\">\\crosstabview</code> \u547d\u4ee4\u5c06\u67e5\u8be2\u7ed3\u679c\u663e\u793a\u4e3a\u4ea4\u53c9\u8868\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>SELECT first, second, first &gt; 2 AS gt2 FROM my_table;</code></strong>\n first | second | gt2\n-------+--------+-----\n     1 | one    | f\n     2 | two    | f\n     3 | three  | t\n     4 | four   | t\n(4 rows)\n\ntestdb=&gt; <strong class=\"userinput\"><code>\\crosstabview first second</code></strong>\n first | one | two | three | four\n-------+-----+-----+-------+------\n     1 | f   |     |       |\n     2 |     | f   |       |\n     3 |     |     | t     |\n     4 |     |     |       | t\n(4 rows)\n</pre>\n<p lang=\"zh\">\u7b2c\u4e8c\u4e2a\u793a\u4f8b\u5c55\u793a\u4e86\u4e00\u4e2a\u4e58\u6cd5\u8868\uff0c\u5176\u4e2d\u884c\u6309\u6570\u5b57\u5012\u5e8f\u6392\u5217\uff0c\u800c\u5217\u6309\u72ec\u7acb\u7684\u5347\u5e8f\u6570\u5b57\u6392\u5217\u3002</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>SELECT t1.first as \"A\", t2.first+100 AS \"B\", t1.first*(t2.first+100) as \"AxB\",</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code>row_number() over(order by t2.first) AS ord</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code>FROM my_table t1 CROSS JOIN my_table t2 ORDER BY 1 DESC</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code>\\crosstabview \"A\" \"B\" \"AxB\" ord</code></strong>\n A | 101 | 102 | 103 | 104\n---+-----+-----+-----+-----\n 4 | 404 | 408 | 412 | 416\n 3 | 303 | 306 | 309 | 312\n 2 | 202 | 204 | 206 | 208\n 1 | 101 | 102 | 103 | 104\n(4 rows)\n</pre>\n</div>\n</div></div>", "manual_path": "app-psql.html", "localization": {"status": "complete", "sources": [{"url": "/docs/16/app-psql.html", "method": "same-major semantic node", "sha256": "72833cd861534255277e73a650a16ab07f11c38db9df980213b8335751a3273d", "language": "zh", "matched_nodes": ["#APP-PSQL/div[10]/div[1]/ul[0]/li[0]", "#APP-PSQL/div[10]/div[1]/ul[0]/li[1]", "#APP-PSQL/div[10]/div[1]/ul[0]/li[2]", "#APP-PSQL/div[10]/h2[0]", "#APP-PSQL/div[11]/div[2]/ul[0]/li[0]", "#APP-PSQL/div[11]/div[2]/ul[0]/li[1]", "#APP-PSQL/div[11]/h2[0]", "#APP-PSQL/div[11]/p[1]", "#APP-PSQL/div[12]/p[11]", "#APP-PSQL/div[12]/p[13]", "#APP-PSQL/div[12]/p[15]", "#APP-PSQL/div[12]/p[17]", "#APP-PSQL/div[12]/p[19]", "#APP-PSQL/div[12]/p[1]", "#APP-PSQL/div[12]/p[3]", "#APP-PSQL/div[12]/p[5]", "#APP-PSQL/div[12]/p[7]", "#APP-PSQL/div[12]/p[9]", "#APP-PSQL/div[2]/p[1]", "#APP-PSQL/div[3]/h2[0]", "#APP-PSQL/div[4]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[11]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[13]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[15]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]/p[2]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[19]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[21]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[23]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[25]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[25]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[27]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[29]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[31]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[35]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[37]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[39]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[3]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[41]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]/div[1]/h3[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]/div[1]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[45]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[47]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[49]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[51]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[53]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[55]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[55]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[57]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[57]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[59]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[5]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[61]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[63]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[65]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[67]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[67]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[69]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[3]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[5]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[6]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[7]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[9]", "#APP-PSQL/div[6]/h2[0]", "#APP-PSQL/div[6]/p[1]", "#APP-PSQL/div[7]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[1]/p[1]", "#APP-PSQL/div[7]/div[1]/p[2]", "#APP-PSQL/div[7]/div[1]/p[5]", "#APP-PSQL/div[7]/div[1]/p[6]", "#APP-PSQL/div[7]/div[1]/p[7]", "#APP-PSQL/div[7]/div[2]/h3[0]", "#APP-PSQL/div[7]/div[2]/p[1]", "#APP-PSQL/div[7]/div[2]/p[3]", "#APP-PSQL/div[7]/div[2]/p[4]", "#APP-PSQL/div[7]/div[2]/p[5]", "#APP-PSQL/div[7]/div[2]/p[6]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[101]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[101]/div[4]/p[1]/a[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[101]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[101]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[101]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[101]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[103]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[103]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[103]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[105]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[105]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[105]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[105]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[107]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[109]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[111]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[111]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[111]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[111]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[113]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[115]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[115]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[115]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[115]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[115]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[117]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[117]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[119]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[121]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[123]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[123]/p[0]/a[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[123]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[123]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[123]/p[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[127]/div[2]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[127]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[127]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[129]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[131]/div[2]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[131]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[131]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/p[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/p[6]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[139]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[13]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[13]/div[5]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[13]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[13]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[13]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[141]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[141]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[141]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[143]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[149]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[153]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[153]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[15]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[15]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[15]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[15]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[17]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[17]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[17]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[17]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[21]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[23]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[23]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[29]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[31]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[31]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[37]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[41]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[43]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[43]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[43]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dt[30]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dt[32]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dt[34]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dt[6]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[5]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/p[4]/a[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[157]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[159]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[15]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[161]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[163]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[165]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[167]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[167]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[167]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[167]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[167]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[169]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[171]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[171]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[173]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[173]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[173]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[175]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[177]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[179]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[181]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[181]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[183]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[183]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[185]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[187]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[189]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[191]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[193]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[193]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[195]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[195]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[197]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[199]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[199]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[199]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[199]/p[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[19]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[19]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[19]/p[0]/a[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[19]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[19]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[19]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[21]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[23]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[25]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[29]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[31]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[37]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[41]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[41]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[41]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[43]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[45]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[45]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[47]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[49]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[51]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[53]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[53]/div[1]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[53]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[55]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[57]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[59]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[5]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[5]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[5]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[5]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[5]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[61]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[63]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[65]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[67]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[69]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[71]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[73]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[75]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[77]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[79]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[79]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[81]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[81]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[81]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[83]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[83]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[85]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[85]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[87]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[89]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[91]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[93]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[95]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[97]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[99]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[9]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[9]/div[1]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[9]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[100]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[126]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[128]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[130]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[134]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[136]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[146]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[148]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[156]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[160]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[184]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[4]", "#APP-PSQL/div[7]/div[3]/div[11]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/p[6]", "#APP-PSQL/div[7]/div[3]/div[11]/p[7]", "#APP-PSQL/div[7]/div[3]/h3[0]", "#APP-PSQL/div[7]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/p[2]", "#APP-PSQL/div[7]/div[3]/p[3]", "#APP-PSQL/div[7]/div[3]/p[4]", "#APP-PSQL/div[7]/div[3]/p[4]/a[2]", "#APP-PSQL/div[7]/div[3]/p[5]", "#APP-PSQL/div[7]/div[3]/p[7]", "#APP-PSQL/div[7]/div[3]/p[8]", "#APP-PSQL/div[7]/div[3]/p[9]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[15]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[17]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/div[2]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[21]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[21]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[23]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[23]/p[2]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[41]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[41]/p[0]/a[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[43]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[47]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[49]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[51]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[53]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[55]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[57]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[59]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[61]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[63]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[65]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[67]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[4]/div[1]/div[8]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/p[10]", "#APP-PSQL/div[7]/div[4]/div[1]/p[11]", "#APP-PSQL/div[7]/div[4]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/p[2]", "#APP-PSQL/div[7]/div[4]/div[1]/p[4]", "#APP-PSQL/div[7]/div[4]/div[1]/p[6]", "#APP-PSQL/div[7]/div[4]/div[1]/p[7]", "#APP-PSQL/div[7]/div[4]/div[1]/p[9]", "#APP-PSQL/div[7]/div[4]/div[2]/p[10]", "#APP-PSQL/div[7]/div[4]/div[2]/p[11]", "#APP-PSQL/div[7]/div[4]/div[2]/p[12]", "#APP-PSQL/div[7]/div[4]/div[2]/p[1]", "#APP-PSQL/div[7]/div[4]/div[2]/p[3]", "#APP-PSQL/div[7]/div[4]/div[2]/p[4]", "#APP-PSQL/div[7]/div[4]/div[2]/p[6]", "#APP-PSQL/div[7]/div[4]/div[2]/p[7]", "#APP-PSQL/div[7]/div[4]/div[2]/p[9]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[15]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[21]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[23]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[25]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[29]/p[0]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[29]/p[2]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[31]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[4]/div[3]/div[5]/p[1]", "#APP-PSQL/div[7]/div[4]/div[3]/p[1]", "#APP-PSQL/div[7]/div[4]/div[3]/p[2]", "#APP-PSQL/div[7]/div[4]/div[4]/h4[0]", "#APP-PSQL/div[7]/div[4]/div[4]/p[3]", "#APP-PSQL/div[7]/div[4]/div[4]/p[4]", "#APP-PSQL/div[7]/div[4]/div[4]/p[5]", "#APP-PSQL/div[7]/div[4]/div[4]/p[7]", "#APP-PSQL/div[7]/div[4]/div[4]/p[8]", "#APP-PSQL/div[7]/div[4]/h3[0]", "#APP-PSQL/div[7]/h2[0]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[11]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[13]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[17]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[19]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[1]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[21]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[3]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[5]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[7]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]/p[0]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]/p[2]", "#APP-PSQL/div[8]/p[2]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[0]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[1]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[2]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[3]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[3]/p[0]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[3]/p[1]", "#APP-PSQL/div[9]/div[1]/dl[0]/dt[0]", "#APP-PSQL/div[9]/h2[0]"]}, {"url": "/docs/16/indexes-index-only-scans.html", "method": "same-major semantic node", "sha256": "11afcd79a6a1517327939f6141ab8aec3f541b3fc4c5d67bc305f9627ce0ab9d", "language": "zh", "matched_nodes": ["#INDEXES-INDEX-ONLY-SCANS/p[25]/span[2]"]}], "language": "zh", "original_text": {"/versions/16/description/0": "psql \u2014 PostgreSQL interactive terminal", "/versions/16/facts/0/label": "Documented executable", "/versions/16/facts/1/label": "Executable version", "/versions/16/facts/2/label": "Reference inventory", "/versions/16/facts/2/value": "Client applications", "/versions/16/facts/3/label": "Option definition groups", "/versions/16/tables/0/title": "Documented options", "/versions/16/tables/1/title": "Environment variables", "/versions/16/related/0/label": "psql meta-commands", "/versions/16/related/1/label": "libpq connection parameters", "/versions/16/tables/0/rows/0/summary": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all .", "/versions/16/tables/0/rows/1/summary": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned .", "/versions/16/tables/0/rows/2/summary": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors .", "/versions/16/tables/0/rows/3/summary": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence.", "/versions/16/tables/0/rows/4/summary": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv .", "/versions/16/tables/0/rows/5/summary": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "/versions/16/tables/0/rows/6/summary": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries .", "/versions/16/tables/0/rows/7/summary": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on .", "/versions/16/tables/0/rows/8/summary": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i .", "/versions/16/tables/0/rows/9/summary": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f .", "/versions/16/tables/0/columns/0/label": "Option and arguments", "/versions/16/tables/0/columns/1/label": "Description", "/versions/16/tables/0/rows/10/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket.", "/versions/16/tables/0/rows/11/summary": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command.", "/versions/16/tables/0/rows/12/summary": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list .", "/versions/16/tables/0/rows/13/summary": "Write all query output into file filename , in addition to the normal output destination.", "/versions/16/tables/0/rows/14/summary": "Do not use Readline for line editing and do not use the command history (see the section called \u201cCommand-Line Editing\u201d below).", "/versions/16/tables/0/rows/15/summary": "Put all query output into file filename . This is equivalent to the command \\o .", "/versions/16/tables/0/rows/16/summary": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432.", "/versions/16/tables/0/rows/17/summary": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex .", "/versions/16/tables/0/rows/18/summary": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on .", "/versions/16/tables/0/rows/19/summary": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep .", "/versions/16/tables/0/rows/20/summary": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts.", "/versions/16/tables/0/rows/21/summary": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does.", "/versions/16/tables/0/rows/22/summary": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only .", "/versions/16/tables/0/rows/23/summary": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details.", "/versions/16/tables/0/rows/24/summary": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)", "/versions/16/tables/0/rows/25/summary": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later.", "/versions/16/tables/0/rows/26/summary": "Print the psql version and exit.", "/versions/16/tables/0/rows/27/summary": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/16/tables/0/rows/28/summary": "Force psql to prompt for a password before connecting to a database, even if the password will not be used.", "/versions/16/tables/0/rows/29/summary": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded .", "/versions/16/tables/0/rows/30/summary": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file).", "/versions/16/tables/0/rows/31/summary": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero .", "/versions/16/tables/0/rows/32/summary": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero .", "/versions/16/tables/0/rows/33/summary": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied.", "/versions/16/tables/0/rows/34/summary": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables.", "/versions/16/tables/1/columns/0/label": "Variable", "/versions/16/tables/1/columns/1/label": "Meaning", "/versions/16/tables/1/rows/0/description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode.", "/versions/16/tables/1/rows/1/description": "Default connection parameters (see Section 34.15 ).", "/versions/16/tables/1/rows/2/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .", "/versions/16/tables/1/rows/3/description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems.", "/versions/16/tables/1/rows/4/description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems.", "/versions/16/tables/1/rows/5/description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed.", "/versions/16/tables/1/rows/6/description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If neither of them is set, the default is to use more on most platforms, but less on Cygwin.", "/versions/16/tables/1/rows/7/description": "When a query is executed repeatedly with the \\watch command, a pager is not used by default. This behavior can be changed by setting PSQL_WATCH_PAGER to a pager command, on Unix systems. The pspg pager (not part of PostgreSQL but available in many open source software distributions) can display the output of \\watch if started with the option --stream .", "/versions/16/tables/1/rows/8/description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed.", "/versions/16/tables/1/rows/9/description": "Command executed by the \\! command.", "/versions/16/tables/1/rows/10/description": "Directory for storing temporary files. The default is /tmp ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "e4b7bd1ccc9bee61e4739dd11aa13c30bcce078c249dc4bc762b7beaa3b08030"}, "comparison_data": {"options": [{"names": ["-a", "--echo-all"], "signature": "-a --echo-all", "description": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all ."}, {"names": ["-A", "--no-align"], "signature": "-A --no-align", "description": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned ."}, {"names": ["-b", "--echo-errors"], "signature": "-b --echo-errors", "description": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors ."}, {"names": ["-c command", "--command= command"], "signature": "-c command --command= command", "description": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. command must be either a command string that is completely parsable by the server (i.e., it contains no psql -specific features), or a single backslash command. Thus you cannot mix SQL and psql meta-commands within a -c option. To achieve that, you could use repeated -c options or pipe the string into psql , for example: psql -c '\\x' -c 'SELECT * FROM foo;' or echo '\\x \\\\ SELECT * FROM foo;' | psql ( \\\\ is the separator meta-command.) Each SQL command string passed to -c is sent to the server as a single request. Because of this, the server executes it as a single transaction even if the string contains multiple SQL commands, unless there are explicit BEGIN / COMMIT commands included in the string to divide it into multiple transactions. (See Section 55.2.2.1 for more details about how the server handles multi-query strings.) If having several commands executed in one transaction is not desired, use repeated -c commands or feed multiple commands to psql 's standard input, either using echo as illustrated above, or via a shell here-document, for example: psql <<EOF \\x SELECT * FROM foo; EOF"}, {"names": ["--csv"], "signature": "--csv", "description": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv ."}, {"names": ["-d dbname", "--dbname= dbname"], "signature": "-d dbname --dbname= dbname", "description": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--echo-queries"], "signature": "-e --echo-queries", "description": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries ."}, {"names": ["-E", "--echo-hidden"], "signature": "-E --echo-hidden", "description": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on ."}, {"names": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i . If filename is - (hyphen), then standard input is read until an EOF indication or \\q meta-command. This can be used to intersperse interactive input with input from files. Note however that Readline is not used in this case (much as if -n had been specified). Using this option is subtly different from writing psql < filename . In general, both will do what you expect, but using -f enables some nice features such as error messages with line numbers. There is also a slight chance that using this option will reduce the start-up overhead. On the other hand, the variant using the shell's input redirection is (in theory) guaranteed to yield exactly the same output you would have received had you entered everything by hand."}, {"names": ["-F separator", "--field-separator= separator"], "signature": "-F separator --field-separator= separator", "description": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f ."}, {"names": ["-h hostname", "--host= hostname"], "signature": "-h hostname --host= hostname", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket."}, {"names": ["-H", "--html"], "signature": "-H --html", "description": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command."}, {"names": ["-l", "--list"], "signature": "-l --list", "description": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list . When this option is used, psql will connect to the database postgres , unless a different database is named on the command line (option -d or non-option argument, possibly via a service entry, but not via an environment variable)."}, {"names": ["-L filename", "--log-file= filename"], "signature": "-L filename --log-file= filename", "description": "Write all query output into file filename , in addition to the normal output destination."}, {"names": ["-n", "--no-readline"], "signature": "-n --no-readline", "description": "Do not use Readline for line editing and do not use the command history (see the section called \u201cCommand-Line Editing\u201d below)."}, {"names": ["-o filename", "--output= filename"], "signature": "-o filename --output= filename", "description": "Put all query output into file filename . This is equivalent to the command \\o ."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432."}, {"names": ["-P assignment", "--pset= assignment"], "signature": "-P assignment --pset= assignment", "description": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex ."}, {"names": ["-q", "--quiet"], "signature": "-q --quiet", "description": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on ."}, {"names": ["-R separator", "--record-separator= separator"], "signature": "-R separator --record-separator= separator", "description": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep ."}, {"names": ["-s", "--single-step"], "signature": "-s --single-step", "description": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts."}, {"names": ["-S", "--single-line"], "signature": "-S --single-line", "description": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does. Note This mode is provided for those who insist on it, but you are not necessarily encouraged to use it. In particular, if you mix SQL and meta-commands on a line the order of execution might not always be clear to the inexperienced user."}, {"names": ["-t", "--tuples-only"], "signature": "-t --tuples-only", "description": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only ."}, {"names": ["-T table_options", "--table-attr= table_options"], "signature": "-T table_options --table-attr= table_options", "description": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)"}, {"names": ["-v assignment", "--set= assignment", "--variable= assignment"], "signature": "-v assignment --set= assignment --variable= assignment", "description": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the psql version and exit."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Force psql to prompt for a password before connecting to a database, even if the password will not be used. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, psql will prompt for a password in any case. However, psql will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-x", "--expanded"], "signature": "-x --expanded", "description": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded ."}, {"names": ["-X", "--no-psqlrc"], "signature": "-X --no-psqlrc", "description": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file)."}, {"names": ["-z", "--field-separator-zero"], "signature": "-z --field-separator-zero", "description": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero ."}, {"names": ["-0", "--record-separator-zero"], "signature": "-0 --record-separator-zero", "description": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero ."}, {"names": ["-1", "--single-transaction"], "signature": "-1 --single-transaction", "description": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied. If the commands themselves contain BEGIN , COMMIT , or ROLLBACK , this option will not have the desired effects. Also, if an individual command cannot be executed inside a transaction block, specifying this option will cause the whole transaction to fail."}, {"names": ["-?", "--help[= topic ]"], "signature": "-? --help[= topic ]", "description": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables."}], "synopsis": ["psql [ option ...] [ dbname [ username ]]"], "environment": [{"name": "COLUMNS", "description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode."}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters (see Section 34.15 )."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems."}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems."}, {"name": "PSQL_HISTORY", "description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed."}, {"name": "PSQL_PAGER PAGER", "description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If neither of them is set, the default is to use more on most platforms, but less on Cygwin."}, {"name": "PSQL_WATCH_PAGER", "description": "When a query is executed repeatedly with the \\watch command, a pager is not used by default. This behavior can be changed by setting PSQL_WATCH_PAGER to a pager command, on Unix systems. The pspg pager (not part of PostgreSQL but available in many open source software distributions) can display the output of \\watch if started with the option --stream ."}, {"name": "PSQLRC", "description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed."}, {"name": "SHELL", "description": "Command executed by the \\! command."}, {"name": "TMPDIR", "description": "Directory for storing temporary files. The default is /tmp ."}]}, "comparison_hash": "56308506614ae7883bdbb2ab59674f49e48510360db59a7100407d7b430ca7b4", "manual_language": "zh"}, "17": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "psql"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "17.11"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "35"}], "tables": [{"key": "options", "rows": [{"summary": "\u5728\u8bfb\u5165\u65f6\u5c06\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u884c\u8bfb\u53d6\uff09\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a all \u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-ECHO-ALL", "text": "-a --echo-all"}}, {"summary": "\u5207\u6362\u5230\u975e\u5bf9\u9f50\u8f93\u51fa\u6a21\u5f0f\uff08\u9ed8\u8ba4\u8f93\u51fa\u6a21\u5f0f\u662f aligned \uff09\u3002\u8fd9\u7b49\u6548\u4e8e \\pset format unaligned \u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-NO-ALIGN", "text": "-A --no-align"}}, {"summary": "\u628a\u5931\u8d25\u7684 SQL \u547d\u4ee4\u6253\u5370\u5230\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a errors \u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-ECHO-ERRORS", "text": "-b --echo-errors"}}, {"summary": "\u6307\u5b9a psql \u6267\u884c\u4e00\u4e2a\u7ed9\u5b9a\u7684\u547d\u4ee4\u5b57\u7b26\u4e32 command \u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u591a\u6b21\u5e76\u4e14\u4ee5\u4efb\u4f55\u987a\u5e8f\u4e0e -f \u9009\u9879\u7ec4\u5408\u5728\u4e00\u8d77\u3002\u5f53 -c \u6216\u8005 -f \u88ab\u6307\u5b9a\u65f6\uff0c psql \u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709 -c \u548c -f \u9009\u9879\u540e\u7ec8\u6b62\u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-COMMAND", "text": "-c command --command= command"}}, {"summary": "\u5207\u6362\u5230 CSV \uff08\u9017\u53f7\u5206\u9694\u503c\uff09\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u76f8\u5f53\u4e8e \\pset format csv \u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-CSV", "text": "--csv"}}, {"summary": "\u6307\u5b9a\u8981\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002\u8fd9\u7b49\u6548\u4e8e\u6307\u5b9a dbname \u4e3a\u547d\u4ee4\u884c\u4e0a\u7684\u7b2c\u4e00\u4e2a\u975e\u9009\u9879\u53c2\u6570\u3002 dbname \u53ef\u4ee5\u662f \u8fde\u63a5\u5b57\u7b26\u4e32 \u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u5c06\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-DBNAME", "text": "-d dbname --dbname= dbname"}}, {"summary": "\u4e5f\u628a\u53d1\u9001\u5230\u670d\u52a1\u5668\u7684\u6240\u6709 SQL \u547d\u4ee4\u590d\u5236\u5230\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a queries \u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-ECHO-QUERIES", "text": "-e --echo-queries"}}, {"summary": "\u56de\u663e \\d \u4ee5\u53ca\u5176\u4ed6\u53cd\u659c\u7ebf\u547d\u4ee4\u751f\u6210\u7684\u5b9e\u9645\u67e5\u8be2\u3002\u53ef\u4ee5\u7528\u5b83\u6765\u5b66\u4e60 psql \u7684\u5185\u90e8\u64cd\u4f5c\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO_HIDDEN \u8bbe\u7f6e\u4e3a on \u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-ECHO-HIDDEN", "text": "-E --echo-hidden"}}, {"summary": "\u4ece\u6587\u4ef6 filename \u800c\u4e0d\u662f\u6807\u51c6\u8f93\u5165\u4e2d\u8bfb\u53d6\u547d\u4ee4\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u6307\u5b9a\uff0c\u4e5f\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u4e0e -c \u9009\u9879\u7ec4\u5408\u4f7f\u7528\u3002\u5f53\u6307\u5b9a\u4e86 -c \u6216 -f \u65f6\uff0c psql \u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709 -c \u548c -f \u9009\u9879\u540e\u7ec8\u6b62\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u7b49\u4ef7\u4e8e\u5143\u547d\u4ee4 \\i \u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-FILE", "text": "-f filename --file= filename"}}, {"summary": "\u4f7f\u7528 separator \u4f5c\u4e3a\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e \\pset fieldsep \u6216\u8005 \\f \u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR", "text": "-F separator --field-separator= separator"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-FIELD-HOST", "text": "-h hostname --host= hostname"}}, {"summary": "\u5207\u6362\u5230 HTML \u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e \\pset format html \u6216\u8005 \\H \u547d\u4ee4\u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-HTML", "text": "-H --html"}}, {"summary": "\u5217\u51fa\u6240\u6709\u53ef\u7528\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u9000\u51fa\u3002\u5176\u4ed6\u975e\u8fde\u63a5\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002\u8fd9\u4e0e\u5143\u547d\u4ee4 \\list \u7c7b\u4f3c\u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-LIST", "text": "-l --list"}}, {"summary": "\u9664\u4e86\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u5199\u5230\u666e\u901a\u8f93\u51fa\u76ee\u6807\u4e4b\u5916\uff0c\u8fd8\u5199\u5230\u6587\u4ef6 filename \u4e2d\u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-LOG-FILE", "text": "-L filename --log-file= filename"}}, {"summary": "\u4e0d\u8981\u4f7f\u7528 Readline \u8fdb\u884c\u884c\u7f16\u8f91\uff0c\u4e5f\u4e0d\u8981\u4f7f\u7528\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\uff08\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684 \u201c\u547d\u4ee4\u884c\u7f16\u8f91\u201d\u4e00\u8282 \uff09\u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-NO-READLINE", "text": "-n --no-readline"}}, {"summary": "\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u653e\u5230\u6587\u4ef6 filename \u4e2d\u3002\u8fd9\u7b49\u6548\u4e8e\u547d\u4ee4 \\o \u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-OUTPUT", "text": "-o filename --output= filename"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u7684\u6587\u4ef6\u540d\u540e\u7f00\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u7684\u503c\uff1b\u672a\u8bbe\u7f6e\u65f6\uff0c\u4f7f\u7528\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u7aef\u53e3\uff0c\u901a\u5e38\u4e3a 5432\u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-PORT", "text": "-p port --port= port"}}, {"summary": "\u4ee5 \\pset \u7684\u5f62\u5f0f\u6307\u5b9a\u6253\u5370\u9009\u9879\u3002\u6ce8\u610f\uff0c\u8fd9\u91cc\u4f60\u5fc5\u987b\u7528\u4e00\u4e2a\u7b49\u53f7\u800c\u4e0d\u662f\u7a7a\u683c\u6765\u5206\u9694\u540d\u79f0\u548c\u503c\u3002\u4f8b\u5982\uff0c\u8981\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a LaTeX \uff0c\u5e94\u8be5\u5199\u6210 -P format=latex \u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-PSET", "text": "-P assignment --pset= assignment"}}, {"summary": "\u6307\u5b9a psql \u5e94\u8be5\u5b89\u9759\u5730\u5de5\u4f5c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4f1a\u6253\u5370\u51fa\u6b22\u8fce\u6d88\u606f\u548c\u5404\u79cd\u63d0\u793a\u4fe1\u606f\u3002\u5982\u679c\u4f7f\u7528\u4e86\u8fd9\u4e2a\u9009\u9879\uff0c\u4ee5\u4e0a\u90a3\u4e9b\u5c31\u90fd\u4e0d\u4f1a\u8f93\u51fa\u3002\u5728\u4f7f\u7528 -c \u9009\u9879\u65f6\uff0c\u914d\u5408\u8fd9\u4e2a\u9009\u9879\u5f88\u6709\u7528\u3002\u8fd9\u7b49\u6548\u4e8e\u8bbe\u7f6e\u53d8\u91cf QUIET \u4e3a on \u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-QUIET", "text": "-q --quiet"}}, {"summary": "\u628a separator \u7528\u4f5c\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e \\pset recordsep \u547d\u4ee4\u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR", "text": "-R separator --record-separator= separator"}}, {"summary": "\u8fd0\u884c\u5728\u5355\u6b65\u6a21\u5f0f\u4e2d\u3002\u8fd9\u610f\u5473\u7740\u5728\u6bcf\u4e2a\u547d\u4ee4\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u4e4b\u524d\u90fd\u4f1a\u63d0\u793a\u7528\u6237\uff0c\u5e76\u5141\u8bb8\u53d6\u6d88\u6267\u884c\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u8c03\u8bd5\u811a\u672c\u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-SINGLE-STEP", "text": "-s --single-step"}}, {"summary": "\u8fd0\u884c\u5728\u5355\u884c\u6a21\u5f0f\u4e2d\uff0c\u5176\u4e2d\u6362\u884c\u7b26\u4f1a\u7ec8\u6b62\u4e00\u4e2a SQL \u547d\u4ee4\uff0c\u5c31\u50cf\u5206\u53f7\u7684\u4f5c\u7528\u4e00\u6837\u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-SINGLE-LINE", "text": "-S --single-line"}}, {"summary": "\u5173\u95ed\u6253\u5370\u5217\u540d\u548c\u7ed3\u679c\u884c\u8ba1\u6570\u9875\u811a\u7b49\u3002\u8fd9\u7b49\u6548\u4e8e \\t \u6216\u8005 \\pset tuples_only \u547d\u4ee4\u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-TUPLES-ONLY", "text": "-t --tuples-only"}}, {"summary": "\u6307\u5b9a\u8981\u653e\u5728 HTML table \u6807\u7b7e\u5185\u7684\u9009\u9879\u3002\u8be6\u89c1 \\pset tableattr \u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-TABLE-ATTR", "text": "-T table_options --table-attr= table_options"}}, {"summary": "\u4f5c\u4e3a\u7528\u6237 username \u800c\u4e0d\u662f\u9ed8\u8ba4\u7528\u6237\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff08\u5f53\u7136\uff0c\u4f60\u5fc5\u987b\u5177\u6709\u8fd9\u6837\u505a\u7684\u6743\u9650\uff09\u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-USERNAME", "text": "-U username --username= username"}}, {"summary": "\u6267\u884c\u4e00\u6b21\u53d8\u91cf\u8d4b\u503c\uff0c\u548c \\set \u5143\u547d\u4ee4\u76f8\u4f3c\u3002\u6ce8\u610f\u4f60\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u7528\u7b49\u53f7\u5206\u9694\u540d\u5b57\u548c\u503c\uff08\u5982\u679c\u6709\uff09\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u7684\u8bbe\u7f6e\uff0c\u53bb\u6389\u7b49\u53f7\u5c31\u884c\u3002\u8981\u628a\u4e00\u4e2a\u53d8\u91cf\u8bbe\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u4f7f\u7528\u7b49\u53f7\u4f46\u662f\u53bb\u6389\u503c\u3002\u8fd9\u4e9b\u8d4b\u503c\u5728\u547d\u4ee4\u884c\u5904\u7406\u671f\u95f4\u88ab\u5b8c\u6210\uff0c\u56e0\u6b64\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u7684\u53d8\u91cf\u5c06\u5728\u7a0d\u540e\u88ab\u8986\u76d6\u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-VARIABLE", "text": "-v assignment --set= assignment --variable= assignment"}}, {"summary": "\u6253\u5370 psql \u7248\u672c\u5e76\u4e14\u9000\u51fa\u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-VERSION", "text": "-V --version"}}, {"summary": "\u6c38\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982 .pgpass \u6587\u4ef6\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u8fd9\u4e2a\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4efb\u52a1\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u65f6\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-NO-PASSWORD", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 psql \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\uff0c\u5373\u4f7f\u8be5\u5bc6\u7801\u5b9e\u9645\u4e0a\u4e0d\u4f1a\u88ab\u4f7f\u7528\u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-PASSWORD", "text": "-W --password"}}, {"summary": "\u6253\u5f00\u6269\u5c55\u8868\u683c\u5f0f\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e \\x \u6216\u8005 \\pset expanded \u547d\u4ee4\u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-EXPANDED", "text": "-x --expanded"}}, {"summary": "\u4e0d\u8bfb\u53d6\u542f\u52a8\u6587\u4ef6\uff08\u65e2\u4e0d\u8bfb\u53d6\u7cfb\u7edf\u8303\u56f4\u7684 psqlrc \u6587\u4ef6\uff0c\u4e5f\u4e0d\u8bfb\u53d6\u7528\u6237\u7684 ~/.psqlrc \u6587\u4ef6\uff09\u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-NO-PSQLRC", "text": "-X --no-psqlrc"}}, {"summary": "\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u8fd9\u7b49\u6548\u4e8e \\pset fieldsep_zero \u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR-ZERO", "text": "-z --field-separator-zero"}}, {"summary": "\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u4f8b\u5982\uff0c\u8fd9\u6709\u52a9\u4e8e\u4e0e xargs -0 \u914d\u5408\u4f7f\u7528\u3002\u8fd9\u7b49\u6548\u4e8e \\pset recordsep_zero \u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR-ZERO", "text": "-0 --record-separator-zero"}}, {"summary": "\u8fd9\u4e2a\u9009\u9879\u53ea\u80fd\u4e0e\u4e00\u4e2a\u6216\u591a\u4e2a -c \u548c/\u6216 -f \u9009\u9879\u7ed3\u5408\u4f7f\u7528\u3002\u5b83\u4f1a\u5bfc\u81f4 psql \u5728\u7b2c\u4e00\u4e2a\u8fd9\u6837\u7684\u9009\u9879\u4e4b\u524d\u53d1\u51fa\u4e00\u4e2a BEGIN \u547d\u4ee4\uff0c\u5e76\u5728\u6700\u540e\u4e00\u4e2a\u9009\u9879\u4e4b\u540e\u53d1\u51fa\u4e00\u4e2a COMMIT \u547d\u4ee4\uff0c\u4ece\u800c\u5c06\u6240\u6709\u547d\u4ee4\u5305\u88c5\u6210\u4e00\u4e2a\u5355\u72ec\u7684\u4e8b\u52a1\u3002\u5982\u679c\u4efb\u4f55\u547d\u4ee4\u5931\u8d25\u4e14\u53d8\u91cf ON_ERROR_STOP \u88ab\u8bbe\u7f6e\uff0c\u5219\u4f1a\u6539\u4e3a\u53d1\u9001\u4e00\u4e2a ROLLBACK \u547d\u4ee4\u3002\u8fd9\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-SINGLE-TRANSACTION", "text": "-1 --single-transaction"}}, {"summary": "\u663e\u793a\u6709\u5173 psql \u7684\u5e2e\u52a9\u5e76\u4e14\u9000\u51fa\u3002\u53ef\u9009\u7684 topic \u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a options \uff09\u9009\u62e9\u8981\u89e3\u91ca psql \u7684\u54ea\u4e00\u90e8\u5206\uff1a commands \u63cf\u8ff0 psql \u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b options \u63cf\u8ff0\u53ef\u4ee5\u88ab\u4f20\u9012\u7ed9 psql \u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c variables \u5219\u663e\u793a\u6709\u5173 psql \u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002", "signature": {"url": "/docs/17/app-psql.html#APP-PSQL-OPTION-HELP", "text": "-? --help[= topic ]"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "COLUMNS", "description": "\u5982\u679c \\pset columns \u4e3a\u96f6\uff0c\u8fd9\u4e2a\u73af\u5883\u53d8\u91cf\u63a7\u5236\u7528\u4e8e wrapped \u683c\u5f0f\u7684\u5bbd\u5ea6\u4ee5\u53ca\u7528\u6765\u786e\u5b9a\u8f83\u5bbd\u7684\u8f93\u51fa\u662f\u5426\u9700\u8981\u5206\u9875\u5668\uff0c\u6216\u8005\u662f\u5426\u5e94\u5207\u6362\u5230\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e2d\u7684\u5782\u76f4\u683c\u5f0f\u7684\u5bbd\u5ea6\u3002"}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\uff08\u89c1 \u7b2c 32.15 \u8282 \uff09\u3002"}, {"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "\\e \u3001 \\ef \u4ee5\u53ca \\ev \u547d\u4ee4\u6240\u4f7f\u7528\u7684\u7f16\u8f91\u5668\u3002\u4f1a\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u68c0\u67e5\u8fd9\u4e9b\u53d8\u91cf\uff0c\u7b2c\u4e00\u4e2a\u88ab\u8bbe\u7f6e\u7684\u5c06\u88ab\u4f7f\u7528\u3002\u5982\u679c\u90fd\u6ca1\u6709\u88ab\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u662f\u4f7f\u7528Unix\u7cfb\u7edf\u4e0a\u7684 vi \u6216\u8005Windows\u7cfb\u7edf\u4e0a\u7684 notepad.exe \u3002"}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "\u5f53 \\e \u3001 \\ef \u6216 \\ev \u5e26\u6709\u884c\u53f7\u53c2\u6570\u4f7f\u7528\u65f6\uff0c\u6b64\u53d8\u91cf\u6307\u5b9a\u5c06\u8d77\u59cb\u884c\u53f7\u4f20\u7ed9\u7528\u6237\u7f16\u8f91\u5668\u65f6\u6240\u7528\u7684\u547d\u4ee4\u884c\u53c2\u6570\u3002\u5bf9\u4e8e Emacs \u6216 vi \u4e4b\u7c7b\u7684\u7f16\u8f91\u5668\uff0c\u8fd9\u4e2a\u53c2\u6570\u662f\u4e00\u4e2a\u52a0\u53f7\u3002\u5982\u679c\u9009\u9879\u540d\u548c\u884c\u53f7\u4e4b\u95f4\u9700\u8981\u7a7a\u683c\uff0c\u8bf7\u5728\u53d8\u91cf\u503c\u4e2d\u5305\u542b\u672b\u5c3e\u7a7a\u683c\u3002\u4f8b\u5982\uff1a PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' \u5728 Unix \u7cfb\u7edf\u4e0a\u9ed8\u8ba4\u662f + \uff08\u5bf9\u5e94\u4e8e\u9ed8\u8ba4\u7f16\u8f91\u5668 vi \uff0c\u4e14\u5bf9\u5f88\u591a\u5176\u4ed6\u5e38\u89c1\u7f16\u8f91\u5668\u53ef\u7528\uff09\u3002\u5728 Windows \u7cfb\u7edf\u4e0a\u6ca1\u6709\u9ed8\u8ba4\u503c\u3002"}, {"name": "PSQL_HISTORY", "description": "\u547d\u4ee4\u5386\u53f2\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08 ~ \uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002"}, {"name": "PSQL_PAGER PAGER", "description": "\u5982\u679c\u67e5\u8be2\u7ed3\u679c\u65e0\u6cd5\u5728\u5c4f\u5e55\u4e0a\u663e\u793a\u5b8c\u6574\uff0c\u5b83\u4eec\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6b64\u547d\u4ee4\u3002\u5178\u578b\u7684\u503c\u662f more \u6216 less \u3002\u53ef\u4ee5\u901a\u8fc7\u5c06 PSQL_PAGER \u6216 PAGER \u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u6216\u901a\u8fc7\u8c03\u6574 \\pset \u547d\u4ee4\u7684\u4e0e\u5206\u9875\u76f8\u5173\u7684\u9009\u9879\u6765\u7981\u7528\u5206\u9875\u5668\u3002\u8fd9\u4e9b\u53d8\u91cf\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u8fdb\u884c\u68c0\u67e5\uff1b\u4f7f\u7528\u6309\u8be5\u987a\u5e8f\u627e\u5230\u7684\u7b2c\u4e00\u4e2a\u5df2\u8bbe\u7f6e\u7684\u53d8\u91cf\u3002\u5982\u679c\u5b83\u4eec\u90fd\u6ca1\u6709\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5728\u5927\u591a\u6570\u5e73\u53f0\u4e0a\u4f7f\u7528 more \uff0c\u4f46\u5728Cygwin\u4e0a\u4f7f\u7528 less \u3002"}, {"name": "PSQL_WATCH_PAGER", "description": "\u4f7f\u7528 \\watch \u547d\u4ee4\u53cd\u590d\u6267\u884c\u67e5\u8be2\u65f6\uff0c\u9ed8\u8ba4\u4e0d\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\u3002\u5728 Unix \u7cfb\u7edf\u4e0a\uff0c\u53ef\u4ee5\u5c06 PSQL_WATCH_PAGER \u8bbe\u4e3a\u5206\u9875\u7a0b\u5e8f\u547d\u4ee4\u6765\u6539\u53d8\u6b64\u884c\u4e3a\u3002pspg \u5206\u9875\u7a0b\u5e8f\uff08\u4e0d\u5c5e\u4e8e PostgreSQL\uff0c\u4f46\u8bb8\u591a\u5f00\u6e90\u8f6f\u4ef6\u53d1\u884c\u7248\u90fd\u63d0\u4f9b\u5b83\uff09\u4ee5 --stream \u9009\u9879\u542f\u52a8\u65f6\uff0c\u53ef\u4ee5\u663e\u793a \\watch \u7684\u8f93\u51fa\u3002"}, {"name": "PSQLRC", "description": "\u7528\u6237\u7684 .psqlrc \u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08 ~ \uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002"}, {"name": "SHELL", "description": "\u88ab \\! \u547d\u4ee4\u6267\u884c\u7684\u547d\u4ee4\u3002"}, {"name": "TMPDIR", "description": "\u5b58\u50a8\u4e34\u65f6\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u662f /tmp \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-a", "--echo-all"], "summary": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all .", "signature": "-a --echo-all", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-ECHO-ALL", "description": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all ."}, {"names": ["-A", "--no-align"], "summary": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned .", "signature": "-A --no-align", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-NO-ALIGN", "description": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned ."}, {"names": ["-b", "--echo-errors"], "summary": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors .", "signature": "-b --echo-errors", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-ECHO-ERRORS", "description": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors ."}, {"names": ["-c command", "--command= command"], "summary": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence.", "signature": "-c command --command= command", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-COMMAND", "description": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. command must be either a command string that is completely parsable by the server (i.e., it contains no psql -specific features), or a single backslash command. Thus you cannot mix SQL and psql meta-commands within a -c option. To achieve that, you could use repeated -c options or pipe the string into psql , for example: psql -c '\\x' -c 'SELECT * FROM foo;' or echo '\\x \\\\ SELECT * FROM foo;' | psql ( \\\\ is the separator meta-command.) Each SQL command string passed to -c is sent to the server as a single request. Because of this, the server executes it as a single transaction even if the string contains multiple SQL commands, unless there are explicit BEGIN / COMMIT commands included in the string to divide it into multiple transactions. (See Section 53.2.2.1 for more details about how the server handles multi-query strings.) If having several commands executed in one transaction is not desired, use repeated -c commands or feed multiple commands to psql 's standard input, either using echo as illustrated above, or via a shell here-document, for example: psql <<EOF \\x SELECT * FROM foo; EOF"}, {"names": ["--csv"], "summary": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv .", "signature": "--csv", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-CSV", "description": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv ."}, {"names": ["-d dbname", "--dbname= dbname"], "summary": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "signature": "-d dbname --dbname= dbname", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-DBNAME", "description": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--echo-queries"], "summary": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries .", "signature": "-e --echo-queries", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-ECHO-QUERIES", "description": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries ."}, {"names": ["-E", "--echo-hidden"], "summary": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on .", "signature": "-E --echo-hidden", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-ECHO-HIDDEN", "description": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on ."}, {"names": ["-f filename", "--file= filename"], "summary": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i .", "signature": "-f filename --file= filename", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-FILE", "description": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i . If filename is - (hyphen), then standard input is read until an EOF indication or \\q meta-command. This can be used to intersperse interactive input with input from files. Note however that Readline is not used in this case (much as if -n had been specified). Using this option is subtly different from writing psql < filename . In general, both will do what you expect, but using -f enables some nice features such as error messages with line numbers. There is also a slight chance that using this option will reduce the start-up overhead. On the other hand, the variant using the shell's input redirection is (in theory) guaranteed to yield exactly the same output you would have received had you entered everything by hand."}, {"names": ["-F separator", "--field-separator= separator"], "summary": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f .", "signature": "-F separator --field-separator= separator", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR", "description": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f ."}, {"names": ["-h hostname", "--host= hostname"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket.", "signature": "-h hostname --host= hostname", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-FIELD-HOST", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket."}, {"names": ["-H", "--html"], "summary": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command.", "signature": "-H --html", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-HTML", "description": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command."}, {"names": ["-l", "--list"], "summary": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list .", "signature": "-l --list", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-LIST", "description": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list . When this option is used, psql will connect to the database postgres , unless a different database is named on the command line (option -d or non-option argument, possibly via a service entry, but not via an environment variable)."}, {"names": ["-L filename", "--log-file= filename"], "summary": "Write all query output into file filename , in addition to the normal output destination.", "signature": "-L filename --log-file= filename", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-LOG-FILE", "description": "Write all query output into file filename , in addition to the normal output destination."}, {"names": ["-n", "--no-readline"], "summary": "Do not use Readline for line editing and do not use the command history (see the section called \u201cCommand-Line Editing\u201d below).", "signature": "-n --no-readline", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-NO-READLINE", "description": "Do not use Readline for line editing and do not use the command history (see the section called \u201cCommand-Line Editing\u201d below)."}, {"names": ["-o filename", "--output= filename"], "summary": "Put all query output into file filename . This is equivalent to the command \\o .", "signature": "-o filename --output= filename", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-OUTPUT", "description": "Put all query output into file filename . This is equivalent to the command \\o ."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432.", "signature": "-p port --port= port", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-PORT", "description": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432."}, {"names": ["-P assignment", "--pset= assignment"], "summary": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex .", "signature": "-P assignment --pset= assignment", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-PSET", "description": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex ."}, {"names": ["-q", "--quiet"], "summary": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on .", "signature": "-q --quiet", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-QUIET", "description": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on ."}, {"names": ["-R separator", "--record-separator= separator"], "summary": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep .", "signature": "-R separator --record-separator= separator", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR", "description": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep ."}, {"names": ["-s", "--single-step"], "summary": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts.", "signature": "-s --single-step", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-SINGLE-STEP", "description": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts."}, {"names": ["-S", "--single-line"], "summary": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does.", "signature": "-S --single-line", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-SINGLE-LINE", "description": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does. Note This mode is provided for those who insist on it, but you are not necessarily encouraged to use it. In particular, if you mix SQL and meta-commands on a line the order of execution might not always be clear to the inexperienced user."}, {"names": ["-t", "--tuples-only"], "summary": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only .", "signature": "-t --tuples-only", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-TUPLES-ONLY", "description": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only ."}, {"names": ["-T table_options", "--table-attr= table_options"], "summary": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details.", "signature": "-T table_options --table-attr= table_options", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-TABLE-ATTR", "description": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details."}, {"names": ["-U username", "--username= username"], "summary": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)", "signature": "-U username --username= username", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-USERNAME", "description": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)"}, {"names": ["-v assignment", "--set= assignment", "--variable= assignment"], "summary": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later.", "signature": "-v assignment --set= assignment --variable= assignment", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-VARIABLE", "description": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later."}, {"names": ["-V", "--version"], "summary": "Print the psql version and exit.", "signature": "-V --version", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-VERSION", "description": "Print the psql version and exit."}, {"names": ["-w", "--no-password"], "summary": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-NO-PASSWORD", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-W", "--password"], "summary": "Force psql to prompt for a password before connecting to a database, even if the password will not be used.", "signature": "-W --password", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-PASSWORD", "description": "Force psql to prompt for a password before connecting to a database, even if the password will not be used. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, psql will prompt for a password in any case. However, psql will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-x", "--expanded"], "summary": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded .", "signature": "-x --expanded", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-EXPANDED", "description": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded ."}, {"names": ["-X", "--no-psqlrc"], "summary": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file).", "signature": "-X --no-psqlrc", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-NO-PSQLRC", "description": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file)."}, {"names": ["-z", "--field-separator-zero"], "summary": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero .", "signature": "-z --field-separator-zero", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR-ZERO", "description": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero ."}, {"names": ["-0", "--record-separator-zero"], "summary": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero .", "signature": "-0 --record-separator-zero", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR-ZERO", "description": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero ."}, {"names": ["-1", "--single-transaction"], "summary": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied.", "signature": "-1 --single-transaction", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-SINGLE-TRANSACTION", "description": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied. If the commands themselves contain BEGIN , COMMIT , or ROLLBACK , this option will not have the desired effects. Also, if an individual command cannot be executed inside a transaction block, specifying this option will cause the whole transaction to fail."}, {"names": ["-?", "--help[= topic ]"], "summary": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables.", "signature": "-? --help[= topic ]", "source_url": "/docs/17/app-psql.html#APP-PSQL-OPTION-HELP", "description": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables."}], "related": [{"url": "/wiki/psql/?v=17", "label": "psql \u5143\u547d\u4ee4"}, {"url": "/wiki/conn/?v=17", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v17.11/postgresql-17.11.tar.bz2", "label": "17.11", "major": "17", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/17/postgresql-17-A4.pdf", "bytes": 15521293, "pages": 3099, "sha256": "1991354df0dc89e70ec39328c28988ef8b19c6a93671dab3893650b63e9f4e36", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/17/postgresql-17-US.pdf", "bytes": 15398150, "pages": 3270, "sha256": "07696c8f38abf31babf22d2db337093936e7c472d2af36d050b000c49bbcf52c", "built_at": "2026-09-26"}}, "tree": "17", "index": "index.html", "major": "17", "pages": 1143, "release": "17.11", "source_url": "https://ftp.postgresql.org/pub/source/v17.11/postgresql-17.11.tar.bz2", "svg_assets": 3, "source_mode": "en SGML built with pinned official archive", "source_sha256": "dd27f2b3c59e73ed14aa3324901242bf69a032a6347805f274e6260322d42979"}, "revision": "58419c9b0dd42cb34c8d53695bb025a7e582edf55ccd4c5bcb1c2c7c71a37487", "evidence_kind": "English manual and source declarations", "source_sha256": "dd27f2b3c59e73ed14aa3324901242bf69a032a6347805f274e6260322d42979"}, "sources": [{"url": "https://pg.center/docs/17/app-psql.html", "file": "app-psql.html", "label": "17.11 English manual \u00b7 app-psql.html", "anchor": "", "sha256": "04c77661f1c96a64e91a27313542c34aff0c7d2a94e350ed98c6f9f35700629b", "language": "en", "original_url": "/docs/17/app-psql.html"}, {"url": "https://pg.center/docs/17/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "3194fc72ddad8e2fcba55f8e007f83413cb352146cb65aaa9457a18d0314ee1b", "language": "en", "original_url": "/docs/17/reference-client.html"}], "sections": [], "synopsis": ["psql [ option ...] [ dbname [ username ]]"], "signature": "psql [ option ...] [ dbname [ username ]]", "description": ["psql \u2014 PostgreSQL \u7684\u4ea4\u4e92\u5f0f\u7ec8\u7aef"], "environment": [{"name": "COLUMNS", "description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode."}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters (see Section 32.15 )."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems."}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems."}, {"name": "PSQL_HISTORY", "description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed."}, {"name": "PSQL_PAGER PAGER", "description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If neither of them is set, the default is to use more on most platforms, but less on Cygwin."}, {"name": "PSQL_WATCH_PAGER", "description": "When a query is executed repeatedly with the \\watch command, a pager is not used by default. This behavior can be changed by setting PSQL_WATCH_PAGER to a pager command, on Unix systems. The pspg pager (not part of PostgreSQL but available in many open source software distributions) can display the output of \\watch if started with the option --stream ."}, {"name": "PSQLRC", "description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed."}, {"name": "SHELL", "description": "Command executed by the \\! command."}, {"name": "TMPDIR", "description": "Directory for storing temporary files. The default is /tmp ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PSQL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></h2>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u2014 <span class=\"productname\">PostgreSQL</span>\u7684\u4ea4\u4e92\u5f0f\u7ec8\u7aef</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.21.4.1\"><code class=\"command\">psql</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em> [<em class=\"replaceable\"><code>username</code></em>]]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.21.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u662f<span class=\"productname\">PostgreSQL</span>\u7684\u4e00\u4e2a\u57fa\u4e8e\u7ec8\u7aef\u7684\u524d\u7aef\u3002\u5b83\u4f7f\u4f60\u80fd\u591f\u4ea4\u4e92\u5f0f\u5730\u8f93\u5165\u67e5\u8be2\uff0c\u5c06\u5176\u53d1\u9001\u7ed9<span class=\"productname\">PostgreSQL</span>\uff0c\u5e76\u67e5\u770b\u67e5\u8be2\u7ed3\u679c\u3002\u4e5f\u53ef\u4ee5\u4ece\u6587\u4ef6\u6216\u547d\u4ee4\u884c\u53c2\u6570\u63d0\u4f9b\u8f93\u5165\u3002\u6b64\u5916\uff0c<span class=\"application\">psql</span>\u8fd8\u63d0\u4f9b\u4e86\u82e5\u5e72\u5143\u547d\u4ee4\u548c\u591a\u79cd\u7c7b\u4f3c shell \u7684\u7279\u6027\uff0c\u4ee5\u4fbf\u4e8e\u7f16\u5199\u811a\u672c\u548c\u81ea\u52a8\u5316\u6267\u884c\u5404\u79cd\u4efb\u52a1\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-PSQL-3\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-OPTION-ECHO-ALL\"><span class=\"term\"><code class=\"option\">-a</code><br/></span><span class=\"term\"><code class=\"option\">--echo-all</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8bfb\u5165\u65f6\u5c06\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u884c\u8bfb\u53d6\uff09\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a <code class=\"literal\">all</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-NO-ALIGN\"><span class=\"term\"><code class=\"option\">-A</code><br/></span><span class=\"term\"><code class=\"option\">--no-align</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230\u975e\u5bf9\u9f50\u8f93\u51fa\u6a21\u5f0f\uff08\u9ed8\u8ba4\u8f93\u51fa\u6a21\u5f0f\u662f<code class=\"literal\">aligned</code>\uff09\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset format unaligned</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-ECHO-ERRORS\"><span class=\"term\"><code class=\"option\">-b</code><br/></span><span class=\"term\"><code class=\"option\">--echo-errors</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u5931\u8d25\u7684 SQL \u547d\u4ee4\u6253\u5370\u5230\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">errors</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-COMMAND\"><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>command</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--command=<em class=\"replaceable\"><code>command</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a<span class=\"application\">psql</span>\u6267\u884c\u4e00\u4e2a\u7ed9\u5b9a\u7684\u547d\u4ee4\u5b57\u7b26\u4e32<em class=\"replaceable\"><code>command</code></em>\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u591a\u6b21\u5e76\u4e14\u4ee5\u4efb\u4f55\u987a\u5e8f\u4e0e<code class=\"option\">-f</code>\u9009\u9879\u7ec4\u5408\u5728\u4e00\u8d77\u3002\u5f53<code class=\"option\">-c</code>\u6216\u8005<code class=\"option\">-f</code>\u88ab\u6307\u5b9a\u65f6\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709<code class=\"option\">-c</code>\u548c<code class=\"option\">-f</code>\u9009\u9879\u540e\u7ec8\u6b62\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>command</code></em>\u5fc5\u987b\u662f\u4e00\u4e2a\u670d\u52a1\u5668\u5b8c\u5168\u53ef\u89e3\u6790\u7684\u547d\u4ee4\u5b57\u7b26\u4e32\uff08\u5373\u4e0d\u5305\u542b<span class=\"application\">psql</span>\u4e13\u6709\u7684\u7279\u6027\uff09\u6216\u8005\u5355\u4e2a\u53cd\u659c\u7ebf\u547d\u4ee4\u3002\u56e0\u6b64\u4e0d\u80fd\u5728\u4e00\u4e2a<code class=\"option\">-c</code>\u9009\u9879\u4e2d\u6df7\u5408<acronym class=\"acronym\">SQL</acronym>\u548c<span class=\"application\">psql</span>\u5143\u547d\u4ee4\u3002\u8981\u90a3\u6837\u505a\uff0c\u53ef\u4ee5\u4f7f\u7528\u591a\u4e2a<code class=\"option\">-c</code>\u9009\u9879\u6216\u8005\u628a\u5b57\u7b26\u4e32\u7528\u7ba1\u9053\u8f93\u9001\u5230<span class=\"application\">psql</span>\u4e2d\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">psql -c '\\x' -c 'SELECT * FROM foo;'\n</pre>\n<p lang=\"zh\">\u6216\u8005</p>\n<pre class=\"programlisting\">echo '\\x \\\\ SELECT * FROM foo;' | psql\n</pre>\n<p lang=\"zh\">\uff08<code class=\"literal\">\\\\</code>\u662f\u5206\u9694\u7b26\u5143\u547d\u4ee4\uff09\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u5b57\u7b26\u4e32\u4f20\u9012\u7ed9<code class=\"option\">-c</code>\u90fd\u4f5c\u4e3a\u4e00\u4e2a\u5355\u72ec\u7684\u8bf7\u6c42\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u56e0\u6b64\uff0c\u5373\u4f7f\u5b57\u7b26\u4e32\u5305\u542b\u591a\u4e2a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\uff0c\u670d\u52a1\u5668\u4e5f\u4f1a\u5c06\u5176\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff0c\u9664\u975e\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u660e\u786e\u7684<code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code>\u547d\u4ee4\u5c06\u5176\u5206\u6210\u591a\u4e2a\u4e8b\u52a1\u3002\uff08\u6709\u5173\u670d\u52a1\u5668\u5982\u4f55\u5904\u7406\u591a\u67e5\u8be2\u5b57\u7b26\u4e32\u7684\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/17/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT\" title=\"53.2.2.1.\u00a0\u4e00\u4e2a\u7b80\u5355\u67e5\u8be2\u4e2d\u7684\u591a\u6761\u8bed\u53e5\">\u7b2c\u00a053.2.2.1\u00a0\u8282</a>\u3002\uff09</p>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u5e0c\u671b\u5728\u4e00\u4e2a\u4e8b\u52a1\u4e2d\u6267\u884c\u591a\u4e2a\u547d\u4ee4\uff0c\u53ef\u4ee5\u4f7f\u7528\u91cd\u590d\u7684<code class=\"option\">-c</code>\u547d\u4ee4\uff0c\u6216\u5c06\u591a\u4e2a\u547d\u4ee4\u8f93\u5165\u5230<span class=\"application\">psql</span>\u7684\u6807\u51c6\u8f93\u5165\uff0c\u53ef\u4ee5\u50cf\u4e0a\u9762\u793a\u4f8b\u4e2d\u4f7f\u7528<span class=\"application\">echo</span>\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7shell\u7684here-document\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">psql &lt;&lt;EOF\n\\x\nSELECT * FROM foo;\nEOF\n</pre>\n</dd>\n<dt id=\"APP-PSQL-OPTION-CSV\"><span class=\"term\"><code class=\"option\">--csv</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230<acronym class=\"acronym\">CSV</acronym>\uff08\u9017\u53f7\u5206\u9694\u503c\uff09\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u76f8\u5f53\u4e8e<code class=\"command\">\\pset format csv</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-DBNAME\"><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>dbname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>dbname</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002\u8fd9\u7b49\u6548\u4e8e\u6307\u5b9a<em class=\"replaceable\"><code>dbname</code></em>\u4e3a\u547d\u4ee4\u884c\u4e0a\u7684\u7b2c\u4e00\u4e2a\u975e\u9009\u9879\u53c2\u6570\u3002<em class=\"replaceable\"><code>dbname</code></em> \u53ef\u4ee5\u662f<a class=\"link\" href=\"/docs/17/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u5c06\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-ECHO-QUERIES\"><span class=\"term\"><code class=\"option\">-e</code><br/></span><span class=\"term\"><code class=\"option\">--echo-queries</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e5f\u628a\u53d1\u9001\u5230\u670d\u52a1\u5668\u7684\u6240\u6709 SQL \u547d\u4ee4\u590d\u5236\u5230\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">queries</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-ECHO-HIDDEN\"><span class=\"term\"><code class=\"option\">-E</code><br/></span><span class=\"term\"><code class=\"option\">--echo-hidden</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u56de\u663e<code class=\"command\">\\d</code>\u4ee5\u53ca\u5176\u4ed6\u53cd\u659c\u7ebf\u547d\u4ee4\u751f\u6210\u7684\u5b9e\u9645\u67e5\u8be2\u3002\u53ef\u4ee5\u7528\u5b83\u6765\u5b66\u4e60<span class=\"application\">psql</span>\u7684\u5185\u90e8\u64cd\u4f5c\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO_HIDDEN</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-FILE\"><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u800c\u4e0d\u662f\u6807\u51c6\u8f93\u5165\u4e2d\u8bfb\u53d6\u547d\u4ee4\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u6307\u5b9a\uff0c\u4e5f\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u4e0e<code class=\"option\">-c</code>\u9009\u9879\u7ec4\u5408\u4f7f\u7528\u3002\u5f53\u6307\u5b9a\u4e86<code class=\"option\">-c</code>\u6216<code class=\"option\">-f</code>\u65f6\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709<code class=\"option\">-c</code>\u548c<code class=\"option\">-f</code>\u9009\u9879\u540e\u7ec8\u6b62\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u7b49\u4ef7\u4e8e\u5143\u547d\u4ee4<code class=\"command\">\\i</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c<em class=\"replaceable\"><code>filename</code></em>\u662f<code class=\"literal\">-</code>\uff08\u8fde\u5b57\u7b26\uff09\uff0c\u5219\u4f1a\u8bfb\u53d6\u6807\u51c6\u8f93\u5165\uff0c\u76f4\u5230\u9047\u5230 <acronym class=\"acronym\">EOF</acronym> \u6307\u793a\u6216<code class=\"command\">\\q</code>\u5143\u547d\u4ee4\u3002\u8fd9\u53ef\u7528\u4e8e\u5c06\u4ea4\u4e92\u5f0f\u8f93\u5165\u4e0e\u6587\u4ef6\u8f93\u5165\u4ea4\u9519\u4f7f\u7528\u3002\u4e0d\u8fc7\u8bf7\u6ce8\u610f\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\u4e0d\u4f1a\u4f7f\u7528 <span class=\"application\">Readline</span>\uff08\u5f88\u50cf\u6307\u5b9a\u4e86<code class=\"option\">-n</code>\u65f6\u7684\u60c5\u51b5\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u4e0e\u5199\u6210<code class=\"literal\">psql &lt; <em class=\"replaceable\"><code>filename</code></em></code>\u6709\u7ec6\u5fae\u5dee\u522b\u3002\u901a\u5e38\u4e24\u79cd\u5f62\u5f0f\u90fd\u4f1a\u5f97\u5230\u4f60\u671f\u671b\u7684\u7ed3\u679c\uff0c\u4f46\u4f7f\u7528<code class=\"literal\">-f</code>\u53ef\u4ee5\u542f\u7528\u4e00\u4e9b\u6709\u7528\u7684\u7279\u6027\uff0c\u4f8b\u5982\u5e26\u884c\u53f7\u7684\u9519\u8bef\u6d88\u606f\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u4e5f\u8fd8\u6709\u4e00\u70b9\u673a\u4f1a\u964d\u4f4e\u542f\u52a8\u5f00\u9500\u3002\u53e6\u4e00\u65b9\u9762\uff0c\u4f7f\u7528 shell \u8f93\u5165\u91cd\u5b9a\u5411\u7684\u5f62\u5f0f\u5728\u7406\u8bba\u4e0a\u80fd\u4fdd\u8bc1\u5f97\u5230\u4e0e\u4f60\u624b\u5de5\u9010\u884c\u8f93\u5165\u65f6\u5b8c\u5168\u76f8\u540c\u7684\u8f93\u51fa\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-FIELD-SEPARATOR\"><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>separator</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--field-separator=<em class=\"replaceable\"><code>separator</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f7f\u7528<em class=\"replaceable\"><code>separator</code></em>\u4f5c\u4e3a\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset fieldsep</code>\u6216\u8005<code class=\"command\">\\f</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-FIELD-HOST\"><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>hostname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>hostname</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-HTML\"><span class=\"term\"><code class=\"option\">-H</code><br/></span><span class=\"term\"><code class=\"option\">--html</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230<acronym class=\"acronym\">HTML</acronym>\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset format html</code>\u6216\u8005<code class=\"command\">\\H</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-LIST\"><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--list</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u6240\u6709\u53ef\u7528\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u9000\u51fa\u3002\u5176\u4ed6\u975e\u8fde\u63a5\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002\u8fd9\u4e0e\u5143\u547d\u4ee4<code class=\"command\">\\list</code>\u7c7b\u4f3c\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8be5\u9009\u9879\u65f6\uff0c<span class=\"application\">psql</span>\u5c06\u8fde\u63a5\u5230\u6570\u636e\u5e93<code class=\"literal\">postgres</code>\uff0c\u9664\u975e\u547d\u4ee4\u884c\u4e0a\u6307\u5b9a\u4e86\u5176\u4ed6\u6570\u636e\u5e93\uff08\u901a\u8fc7<code class=\"option\">-d</code>\u9009\u9879\u6216\u975e\u9009\u9879\u53c2\u6570\uff0c\u4e5f\u53ef\u80fd\u901a\u8fc7\u670d\u52a1\u9879\uff0c\u4f46\u4e0d\u80fd\u901a\u8fc7\u73af\u5883\u53d8\u91cf\uff09\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-LOG-FILE\"><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--log-file=<em class=\"replaceable\"><code>filename</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9664\u4e86\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u5199\u5230\u666e\u901a\u8f93\u51fa\u76ee\u6807\u4e4b\u5916\uff0c\u8fd8\u5199\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-NO-READLINE\"><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-readline</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8981\u4f7f\u7528<span class=\"application\">Readline</span>\u8fdb\u884c\u884c\u7f16\u8f91\uff0c\u4e5f\u4e0d\u8981\u4f7f\u7528\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\uff08\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/17/app-psql.html#APP-PSQL-READLINE\" title=\"\u547d\u4ee4\u884c\u7f16\u8f91\">\u201c\u547d\u4ee4\u884c\u7f16\u8f91\u201d\u4e00\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-OUTPUT\"><span class=\"term\"><code class=\"option\">-o <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--output=<em class=\"replaceable\"><code>filename</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u653e\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u3002\u8fd9\u7b49\u6548\u4e8e\u547d\u4ee4<code class=\"command\">\\o</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-PORT\"><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u7684\u6587\u4ef6\u540d\u540e\u7f00\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u7684\u503c\uff1b\u672a\u8bbe\u7f6e\u65f6\uff0c\u4f7f\u7528\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u7aef\u53e3\uff0c\u901a\u5e38\u4e3a 5432\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-PSET\"><span class=\"term\"><code class=\"option\">-P <em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--pset=<em class=\"replaceable\"><code>assignment</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ee5<code class=\"command\">\\pset</code>\u7684\u5f62\u5f0f\u6307\u5b9a\u6253\u5370\u9009\u9879\u3002\u6ce8\u610f\uff0c\u8fd9\u91cc\u4f60\u5fc5\u987b\u7528\u4e00\u4e2a\u7b49\u53f7\u800c\u4e0d\u662f\u7a7a\u683c\u6765\u5206\u9694\u540d\u79f0\u548c\u503c\u3002\u4f8b\u5982\uff0c\u8981\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a<span class=\"application\">LaTeX</span>\uff0c\u5e94\u8be5\u5199\u6210<code class=\"literal\">-P format=latex</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-QUIET\"><span class=\"term\"><code class=\"option\">-q</code><br/></span><span class=\"term\"><code class=\"option\">--quiet</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a<span class=\"application\">psql</span>\u5e94\u8be5\u5b89\u9759\u5730\u5de5\u4f5c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4f1a\u6253\u5370\u51fa\u6b22\u8fce\u6d88\u606f\u548c\u5404\u79cd\u63d0\u793a\u4fe1\u606f\u3002\u5982\u679c\u4f7f\u7528\u4e86\u8fd9\u4e2a\u9009\u9879\uff0c\u4ee5\u4e0a\u90a3\u4e9b\u5c31\u90fd\u4e0d\u4f1a\u8f93\u51fa\u3002\u5728\u4f7f\u7528<code class=\"option\">-c</code>\u9009\u9879\u65f6\uff0c\u914d\u5408\u8fd9\u4e2a\u9009\u9879\u5f88\u6709\u7528\u3002\u8fd9\u7b49\u6548\u4e8e\u8bbe\u7f6e\u53d8\u91cf<code class=\"varname\">QUIET</code>\u4e3a<code class=\"literal\">on</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-RECORD-SEPARATOR\"><span class=\"term\"><code class=\"option\">-R <em class=\"replaceable\"><code>separator</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--record-separator=<em class=\"replaceable\"><code>separator</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a<em class=\"replaceable\"><code>separator</code></em>\u7528\u4f5c\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset recordsep</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-SINGLE-STEP\"><span class=\"term\"><code class=\"option\">-s</code><br/></span><span class=\"term\"><code class=\"option\">--single-step</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5728\u5355\u6b65\u6a21\u5f0f\u4e2d\u3002\u8fd9\u610f\u5473\u7740\u5728\u6bcf\u4e2a\u547d\u4ee4\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u4e4b\u524d\u90fd\u4f1a\u63d0\u793a\u7528\u6237\uff0c\u5e76\u5141\u8bb8\u53d6\u6d88\u6267\u884c\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u8c03\u8bd5\u811a\u672c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-SINGLE-LINE\"><span class=\"term\"><code class=\"option\">-S</code><br/></span><span class=\"term\"><code class=\"option\">--single-line</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd0\u884c\u5728\u5355\u884c\u6a21\u5f0f\u4e2d\uff0c\u5176\u4e2d\u6362\u884c\u7b26\u4f1a\u7ec8\u6b62\u4e00\u4e2a SQL \u547d\u4ee4\uff0c\u5c31\u50cf\u5206\u53f7\u7684\u4f5c\u7528\u4e00\u6837\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u79cd\u6a21\u5f0f\u662f\u4e3a\u575a\u6301\u4f7f\u7528\u5b83\u7684\u7528\u6237\u63d0\u4f9b\u7684\uff0c\u4f46\u5e76\u4e0d\u4e00\u5b9a\u503c\u5f97\u63a8\u8350\u3002\u7279\u522b\u662f\uff0c\u5982\u679c\u5728\u4e00\u884c\u4e2d\u6df7\u5408\u4e86<acronym class=\"acronym\">SQL</acronym>\u548c\u5143\u547d\u4ee4\uff0c\u5bf9\u4e8e\u6ca1\u6709\u7ecf\u9a8c\u7684\u7528\u6237\u6765\u8bf4\uff0c\u5b83\u4eec\u7684\u6267\u884c\u987a\u5e8f\u672a\u5fc5\u603b\u662f\u6e05\u695a\u7684\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-OPTION-TUPLES-ONLY\"><span class=\"term\"><code class=\"option\">-t</code><br/></span><span class=\"term\"><code class=\"option\">--tuples-only</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5173\u95ed\u6253\u5370\u5217\u540d\u548c\u7ed3\u679c\u884c\u8ba1\u6570\u9875\u811a\u7b49\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\t</code>\u6216\u8005<code class=\"command\">\\pset tuples_only</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-TABLE-ATTR\"><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>table_options</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--table-attr=<em class=\"replaceable\"><code>table_options</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u653e\u5728<acronym class=\"acronym\">HTML</acronym> <code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u9009\u9879\u3002\u8be6\u89c1<code class=\"command\">\\pset tableattr</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-USERNAME\"><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f5c\u4e3a\u7528\u6237<em class=\"replaceable\"><code>username</code></em>\u800c\u4e0d\u662f\u9ed8\u8ba4\u7528\u6237\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff08\u5f53\u7136\uff0c\u4f60\u5fc5\u987b\u5177\u6709\u8fd9\u6837\u505a\u7684\u6743\u9650\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-VARIABLE\"><span class=\"term\"><code class=\"option\">-v <em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--set=<em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--variable=<em class=\"replaceable\"><code>assignment</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6267\u884c\u4e00\u6b21\u53d8\u91cf\u8d4b\u503c\uff0c\u548c<code class=\"command\">\\set</code>\u5143\u547d\u4ee4\u76f8\u4f3c\u3002\u6ce8\u610f\u4f60\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u7528\u7b49\u53f7\u5206\u9694\u540d\u5b57\u548c\u503c\uff08\u5982\u679c\u6709\uff09\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u7684\u8bbe\u7f6e\uff0c\u53bb\u6389\u7b49\u53f7\u5c31\u884c\u3002\u8981\u628a\u4e00\u4e2a\u53d8\u91cf\u8bbe\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u4f7f\u7528\u7b49\u53f7\u4f46\u662f\u53bb\u6389\u503c\u3002\u8fd9\u4e9b\u8d4b\u503c\u5728\u547d\u4ee4\u884c\u5904\u7406\u671f\u95f4\u88ab\u5b8c\u6210\uff0c\u56e0\u6b64\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u7684\u53d8\u91cf\u5c06\u5728\u7a0d\u540e\u88ab\u8986\u76d6\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-VERSION\"><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">psql</span>\u7248\u672c\u5e76\u4e14\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-NO-PASSWORD\"><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6c38\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u8fd9\u4e2a\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4efb\u52a1\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u65f6\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u6574\u4e2a\u4f1a\u8bdd\u671f\u95f4\u90fd\u4f1a\u4fdd\u6301\u751f\u6548\uff0c\u56e0\u6b64\u5b83\u4e0d\u4ec5\u5f71\u54cd\u521d\u59cb\u8fde\u63a5\u5c1d\u8bd5\uff0c\u4e5f\u4f1a\u5f71\u54cd\u5143\u547d\u4ee4<code class=\"command\">\\connect</code>\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-PASSWORD\"><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236<span class=\"application\">psql</span>\u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\uff0c\u5373\u4f7f\u8be5\u5bc6\u7801\u5b9e\u9645\u4e0a\u4e0d\u4f1a\u88ab\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff0c\u5219<span class=\"application\">psql</span>\u65e0\u8bba\u5982\u4f55\u90fd\u4f1a\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">psql</span>\u9700\u8981\u5148\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\uff0c\u624d\u80fd\u77e5\u9053\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u663e\u5f0f\u6307\u5b9a<code class=\"option\">-W</code>\u503c\u5f97\u7528\u6765\u907f\u514d\u8fd9\u6b21\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u6574\u4e2a\u4f1a\u8bdd\u671f\u95f4\u90fd\u4f1a\u4fdd\u6301\u751f\u6548\uff0c\u56e0\u6b64\u5b83\u4e0d\u4ec5\u5f71\u54cd\u521d\u59cb\u8fde\u63a5\u5c1d\u8bd5\uff0c\u4e5f\u4f1a\u5f71\u54cd\u5143\u547d\u4ee4<code class=\"command\">\\connect</code>\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-EXPANDED\"><span class=\"term\"><code class=\"option\">-x</code><br/></span><span class=\"term\"><code class=\"option\">--expanded</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5f00\u6269\u5c55\u8868\u683c\u5f0f\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\x</code>\u6216\u8005<code class=\"command\">\\pset expanded</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-NO-PSQLRC\"><span class=\"term\"><code class=\"option\">-X</code><br/></span><span class=\"term\"><code class=\"option\">--no-psqlrc</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8bfb\u53d6\u542f\u52a8\u6587\u4ef6\uff08\u65e2\u4e0d\u8bfb\u53d6\u7cfb\u7edf\u8303\u56f4\u7684<code class=\"filename\">psqlrc</code>\u6587\u4ef6\uff0c\u4e5f\u4e0d\u8bfb\u53d6\u7528\u6237\u7684<code class=\"filename\">~/.psqlrc</code>\u6587\u4ef6\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-FIELD-SEPARATOR-ZERO\"><span class=\"term\"><code class=\"option\">-z</code><br/></span><span class=\"term\"><code class=\"option\">--field-separator-zero</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset fieldsep_zero</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-RECORD-SEPARATOR-ZERO\"><span class=\"term\"><code class=\"option\">-0</code><br/></span><span class=\"term\"><code class=\"option\">--record-separator-zero</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u4f8b\u5982\uff0c\u8fd9\u6709\u52a9\u4e8e\u4e0e<code class=\"literal\">xargs -0</code>\u914d\u5408\u4f7f\u7528\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset recordsep_zero</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-SINGLE-TRANSACTION\"><span class=\"term\"><code class=\"option\">-1</code><br/></span><span class=\"term\"><code class=\"option\">--single-transaction</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u9009\u9879\u53ea\u80fd\u4e0e\u4e00\u4e2a\u6216\u591a\u4e2a<code class=\"option\">-c</code>\u548c/\u6216<code class=\"option\">-f</code>\u9009\u9879\u7ed3\u5408\u4f7f\u7528\u3002\u5b83\u4f1a\u5bfc\u81f4<span class=\"application\">psql</span>\u5728\u7b2c\u4e00\u4e2a\u8fd9\u6837\u7684\u9009\u9879\u4e4b\u524d\u53d1\u51fa\u4e00\u4e2a<code class=\"command\">BEGIN</code>\u547d\u4ee4\uff0c\u5e76\u5728\u6700\u540e\u4e00\u4e2a\u9009\u9879\u4e4b\u540e\u53d1\u51fa\u4e00\u4e2a<code class=\"command\">COMMIT</code>\u547d\u4ee4\uff0c\u4ece\u800c\u5c06\u6240\u6709\u547d\u4ee4\u5305\u88c5\u6210\u4e00\u4e2a\u5355\u72ec\u7684\u4e8b\u52a1\u3002\u5982\u679c\u4efb\u4f55\u547d\u4ee4\u5931\u8d25\u4e14\u53d8\u91cf<code class=\"varname\">ON_ERROR_STOP</code>\u88ab\u8bbe\u7f6e\uff0c\u5219\u4f1a\u6539\u4e3a\u53d1\u9001\u4e00\u4e2a<code class=\"command\">ROLLBACK</code>\u547d\u4ee4\u3002\u8fd9\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u547d\u4ee4\u672c\u8eab\u5305\u542b<code class=\"command\">BEGIN</code>\u3001<code class=\"command\">COMMIT</code>\u6216<code class=\"command\">ROLLBACK</code>\uff0c\u8fd9\u4e2a\u9009\u9879\u5c31\u4e0d\u4f1a\u4ea7\u751f\u671f\u671b\u7684\u6548\u679c\u3002\u53e6\u5916\uff0c\u5982\u679c\u67d0\u4e2a\u5355\u72ec\u547d\u4ee4\u4e0d\u80fd\u5728\u4e8b\u52a1\u5757\u4e2d\u6267\u884c\uff0c\u6307\u5b9a\u8fd9\u4e2a\u9009\u9879\u5c06\u5bfc\u81f4\u6574\u4e2a\u4e8b\u52a1\u5931\u8d25\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-HELP\"><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help[=<em class=\"replaceable\"><code>topic</code></em>]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u6709\u5173<span class=\"application\">psql</span>\u7684\u5e2e\u52a9\u5e76\u4e14\u9000\u51fa\u3002\u53ef\u9009\u7684<em class=\"replaceable\"><code>topic</code></em>\u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a<code class=\"literal\">options</code>\uff09\u9009\u62e9\u8981\u89e3\u91ca<span class=\"application\">psql</span>\u7684\u54ea\u4e00\u90e8\u5206\uff1a<code class=\"literal\">commands</code>\u63cf\u8ff0<span class=\"application\">psql</span>\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b<code class=\"literal\">options</code>\u63cf\u8ff0\u53ef\u4ee5\u88ab\u4f20\u9012\u7ed9<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c<code class=\"literal\">variables</code>\u5219\u663e\u793a\u6709\u5173<span class=\"application\">psql</span>\u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.21.7\">\n<h2 lang=\"zh\">\u9000\u51fa\u72b6\u6001</h2>\n<p lang=\"zh\">\u5982\u679c<span class=\"application\">psql</span>\u6b63\u5e38\u7ed3\u675f\uff0c\u5b83\u4f1a\u5411 shell \u8fd4\u56de 0\uff1b\u5982\u679c\u5b83\u81ea\u8eab\u53d1\u751f\u81f4\u547d\u9519\u8bef\uff08\u4f8b\u5982\u5185\u5b58\u8017\u5c3d\u3001\u627e\u4e0d\u5230\u6587\u4ef6\uff09\uff0c\u5219\u8fd4\u56de 1\uff1b\u5982\u679c\u5230\u670d\u52a1\u5668\u7684\u8fde\u63a5\u53d1\u751f\u6545\u969c\u4e14\u8be5\u4f1a\u8bdd\u4e0d\u662f\u4ea4\u4e92\u5f0f\u7684\uff0c\u5219\u8fd4\u56de 2\uff1b\u5982\u679c\u811a\u672c\u4e2d\u53d1\u751f\u9519\u8bef\u4e14\u53d8\u91cf<code class=\"varname\">ON_ERROR_STOP</code>\u5df2\u8bbe\u7f6e\uff0c\u5219\u8fd4\u56de 3\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.21.8\">\n<h2 lang=\"zh\">\u7528\u6cd5</h2>\n<div class=\"refsect2\" id=\"R2-APP-PSQL-CONNECTING\">\n<h3 lang=\"zh\">\u8fde\u63a5\u5230\u6570\u636e\u5e93</h3>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u662f\u5e38\u89c4\u7684 <span class=\"productname\">PostgreSQL</span> \u5ba2\u6237\u7aef\u5e94\u7528\u7a0b\u5e8f\u3002\u8981\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff0c\u4f60\u9700\u8981\u77e5\u9053\u76ee\u6807\u6570\u636e\u5e93\u540d\u79f0\u3001\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u548c\u7aef\u53e3\u53f7\uff0c\u4ee5\u53ca\u8981\u4ee5\u54ea\u4e2a\u6570\u636e\u5e93\u7528\u6237\u540d\u8fde\u63a5\u3002<span class=\"application\">psql</span> \u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u9009\u9879 <code class=\"option\">-d</code>\u3001<code class=\"option\">-h</code>\u3001<code class=\"option\">-p</code> \u548c <code class=\"option\">-U</code> \u5206\u522b\u6307\u5b9a\u8fd9\u4e9b\u53c2\u6570\u3002\u5982\u679c\u9047\u5230\u4e00\u4e2a\u4e0d\u5c5e\u4e8e\u4efb\u4f55\u9009\u9879\u7684\u53c2\u6570\uff0c\u5b83\u5c06\u88ab\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u540d\uff08\u5982\u679c\u6570\u636e\u5e93\u540d\u5df2\u7ecf\u7ed9\u51fa\uff0c\u5219\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u7528\u6237\u540d\uff09\u3002\u5e76\u975e\u6240\u6709\u8fd9\u4e9b\u9009\u9879\u90fd\u662f\u5fc5\u9700\u7684\uff1b\u5b83\u4eec\u90fd\u6709\u6709\u7528\u7684\u9ed8\u8ba4\u503c\u3002\u5982\u679c\u7701\u7565\u4e3b\u673a\u540d\uff0c<span class=\"application\">psql</span> \u5728 Unix \u4e0a\u5c06\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u5230\u672c\u5730\u4e3b\u673a\u4e0a\u7684\u670d\u52a1\u5668\uff0c\u5728 Windows \u4e0a\u5219\u901a\u8fc7 TCP/IP \u8fde\u63a5\u5230 <code class=\"literal\">localhost</code>\u3002\u9ed8\u8ba4\u7aef\u53e3\u53f7\u5728\u7f16\u8bd1\u65f6\u786e\u5b9a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u670d\u52a1\u5668\u4f7f\u7528\u76f8\u540c\u7684\u9ed8\u8ba4\u503c\uff0c\u56e0\u6b64\u5728\u5927\u591a\u6570\u60c5\u51b5\u4e0b\u4e0d\u5fc5\u6307\u5b9a\u7aef\u53e3\u3002\u9ed8\u8ba4\u6570\u636e\u5e93\u7528\u6237\u540d\u662f\u4f60\u7684\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\u3002\u6570\u636e\u5e93\u7528\u6237\u540d\u786e\u5b9a\u540e\uff0c\u5b83\u4e5f\u4f1a\u88ab\u7528\u4f5c\u9ed8\u8ba4\u6570\u636e\u5e93\u540d\u3002\u8bf7\u6ce8\u610f\uff0c\u4f60\u4e0d\u80fd\u968f\u610f\u4ee5\u4efb\u610f\u6570\u636e\u5e93\u7528\u6237\u540d\u8fde\u63a5\u5230\u4efb\u610f\u6570\u636e\u5e93\u3002\u6570\u636e\u5e93\u7ba1\u7406\u5458\u5e94\u5f53\u5df2\u7ecf\u544a\u77e5\u4f60\u62e5\u6709\u7684\u8bbf\u95ee\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5f53\u9ed8\u8ba4\u503c\u4e0d\u5b8c\u5168\u5408\u9002\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7\u628a\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGDATABASE</code>\u3001<code class=\"envar\">PGHOST</code>\u3001<code class=\"envar\">PGPORT</code>\u548c<code class=\"envar\">PGUSER</code>\u8bbe\u7f6e\u4e3a\u9002\u5f53\u7684\u503c\u6765\u5c11\u6572\u4e00\u4e9b\u952e\u76d8\uff08\u989d\u5916\u7684\u73af\u5883\u53d8\u91cf\u89c1<a class=\"xref\" href=\"/docs/17/libpq-envars.html\" title=\"32.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a032.15\u00a0\u8282</a>\uff09\u3002\u53e6\u5916\uff0c\u51c6\u5907\u4e00\u4e2a<code class=\"filename\">~/.pgpass</code>\u6587\u4ef6\u4e5f\u5f88\u65b9\u4fbf\uff0c\u8fd9\u6837\u5c31\u4e0d\u5fc5\u7ecf\u5e38\u624b\u5de5\u8f93\u5165\u5bc6\u7801\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/17/libpq-pgpass.html\" title=\"32.16.\u00a0\u5bc6\u7801\u6587\u4ef6\">\u7b2c\u00a032.16\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u53e6\u4e00\u79cd\u6307\u5b9a\u8fde\u63a5\u53c2\u6570\u7684\u65b9\u6cd5\u662f\u4f7f\u7528 conninfo \u5b57\u7b26\u4e32\u6216 URI \u6765\u4ee3\u66ff\u6570\u636e\u5e93\u540d\u3002\u6b64\u673a\u5236\u5141\u8bb8\u5bf9\u8fde\u63a5\u8fdb\u884c\u975e\u5e38\u5e7f\u6cdb\u7684\u63a7\u5236\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">$ <strong class=\"userinput\"><code>psql \"service=myservice sslmode=require\"</code></strong>\n$ <strong class=\"userinput\"><code>psql postgresql://dbmaster:5433/mydb?sslmode=require</code></strong>\n</pre>\n<p lang=\"zh\">\u7528\u8fd9\u79cd\u65b9\u5f0f\uff0c\u4f60\u4e5f\u53ef\u4ee5\u628a<acronym class=\"acronym\">LDAP</acronym>\u7528\u4e8e<a class=\"xref\" href=\"/docs/17/libpq-ldap.html\" title=\"32.18.\u00a0\u8fde\u63a5\u53c2\u6570\u7684 LDAP \u67e5\u627e\">\u7b2c\u00a032.18\u00a0\u8282</a>\u4e2d\u63cf\u8ff0\u7684\u8fde\u63a5\u53c2\u6570\u67e5\u627e\u3002\u53ef\u7528\u8fde\u63a5\u9009\u9879\u7684\u66f4\u591a\u4fe1\u606f\u8bf7\u89c1<a class=\"xref\" href=\"/docs/17/libpq-connect.html#LIBPQ-PARAMKEYWORDS\" title=\"32.1.2.\u00a0\u53c2\u6570\u5173\u952e\u8bcd\">\u7b2c\u00a032.1.2\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7531\u4e8e\u4efb\u4f55\u539f\u56e0\uff08\u4f8b\u5982\u6743\u9650\u4e0d\u8db3\u3001\u670d\u52a1\u5668\u6ca1\u6709\u5728\u76ee\u6807\u4e3b\u673a\u4e0a\u8fd0\u884c\u7b49\uff09\u5bfc\u81f4\u8fde\u63a5\u65e0\u6cd5\u5efa\u7acb\uff0c<span class=\"application\">psql</span>\u5c06\u8fd4\u56de\u4e00\u4e2a\u9519\u8bef\u5e76\u4e14\u7ec8\u6b62\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6807\u51c6\u8f93\u5165\u548c\u6807\u51c6\u8f93\u51fa\u90fd\u662f\u7ec8\u7aef\uff0c\u90a3\u4e48<span class=\"application\">psql</span>\u4f1a\u628a\u5ba2\u6237\u7aef\u7f16\u7801\u8bbe\u7f6e\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">auto</span>\u201d</span>\uff0c\u4ece\u533a\u57df\u8bbe\u7f6e\u4e2d\u68c0\u6d4b\u5408\u9002\u7684\u5ba2\u6237\u7aef\u7f16\u7801\uff08\u5728 Unix \u7cfb\u7edf\u4e0a\u662f<code class=\"envar\">LC_CTYPE</code>\u73af\u5883\u53d8\u91cf\uff09\u3002\u5982\u679c\u7ed3\u679c\u4e0d\u7b26\u5408\u9884\u671f\uff0c\u53ef\u4ee5\u4f7f\u7528\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGCLIENTENCODING</code>\u8986\u76d6\u5ba2\u6237\u7aef\u7f16\u7801\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"R2-APP-PSQL-4\">\n<h3 lang=\"zh\">\u8f93\u5165 SQL \u547d\u4ee4</h3>\n<p lang=\"zh\">\u5728\u6b63\u5e38\u64cd\u4f5c\u65f6\uff0c<span class=\"application\">psql</span>\u4f1a\u63d0\u4f9b\u4e00\u4e2a\u63d0\u793a\u7b26\uff0c\u8be5\u63d0\u793a\u7b26\u662f<span class=\"application\">psql</span>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u540d\u79f0\u540e\u9762\u8ddf\u4e0a\u5b57\u7b26\u4e32<code class=\"literal\">=&gt;</code>\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">$ <strong class=\"userinput\"><code>psql testdb</code></strong>\npsql (17.11)\nType \"help\" for help.\n\ntestdb=&gt;\n</pre>\n<p lang=\"zh\">\u5728\u63d0\u793a\u7b26\u4e0b\uff0c\u7528\u6237\u53ef\u4ee5\u8f93\u5165<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u3002\u901a\u5e38\uff0c\u5f53\u9047\u5230\u8868\u793a\u547d\u4ee4\u7ed3\u675f\u7684\u5206\u53f7\u65f6\uff0c\u8f93\u5165\u7684\u5185\u5bb9\u5c31\u4f1a\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u3002\u884c\u7ed3\u675f\u5e76\u4e0d\u4f1a\u7ec8\u6b62\u4e00\u6761\u547d\u4ee4\uff0c\u56e0\u6b64\u4e3a\u4e86\u63d0\u9ad8\u6e05\u6670\u5ea6\uff0c\u547d\u4ee4\u53ef\u4ee5\u5206\u5e03\u5728\u591a\u884c\u4e0a\u3002\u5982\u679c\u547d\u4ee4\u88ab\u53d1\u9001\u5e76\u6210\u529f\u6267\u884c\uff0c\u5176\u7ed3\u679c\u5c31\u4f1a\u663e\u793a\u5728\u5c4f\u5e55\u4e0a\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u53d7\u4fe1\u4efb\u7684\u7528\u6237\u80fd\u591f\u8bbf\u95ee\u5c1a\u672a\u91c7\u7528<a class=\"link\" href=\"/docs/17/ddl-schemas.html#DDL-SCHEMAS-PATTERNS\" title=\"5.10.6.\u00a0\u4f7f\u7528\u65b9\u5f0f\">\u6a21\u5f0f\u7684\u5b89\u5168\u4f7f\u7528\u65b9\u5f0f</a>\u7684\u6570\u636e\u5e93\uff0c\u8bf7\u5728\u4f1a\u8bdd\u5f00\u59cb\u65f6\u4ece<code class=\"varname\">search_path</code>\u4e2d\u79fb\u9664\u6240\u6709\u516c\u4f17\u53ef\u5199\u7684\u6a21\u5f0f\u3002\u53ef\u4ee5\u5728\u8fde\u63a5\u5b57\u7b26\u4e32\u4e2d\u52a0\u5165<code class=\"literal\">options=-csearch_path=</code>\uff0c\u6216\u8005\u5728\u6267\u884c\u5176\u4ed6 SQL \u547d\u4ee4\u4e4b\u524d\u53d1\u51fa<code class=\"literal\">SELECT pg_catalog.set_config('search_path', '', false)</code>\u3002\u8fd9\u79cd\u8003\u8651\u5e76\u975e<span class=\"application\">psql</span>\u7279\u6709\uff1b\u5b83\u9002\u7528\u4e8e\u4efb\u4f55\u6267\u884c\u4efb\u610f SQL \u547d\u4ee4\u7684\u63a5\u53e3\u3002</p>\n<p lang=\"zh\">\u6bcf\u5f53\u6267\u884c\u547d\u4ee4\u65f6\uff0c<span class=\"application\">psql</span>\u4e5f\u4f1a\u8f6e\u8be2\u7531<a class=\"link\" href=\"/docs/17/sql-listen.html\" title=\"LISTEN\"><code class=\"command\">LISTEN</code></a>\u548c<a class=\"link\" href=\"/docs/17/sql-notify.html\" title=\"NOTIFY\"><code class=\"command\">NOTIFY</code></a>\u751f\u6210\u7684\u5f02\u6b65\u901a\u77e5\u4e8b\u4ef6\u3002</p>\n<p lang=\"zh\">\u867d\u7136 C \u98ce\u683c\u7684\u5757\u6ce8\u91ca\u4f1a\u88ab\u4f20\u7ed9\u670d\u52a1\u5668\u5904\u7406\u5e76\u79fb\u9664\uff0c\u4f46 SQL \u6807\u51c6\u6ce8\u91ca\u4f1a\u7531<span class=\"application\">psql</span>\u81ea\u884c\u79fb\u9664\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"APP-PSQL-META-COMMANDS\">\n<h3 lang=\"zh\">\u5143\u547d\u4ee4</h3>\n<p lang=\"zh\">\u4f60\u8f93\u5165\u5230<span class=\"application\">psql</span>\u4e2d\u7684\u4efb\u4f55\u4ee5\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u5f00\u59cb\u7684\u4e1c\u897f\u90fd\u662f\u4e00\u4e2a<span class=\"application\">psql</span>\u5143\u547d\u4ee4\uff0c\u5b83\u4eec\u7531<span class=\"application\">psql</span>\u81ea\u884c\u5904\u7406\u3002\u8fd9\u4e9b\u547d\u4ee4\u8ba9<span class=\"application\">psql</span>\u5bf9\u7ba1\u7406\u548c\u7f16\u5199\u811a\u672c\u66f4\u6709\u7528\u3002\u5143\u547d\u4ee4\u5e38\u5e38\u88ab\u79f0\u4f5c\u659c\u7ebf\u6216\u8005\u53cd\u659c\u7ebf\u547d\u4ee4\u3002</p>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u547d\u4ee4\u7684\u683c\u5f0f\u662f\u7528\u53cd\u659c\u7ebf\u540e\u9762\u76f4\u63a5\u8ddf\u4e0a\u4e00\u4e2a\u547d\u4ee4\u52a8\u8bcd\uff0c\u7136\u540e\u662f\u4e00\u4e9b\u53c2\u6570\u3002\u53c2\u6570\u4e0e\u547d\u4ee4\u52a8\u8bcd\u548c\u5176\u4ed6\u53c2\u6570\u4e4b\u95f4\u7528\u4efb\u610f\u591a\u4e2a\u7a7a\u767d\u5b57\u7b26\u5206\u9694\u5f00\u3002</p>\n<p lang=\"zh\">\u8981\u5728\u53c2\u6570\u4e2d\u5305\u542b\u7a7a\u767d\uff0c\u53ef\u4ee5\u7528\u5355\u5f15\u53f7\u5c06\u5b83\u62ec\u8d77\u6765\u3002\u8981\u5728\u53c2\u6570\u4e2d\u5305\u542b\u4e00\u4e2a\u5355\u5f15\u53f7\uff0c\u53ef\u4ee5\u5728\u5355\u5f15\u53f7\u6587\u672c\u5185\u5199\u4e24\u4e2a\u5355\u5f15\u53f7\u3002\u5355\u5f15\u53f7\u4e2d\u7684\u5185\u5bb9\u8fd8\u4f1a\u63a5\u53d7\u7c7b\u4f3c C \u8bed\u8a00\u7684\u66ff\u6362\uff1a<code class=\"literal\">\\n</code>\uff08\u6362\u884c\uff09\u3001<code class=\"literal\">\\t</code>\uff08\u5236\u8868\u7b26\uff09\u3001<code class=\"literal\">\\b</code>\uff08\u9000\u683c\uff09\u3001<code class=\"literal\">\\r</code>\uff08\u56de\u8f66\uff09\u3001<code class=\"literal\">\\f</code>\uff08\u6362\u9875\uff09\u3001<code class=\"literal\">\\</code><em class=\"replaceable\"><code>digits</code></em>\uff08\u516b\u8fdb\u5236\uff09\u4ee5\u53ca<code class=\"literal\">\\x</code><em class=\"replaceable\"><code>digits</code></em>\uff08\u5341\u516d\u8fdb\u5236\uff09\u3002\u5728\u5355\u5f15\u53f7\u6587\u672c\u5185\uff0c\u53cd\u659c\u7ebf\u51fa\u73b0\u5728\u4efb\u4f55\u5176\u4ed6\u5b57\u7b26\u524d\u9762\u65f6\uff0c\u53ea\u662f\u5bf9\u8be5\u5355\u4e2a\u5b57\u7b26\u8fdb\u884c\u8f6c\u4e49\uff0c\u4e0d\u8bba\u5b83\u662f\u4ec0\u4e48\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u53c2\u6570\u4e2d\u51fa\u73b0\u4e00\u4e2a\u672a\u52a0\u5f15\u53f7\u7684\u5192\u53f7\uff08<code class=\"literal\">:</code>\uff09\uff0c\u540e\u9762\u7d27\u8ddf\u4e00\u4e2a<span class=\"application\">psql</span>\u53d8\u91cf\u540d\uff0c\u5b83\u5c31\u4f1a\u88ab\u8be5\u53d8\u91cf\u7684\u503c\u66ff\u6362\uff0c\u5982\u4e0b\u9762<a class=\"xref\" href=\"/docs/17/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL \u63d2\u503c\">SQL \u63d2\u503c</a>\u6240\u8ff0\u3002\u5176\u4e2d\u4ecb\u7ecd\u7684<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u548c<code class=\"literal\">:\"<em class=\"replaceable\"><code>variable_name</code></em>\"</code>\u5f62\u5f0f\u4e5f\u540c\u6837\u9002\u7528\u3002<code class=\"literal\">:{?<em class=\"replaceable\"><code>variable_name</code></em>}</code>\u8bed\u6cd5\u5141\u8bb8\u6d4b\u8bd5\u53d8\u91cf\u662f\u5426\u5df2\u5b9a\u4e49\uff1b\u5b83\u4f1a\u88ab TRUE \u6216 FALSE \u66ff\u6362\u3002\u7528\u53cd\u659c\u7ebf\u8f6c\u4e49\u8be5\u5192\u53f7\u53ef\u4ee5\u9632\u6b62\u66ff\u6362\u53d1\u751f\u3002</p>\n<p lang=\"zh\">\u5728\u53c2\u6570\u4e2d\uff0c\u7528\u53cd\u5f15\u53f7\uff08<code class=\"literal\">`</code>\uff09\u5305\u56f4\u7684\u6587\u672c\u4f1a\u88ab\u89c6\u4e3a\u4f20\u7ed9 shell \u7684\u547d\u4ee4\u884c\u3002\u8be5\u547d\u4ee4\u7684\u8f93\u51fa\uff08\u53bb\u6389\u672b\u5c3e\u7684\u6362\u884c\u7b26\uff09\u4f1a\u66ff\u6362\u53cd\u5f15\u53f7\u4e2d\u7684\u6587\u672c\u3002\u5728\u53cd\u5f15\u53f7\u5305\u56f4\u7684\u6587\u672c\u5185\u90e8\uff0c\u4e0d\u4f1a\u8fdb\u884c\u7279\u6b8a\u7684\u5f15\u53f7\u5904\u7406\u6216\u5176\u4ed6\u5904\u7406\uff0c\u4f46\u51fa\u73b0<code class=\"literal\">:<em class=\"replaceable\"><code>variable_name</code></em></code>\u65f6\uff0c\u5982\u679c<em class=\"replaceable\"><code>variable_name</code></em>\u662f<span class=\"application\">psql</span>\u53d8\u91cf\u540d\uff0c\u5c31\u4f1a\u88ab\u66ff\u6362\u4e3a\u8be5\u53d8\u91cf\u7684\u503c\u3002\u6b64\u5916\uff0c<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u4e5f\u4f1a\u88ab\u66ff\u6362\u4e3a\u8be5\u53d8\u91cf\u7684\u503c\uff0c\u5e76\u4f1a\u9002\u5f53\u5730\u52a0\u4e0a\u5f15\u53f7\uff0c\u4f7f\u5176\u6210\u4e3a\u5355\u4e2a shell \u547d\u4ee4\u53c2\u6570\u3002\uff08\u540e\u4e00\u79cd\u5f62\u5f0f\u51e0\u4e4e\u603b\u662f\u66f4\u53ef\u53d6\uff0c\u9664\u975e\u4f60\u975e\u5e38\u786e\u5b9a\u53d8\u91cf\u4e2d\u5305\u542b\u4ec0\u4e48\u3002\uff09\u7531\u4e8e\u65e0\u6cd5\u4fdd\u8bc1\u5728\u6240\u6709\u5e73\u53f0\u4e0a\u90fd\u80fd\u5bf9\u56de\u8f66\u548c\u6362\u884c\u5b57\u7b26\u5b89\u5168\u5730\u52a0\u5f15\u53f7\uff0c\u5f53\u53d8\u91cf\u503c\u4e2d\u51fa\u73b0\u8fd9\u7c7b\u5b57\u7b26\u65f6\uff0c<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u5f62\u5f0f\u4f1a\u6253\u5370\u9519\u8bef\u6d88\u606f\uff0c\u5e76\u4e14\u4e0d\u4f1a\u66ff\u6362\u53d8\u91cf\u503c\u3002</p>\n<p lang=\"zh\">\u4e00\u4e9b\u547d\u4ee4\u63a5\u53d7 SQL \u6807\u8bc6\u7b26\uff08\u4f8b\u5982\u8868\u540d\uff09\u4f5c\u4e3a\u53c2\u6570\u3002\u8fd9\u4e9b\u53c2\u6570\u9075\u5faa SQL \u8bed\u6cd5\u89c4\u5219\uff1a\u672a\u52a0\u5f15\u53f7\u7684\u5b57\u6bcd\u4f1a\u5f3a\u5236\u8f6c\u6362\u4e3a\u5c0f\u5199\uff0c\u800c\u53cc\u5f15\u53f7\uff08\"\uff09\u4f1a\u4fdd\u62a4\u5b57\u6bcd\u4e0d\u88ab\u8f6c\u6362\u5927\u5c0f\u5199\uff0c\u5e76\u5141\u8bb8\u6807\u8bc6\u7b26\u5305\u542b\u7a7a\u767d\u5b57\u7b26\u3002\u5728\u53cc\u5f15\u53f7\u5185\u90e8\uff0c\u8fde\u7eed\u4e24\u4e2a\u53cc\u5f15\u53f7\u4f1a\u5728\u6700\u7ec8\u540d\u79f0\u4e2d\u53d8\u4e3a\u4e00\u4e2a\u53cc\u5f15\u53f7\u3002\u4f8b\u5982\uff0cFOO\"BAR\"BAZ \u4f1a\u88ab\u89e3\u91ca\u4e3a fooBARbaz\uff0c\u800c \"A weird\"\" name\" \u4f1a\u53d8\u4e3a A weird\" name\u3002</p>\n<p lang=\"zh\">\u53c2\u6570\u89e3\u6790\u4f1a\u5728\u884c\u5c3e\u6216\u9047\u5230\u53e6\u4e00\u4e2a\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u65f6\u505c\u6b62\u3002\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u4f1a\u88ab\u89c6\u4e3a\u65b0\u5143\u547d\u4ee4\u7684\u5f00\u59cb\u3002\u7279\u6b8a\u5e8f\u5217<code class=\"literal\">\\\\</code>\uff08\u4e24\u4e2a\u53cd\u659c\u7ebf\uff09\u8868\u793a\u53c2\u6570\u7ed3\u675f\uff0c\u5e76\u7ee7\u7eed\u89e3\u6790<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\uff08\u5982\u679c\u8fd8\u6709\uff09\u3002\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u548c<span class=\"application\">psql</span>\u547d\u4ee4\u53ef\u4ee5\u81ea\u7531\u5730\u6df7\u5408\u5728\u540c\u4e00\u884c\u4e2d\u3002\u4f46\u65e0\u8bba\u5982\u4f55\uff0c\u5143\u547d\u4ee4\u7684\u53c2\u6570\u90fd\u4e0d\u80fd\u5ef6\u7eed\u5230\u4e0b\u4e00\u884c\u3002</p>\n<p lang=\"zh\">\u8bb8\u591a\u5143\u547d\u4ee4\u4f5c\u7528\u4e8e<em class=\"firstterm\">\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a</em>\u3002\u8fd9\u53ea\u662f\u4e00\u4e2a\u4fdd\u5b58\u5df2\u8f93\u5165\u4f46\u5c1a\u672a\u53d1\u9001\u5230\u670d\u52a1\u5668\u6267\u884c\u7684 SQL \u547d\u4ee4\u6587\u672c\u7684\u7f13\u51b2\u533a\u3002\u5176\u4e2d\u65e2\u5305\u62ec\u5148\u524d\u8f93\u5165\u7684\u884c\uff0c\u4e5f\u5305\u62ec\u540c\u4e00\u884c\u4e0a\u4f4d\u4e8e\u5143\u547d\u4ee4\u4e4b\u524d\u7684\u6587\u672c\u3002</p>\n<p lang=\"zh\">\u5b9a\u4e49\u4e86\u4ee5\u4e0b\u5143\u547d\u4ee4\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-META-COMMAND-A\"><span class=\"term\"><code class=\"literal\">\\a</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u5f53\u524d\u8868\u683c\u8f93\u51fa\u683c\u5f0f\u662f\u975e\u5bf9\u9f50\uff0c\u5219\u5207\u6362\u4e3a\u5bf9\u9f50\uff1b\u5426\u5219\u5207\u6362\u4e3a\u975e\u5bf9\u9f50\u3002\u4fdd\u7559\u6b64\u547d\u4ee4\u662f\u4e3a\u4e86\u5411\u540e\u517c\u5bb9\u3002\u66f4\u901a\u7528\u7684\u89e3\u51b3\u65b9\u6848\u8bf7\u53c2\u89c1<code class=\"command\">\\pset</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-BIND\"><span class=\"term\"><code class=\"literal\">\\bind</code> [ <em class=\"replaceable\"><code>parameter</code></em> ] ...</span> </dt>\n<dd>\n<p lang=\"zh\">\u4e3a\u4e0b\u4e00\u6b21\u67e5\u8be2\u6267\u884c\u8bbe\u7f6e\u67e5\u8be2\u53c2\u6570\uff0c\u5e76\u5c06\u6307\u5b9a\u53c2\u6570\u4f20\u7ed9\u4efb\u610f\u53c2\u6570\u5360\u4f4d\u7b26\uff08<code class=\"literal\">$1</code> \u7b49\uff09\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">INSERT INTO tbl1 VALUES ($1, $2) \\bind 'first value' 'second value' \\g\n</pre>\n<p lang=\"zh\">\u8fd9\u5bf9\u9664 <code class=\"literal\">\\g</code> \u4e4b\u5916\u7684\u67e5\u8be2\u6267\u884c\u547d\u4ee4\u4e5f\u6709\u6548\uff0c\u4f8b\u5982 <code class=\"literal\">\\gx</code> \u548c <code class=\"literal\">\\gset</code>\u3002</p>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4f1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/17/protocol-overview.html#PROTOCOL-QUERY-CONCEPTS\" title=\"53.1.2.\u00a0\u6269\u5c55\u67e5\u8be2\u6982\u8ff0\">\u7b2c\u00a053.1.2\u00a0\u8282</a>\uff09\uff0c\u4e0d\u540c\u4e8e<span class=\"application\">psql</span>\u901a\u5e38\u4f7f\u7528\u7684\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002\u56e0\u6b64\uff0c\u53ef\u4ee5\u7528\u5b83\u5728<span class=\"application\">psql</span>\u4e2d\u6d4b\u8bd5\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002\uff08\u5373\u4f7f\u67e5\u8be2\u6ca1\u6709\u53c2\u6570\uff0c\u800c\u4e14\u6b64\u547d\u4ee4\u6307\u5b9a\u4e86\u96f6\u4e2a\u53c2\u6570\uff0c\u4e5f\u4f1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002\uff09\u6b64\u547d\u4ee4\u53ea\u5f71\u54cd\u4e0b\u4e00\u6761\u88ab\u6267\u884c\u7684\u67e5\u8be2\uff1b\u4e4b\u540e\u7684\u6240\u6709\u67e5\u8be2\u9ed8\u8ba4\u4ecd\u4f1a\u4f7f\u7528\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-C-LC\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\c</code> \u6216 <code class=\"literal\">\\connect [ -reuse-previous=<em class=\"replaceable\"><code>on|off</code></em> ] [ <em class=\"replaceable\"><code>dbname</code></em> [ <em class=\"replaceable\"><code>username</code></em> ] [ <em class=\"replaceable\"><code>host</code></em> ] [ <em class=\"replaceable\"><code>port</code></em> ] | <em class=\"replaceable\"><code>conninfo</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5efa\u7acb\u5230<span class=\"productname\">PostgreSQL</span>\u670d\u52a1\u5668\u7684\u65b0\u8fde\u63a5\u3002\u53ef\u4ee5\u4f7f\u7528\u4f4d\u7f6e\u8bed\u6cd5\uff08\u6570\u636e\u5e93\u540d\u79f0\u3001\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\u4e2d\u7684\u4e00\u4e2a\u6216\u591a\u4e2a\uff09\u6307\u5b9a\u8981\u4f7f\u7528\u7684\u8fde\u63a5\u53c2\u6570\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528<em class=\"replaceable\"><code>conninfo</code></em>\u8fde\u63a5\u5b57\u7b26\u4e32\uff0c\u8be6\u89c1<a class=\"xref\" href=\"/docs/17/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u7b2c\u00a032.1.1\u00a0\u8282</a>\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa\u53c2\u6570\uff0c\u5219\u4f7f\u7528\u4e0e\u4e4b\u524d\u76f8\u540c\u7684\u53c2\u6570\u5efa\u7acb\u65b0\u8fde\u63a5\u3002</p>\n<p lang=\"zh\">\u5c06<em class=\"replaceable\"><code>dbname</code></em>\u3001<em class=\"replaceable\"><code>username</code></em>\u3001<em class=\"replaceable\"><code>host</code></em>\u6216 <em class=\"replaceable\"><code>port</code></em>\u4e2d\u7684\u4efb\u610f\u4e00\u4e2a\u6307\u5b9a\u4e3a <code class=\"literal\">-</code>\uff0c\u7b49\u540c\u4e8e\u7701\u7565\u8be5\u53c2\u6570\u3002</p>\n<p lang=\"zh\">\u65b0\u8fde\u63a5\u53ef\u4ee5\u91cd\u7528\u524d\u4e00\u4e2a\u8fde\u63a5\u7684\u8fde\u63a5\u53c2\u6570\uff1b\u4e0d\u4ec5\u5305\u62ec\u6570\u636e\u5e93\u540d\u79f0\u3001\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\uff0c\u8fd8\u5305\u62ec\u5176\u4ed6\u8bbe\u7f6e\uff0c\u5982<em class=\"replaceable\"><code>sslmode</code></em>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53c2\u6570\u5728\u4f4d\u7f6e\u8bed\u6cd5\u4e2d\u88ab\u91cd\u7528\uff0c\u4f46\u5728\u7ed9\u5b9a<em class=\"replaceable\"><code>conninfo</code></em>\u5b57\u7b26\u4e32\u65f6\u4e0d\u4f1a\u88ab\u91cd\u7528\u3002\u4f20\u9012<code class=\"literal\">-reuse-previous=on</code>\u6216<code class=\"literal\">-reuse-previous=off</code>\u4f5c\u4e3a\u7b2c\u4e00\u4e2a\u53c2\u6570\u5c06\u8986\u76d6\u8be5\u9ed8\u8ba4\u8bbe\u7f6e\u3002\u5982\u679c\u53c2\u6570\u88ab\u91cd\u7528\uff0c\u5219\u4efb\u4f55\u672a\u660e\u786e\u6307\u5b9a\u4e3a\u4f4d\u7f6e\u53c2\u6570\u6216\u5728<em class=\"replaceable\"><code>conninfo</code></em>\u5b57\u7b26\u4e32\u4e2d\u7684\u53c2\u6570\u5c06\u4ece\u73b0\u6709\u8fde\u63a5\u7684\u53c2\u6570\u4e2d\u83b7\u53d6\u3002\u4e00\u4e2a\u4f8b\u5916\u662f\uff0c\u5982\u679c\u4f7f\u7528\u4f4d\u7f6e\u8bed\u6cd5\u66f4\u6539<em class=\"replaceable\"><code>host</code></em>\u8bbe\u7f6e\uff0c\u4f7f\u5176\u4e0d\u540c\u4e8e\u5148\u524d\u7684\u503c\uff0c\u5219\u73b0\u6709\u8fde\u63a5\u53c2\u6570\u4e2d\u5b58\u5728\u7684\u4efb\u4f55<em class=\"replaceable\"><code>hostaddr</code></em>\u8bbe\u7f6e\u5c06\u88ab\u5220\u9664\u3002\u6b64\u5916\uff0c\u4ec5\u5f53\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\u8bbe\u7f6e\u672a\u66f4\u6539\u65f6\uff0c\u624d\u4f1a\u91cd\u7528\u73b0\u6709\u8fde\u63a5\u4f7f\u7528\u7684\u4efb\u4f55\u5bc6\u7801\u3002\u5f53\u547d\u4ee4\u65e2\u4e0d\u6307\u5b9a\u4e5f\u4e0d\u91cd\u7528\u7279\u5b9a\u53c2\u6570\u65f6\uff0c\u5c06\u4f7f\u7528<span class=\"application\">libpq</span>\u7684\u9ed8\u8ba4\u503c\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u65b0\u8fde\u63a5\u6210\u529f\u5efa\u7acb\uff0c\u5219\u5173\u95ed\u5148\u524d\u7684\u8fde\u63a5\u3002\u5982\u679c\u8fde\u63a5\u5c1d\u8bd5\u5931\u8d25\uff08\u7528\u6237\u540d\u9519\u8bef\uff0c\u8bbf\u95ee\u88ab\u62d2\u7edd\u7b49\uff09\uff0c\u4e14<span class=\"application\">psql</span>\u5904\u4e8e\u4ea4\u4e92\u6a21\u5f0f\uff0c\u5219\u4fdd\u7559\u5148\u524d\u7684\u8fde\u63a5\u3002\u4f46\u5728\u6267\u884c\u975e\u4ea4\u4e92\u811a\u672c\u65f6\uff0c\u65e7\u8fde\u63a5\u5c06\u88ab\u5173\u95ed\u5e76\u62a5\u544a\u9519\u8bef\u3002\u8fd9\u53ef\u80fd\u4f1a\u6216\u53ef\u80fd\u4e0d\u4f1a\u7ec8\u6b62\u811a\u672c\uff1b\u5982\u679c\u6ca1\u6709\u7ec8\u6b62\uff0c\u76f4\u5230\u6210\u529f\u6267\u884c\u53e6\u4e00\u4e2a<code class=\"literal\">\\connect</code>\u547d\u4ee4\u4e4b\u524d\uff0c\u6240\u6709\u8bbf\u95ee\u6570\u636e\u5e93\u7684\u547d\u4ee4\u90fd\u5c06\u5931\u8d25\u3002\u91c7\u7528\u8fd9\u79cd\u533a\u522b\uff0c\u4e00\u65b9\u9762\u662f\u4e3a\u4e86\u65b9\u4fbf\u7528\u6237\u5e94\u5bf9\u8f93\u5165\u7b14\u8bef\uff0c\u53e6\u4e00\u65b9\u9762\u662f\u4e3a\u4e86\u9632\u6b62\u811a\u672c\u610f\u5916\u64cd\u4f5c\u9519\u8bef\u7684\u6570\u636e\u5e93\u3002\u8bf7\u6ce8\u610f\uff0c\u6bcf\u5f53<code class=\"literal\">\\connect</code>\u547d\u4ee4\u5c1d\u8bd5\u91cd\u65b0\u4f7f\u7528\u53c2\u6570\u65f6\uff0c\u91cd\u65b0\u4f7f\u7528\u7684\u503c\u662f\u6700\u540e\u4e00\u4e2a\u6210\u529f\u8fde\u63a5\u7684\u503c\uff0c\u800c\u4e0d\u662f\u968f\u540e\u7684\u4efb\u4f55\u5931\u8d25\u5c1d\u8bd5\u7684\u503c\u3002\u4f46\u662f\uff0c\u5728\u975e\u4ea4\u4e92<code class=\"literal\">\\connect</code>\u5931\u8d25\u7684\u60c5\u51b5\u4e0b\uff0c\u4e0d\u5141\u8bb8\u7a0d\u540e\u91cd\u65b0\u4f7f\u7528\u53c2\u6570\uff0c\u56e0\u4e3a\u811a\u672c\u53ef\u80fd\u671f\u671b\u4ece\u5931\u8d25\u7684<code class=\"literal\">\\connect</code>\u4e2d\u91cd\u65b0\u4f7f\u7528\u503c\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">=&gt; \\c mydb myuser host.dom 6432\n=&gt; \\c service=foo\n=&gt; \\c \"host=localhost port=5432 dbname=mydb connect_timeout=10 sslmode=disable\"\n=&gt; \\c -reuse-previous=on sslmode=require    -- changes only sslmode\n=&gt; \\c postgresql://tom@localhost/mydb?application_name=myapp\n</pre>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-C-UC\"><span class=\"term\"><code class=\"literal\">\\C [ <em class=\"replaceable\"><code>title</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u4f5c\u4e3a\u67e5\u8be2\u7ed3\u679c\u6253\u5370\u7684\u8868\u7684\u6807\u9898\uff0c\u6216\u53d6\u6d88\u6b64\u7c7b\u6807\u9898\u3002\u8be5\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset title <em class=\"replaceable\"><code>title</code></em></code>\u3002\uff08\u6b64\u547d\u4ee4\u7684\u540d\u79f0\u6e90\u81ea<span class=\"quote\">\u201c<span class=\"quote\">caption</span>\u201d</span>\uff0c\u56e0\u4e3a\u5b83\u8fc7\u53bb\u53ea\u7528\u4e8e\u8bbe\u7f6e<acronym class=\"acronym\">HTML</acronym>\u8868\u7684\u6807\u9898\u3002\uff09</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-CD\"><span class=\"term\"><code class=\"literal\">\\cd [ <em class=\"replaceable\"><code>directory</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u66f4\u6539\u4e3a<em class=\"replaceable\"><code>directory</code></em>\u3002\u5982\u679c\u6ca1\u6709\u53c2\u6570\uff0c\u5219\u5207\u6362\u5230\u5f53\u524d\u7528\u6237\u7684\u4e3b\u76ee\u5f55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8981\u6253\u5370\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\uff0c\u8bf7\u4f7f\u7528<code class=\"literal\">\\! pwd</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-CONNINFO\"><span class=\"term\"><code class=\"literal\">\\conninfo</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8f93\u51fa\u5f53\u524d\u6570\u636e\u5e93\u8fde\u63a5\u7684\u4fe1\u606f\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMANDS-COPY\"><span class=\"term\"><code class=\"literal\">\\copy { <em class=\"replaceable\"><code>table</code></em> [ ( <em class=\"replaceable\"><code>column_list</code></em> ) ] } <code class=\"literal\">from</code> { <em class=\"replaceable\"><code>'filename'</code></em> | program <em class=\"replaceable\"><code>'command'</code></em> | stdin | pstdin } [ [ with ] ( <em class=\"replaceable\"><code>option</code></em> [, ...] ) ] [ where <em class=\"replaceable\"><code>condition</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\copy { <em class=\"replaceable\"><code>table</code></em> [ ( <em class=\"replaceable\"><code>column_list</code></em> ) ] | ( <em class=\"replaceable\"><code>query</code></em> ) } <code class=\"literal\">to</code> { <em class=\"replaceable\"><code>'filename'</code></em> | program <em class=\"replaceable\"><code>'command'</code></em> | stdout | pstdout } [ [ with ] ( <em class=\"replaceable\"><code>option</code></em> [, ...] ) ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6267\u884c\u524d\u7aef\uff08\u5ba2\u6237\u7aef\uff09\u590d\u5236\u3002\u8be5\u64cd\u4f5c\u4f1a\u8fd0\u884c\u4e00\u4e2a<acronym class=\"acronym\">SQL</acronym> <a class=\"link\" href=\"/docs/17/sql-copy.html\" title=\"COPY\"><code class=\"command\">COPY</code></a>\u547d\u4ee4\uff0c\u4f46\u5e76\u4e0d\u662f\u7531\u670d\u52a1\u5668\u8bfb\u53d6\u6216\u5199\u5165\u6307\u5b9a\u6587\u4ef6\uff0c\u800c\u662f\u7531<span class=\"application\">psql</span>\u8bfb\u53d6\u6216\u5199\u5165\u6587\u4ef6\uff0c\u5e76\u5728\u670d\u52a1\u5668\u4e0e\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e4b\u95f4\u8f6c\u9001\u6570\u636e\u3002\u8fd9\u610f\u5473\u7740\u6587\u4ef6\u53ef\u8bbf\u95ee\u6027\u548c\u6743\u9650\u53d6\u51b3\u4e8e\u672c\u5730\u7528\u6237\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\uff0c\u4e5f\u4e0d\u9700\u8981 SQL \u8d85\u7ea7\u7528\u6237\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5f53\u6307\u5b9a<code class=\"literal\">program</code>\u65f6\uff0c<em class=\"replaceable\"><code>command</code></em> \u7531<span class=\"application\">psql</span>\u6267\u884c\uff0c\u4f20\u7ed9<em class=\"replaceable\"><code>command</code></em>\u7684\u6570\u636e\u6216\u4ece\u5176\u4e2d\u8bfb\u51fa\u7684\u6570\u636e\u90fd\u4f1a\u5728\u670d\u52a1\u5668\u4e0e\u5ba2\u6237\u7aef\u4e4b\u95f4\u8f6c\u9001\u3002\u518d\u6b21\u5f3a\u8c03\uff0c\u6267\u884c\u6743\u9650\u5c5e\u4e8e\u672c\u5730\u7528\u6237\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\uff0c\u4e5f\u4e0d\u9700\u8981 SQL \u8d85\u7ea7\u7528\u6237\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e \\copy ... from stdin\uff0c\u4ece\u53d1\u51fa\u547d\u4ee4\u7684\u540c\u4e00\u8f93\u5165\u6e90\u8bfb\u53d6\u6570\u636e\u884c\uff0c\u76f4\u5230\u8bfb\u53d6\u5230 \\.\u6216\u8f93\u5165\u6d41\u5230\u8fbe EOF\u3002\u8fd9\u9002\u5408\u5728 SQL \u811a\u672c\u4e2d\u5185\u8054\u586b\u5145\u8868\u3002\u5bf9\u4e8e \\copy ... to stdout\uff0c\u8f93\u51fa\u53d1\u5f80\u4e0e psql \u547d\u4ee4\u8f93\u51fa\u76f8\u540c\u7684\u4f4d\u7f6e\uff0c\u4e14\u4e0d\u6253\u5370 COPY count \u547d\u4ee4\u72b6\u6001\uff0c\u4ee5\u514d\u4e0e\u6570\u636e\u884c\u6df7\u6dc6\u3002\u82e5\u8981\u59cb\u7ec8\u8bfb\u5199 psql \u7684\u6807\u51c6\u8f93\u5165\u6216\u8f93\u51fa\uff0c\u800c\u4e0d\u53d7\u5f53\u524d\u547d\u4ee4\u6765\u6e90\u6216 \\o \u9009\u9879\u5f71\u54cd\uff0c\u8bf7\u4f7f\u7528 from pstdin \u6216 to pstdout\u3002</p>\n<p lang=\"zh\">\u8be5\u547d\u4ee4\u7684\u8bed\u6cd5\u4e0e<acronym class=\"acronym\">SQL</acronym> <a class=\"link\" href=\"/docs/17/sql-copy.html\" title=\"COPY\"><code class=\"command\">COPY</code></a>\u547d\u4ee4\u7c7b\u4f3c\u3002\u9664\u6570\u636e\u6e90\u6216\u76ee\u6807\u4e4b\u5916\uff0c\u5176\u4ed6\u6240\u6709\u9009\u9879\u90fd\u4e0e<code class=\"command\">COPY</code>\u547d\u4ee4\u4e2d\u7684\u6307\u5b9a\u76f8\u540c\u3002\u56e0\u6b64\uff0c\u7279\u6b8a\u7684\u89e3\u6790\u89c4\u5219\u9002\u7528\u4e8e<code class=\"command\">\\copy</code>\u5143\u547d\u4ee4\u3002\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u5269\u4f59\u884c\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\copy</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u6267\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u53e6\u4e00\u79cd\u83b7\u5f97\u4e0e<code class=\"literal\">\\copy ... to</code>\u76f8\u540c\u7ed3\u679c\u7684\u65b9\u6cd5\u662f\u4f7f\u7528<acronym class=\"acronym\">SQL</acronym> <code class=\"literal\">COPY ... TO STDOUT</code>\u547d\u4ee4\uff0c\u5e76\u4ee5<code class=\"literal\">\\g <em class=\"replaceable\"><code>filename</code></em></code> \u6216<code class=\"literal\">\\g |<em class=\"replaceable\"><code>program</code></em></code>\u7ed3\u675f\u3002\u4e0e<code class=\"literal\">\\copy</code>\u4e0d\u540c\uff0c\u8fd9\u79cd\u65b9\u6cd5\u5141\u8bb8\u547d\u4ee4\u8de8\u8d8a\u591a\u884c\uff1b\u6b64\u5916\uff0c\u53ef\u4ee5\u4f7f\u7528\u53d8\u91cf\u63d2\u503c\u548c\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</div>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8fd9\u4e9b\u64cd\u4f5c\u4e0d\u5982\u4ee5\u6587\u4ef6\u6216\u7a0b\u5e8f\u4f5c\u4e3a\u6570\u636e\u6e90\u6216\u76ee\u6807\u7684<acronym class=\"acronym\">SQL</acronym> <code class=\"command\">COPY</code>\u547d\u4ee4\u9ad8\u6548\uff0c\u56e0\u4e3a\u6240\u6709\u6570\u636e\u90fd\u5fc5\u987b\u901a\u8fc7\u5ba2\u6237\u7aef/\u670d\u52a1\u5668\u8fde\u63a5\u4f20\u8f93\u3002\u5bf9\u4e8e\u5927\u91cf\u6570\u636e\uff0c\u4f7f\u7528<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u53ef\u80fd\u66f4\u5408\u9002\u3002\u53e6\u5916\uff0c\u7531\u4e8e\u91c7\u7528\u8fd9\u79cd\u6570\u636e\u8f6c\u9001\u65b9\u5f0f\uff0c<acronym class=\"acronym\">CSV</acronym>\u6a21\u5f0f\u4e0b\u7684<code class=\"literal\">\\copy ... from</code>\u4f1a\u9519\u8bef\u5730\u628a\u5355\u72ec\u5360\u636e\u4e00\u884c\u7684<code class=\"literal\">\\.</code>\u6570\u636e\u503c\u5f53\u4f5c\u8f93\u5165\u7ed3\u675f\u6807\u8bb0\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-COPYRIGHT\"><span class=\"term\"><code class=\"literal\">\\copyright</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"productname\">PostgreSQL</span>\u7684\u7248\u6743\u548c\u5206\u53d1\u6761\u6b3e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMANDS-CROSSTABVIEW\"><span class=\"term\"><code class=\"literal\">\\crosstabview [ <em class=\"replaceable\"><code>colV</code></em> [ <em class=\"replaceable\"><code>colH</code></em> [ <em class=\"replaceable\"><code>colD</code></em> [ <em class=\"replaceable\"><code>sortcolH</code></em> ] ] ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6267\u884c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\uff08\u4e0e<code class=\"literal\">\\g</code>\u7c7b\u4f3c\uff09\uff0c\u5e76\u4ee5\u4ea4\u53c9\u8868\u7f51\u683c\u663e\u793a\u7ed3\u679c\u3002\u67e5\u8be2\u5fc5\u987b\u8fd4\u56de\u81f3\u5c11\u4e09\u5217\u3002\u7531<em class=\"replaceable\"><code>colV</code></em>\u6807\u8bc6\u7684\u8f93\u51fa\u5217\u6210\u4e3a\u7eb5\u5411\u8868\u5934\uff0c\u7531<em class=\"replaceable\"><code>colH</code></em>\u6807\u8bc6\u7684\u8f93\u51fa\u5217\u6210\u4e3a\u6a2a\u5411\u8868\u5934\u3002<em class=\"replaceable\"><code>colD</code></em>\u6807\u8bc6\u8981\u5728\u7f51\u683c\u4e2d\u663e\u793a\u7684\u8f93\u51fa\u5217\u3002<em class=\"replaceable\"><code>sortcolH</code></em>\u6807\u8bc6\u6a2a\u5411\u8868\u5934\u7684\u53ef\u9009\u6392\u5e8f\u5217\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a\u5217\u6307\u5b9a\u9879\u53ef\u4ee5\u662f\u4ece 1 \u5f00\u59cb\u7684\u5217\u53f7\uff0c\u4e5f\u53ef\u4ee5\u662f\u5217\u540d\uff1b\u5217\u540d\u9075\u5faa\u5e38\u89c4 SQL \u5927\u5c0f\u5199\u6298\u53e0\u548c\u5f15\u53f7\u89c4\u5219\u3002\u7701\u7565\u65f6\uff0ccolV \u9ed8\u8ba4\u4e3a\u7b2c 1 \u5217\uff0ccolH \u9ed8\u8ba4\u4e3a\u7b2c 2 \u5217\u3002colH \u5fc5\u987b\u4e0e colV \u4e0d\u540c\u3002\u82e5\u4e0d\u6307\u5b9a colD\uff0c\u67e5\u8be2\u7ed3\u679c\u5fc5\u987b\u6070\u6709\u4e09\u5217\uff0c\u65e2\u975e colV \u4e5f\u975e colH \u7684\u90a3\u4e00\u5217\u4f5c\u4e3a colD\u3002</p>\n<p lang=\"zh\">\u7eb5\u5411\u8868\u5934\u663e\u793a\u4e3a\u6700\u5de6\u5217\uff0c\u5305\u542b<em class=\"replaceable\"><code>colV</code></em>\u5217\u4e2d\u7684\u503c\uff0c\u5176\u987a\u5e8f\u4e0e\u67e5\u8be2\u7ed3\u679c\u4e2d\u76f8\u540c\uff0c\u4f46\u4f1a\u79fb\u9664\u91cd\u590d\u503c\u3002</p>\n<p lang=\"zh\">\u6a2a\u5411\u8868\u5934\u663e\u793a\u4e3a\u7b2c\u4e00\u884c\uff0c\u5305\u542b<em class=\"replaceable\"><code>colH</code></em>\u5217\u4e2d\u7684\u503c\uff0c\u5e76\u79fb\u9664\u91cd\u590d\u503c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4eec\u6309\u67e5\u8be2\u7ed3\u679c\u4e2d\u7684\u76f8\u540c\u987a\u5e8f\u663e\u793a\u3002\u4f46\u5982\u679c\u7ed9\u51fa\u4e86\u53ef\u9009\u7684<em class=\"replaceable\"><code>sortcolH</code></em>\u53c2\u6570\uff0c\u5b83\u6240\u6807\u8bc6\u7684\u5217\u7684\u503c\u5fc5\u987b\u662f\u6574\u6570\uff0c\u800c<em class=\"replaceable\"><code>colH</code></em>\u4e2d\u7684\u503c\u4f1a\u6309\u7167\u5bf9\u5e94\u7684<em class=\"replaceable\"><code>sortcolH</code></em>\u503c\u6392\u5e8f\u540e\u663e\u793a\u5728\u6a2a\u5411\u8868\u5934\u4e2d\u3002</p>\n<p lang=\"zh\">\u4ea4\u53c9\u8868\u4e2d\uff0c\u5bf9\u4e8e colH \u7684\u6bcf\u4e2a\u4e0d\u540c\u503c x \u548c colV \u7684\u6bcf\u4e2a\u4e0d\u540c\u503c y\uff0c\u4ea4\u70b9 (x,y) \u7684\u5355\u5143\u683c\u4fdd\u5b58\u67e5\u8be2\u7ed3\u679c\u4e2d colH=x \u4e14 colV=y \u90a3\u4e00\u884c\u7684 colD \u503c\u3002\u6ca1\u6709\u5339\u914d\u884c\u65f6\u5355\u5143\u683c\u4e3a\u7a7a\uff1b\u5b58\u5728\u591a\u884c\u65f6\u4f1a\u62a5\u9519\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-D\"><span class=\"term\"><code class=\"literal\">\\d[S+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5bf9\u4e8e\u6bcf\u4e2a\u4e0e<em class=\"replaceable\"><code>pattern</code></em>\u5339\u914d\u7684\u5173\u7cfb\uff08\u8868\u3001\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u7d22\u5f15\u3001\u5e8f\u5217\u6216\u5916\u90e8\u8868\uff09\u6216\u590d\u5408\u7c7b\u578b\uff0c\u663e\u793a\u6240\u6709\u5217\u3001\u5b83\u4eec\u7684\u7c7b\u578b\u3001\u8868\u7a7a\u95f4\uff08\u5982\u679c\u4e0d\u662f\u9ed8\u8ba4\u7684\uff09\u4ee5\u53ca\u4efb\u4f55\u7279\u6b8a\u5c5e\u6027\uff0c\u5982<code class=\"literal\">NOT NULL</code>\u6216\u9ed8\u8ba4\u503c\u3002\u8fd8\u663e\u793a\u76f8\u5173\u7684\u7d22\u5f15\u3001\u7ea6\u675f\u3001\u89c4\u5219\u548c\u89e6\u53d1\u5668\u3002\u5bf9\u4e8e\u5916\u90e8\u8868\uff0c\u8fd8\u663e\u793a\u5173\u8054\u7684\u5916\u90e8\u670d\u52a1\u5668\u3002\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u5339\u914d\u6a21\u5f0f</span>\u201d</span>\u7684\u5b9a\u4e49\u5728\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"\u6a21\u5f0f\">\u6a21\u5f0f</a>\u4e2d\u3002\uff09</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u67d0\u4e9b\u7c7b\u578b\u7684\u5173\u7cfb\uff0c<code class=\"literal\">\\d</code>\u663e\u793a\u6bcf\u5217\u7684\u9644\u52a0\u4fe1\u606f\uff1a\u5e8f\u5217\u7684\u5217\u503c\uff0c\u7d22\u5f15\u7684\u7d22\u5f15\u8868\u8fbe\u5f0f\uff0c\u5916\u90e8\u8868\u7684\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u547d\u4ee4\u5f62\u5f0f<code class=\"literal\">\\d+</code>\u4e0e\u524d\u8005\u76f8\u540c\uff0c\u4f46\u4f1a\u663e\u793a\u66f4\u591a\u4fe1\u606f\uff1a\u8868\u5217\u5173\u8054\u7684\u6ce8\u91ca\u3001\u8868\u662f\u5426\u5305\u542b OID\u3001\u5f53\u5173\u7cfb\u4e3a\u89c6\u56fe\u65f6\u7684\u89c6\u56fe\u5b9a\u4e49\u3001\u975e\u9ed8\u8ba4\u7684<a class=\"link\" href=\"/docs/17/sql-altertable.html#SQL-ALTERTABLE-REPLICA-IDENTITY\">\u590d\u5236\u6807\u8bc6</a>\u8bbe\u7f6e\uff0c\u4ee5\u53ca\u5f53\u5173\u7cfb\u5177\u6709\u8bbf\u95ee\u65b9\u6cd5\u65f6\u7684<a class=\"link\" href=\"/docs/17/sql-create-access-method.html\" title=\"CREATE ACCESS METHOD\">\u8bbf\u95ee\u65b9\u6cd5</a>\u540d\u79f0\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u4e00\u4e2a\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u4ee5\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528<code class=\"command\">\\d</code>\u800c\u6ca1\u6709<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\uff0c\u5b83\u7b49\u540c\u4e8e<code class=\"command\">\\dtvmsE</code>\uff0c\u5b83\u5c06\u663e\u793a\u6240\u6709\u53ef\u89c1\u7684\u8868\u3001\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u7684\u5217\u8868\u3002\u8fd9\u7eaf\u7cb9\u662f\u4e00\u79cd\u4fbf\u5229\u63aa\u65bd\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DA-LC\"><span class=\"term\"><code class=\"literal\">\\da[S] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u805a\u5408\u51fd\u6570\uff0c\u4ee5\u53ca\u5b83\u4eec\u7684\u8fd4\u56de\u7c7b\u578b\u548c\u6240\u4f5c\u7528\u7684\u6570\u636e\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u805a\u5408\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DA-UC\"><span class=\"term\"><code class=\"literal\">\\dA[+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8bbf\u95ee\u65b9\u6cd5\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bbf\u95ee\u65b9\u6cd5\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u8bbf\u95ee\u65b9\u6cd5\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u7684\u5904\u7406\u5668\u51fd\u6570\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DAC\"><span class=\"term\"><code class=\"literal\">\\dAc[+] [<a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>input-type-pattern</code></em></a>]]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u64cd\u4f5c\u7b26\u7c7b\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/17/xindex.html#XINDEX-OPCLASS\" title=\"36.16.1.\u00a0\u7d22\u5f15\u65b9\u6cd5\u548c\u64cd\u4f5c\u7b26\u7c7b\">\u7b2c\u00a036.16.1\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u7c7b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>input-type-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8f93\u5165\u7c7b\u578b\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u7c7b\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u7c7b\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u548c\u6240\u6709\u8005\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DAF\"><span class=\"term\"><code class=\"literal\">\\dAf[+] [<a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>input-type-pattern</code></em></a>]]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u64cd\u4f5c\u7b26\u65cf\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/17/xindex.html#XINDEX-OPFAMILY\" title=\"36.16.5.\u00a0\u64cd\u4f5c\u7b26\u7c7b\u548c\u64cd\u4f5c\u7b26\u65cf\">\u7b2c\u00a036.16.5\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>input-type-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8f93\u5165\u7c7b\u578b\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u65cf\u90fd\u4f1a\u8fde\u540c\u5176\u6240\u6709\u8005\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DAO\"><span class=\"term\"><code class=\"literal\">\\dAo[+] [<a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>operator-family-pattern</code></em></a>]]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u4e0e\u64cd\u4f5c\u7b26\u65cf\u5173\u8054\u7684\u64cd\u4f5c\u7b26\uff08\u89c1<a class=\"xref\" href=\"/docs/17/xindex.html#XINDEX-STRATEGIES\" title=\"36.16.2.\u00a0\u7d22\u5f15\u65b9\u6cd5\u7b56\u7565\">\u7b2c\u00a036.16.2\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u5173\u8054\u8bbf\u95ee\u65b9\u6cd5\u7684\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u64cd\u4f5c\u7b26\u65cf\u6210\u5458\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>operator-family-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u64cd\u4f5c\u7b26\u65cf\u6210\u5458\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u5217\u51fa\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u7684\u6392\u5e8f\u64cd\u4f5c\u7b26\u65cf\uff08\u5982\u679c\u5b83\u662f\u4e00\u4e2a\u6392\u5e8f\u64cd\u4f5c\u7b26\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DAP\"><span class=\"term\"><code class=\"literal\">\\dAp[+] [<a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>operator-family-pattern</code></em></a>]]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u4e0e\u64cd\u4f5c\u7b26\u65cf\u5173\u8054\u7684\u652f\u6301\u51fd\u6570\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/17/xindex.html#XINDEX-SUPPORT\" title=\"36.16.3.\u00a0\u7d22\u5f15\u65b9\u6cd5\u652f\u6301\u4f8b\u7a0b\">\u7b2c\u00a036.16.3\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u6240\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u51fd\u6570\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>operator-family-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u8be5\u6a21\u5f0f\u5339\u914d\u7684\u64cd\u4f5c\u7b26\u65cf\u51fd\u6570\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u51fd\u6570\u4f1a\u4ee5\u8be6\u7ec6\u5f62\u5f0f\u663e\u793a\uff0c\u5e76\u5e26\u6709\u5176\u5b9e\u9645\u53c2\u6570\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DB\"><span class=\"term\"><code class=\"literal\">\\db[+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8868\u7a7a\u95f4\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8868\u7a7a\u95f4\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u8868\u7a7a\u95f4\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u9009\u9879\u3001\u78c1\u76d8\u5927\u5c0f\u3001\u6743\u9650\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DC-LC\"><span class=\"term\"><code class=\"literal\">\\dc[S+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5b57\u7b26\u96c6\u7f16\u7801\u4e4b\u95f4\u7684\u8f6c\u6362\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8f6c\u6362\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DCONFIG\"><span class=\"term\"><code class=\"literal\">\\dconfig[+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u670d\u52a1\u5668\u914d\u7f6e\u53c2\u6570\u53ca\u5176\u503c\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u53c2\u6570\u3002\u4e0d\u5e26 <em class=\"replaceable\"><code>pattern</code></em> \u65f6\uff0c\u53ea\u5217\u51fa\u88ab\u8bbe\u7f6e\u4e3a\u975e\u9ed8\u8ba4\u503c\u7684\u53c2\u6570\u3002\uff08\u4f7f\u7528 <code class=\"literal\">\\dconfig *</code> \u53ef\u67e5\u770b\u6240\u6709\u53c2\u6570\u3002\uff09\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u53c2\u6570\u90fd\u4f1a\u8fde\u540c\u5176\u6570\u636e\u7c7b\u578b\u3001\u8be5\u53c2\u6570\u53ef\u8bbe\u7f6e\u7684\u4e0a\u4e0b\u6587\u4ee5\u53ca\u8bbf\u95ee\u6743\u9650\uff08\u5982\u679c\u5df2\u6388\u4e88\u975e\u9ed8\u8ba4\u8bbf\u95ee\u6743\u9650\uff09\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DC-UC\"><span class=\"term\"><code class=\"literal\">\\dC[+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u7c7b\u578b\u8f6c\u6362\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u6e90\u7c7b\u578b\u6216\u76ee\u6807\u7c7b\u578b\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u7c7b\u578b\u8f6c\u6362\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u5217\u51fa\u6bcf\u4e2a\u5bf9\u8c61\u5173\u8054\u7684\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DD-LC\"><span class=\"term\"><code class=\"literal\">\\dd[S] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u663e\u793a<code class=\"literal\">constraint</code>\u3001<code class=\"literal\">operator class</code>\u3001<code class=\"literal\">operator family</code>\u3001<code class=\"literal\">rule</code>\u548c <code class=\"literal\">trigger</code>\u7c7b\u578b\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002\u5176\u4ed6\u6ce8\u91ca\u53ef\u901a\u8fc7\u5bf9\u5e94\u5bf9\u8c61\u7c7b\u578b\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u67e5\u770b\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">\\dd</code> \u663e\u793a\u4e0e <em class=\"replaceable\"><code>pattern</code></em> \u5339\u914d\u7684\u5bf9\u8c61\u63cf\u8ff0\uff1b\u5982\u679c\u6ca1\u6709\u7ed9\u51fa\u53c2\u6570\uff0c\u5219\u663e\u793a\u76f8\u5e94\u7c7b\u578b\u7684\u53ef\u89c1\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002\u4f46\u65e0\u8bba\u54ea\u79cd\u60c5\u51b5\uff0c\u53ea\u5217\u51fa\u90a3\u4e9b\u5df2\u6709\u63cf\u8ff0\u7684\u5bf9\u8c61\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528 <a class=\"link\" href=\"/docs/17/sql-comment.html\" title=\"COMMENT\"><code class=\"command\">COMMENT</code></a> <acronym class=\"acronym\">SQL</acronym> \u547d\u4ee4\u521b\u5efa\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DD-UC\"><span class=\"term\"><code class=\"literal\">\\dD[S+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u57df\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u57df\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u6743\u9650\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DDP\"><span class=\"term\"><code class=\"literal\">\\ddp [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u9ed8\u8ba4\u8bbf\u95ee\u6743\u9650\u8bbe\u7f6e\u3002\u5bf9\u4e8e\u6bcf\u4e2a\u9ed8\u8ba4\u6743\u9650\u8bbe\u7f6e\u5df2\u504f\u79bb\u5185\u7f6e\u9ed8\u8ba4\u503c\u7684\u89d2\u8272\uff08\u4ee5\u53ca\u9002\u7528\u65f6\u7684\u6a21\u5f0f\uff09\uff0c\u90fd\u4f1a\u663e\u793a\u4e00\u6761\u8bb0\u5f55\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u89d2\u8272\u540d\u6216\u6a21\u5f0f\u540d\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bb0\u5f55\u3002</p>\n<p lang=\"zh\"><a class=\"link\" href=\"/docs/17/sql-alterdefaultprivileges.html\" title=\"ALTER DEFAULT PRIVILEGES\"><code class=\"command\">ALTER DEFAULT PRIVILEGES</code></a>\u547d\u4ee4\u7528\u4e8e\u8bbe\u7f6e\u9ed8\u8ba4\u8bbf\u95ee\u6743\u9650\u3002\u6743\u9650\u663e\u793a\u7684\u542b\u4e49\u5728<a class=\"xref\" href=\"/docs/17/ddl-priv.html\" title=\"5.8.\u00a0\u6743\u9650\">\u7b2c\u00a05.8\u00a0\u8282</a>\u4e2d\u6709\u89e3\u91ca\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DE\"><span class=\"term\"><code class=\"literal\">\\dE[S+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\di[S+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dm[S+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\ds[S+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dt[S+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dv[S+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd9\u7ec4\u547d\u4ee4\u4e2d\uff0c\u5b57\u6bcd <code class=\"literal\">E</code>\u3001<code class=\"literal\">i</code>\u3001<code class=\"literal\">m</code>\u3001<code class=\"literal\">s</code>\u3001<code class=\"literal\">t</code> \u548c <code class=\"literal\">v</code> \u5206\u522b\u8868\u793a\u5916\u90e8\u8868\u3001\u7d22\u5f15\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u3001\u8868\u548c\u89c6\u56fe\u3002\u4f60\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u6307\u5b9a\u5176\u4e2d\u4efb\u610f\u4e00\u4e2a\u6216\u591a\u4e2a\u5b57\u6bcd\uff0c\u4ee5\u83b7\u53d6\u8fd9\u4e9b\u7c7b\u578b\u5bf9\u8c61\u7684\u5217\u8868\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dti</code> \u4f1a\u5217\u51fa\u8868\u548c\u7d22\u5f15\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u6301\u4e45\u6027\u72b6\u6001\uff08\u6c38\u4e45\u3001\u4e34\u65f6\u6216\u4e0d\u8bb0\u5f55 WAL\uff09\u3001\u78c1\u76d8\u4e0a\u7684\u7269\u7406\u5927\u5c0f\u4ee5\u53ca\u76f8\u5173\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u4e00\u8d77\u5217\u51fa\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u5bf9\u8c61\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DES\"><span class=\"term\"><code class=\"literal\">\\des[+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u670d\u52a1\u5668\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external servers</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u670d\u52a1\u5668\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\des+</code>\u5f62\u5f0f\uff0c\u5219\u663e\u793a\u6bcf\u4e2a\u670d\u52a1\u5668\u7684\u5b8c\u6574\u8bf4\u660e\uff0c\u5305\u62ec\u670d\u52a1\u5668\u7684\u8bbf\u95ee\u6743\u9650\u3001\u7c7b\u578b\u3001\u7248\u672c\u3001\u9009\u9879\u548c\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DET\"><span class=\"term\"><code class=\"literal\">\\det[+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u8868\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external tables</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u8868\u540d\u6216\u6a21\u5f0f\u540d\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6761\u76ee\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\det+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u901a\u7528\u9009\u9879\u548c\u5916\u90e8\u8868\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DEU\"><span class=\"term\"><code class=\"literal\">\\deu[+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u7528\u6237\u6620\u5c04\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external users</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u7528\u6237\u540d\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6620\u5c04\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\deu+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u6620\u5c04\u7684\u9644\u52a0\u4fe1\u606f\u3002</p>\n<div class=\"caution\">\n<h3 class=\"title\" lang=\"zh\">\u5c0f\u5fc3</h3>\n<p lang=\"zh\"><code class=\"literal\">\\deu+</code>\u8fd8\u53ef\u80fd\u663e\u793a\u8fdc\u7a0b\u7528\u6237\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u56e0\u6b64\u5e94\u6ce8\u610f\u4e0d\u8981\u6cc4\u9732\u5b83\u4eec\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DEW\"><span class=\"term\"><code class=\"literal\">\\dew[+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\uff08\u52a9\u8bb0\u8bcd\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external wrappers</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dew+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u7684\u8bbf\u95ee\u6743\u9650\u3001\u9009\u9879\u548c\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DF-LC\"><span class=\"term\"><code class=\"literal\">\\df[anptwS+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> [ <em class=\"replaceable\"><code>arg_pattern</code></em> ... ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u51fd\u6570\uff0c\u4ee5\u53ca\u5b83\u4eec\u7684\u7ed3\u679c\u6570\u636e\u7c7b\u578b\u3001\u53c2\u6570\u6570\u636e\u7c7b\u578b\u548c\u51fd\u6570\u7c7b\u578b\uff0c\u51fd\u6570\u7c7b\u578b\u5206\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">agg</span>\u201d</span>\uff08\u805a\u5408\uff09\u3001<span class=\"quote\">\u201c<span class=\"quote\">normal</span>\u201d</span>\u3001<span class=\"quote\">\u201c<span class=\"quote\">procedure</span>\u201d</span>\u3001<span class=\"quote\">\u201c<span class=\"quote\">trigger</span>\u201d</span>\u6216<span class=\"quote\">\u201c<span class=\"quote\">window</span>\u201d</span>\u3002\u8981\u53ea\u663e\u793a\u7279\u5b9a\u7c7b\u578b\u7684\u51fd\u6570\uff0c\u8bf7\u5728\u547d\u4ee4\u540e\u6dfb\u52a0\u76f8\u5e94\u7684\u5b57\u6bcd <code class=\"literal\">a</code>\u3001<code class=\"literal\">n</code>\u3001<code class=\"literal\">p</code>\u3001<code class=\"literal\">t</code> \u6216 <code class=\"literal\">w</code>\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u51fd\u6570\u3002\u4efb\u4f55\u9644\u52a0\u53c2\u6570\u90fd\u662f\u7c7b\u578b\u540d\u6a21\u5f0f\uff0c\u5206\u522b\u4e0e\u51fd\u6570\u7b2c\u4e00\u3001\u7b2c\u4e8c\u7b49\u53c2\u6570\u7684\u7c7b\u578b\u540d\u5339\u914d\u3002\uff08\u5339\u914d\u5230\u7684\u51fd\u6570\u53ef\u4ee5\u6bd4\u4f60\u6307\u5b9a\u7684\u53c2\u6570\u66f4\u591a\uff1b\u82e5\u8981\u9632\u6b62\u8fd9\u79cd\u60c5\u51b5\uff0c\u53ef\u5c06\u8fde\u5b57\u7b26 <code class=\"literal\">-</code> \u5199\u6210\u6700\u540e\u4e00\u4e2a <em class=\"replaceable\"><code>arg_pattern</code></em>\u3002\uff09\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u4f7f\u7528 <code class=\"literal\">\\df+</code> \u5f62\u5f0f\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u51fd\u6570\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u6613\u53d8\u6027\u3001\u5e76\u884c\u5b89\u5168\u6027\u3001\u6240\u6709\u8005\u3001\u5b89\u5168\u5206\u7c7b\u3001\u8bbf\u95ee\u6743\u9650\u3001\u8bed\u8a00\u3001\u5185\u90e8\u540d\u79f0\uff08\u4ec5\u9002\u7528\u4e8e C \u548c internal \u51fd\u6570\uff09\u4ee5\u53ca\u63cf\u8ff0\u3002\u7279\u5b9a\u51fd\u6570\u7684\u6e90\u4ee3\u7801\u53ef\u901a\u8fc7 <code class=\"literal\">\\sf</code> \u67e5\u770b\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DF-UC\"><span class=\"term\"><code class=\"literal\">\\dF[+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u914d\u7f6e\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u914d\u7f6e\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dF+</code>\u5f62\u5f0f\uff0c\u5219\u663e\u793a\u6bcf\u4e2a\u914d\u7f6e\u7684\u5b8c\u6574\u8bf4\u660e\uff0c\u5305\u62ec\u5e95\u5c42\u5168\u6587\u68c0\u7d22\u89e3\u6790\u5668\u548c\u6bcf\u79cd\u89e3\u6790\u5668\u8bcd\u5143\u7c7b\u578b\u7684\u8bcd\u5178\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DFD\"><span class=\"term\"><code class=\"literal\">\\dFd[+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u8bcd\u5178\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bcd\u5178\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dFd+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u9009\u4e2d\u8bcd\u5178\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5e95\u5c42\u5168\u6587\u68c0\u7d22\u6a21\u677f\u548c\u9009\u9879\u503c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DFP\"><span class=\"term\"><code class=\"literal\">\\dFp[+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u89e3\u6790\u5668\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u89e3\u6790\u5668\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dFp+</code>\u5f62\u5f0f\uff0c\u5219\u663e\u793a\u6bcf\u4e2a\u89e3\u6790\u5668\u7684\u5b8c\u6574\u8bf4\u660e\uff0c\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u548c\u53ef\u8bc6\u522b\u7684\u8bcd\u5143\u7c7b\u578b\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DFT\"><span class=\"term\"><code class=\"literal\">\\dFt[+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u6a21\u677f\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6a21\u677f\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dFt+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u6a21\u677f\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u540d\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DG\"><span class=\"term\"><code class=\"literal\">\\dg[S+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u5e93\u89d2\u8272\u3002\uff08\u7531\u4e8e<span class=\"quote\">\u201c<span class=\"quote\">\u7528\u6237</span>\u201d</span>\u548c<span class=\"quote\">\u201c<span class=\"quote\">\u7ec4</span>\u201d</span>\u7684\u6982\u5ff5\u5df2\u7ecf\u7edf\u4e00\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">\u89d2\u8272</span>\u201d</span>\uff0c\u6b64\u547d\u4ee4\u73b0\u5728\u7b49\u4ef7\u4e8e<code class=\"literal\">\\du</code>\u3002\uff09\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u89d2\u8272\uff1b\u63d0\u4f9b<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u89d2\u8272\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u89d2\u8272\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dg+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u89d2\u8272\u7684\u9644\u52a0\u4fe1\u606f\uff1b\u76ee\u524d\u4f1a\u589e\u52a0\u6bcf\u4e2a\u89d2\u8272\u7684\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DL-LC\"><span class=\"term\"><code class=\"literal\">\\dl[+]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u662f <code class=\"command\">\\lo_list</code> \u7684\u522b\u540d\uff0c\u540e\u8005\u4f1a\u663e\u793a\u5927\u5bf9\u8c61\u5217\u8868\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u5217\u51fa\u6bcf\u4e2a\u5927\u5bf9\u8c61\u7684\u76f8\u5173\u6743\u9650\uff08\u5982\u679c\u6709\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DL-UC\"><span class=\"term\"><code class=\"literal\">\\dL[S+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8fc7\u7a0b\u8bed\u8a00\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bed\u8a00\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u8bed\u8a00\uff1b\u63d0\u4f9b <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u79cd\u8bed\u8a00\u90fd\u4f1a\u8fde\u540c\u5176\u8c03\u7528\u5904\u7406\u5668\u3001\u9a8c\u8bc1\u5668\u3001\u8bbf\u95ee\u6743\u9650\u4ee5\u53ca\u5b83\u662f\u5426\u4e3a\u7cfb\u7edf\u5bf9\u8c61\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DN\"><span class=\"term\"><code class=\"literal\">\\dn[S+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6a21\u5f0f\uff08\u547d\u540d\u7a7a\u95f4\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6a21\u5f0f\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u6743\u9650\u548c\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DO-LC\"><span class=\"term\"><code class=\"literal\">\\do[S+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> [ <em class=\"replaceable\"><code>arg_pattern</code></em> [ <em class=\"replaceable\"><code>arg_pattern</code></em> ] ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u64cd\u4f5c\u7b26\u53ca\u5176\u64cd\u4f5c\u6570\u7c7b\u578b\u548c\u7ed3\u679c\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u64cd\u4f5c\u7b26\u3002\u5982\u679c\u6307\u5b9a\u4e86\u4e00\u4e2a <em class=\"replaceable\"><code>arg_pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u5176\u53f3\u53c2\u6570\u7c7b\u578b\u540d\u79f0\u4e0e\u8be5\u6a21\u5f0f\u5339\u914d\u7684\u524d\u7f00\u64cd\u4f5c\u7b26\u3002\u5982\u679c\u6307\u5b9a\u4e86\u4e24\u4e2a <em class=\"replaceable\"><code>arg_pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u53c2\u6570\u7c7b\u578b\u540d\u79f0\u4e0e\u8fd9\u4e9b\u6a21\u5f0f\u5339\u914d\u7684\u4e8c\u5143\u64cd\u4f5c\u7b26\u3002\uff08\u5bf9\u4e8e\u4e00\u5143\u64cd\u4f5c\u7b26\u672a\u4f7f\u7528\u7684\u53c2\u6570\uff0c\u4e5f\u53ef\u4ee5\u5199\u6210 <code class=\"literal\">-</code>\u3002\uff09\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u76ee\u524d\u4ec5\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u540d\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DO-UC\"><span class=\"term\"><code class=\"literal\">\\dO[S+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6392\u5e8f\u89c4\u5219\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6392\u5e8f\u89c4\u5219\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u6392\u5e8f\u89c4\u5219\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u4e00\u8d77\u5217\u51fa\u3002\u8bf7\u6ce8\u610f\uff0c\u53ea\u4f1a\u663e\u793a\u4e0e\u5f53\u524d\u6570\u636e\u5e93\u7f16\u7801\u517c\u5bb9\u7684\u6392\u5e8f\u89c4\u5219\uff0c\u56e0\u6b64\u5728\u540c\u4e00\u5b89\u88c5\u4e2d\u7684\u4e0d\u540c\u6570\u636e\u5e93\u91cc\u7ed3\u679c\u53ef\u80fd\u4e0d\u540c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DP-LC\"><span class=\"term\"><code class=\"literal\">\\dp[S] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u53ca\u5176\u76f8\u5173\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n<p lang=\"zh\"><a class=\"link\" href=\"/docs/17/sql-grant.html\" title=\"GRANT\"><code class=\"command\">GRANT</code></a>\u548c <a class=\"link\" href=\"/docs/17/sql-revoke.html\" title=\"REVOKE\"><code class=\"command\">REVOKE</code></a> \u547d\u4ee4\u7528\u4e8e\u8bbe\u7f6e\u8bbf\u95ee\u6743\u9650\u3002\u6743\u9650\u663e\u793a\u7684\u542b\u4e49\u5728<a class=\"xref\" href=\"/docs/17/ddl-priv.html\" title=\"5.8.\u00a0\u6743\u9650\">\u7b2c\u00a05.8\u00a0\u8282</a>\u4e2d\u6709\u89e3\u91ca\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DP-UC\"><span class=\"term\"><code class=\"literal\">\\dP[itn+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5206\u533a\u5173\u7cfb\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6761\u76ee\u3002\u53ef\u4ee5\u5728\u547d\u4ee4\u540e\u9644\u52a0\u4fee\u9970\u7b26<code class=\"literal\">t</code>\uff08\u8868\uff09\u548c<code class=\"literal\">i</code>\uff08\u7d22\u5f15\uff09\uff0c\u7b5b\u9009\u8981\u5217\u51fa\u7684\u5173\u7cfb\u7c7b\u578b\u3002\u9ed8\u8ba4\u4f1a\u5217\u51fa\u5206\u533a\u8868\u548c\u5206\u533a\u7d22\u5f15\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528\u4e86\u4fee\u9970\u7b26<code class=\"literal\">n</code>\uff08<span class=\"quote\">\u201c<span class=\"quote\">nested</span>\u201d</span>\uff09\uff0c\u6216\u6307\u5b9a\u4e86\u6a21\u5f0f\uff0c\u5219\u4f1a\u5305\u542b\u975e\u6839\u5206\u533a\u5173\u7cfb\uff0c\u5e76\u663e\u793a\u4e00\u5217\uff0c\u5217\u51fa\u6bcf\u4e2a\u5206\u533a\u5173\u7cfb\u7684\u7236\u5173\u7cfb\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u9644\u52a0<code class=\"literal\">+</code>\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u5173\u7cfb\u7684\u5404\u4e2a\u5206\u533a\u7684\u5927\u5c0f\u4e4b\u548c\uff0c\u4ee5\u53ca\u8be5\u5173\u7cfb\u7684\u63cf\u8ff0\u3002\u5982\u679c\u5c06<code class=\"literal\">n</code>\u4e0e<code class=\"literal\">+</code>\u7ed3\u5408\u4f7f\u7528\uff0c\u5219\u663e\u793a\u4e24\u4e2a\u5927\u5c0f\uff1a\u4e00\u4e2a\u662f\u76f4\u63a5\u9644\u52a0\u7684\u53f6\u5b50\u5206\u533a\u7684\u603b\u5927\u5c0f\uff0c\u53e6\u4e00\u4e2a\u662f\u6240\u6709\u5206\u533a\u7684\u603b\u5927\u5c0f\uff0c\u5305\u62ec\u95f4\u63a5\u9644\u52a0\u7684\u5b50\u5206\u533a\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DRDS\"><span class=\"term\"><code class=\"literal\">\\drds [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>role-pattern</code></em></a> [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>database-pattern</code></em></a> ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5df2\u5b9a\u4e49\u7684\u914d\u7f6e\u8bbe\u7f6e\u3002\u8fd9\u4e9b\u8bbe\u7f6e\u53ef\u4ee5\u7279\u5b9a\u4e8e\u89d2\u8272\u3001\u7279\u5b9a\u4e8e\u6570\u636e\u5e93\uff0c\u6216\u540c\u65f6\u7279\u5b9a\u4e8e\u4e24\u8005\u3002<em class=\"replaceable\"><code>role-pattern</code></em>\u548c<em class=\"replaceable\"><code>database-pattern</code></em>\u5206\u522b\u7528\u4e8e\u9009\u62e9\u8981\u5217\u51fa\u7684\u89d2\u8272\u548c\u6570\u636e\u5e93\u3002\u7701\u7565\u67d0\u4e2a\u6a21\u5f0f\u53c2\u6570\u6216\u5c06\u5176\u6307\u5b9a\u4e3a<code class=\"literal\">*</code>\u65f6\uff0c\u4e0d\u4f1a\u6309\u8be5\u53c2\u6570\u7b5b\u9009\uff0c\u8fd8\u4f1a\u5206\u522b\u5305\u542b\u4e0d\u7279\u5b9a\u4e8e\u89d2\u8272\u6216\u4e0d\u7279\u5b9a\u4e8e\u6570\u636e\u5e93\u7684\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\"><a class=\"link\" href=\"/docs/17/sql-alterrole.html\" title=\"ALTER ROLE\"><code class=\"command\">ALTER ROLE</code></a>\u548c <a class=\"link\" href=\"/docs/17/sql-alterdatabase.html\" title=\"ALTER DATABASE\"><code class=\"command\">ALTER DATABASE</code></a> \u547d\u4ee4\u7528\u4e8e\u5b9a\u4e49\u6bcf\u4e2a\u89d2\u8272\u548c\u6bcf\u4e2a\u6570\u636e\u5e93\u7684\u914d\u7f6e\u8bbe\u7f6e\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DRG\"><span class=\"term\"><code class=\"literal\">\\drg[S] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u6bcf\u4e2a\u88ab\u6388\u4e88\u89d2\u8272\u6210\u5458\u8eab\u4efd\u7684\u4fe1\u606f\uff0c\u5305\u62ec\u88ab\u6388\u4e88\u7684\u9009\u9879\uff08<code class=\"literal\">ADMIN</code>\u3001<code class=\"literal\">INHERIT</code> \u548c/\u6216 <code class=\"literal\">SET</code>\uff09\u4ee5\u53ca\u6388\u4e88\u8005\u3002\u5173\u4e8e\u89d2\u8272\u6210\u5458\u8eab\u4efd\uff0c\u53c2\u89c1 <a class=\"link\" href=\"/docs/17/sql-grant.html\" title=\"GRANT\"><code class=\"command\">GRANT</code></a> \u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u6388\u4e88\u7528\u6237\u521b\u5efa\u89d2\u8272\u7684\u6210\u5458\u8eab\u4efd\uff1b\u63d0\u4f9b <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u89d2\u8272\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u6388\u4e88\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u89d2\u8272\u7684\u6210\u5458\u8eab\u4efd\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DRP\"><span class=\"term\"><code class=\"literal\">\\dRp[+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u903b\u8f91\u590d\u5236\u53d1\u5e03\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u53d1\u5e03\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u8fd8\u4f1a\u663e\u793a\u4e0e\u6bcf\u4e2a\u53d1\u5e03\u5173\u8054\u7684\u8868\u548c\u6a21\u5f0f\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DRS\"><span class=\"term\"><code class=\"literal\">\\dRs[+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u903b\u8f91\u590d\u5236\u8ba2\u9605\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8ba2\u9605\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u8ba2\u9605\u7684\u5176\u4ed6\u5c5e\u6027\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DT\"><span class=\"term\"><code class=\"literal\">\\dT[S+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u7c7b\u578b\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u7c7b\u578b\u90fd\u4f1a\u8fde\u540c\u5176\u5185\u90e8\u540d\u79f0\u3001\u5927\u5c0f\u4ee5\u53ca\u76f8\u5173\u6743\u9650\u4e00\u8d77\u5217\u51fa\uff1b\u5bf9\u4e8e <code class=\"type\">enum</code> \u7c7b\u578b\uff0c\u8fd8\u4f1a\u663e\u793a\u5176\u5141\u8bb8\u503c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DU\"><span class=\"term\"><code class=\"literal\">\\du[S+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u5e93\u89d2\u8272\u3002\uff08\u7531\u4e8e<span class=\"quote\">\u201c<span class=\"quote\">\u7528\u6237</span>\u201d</span>\u548c<span class=\"quote\">\u201c<span class=\"quote\">\u7ec4</span>\u201d</span>\u7684\u6982\u5ff5\u5df2\u7ecf\u7edf\u4e00\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">\u89d2\u8272</span>\u201d</span>\uff0c\u6b64\u547d\u4ee4\u73b0\u5728\u7b49\u4ef7\u4e8e<code class=\"literal\">\\dg</code>\u3002\uff09\u9ed8\u8ba4\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u89d2\u8272\uff1b\u63d0\u4f9b<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u53ef\u5305\u542b\u7cfb\u7edf\u89d2\u8272\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u89d2\u8272\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\du+</code>\u5f62\u5f0f\uff0c\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u89d2\u8272\u7684\u9644\u52a0\u4fe1\u606f\uff1b\u76ee\u524d\u4f1a\u589e\u52a0\u6bcf\u4e2a\u89d2\u8272\u7684\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DX-LC\"><span class=\"term\"><code class=\"literal\">\\dx[+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5df2\u5b89\u88c5\u7684\u6269\u5c55\u3002\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u6269\u5c55\u3002\u5982\u679c\u4f7f\u7528<code class=\"literal\">\\dx+</code>\u5f62\u5f0f\uff0c\u5219\u5217\u51fa\u5c5e\u4e8e\u6bcf\u4e2a\u5339\u914d\u6269\u5c55\u7684\u6240\u6709\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DX-UC\"><span class=\"term\"><code class=\"literal\">\\dX [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u6269\u5c55\u7edf\u8ba1\u4fe1\u606f\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6269\u5c55\u7edf\u8ba1\u4fe1\u606f\u3002</p>\n<p lang=\"zh\">\u6bcf\u79cd\u6269\u5c55\u7edf\u8ba1\u7684\u72b6\u6001\u663e\u793a\u5728\u4ee5\u7edf\u8ba1\u79cd\u7c7b\u547d\u540d\u7684\u5217\u4e2d\uff0c\u4f8b\u5982 Ndistinct\u3002defined \u8868\u793a\u521b\u5efa\u7edf\u8ba1\u65f6\u8bf7\u6c42\u4e86\u8be5\u7edf\u8ba1\uff0cNULL \u8868\u793a\u672a\u8bf7\u6c42\u3002\u82e5\u8981\u5224\u65ad ANALYZE \u662f\u5426\u8fd0\u884c\u8fc7\u3001\u7edf\u8ba1\u662f\u5426\u53ef\u4f9b\u89c4\u5212\u5668\u4f7f\u7528\uff0c\u53ef\u67e5\u8be2 pg_stats_ext\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DY\"><span class=\"term\"><code class=\"literal\">\\dy[+] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u4e8b\u4ef6\u89e6\u53d1\u5668\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u4e8b\u4ef6\u89e6\u53d1\u5668\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-EDIT\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\e</code> \u6216 <code class=\"literal\">\\edit</code> <code class=\"literal\">[ <span class=\"optional\"><em class=\"replaceable\"><code>filename</code></em></span> ] [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5219\u7f16\u8f91\u8be5\u6587\u4ef6\uff1b\u7f16\u8f91\u5668\u9000\u51fa\u540e\uff0c\u6587\u4ef6\u5185\u5bb9\u5c06\u88ab\u590d\u5236\u5230\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5219\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u590d\u5236\u5230\u4e34\u65f6\u6587\u4ef6\u4e2d\uff0c\u7136\u540e\u4ee5\u76f8\u540c\u65b9\u5f0f\u8fdb\u884c\u7f16\u8f91\u3002\u6216\u8005\uff0c\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u5c06\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u590d\u5236\u5230\u4e34\u65f6\u6587\u4ef6\u4e2d\uff0c\u5e76\u4ee5\u76f8\u540c\u65b9\u5f0f\u8fdb\u884c\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7f16\u8f91\u6587\u4ef6\u6216\u4e0a\u4e00\u4e2a\u67e5\u8be2\u540e\u5728\u672a\u4fee\u6539\u6587\u4ef6\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5219\u67e5\u8be2\u7f13\u51b2\u533a\u5c06\u88ab\u6e05\u9664\u3002\u5426\u5219\uff0c\u67e5\u8be2\u7f13\u51b2\u533a\u7684\u65b0\u5185\u5bb9\u5c06\u6839\u636e<span class=\"application\">psql</span>\u7684\u6b63\u5e38\u89c4\u5219\u91cd\u65b0\u89e3\u6790\uff0c\u5c06\u6574\u4e2a\u7f13\u51b2\u533a\u89c6\u4e3a\u5355\u884c\u3002\u4efb\u4f55\u5b8c\u6574\u7684\u67e5\u8be2\u5c06\u7acb\u5373\u6267\u884c\uff1b\u4e5f\u5c31\u662f\u8bf4\uff0c\u5982\u679c\u67e5\u8be2\u7f13\u51b2\u533a\u5305\u542b\u5206\u53f7\u6216\u4ee5\u5206\u53f7\u7ed3\u5c3e\uff0c\u5219\u6267\u884c\u5e76\u4ece\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u5220\u9664\u5230\u8be5\u70b9\u7684\u6240\u6709\u5185\u5bb9\u3002\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u5269\u4f59\u7684\u5185\u5bb9\u5c06\u91cd\u65b0\u663e\u793a\u3002\u8f93\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u8f93\u5165<code class=\"literal\">\\r</code>\u901a\u8fc7\u6e05\u9664\u67e5\u8be2\u7f13\u51b2\u533a\u6765\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u5c06\u7f13\u51b2\u533a\u89c6\u4e3a\u5355\u884c\u4e3b\u8981\u5f71\u54cd\u5143\u547d\u4ee4\uff1a\u5728\u5143\u547d\u4ee4\u540e\u7684\u7f13\u51b2\u533a\u5c06\u88ab\u89c6\u4e3a\u5143\u547d\u4ee4\u7684\u53c2\u6570\uff0c\u5373\u4f7f\u5b83\u8de8\u8d8a\u591a\u884c\u3002\uff08\u56e0\u6b64\uff0c\u4e0d\u80fd\u7528\u8fd9\u79cd\u65b9\u5f0f\u521b\u5efa\u4f7f\u7528\u5143\u547d\u4ee4\u7684\u811a\u672c\u3002\u8bf7\u4f7f\u7528<code class=\"command\">\\i</code>\u3002\uff09</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u5c06\u5149\u6807\u5b9a\u4f4d\u5728\u6587\u4ef6\u6216\u67e5\u8be2\u7f13\u51b2\u533a\u7684\u6307\u5b9a\u884c\u4e0a\u3002\u8bf7\u6ce8\u610f\uff0c\u5982\u679c\u53ea\u7ed9\u51fa\u4e00\u4e2a\u5168\u662f\u6570\u5b57\u7684\u53c2\u6570\uff0c<span class=\"application\">psql</span>\u4f1a\u5047\u5b9a\u5b83\u662f\u4e00\u4e2a\u884c\u53f7\uff0c\u800c\u4e0d\u662f\u6587\u4ef6\u540d\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5173\u4e8e\u5982\u4f55\u914d\u7f6e\u548c\u81ea\u5b9a\u4e49\u7f16\u8f91\u5668\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/17/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"\u73af\u5883\">\u73af\u5883</a>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-ECHO\"><span class=\"term\"><code class=\"literal\">\\echo <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6c42\u503c\u540e\u7684\u53c2\u6570\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff0c\u7528\u7a7a\u683c\u5206\u9694\uff0c\u5e76\u5728\u672b\u5c3e\u52a0\u4e0a\u6362\u884c\u7b26\u3002\u8fd9\u5bf9\u4e8e\u5728\u811a\u672c\u8f93\u51fa\u4e2d\u7a7f\u63d2\u4fe1\u606f\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>\\echo `date`</code></strong>\nTue Oct 26 21:40:57 CEST 1999\n</pre>\n<p lang=\"zh\">\u5982\u679c\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f\u672a\u52a0\u5f15\u53f7\u7684<code class=\"literal\">-n</code>\uff0c\u5219\u4e0d\u4f1a\u5199\u5165\u5c3e\u968f\u7684\u6362\u884c\u7b26\uff08\u4e5f\u4e0d\u4f1a\u5199\u5165\u7b2c\u4e00\u4e2a\u53c2\u6570\uff09\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528<code class=\"command\">\\o</code>\u547d\u4ee4\u91cd\u5b9a\u5411\u67e5\u8be2\u8f93\u51fa\uff0c\u53ef\u80fd\u4f1a\u60f3\u7528<code class=\"command\">\\qecho</code>\u4ee3\u66ff\u8fd9\u4e2a\u547d\u4ee4\u3002\u53e6\u8bf7\u53c2\u9605<code class=\"command\">\\warn</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-EF\"><span class=\"term\"><code class=\"literal\">\\ef [ <span class=\"optional\"><em class=\"replaceable\"><code>function_description</code></em> [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</span> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u7f16\u8f91\u6307\u5b9a\u51fd\u6570\u6216\u8fc7\u7a0b\u7684\u5b9a\u4e49\uff0c\u5f62\u5f0f\u4e3a<code class=\"command\">CREATE OR REPLACE FUNCTION</code>\u6216 <code class=\"command\">CREATE OR REPLACE PROCEDURE</code>\u547d\u4ee4\u3002\u7f16\u8f91\u65b9\u5f0f\u4e0e<code class=\"literal\">\\edit</code>\u76f8\u540c\u3002\u5982\u679c\u5728\u4e0d\u4fdd\u5b58\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5219\u8be5\u8bed\u53e5\u4f1a\u88ab\u4e22\u5f03\u3002\u5982\u679c\u4fdd\u5b58\u5e76\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5e76\u5728\u5176\u4e2d\u6dfb\u52a0\u4e86\u5206\u53f7\uff0c\u5219\u66f4\u65b0\u540e\u7684\u547d\u4ee4\u4f1a\u7acb\u5373\u6267\u884c\u3002\u5426\u5219\u5b83\u4f1a\u91cd\u65b0\u663e\u793a\uff1b\u952e\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u7528<code class=\"literal\">\\r</code>\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u76ee\u6807\u51fd\u6570\u53ef\u4ec5\u7528\u540d\u79f0\u6307\u5b9a\uff0c\u4e5f\u53ef\u7528\u540d\u79f0\u548c\u53c2\u6570\u6307\u5b9a\uff0c\u4f8b\u5982 foo(integer, text)\u3002\u82e5\u6709\u591a\u4e2a\u540c\u540d\u51fd\u6570\uff0c\u5219\u5fc5\u987b\u63d0\u4f9b\u53c2\u6570\u7c7b\u578b\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u51fd\u6570\uff0c\u5219\u4f1a\u5448\u73b0\u4e00\u4e2a\u7a7a\u7684<code class=\"command\">CREATE FUNCTION</code>\u6a21\u677f\u4f9b\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u5c06\u5149\u6807\u5b9a\u4f4d\u5728\u51fd\u6570\u4f53\u7684\u6307\u5b9a\u884c\u4e0a\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u51fd\u6570\u4f53\u901a\u5e38\u4e0d\u4f1a\u4ece\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u5f00\u59cb\u3002\uff09</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\ef</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5173\u4e8e\u5982\u4f55\u914d\u7f6e\u548c\u81ea\u5b9a\u4e49\u7f16\u8f91\u5668\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/17/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"\u73af\u5883\">\u73af\u5883</a>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-ENCODING\"><span class=\"term\"><code class=\"literal\">\\encoding [ <em class=\"replaceable\"><code>encoding</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5ba2\u6237\u7aef\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u6ca1\u6709\u53c2\u6570\u65f6\uff0c\u6b64\u547d\u4ee4\u663e\u793a\u5f53\u524d\u7f16\u7801\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-ERRVERBOSE\"><span class=\"term\"><code class=\"literal\">\\errverbose</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ee5\u6700\u5927\u7684\u8be6\u7ec6\u7a0b\u5ea6\u91cd\u590d\u6700\u8fd1\u7684\u670d\u52a1\u5668\u9519\u8bef\u6d88\u606f\uff0c\u5c31\u597d\u50cf<code class=\"varname\">VERBOSITY</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">verbose</code>\uff0c<code class=\"varname\">SHOW_CONTEXT</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">always</code>\u4e00\u6837\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-EV\"><span class=\"term\"><code class=\"literal\">\\ev [ <span class=\"optional\"><em class=\"replaceable\"><code>view_name</code></em> [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</span> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u7f16\u8f91\u6307\u5b9a\u89c6\u56fe\u7684\u5b9a\u4e49\uff0c\u5f62\u5f0f\u4e3a<code class=\"command\">CREATE OR REPLACE VIEW</code>\u547d\u4ee4\u3002\u7f16\u8f91\u65b9\u5f0f\u4e0e<code class=\"literal\">\\edit</code>\u76f8\u540c\u3002\u5982\u679c\u5728\u4e0d\u4fdd\u5b58\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5219\u8be5\u8bed\u53e5\u4f1a\u88ab\u4e22\u5f03\u3002\u5982\u679c\u4fdd\u5b58\u5e76\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5e76\u5728\u5176\u4e2d\u6dfb\u52a0\u4e86\u5206\u53f7\uff0c\u5219\u66f4\u65b0\u540e\u7684\u547d\u4ee4\u4f1a\u7acb\u5373\u6267\u884c\uff1b\u5426\u5219\u5c06\u91cd\u65b0\u663e\u793a\uff1b\u8f93\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u7528<code class=\"literal\">\\r</code>\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u89c6\u56fe\uff0c\u5219\u4f1a\u5448\u73b0\u4e00\u4e2a\u7a7a\u7684<code class=\"command\">CREATE VIEW</code>\u6a21\u677f\u4f9b\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u5c06\u5149\u6807\u5b9a\u4f4d\u5728\u89c6\u56fe\u5b9a\u4e49\u7684\u6307\u5b9a\u884c\u4e0a\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\ev</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-F\"><span class=\"term\"><code class=\"literal\">\\f [ <em class=\"replaceable\"><code>string</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u67e5\u8be2\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u9ed8\u8ba4\u503c\u662f\u7ad6\u7ebf\uff08<code class=\"literal\">|</code>\uff09\u3002\u5b83\u7b49\u540c\u4e8e<code class=\"command\">\\pset fieldsep</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-G\"><span class=\"term\"><code class=\"literal\">\\g [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\g [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u6267\u884c\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728<code class=\"literal\">\\g</code>\u540e\u9762\u51fa\u73b0\u62ec\u53f7\uff0c\u5219\u62ec\u53f7\u4e2d\u662f\u7528\u7a7a\u683c\u5206\u9694\u7684<em class=\"replaceable\"><code>option</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em>\u683c\u5f0f\u9009\u9879\u5b50\u53e5\u5217\u8868\u3002\u8fd9\u4e9b\u5b50\u53e5\u7684\u89e3\u91ca\u65b9\u5f0f\u4e0e<code class=\"literal\">\\pset</code> <em class=\"replaceable\"><code>option</code></em> <em class=\"replaceable\"><code>value</code></em>\u547d\u4ee4\u76f8\u540c\uff0c\u4f46\u4ec5\u5728\u6b64\u67e5\u8be2\u6267\u884c\u671f\u95f4\u751f\u6548\u3002\u5728\u6b64\u5217\u8868\u4e2d\uff0c<code class=\"literal\">=</code>\u7b26\u53f7\u5468\u56f4\u4e0d\u5141\u8bb8\u6709\u7a7a\u683c\uff0c\u4f46\u9009\u9879\u5b50\u53e5\u4e4b\u95f4\u5fc5\u987b\u6709\u7a7a\u683c\u3002\u5982\u679c<code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em>\u88ab\u7701\u7565\uff0c\u5219\u6307\u5b9a\u7684<em class=\"replaceable\"><code>option</code></em>\u4f1a\u6309\u4ee5\u4e0b\u547d\u4ee4\u7684\u65b9\u5f0f\u66f4\u6539\uff1a<code class=\"literal\">\\pset</code> <em class=\"replaceable\"><code>option</code></em>\uff0c\u5176\u4e2d\u4e0d\u663e\u5f0f\u6307\u5b9a<em class=\"replaceable\"><code>value</code></em>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7ed9\u51fa\u4e86<em class=\"replaceable\"><code>filename</code></em>\u6216<code class=\"literal\">|</code><em class=\"replaceable\"><code>command</code></em>\u53c2\u6570\uff0c\u67e5\u8be2\u8f93\u51fa\u5c31\u4f1a\u5199\u5165\u6307\u5b9a\u6587\u4ef6\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6307\u5b9a\u7684 shell \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u7167\u5e38\u663e\u793a\u3002\u53ea\u6709\u5f53\u67e5\u8be2\u6210\u529f\u8fd4\u56de\u96f6\u4e2a\u6216\u591a\u4e2a\u5143\u7ec4\u65f6\uff0c\u624d\u4f1a\u5411\u6587\u4ef6\u6216\u547d\u4ee4\u5199\u5165\uff1b\u5982\u679c\u67e5\u8be2\u5931\u8d25\uff0c\u6216\u6267\u884c\u7684\u662f\u4e0d\u8fd4\u56de\u6570\u636e\u7684 SQL \u547d\u4ee4\uff0c\u5219\u4e0d\u4f1a\u5199\u5165\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u5c06\u88ab\u91cd\u65b0\u6267\u884c\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u6ca1\u6709\u4efb\u4f55\u53c2\u6570\u7684<code class=\"literal\">\\g</code>\u57fa\u672c\u4e0a\u7b49\u540c\u4e8e\u4e00\u4e2a\u5206\u53f7\u3002\u5e26\u6709\u53c2\u6570\u7684<code class=\"literal\">\\g</code>\u63d0\u4f9b\u4e86\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u4e00\u6b21\u6027</span>\u201d</span>\u66ff\u4ee3<code class=\"command\">\\o</code>\u547d\u4ee4\u7684\u9009\u62e9\uff0c\u5e76\u4e14\u8fd8\u5141\u8bb8\u4e00\u6b21\u6027\u8c03\u6574\u901a\u5e38\u7531<code class=\"literal\">\\pset</code>\u8bbe\u7f6e\u7684\u8f93\u51fa\u683c\u5f0f\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u5f53\u6700\u540e\u4e00\u4e2a\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\u65f6\uff0c\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u90fd\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u65e2\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\uff0c\u4e5f\u4e0d\u8fdb\u884c\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u90e8\u5206\u4f1a\u76f4\u63a5\u6309\u5b57\u9762\u4f20\u7ed9 shell\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-GDESC\"><span class=\"term\"><code class=\"literal\">\\gdesc</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u663e\u793a\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u67e5\u8be2\u7ed3\u679c\u7684\u63cf\u8ff0\uff08\u5373\u5217\u540d\u548c\u6570\u636e\u7c7b\u578b\uff09\u3002\u67e5\u8be2\u5e76\u4e0d\u4f1a\u5b9e\u9645\u6267\u884c\uff1b\u4e0d\u8fc7\uff0c\u5982\u679c\u5176\u4e2d\u5b58\u5728\u8bed\u6cd5\u9519\u8bef\uff0c\u4f1a\u6309\u901a\u5e38\u7684\u65b9\u5f0f\u62a5\u544a\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6539\u4e3a\u63cf\u8ff0\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-GETENV\"><span class=\"term\"><code class=\"literal\">\\getenv <em class=\"replaceable\"><code>psql_var</code></em> <em class=\"replaceable\"><code>env_var</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u83b7\u53d6\u73af\u5883\u53d8\u91cf<em class=\"replaceable\"><code>env_var</code></em>\u7684\u503c\uff0c\u5e76\u5c06\u5176\u8d4b\u7ed9<span class=\"application\">psql</span>\u53d8\u91cf<em class=\"replaceable\"><code>psql_var</code></em>\u3002\u5982\u679c<em class=\"replaceable\"><code>env_var</code></em>\u5728<span class=\"application\">psql</span>\u8fdb\u7a0b\u7684\u73af\u5883\u4e2d\u672a\u5b9a\u4e49\uff0c<em class=\"replaceable\"><code>psql_var</code></em>\u4e0d\u4f1a\u88ab\u6539\u53d8\u3002\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>\\getenv home HOME</code></strong>\n=&gt; <strong class=\"userinput\"><code>\\echo :home</code></strong>\n/home/postgres\n</pre>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-GEXEC\"><span class=\"term\"><code class=\"literal\">\\gexec</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u7136\u540e\u5c06\u67e5\u8be2\u8f93\u51fa\u7684\u6bcf\u884c\u6bcf\u5217\u89c6\u4e3a\u8981\u6267\u884c\u7684SQL\u8bed\u53e5\u3002\u4f8b\u5982\uff0c\u8981\u5728<code class=\"structname\">my_table</code>\u7684\u6bcf\u4e00\u5217\u4e0a\u521b\u5efa\u7d22\u5f15\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT format('create index on my_table(%I)', attname)</code></strong>\n-&gt; <strong class=\"userinput\"><code>FROM pg_attribute</code></strong>\n-&gt; <strong class=\"userinput\"><code>WHERE attrelid = 'my_table'::regclass AND attnum &gt; 0</code></strong>\n-&gt; <strong class=\"userinput\"><code>ORDER BY attnum</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gexec</code></strong>\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\n</pre>\n<p lang=\"zh\">\u751f\u6210\u7684\u67e5\u8be2\u6309\u8fd4\u56de\u884c\u7684\u987a\u5e8f\u6267\u884c\uff1b\u540c\u4e00\u884c\u6709\u591a\u5217\u65f6\u4ece\u5de6\u5230\u53f3\u6267\u884c\uff0c\u5ffd\u7565 NULL \u5b57\u6bb5\u3002\u67e5\u8be2\u539f\u6837\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u56e0\u6b64\u4e0d\u80fd\u662f psql \u5143\u547d\u4ee4\uff0c\u4e5f\u4e0d\u80fd\u5305\u542b psql \u53d8\u91cf\u5f15\u7528\u3002\u9664\u975e\u8bbe\u7f6e ON_ERROR_STOP\uff0c\u67d0\u6761\u67e5\u8be2\u5931\u8d25\u540e\u4ecd\u7ee7\u7eed\u6267\u884c\u5176\u4f59\u67e5\u8be2\u3002\u6bcf\u6761\u67e5\u8be2\u5747\u9075\u5faa ECHO \u8bbe\u7f6e\uff08\u4f7f\u7528 \\gexec \u65f6\uff0c\u901a\u5e38\u5efa\u8bae\u5c06 ECHO \u8bbe\u4e3a all \u6216 queries\uff09\uff0c\u67e5\u8be2\u65e5\u5fd7\u3001\u5355\u6b65\u6a21\u5f0f\u3001\u8ba1\u65f6\u7b49\u6267\u884c\u529f\u80fd\u4e5f\u5206\u522b\u5e94\u7528\u4e8e\u6bcf\u6761\u751f\u6210\u7684\u67e5\u8be2\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-GSET\"><span class=\"term\"><code class=\"literal\">\\gset [ <em class=\"replaceable\"><code>prefix</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u5e76\u5c06\u67e5\u8be2\u8f93\u51fa\u5b58\u5165 <span class=\"application\">psql</span> \u53d8\u91cf\uff08\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/17/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\uff09\u3002\u8981\u6267\u884c\u7684\u67e5\u8be2\u5fc5\u987b\u6070\u597d\u8fd4\u56de\u4e00\u884c\u3002\u8be5\u884c\u7684\u6bcf\u4e00\u5217\u5206\u522b\u5b58\u5165\u4e00\u4e2a\u53d8\u91cf\uff0c\u53d8\u91cf\u540d\u4e0e\u5217\u540d\u76f8\u540c\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT 'hello' AS var1, 10 AS var2</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gset</code></strong>\n=&gt; <strong class=\"userinput\"><code>\\echo :var1 :var2</code></strong>\nhello 10\n</pre>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>prefix</code></em>\uff0c\u5219\u4f1a\u5c06\u8be5\u5b57\u7b26\u4e32\u52a0\u5230\u67e5\u8be2\u7684\u5217\u540d\u524d\u9762\uff0c\u4ee5\u6784\u6210\u8981\u4f7f\u7528\u7684\u53d8\u91cf\u540d\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT 'hello' AS var1, 10 AS var2</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gset result_</code></strong>\n=&gt; <strong class=\"userinput\"><code>\\echo :result_var1 :result_var2</code></strong>\nhello 10\n</pre>\n<p lang=\"zh\">\u5982\u679c\u67d0\u4e00\u5217\u7684\u7ed3\u679c\u4e3a NULL\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u5bf9\u5e94\u7684\u53d8\u91cf\uff0c\u800c\u4e0d\u662f\u8bbe\u7f6e\u5b83\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u67e5\u8be2\u5931\u8d25\u6216\u6ca1\u6709\u6070\u597d\u8fd4\u56de\u4e00\u884c\uff0c\u5219\u4e0d\u4f1a\u66f4\u6539\u4efb\u4f55\u53d8\u91cf\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-GX\"><span class=\"term\"><code class=\"literal\">\\gx [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\gx [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\\gx \u4e0e \\g \u7b49\u4ef7\uff0c\u4f46\u4f1a\u5f3a\u5236\u6b64\u67e5\u8be2\u4f7f\u7528\u6269\u5c55\u8f93\u51fa\u6a21\u5f0f\uff0c\u76f8\u5f53\u4e8e\u5728 \\pset \u9009\u9879\u5217\u8868\u4e2d\u6307\u5b9a expanded=on\u3002\u53e6\u89c1 \\x\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-HELP\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\h</code>\u6216<code class=\"literal\">\\help</code> <code class=\"literal\">[ <em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u7ed9\u51fa\u6307\u5b9a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u7684\u8bed\u6cd5\u5e2e\u52a9\u3002\u5982\u679c\u672a\u6307\u5b9a<em class=\"replaceable\"><code>command</code></em>\uff0c\u5219<span class=\"application\">psql</span>\u5c06\u5217\u51fa\u6240\u6709\u53ef\u7528\u8bed\u6cd5\u5e2e\u52a9\u7684\u547d\u4ee4\u3002\u5982\u679c<em class=\"replaceable\"><code>command</code></em>\u662f\u661f\u53f7\uff08<code class=\"literal\">*</code>\uff09\uff0c\u5219\u663e\u793a\u6240\u6709<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u7684\u8bed\u6cd5\u5e2e\u52a9\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\help</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u4e3a\u4e86\u7b80\u5316\u8f93\u5165\uff0c\u7531\u591a\u4e2a\u5355\u8bcd\u7ec4\u6210\u7684\u547d\u4ee4\u4e0d\u9700\u8981\u52a0\u5f15\u53f7\u3002\u56e0\u6b64\uff0c\u53ef\u4ee5\u76f4\u63a5\u8f93\u5165<strong class=\"userinput\"><code>\\help alter table</code></strong>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-HTML\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\H</code> \u6216 <code class=\"literal\">\\html</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5f00<acronym class=\"acronym\">HTML</acronym>\u67e5\u8be2\u8f93\u51fa\u683c\u5f0f\u3002\u5982\u679c<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u5df2\u7ecf\u6253\u5f00\uff0c\u5219\u5207\u6362\u56de\u9ed8\u8ba4\u7684\u5bf9\u9f50\u6587\u672c\u683c\u5f0f\u3002\u6b64\u547d\u4ee4\u662f\u4e3a\u517c\u5bb9\u6027\u548c\u4fbf\u5229\u6027\u800c\u4fdd\u7559\u7684\uff1b\u8bbe\u7f6e\u5176\u4ed6\u8f93\u51fa\u9009\u9879\u7684\u65b9\u6cd5\u89c1<code class=\"command\">\\pset</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-INCLUDE\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\i</code> \u6216 <code class=\"literal\">\\include</code> <em class=\"replaceable\"><code>filename</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u8bfb\u53d6\u8f93\u5165\uff0c\u5e76\u50cf\u5728\u952e\u76d8\u4e0a\u8f93\u5165\u4e00\u6837\u6267\u884c\u5b83\u3002</p>\n<p lang=\"zh\">\u5982\u679c<em class=\"replaceable\"><code>filename</code></em>\u662f<code class=\"literal\">-</code>\uff08\u8fde\u5b57\u7b26\uff09\uff0c\u5219\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\uff0c\u76f4\u5230\u9047\u5230 EOF \u6307\u793a\u6216<code class=\"command\">\\q</code>\u5143\u547d\u4ee4\u3002\u8fd9\u53ef\u7528\u4e8e\u5c06\u4ea4\u4e92\u5f0f\u8f93\u5165\u4e0e\u6587\u4ef6\u8f93\u5165\u4ea4\u9519\u4f7f\u7528\u3002\u8bf7\u6ce8\u610f\uff0c\u53ea\u6709\u5728\u6700\u5916\u5c42\u542f\u7528\u4e86 Readline\uff0c\u6b64\u5904\u624d\u4f1a\u4f7f\u7528 Readline \u529f\u80fd\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5982\u679c\u60f3\u5728\u5c4f\u5e55\u4e0a\u770b\u5230\u88ab\u8bfb\u5165\u7684\u5404\u884c\uff0c\u8bf7\u5c06\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">all</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"PSQL-METACOMMAND-IF\"><span class=\"term\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\elif</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\else</code><br/></span><span class=\"term\"><code class=\"literal\">\\endif</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u7ec4\u547d\u4ee4\u5b9e\u73b0\u4e86\u53ef\u5d4c\u5957\u7684\u6761\u4ef6\u5757\u3002\u6761\u4ef6\u5757\u5fc5\u987b\u4ee5<code class=\"command\">\\if</code>\u5f00\u59cb\uff0c\u5e76\u4ee5<code class=\"command\">\\endif</code>\u7ed3\u675f\u3002\u5728\u4e24\u8005\u4e4b\u95f4\u53ef\u4ee5\u6709\u4efb\u610f\u6570\u91cf\u7684<code class=\"command\">\\elif</code>\u5b50\u53e5\uff0c\u540e\u9762\u53ef\u4ee5\u9009\u62e9\u6027\u5730\u8ddf\u7740\u4e00\u4e2a<code class=\"command\">\\else</code>\u5b50\u53e5\u3002\u5728\u5f62\u6210\u6761\u4ef6\u5757\u7684\u547d\u4ee4\u4e4b\u95f4\u901a\u5e38\u4f1a\u51fa\u73b0\u666e\u901a\u67e5\u8be2\u548c\u5176\u4ed6\u7c7b\u578b\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\\if \u548c \\elif \u8bfb\u53d6\u53c2\u6570\u5e76\u5c06\u5176\u4f5c\u4e3a\u5e03\u5c14\u8868\u8fbe\u5f0f\u6c42\u503c\u3002\u7ed3\u679c\u4e3a\u771f\u65f6\u7ee7\u7eed\u6b63\u5e38\u5904\u7406\uff0c\u5426\u5219\u8df3\u8fc7\u540e\u7eed\u884c\uff0c\u76f4\u5230\u9047\u5230\u5339\u914d\u7684 \\elif\u3001\\else \u6216 \\endif\u3002\u67d0\u4e2a \\if \u6216 \\elif \u6761\u4ef6\u6210\u7acb\u540e\uff0c\u540c\u4e00\u5757\u4e2d\u540e\u7eed \\elif \u7684\u53c2\u6570\u4e0d\u518d\u6c42\u503c\uff0c\u76f4\u63a5\u89c6\u4e3a\u5047\u3002\u53ea\u6709\u4e4b\u524d\u5339\u914d\u7684 \\if \u548c \\elif \u5747\u672a\u6210\u7acb\uff0c\u624d\u5904\u7406 \\else \u540e\u7684\u884c\u3002</p>\n<p lang=\"zh\">\u4e0e\u5176\u4ed6\u53cd\u659c\u6760\u547d\u4ee4\u53c2\u6570\u4e00\u6837\uff0c\\if \u6216 \\elif \u7684\u8868\u8fbe\u5f0f\u53c2\u6570\u5148\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u548c\u53cd\u5f15\u53f7\u5c55\u5f00\uff0c\u7136\u540e\u50cf\u5f00\u5173\u9009\u9879\u53d8\u91cf\u4e00\u6837\u6c42\u503c\u3002\u6709\u6548\u503c\u4e3a true\u3001false\u30011\u30010\u3001on\u3001off\u3001yes\u3001no \u7684\u4efb\u610f\u65e0\u6b67\u4e49\u3001\u4e0d\u533a\u5206\u5927\u5c0f\u5199\u7684\u5339\u914d\u3002\u4f8b\u5982 t\u3001T \u548c tR \u90fd\u4f1a\u89c6\u4e3a\u771f\u3002</p>\n<p lang=\"zh\">\u4e0d\u80fd\u6b63\u786e\u6c42\u503c\u4e3a\u771f\u6216\u5047\u7684\u8868\u8fbe\u5f0f\u4f1a\u4ea7\u751f\u8b66\u544a\uff0c\u5e76\u88ab\u89c6\u4e3a\u5047\u3002</p>\n<p lang=\"zh\">\u88ab\u8df3\u8fc7\u7684\u884c\u4f1a\u88ab\u6b63\u5e38\u89e3\u6790\u4ee5\u8bc6\u522b\u67e5\u8be2\u548c\u53cd\u659c\u7ebf\u547d\u4ee4\uff0c\u4f46\u67e5\u8be2\u4e0d\u4f1a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u4e14\u9664\u4e86\u6761\u4ef6\u547d\u4ee4\uff08<code class=\"command\">\\if</code>\u3001<code class=\"command\">\\elif</code>\u3001<code class=\"command\">\\else</code>\u3001<code class=\"command\">\\endif</code>\uff09\u4e4b\u5916\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u4f1a\u88ab\u5ffd\u7565\u3002\u4ec5\u68c0\u67e5\u8df3\u8fc7\u884c\u4e2d\u6761\u4ef6\u547d\u4ee4\u7684\u6709\u6548\u5d4c\u5957\u3002\u8df3\u8fc7\u884c\u4e2d\u7684\u53d8\u91cf\u5f15\u7528\u4e0d\u4f1a\u88ab\u5c55\u5f00\uff0c\u4e5f\u4e0d\u4f1a\u6267\u884c\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<p lang=\"zh\">\u540c\u4e00\u4e2a\u6761\u4ef6\u5757\u7684\u6240\u6709\u53cd\u659c\u7ebf\u547d\u4ee4\u5fc5\u987b\u51fa\u73b0\u5728\u540c\u4e00\u4e2a\u6e90\u6587\u4ef6\u4e2d\u3002\u5982\u679c\u4e3b\u8f93\u5165\u6587\u4ef6\u6216\u901a\u8fc7<code class=\"command\">\\include</code>\u5f15\u5165\u7684\u6587\u4ef6\u5230\u8fbe EOF \u65f6\uff0c\u4ecd\u6709\u672c\u5730<code class=\"command\">\\if</code>\u5757\u672a\u5173\u95ed\uff0c<span class=\"application\">psql</span>\u5c31\u4f1a\u62a5\u9519\u3002</p>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4e00\u4e2a\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">-- check for the existence of two separate records in the database and store\n-- the results in separate psql variables\nSELECT\n    EXISTS(SELECT 1 FROM customer WHERE customer_id = 123) as is_customer,\n    EXISTS(SELECT 1 FROM employee WHERE employee_id = 456) as is_employee\n\\gset\n\\if :is_customer\n    SELECT * FROM customer WHERE customer_id = 123;\n\\elif :is_employee\n    \\echo 'is not a customer but is an employee'\n    SELECT * FROM employee WHERE employee_id = 456;\n\\else\n    \\if yes\n        \\echo 'not a customer or employee'\n    \\else\n        \\echo 'this will never print'\n    \\endif\n\\endif\n</pre>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-INCLUDE-RELATIVE\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\ir</code> \u6216 <code class=\"literal\">\\include_relative</code> <em class=\"replaceable\"><code>filename</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"literal\">\\ir</code>\u547d\u4ee4\u4e0e<code class=\"literal\">\\i</code>\u76f8\u4f3c\uff0c\u4f46\u89e3\u6790\u76f8\u5bf9\u6587\u4ef6\u540d\u7684\u65b9\u5f0f\u4e0d\u540c\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\u6267\u884c\u65f6\uff0c\u8fd9\u4e24\u4e2a\u547d\u4ee4\u7684\u884c\u4e3a\u76f8\u540c\u3002\u4e0d\u8fc7\uff0c\u5728\u811a\u672c\u4e2d\u8c03\u7528\u65f6\uff0c<code class=\"literal\">\\ir</code>\u4f1a\u76f8\u5bf9\u4e8e\u811a\u672c\u6240\u5728\u7684\u76ee\u5f55\u6765\u89e3\u91ca\u6587\u4ef6\u540d\uff0c\u800c\u4e0d\u662f\u76f8\u5bf9\u4e8e\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-LIST\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\l[+]</code>\u6216<code class=\"literal\">\\list[+] [ <a class=\"link\" href=\"/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"\u6a21\u5f0f\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u670d\u52a1\u5668\u4e2d\u7684\u6570\u636e\u5e93\uff0c\u5e76\u663e\u793a\u5176\u540d\u79f0\u3001\u6240\u6709\u8005\u3001\u5b57\u7b26\u96c6\u7f16\u7801\u548c\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6570\u636e\u5e93\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u8fd8\u4f1a\u663e\u793a\u6570\u636e\u5e93\u5927\u5c0f\u3001\u9ed8\u8ba4\u8868\u7a7a\u95f4\u548c\u63cf\u8ff0\u3002\u5f53\u524d\u7528\u6237\u5bf9\u5176\u62e5\u6709 <code class=\"literal\">CONNECT</code> \u6743\u9650\u7684\u6570\u636e\u5e93\u53ef\u4ee5\u663e\u793a\u5927\u5c0f\u4fe1\u606f\uff1b\u5982\u679c\u5f53\u524d\u7528\u6237\u662f\u8d85\u7ea7\u7528\u6237\u6216\u5177\u6709 <code class=\"literal\">pg_read_all_stats</code> \u89d2\u8272\u7684\u6743\u9650\uff0c\u4e5f\u53ef\u4ee5\u663e\u793a\u5927\u5c0f\u4fe1\u606f\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-LO-EXPORT\"><span class=\"term\"><code class=\"literal\">\\lo_export <em class=\"replaceable\"><code>loid</code></em> <em class=\"replaceable\"><code>filename</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6570\u636e\u5e93\u4e2d\u8bfb\u53d6\u5177\u6709<acronym class=\"acronym\">OID</acronym><em class=\"replaceable\"><code>loid</code></em>\u7684\u5927\u5bf9\u8c61\uff0c\u5e76\u5c06\u5176\u5199\u5165<em class=\"replaceable\"><code>filename</code></em>\u3002\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e0e\u670d\u52a1\u5668\u51fd\u6570 <code class=\"function\">lo_export</code>\u7565\u6709\u4e0d\u540c\uff0c\u540e\u8005\u4f7f\u7528\u8fd0\u884c\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7528\u6237\u7684\u6743\u9650\uff0c\u5e76\u5728\u670d\u52a1\u5668\u7684\u6587\u4ef6\u7cfb\u7edf\u4e0a\u64cd\u4f5c\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u4f7f\u7528 \\lo_list \u67e5\u627e\u5927\u5bf9\u8c61\u7684 OID\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-LO-IMPORT\"><span class=\"term\"><code class=\"literal\">\\lo_import <em class=\"replaceable\"><code>filename</code></em> [ <em class=\"replaceable\"><code>comment</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6587\u4ef6\u5b58\u50a8\u5230\u4e00\u4e2a<span class=\"productname\">PostgreSQL</span>\u5927\u5bf9\u8c61\u4e2d\u3002\u53ef\u9009\u5730\uff0c\u5b83\u5c06\u7ed9\u5b9a\u7684\u6ce8\u91ca\u4e0e\u5bf9\u8c61\u5173\u8054\u8d77\u6765\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">foo=&gt; <strong class=\"userinput\"><code>\\lo_import '/home/peter/pictures/photo.xcf' 'a picture of me'</code></strong>\nlo_import 152801\n</pre>\n<p lang=\"zh\">\u54cd\u5e94\u8868\u660e\u5927\u5bf9\u8c61\u83b7\u5f97\u4e86\u5bf9\u8c61 ID 152801\uff0c\u8fd9\u4e2a ID \u53ef\u4ee5\u7528\u6765\u5728\u5c06\u6765\u8bbf\u95ee\u65b0\u521b\u5efa\u7684\u5927\u5bf9\u8c61\u3002\u4e3a\u4fbf\u4e8e\u9605\u8bfb\uff0c\u5efa\u8bae\u59cb\u7ec8\u4e3a\u6bcf\u4e2a\u5bf9\u8c61\u5173\u8054\u4e00\u6761\u4fbf\u4e8e\u4eba\u9605\u8bfb\u7684\u6ce8\u91ca\u3002\u67e5\u770b OID \u548c\u6ce8\u91ca\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528<code class=\"command\">\\lo_list</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u6b64\u547d\u4ee4\u4e0e\u670d\u52a1\u5668\u7aef\u7684<code class=\"function\">lo_import</code>\u7565\u6709\u4e0d\u540c\uff0c\u56e0\u4e3a\u5b83\u4f5c\u4e3a\u672c\u5730\u7528\u6237\u5728\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e0a\u64cd\u4f5c\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\u7684\u7528\u6237\u548c\u6587\u4ef6\u7cfb\u7edf\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-LO-LIST\"><span class=\"term\"><code class=\"literal\">\\lo_list[+]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5f53\u524d\u5b58\u50a8\u5728\u6570\u636e\u5e93\u4e2d\u7684\u5168\u90e8 <span class=\"productname\">PostgreSQL</span> \u5927\u5bf9\u8c61\u5217\u8868\uff0c\u4ee5\u53ca\u4e3a\u5b83\u4eec\u63d0\u4f9b\u7684\u4efb\u4f55\u6ce8\u91ca\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u5217\u51fa\u6bcf\u4e2a\u5927\u5bf9\u8c61\u7684\u76f8\u5173\u6743\u9650\uff08\u5982\u679c\u6709\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-LO-UNLINK\"><span class=\"term\"><code class=\"literal\">\\lo_unlink <em class=\"replaceable\"><code>loid</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6570\u636e\u5e93\u4e2d\u5220\u9664<acronym class=\"acronym\">OID</acronym> \u4e3a <em class=\"replaceable\"><code>loid</code></em>\u7684\u5927\u5bf9\u8c61\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u4f7f\u7528 \\lo_list \u67e5\u627e\u5927\u5bf9\u8c61\u7684 OID\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-OUT\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\o</code> \u6216 <code class=\"literal\">\\out [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\o</code> \u6216 <code class=\"literal\">\\out [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u540e\u7eed\u67e5\u8be2\u7ed3\u679c\u4fdd\u5b58\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9 shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002\u5982\u679c\u6ca1\u6709\u6307\u5b9a\u53c2\u6570\uff0c\u67e5\u8be2\u8f93\u51fa\u5c06\u6062\u590d\u4e3a\u6807\u51c6\u8f93\u51fa\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\uff0c\u5219\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u7684\u5185\u5bb9\u53ea\u4f1a\u539f\u6837\u4f20\u9012\u7ed9 shell\u3002</p>\n<p lang=\"zh\"><span class=\"quote\">\u201c<span class=\"quote\">\u67e5\u8be2\u7ed3\u679c</span>\u201d</span>\u5305\u62ec\u4ece\u6570\u636e\u5e93\u670d\u52a1\u5668\u83b7\u53d6\u7684\u6240\u6709\u8868\u683c\u3001\u547d\u4ee4\u54cd\u5e94\u548c\u901a\u77e5\uff0c\u4ee5\u53ca\u67e5\u8be2\u6570\u636e\u5e93\u7684\u5404\u79cd\u53cd\u659c\u6760\u547d\u4ee4\u7684\u8f93\u51fa\uff08\u4f8b\u5982<code class=\"command\">\\d</code>\uff09\uff1b\u4f46\u4e0d\u5305\u62ec\u9519\u8bef\u6d88\u606f\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8981\u5728\u67e5\u8be2\u7ed3\u679c\u4e4b\u95f4\u63d2\u5165\u6587\u672c\u8f93\u51fa\uff0c\u4f7f\u7528<code class=\"command\">\\qecho</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PRINT\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\p</code>\u6216<code class=\"literal\">\\print</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\u3002\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6253\u5370\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PASSWORD\"><span class=\"term\"><code class=\"literal\">\\password [ <em class=\"replaceable\"><code>username</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u66f4\u6539\u6307\u5b9a\u7528\u6237\uff08\u9ed8\u8ba4\u4e3a\u5f53\u524d\u7528\u6237\uff09\u7684\u5bc6\u7801\u3002\u6b64\u547d\u4ee4\u63d0\u793a\u8f93\u5165\u65b0\u5bc6\u7801\uff0c\u5bf9\u5176\u8fdb\u884c\u52a0\u5bc6\uff0c\u5e76\u5c06\u5176\u4f5c\u4e3a<code class=\"command\">ALTER ROLE</code>\u547d\u4ee4\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u65b0\u5bc6\u7801\u4e0d\u4f1a\u4ee5\u660e\u6587\u5f62\u5f0f\u51fa\u73b0\u5728\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\u3001\u670d\u52a1\u5668\u65e5\u5fd7\u6216\u5176\u4ed6\u5730\u65b9\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PROMPT\"><span class=\"term\"><code class=\"literal\">\\prompt [ <em class=\"replaceable\"><code>text</code></em> ] <em class=\"replaceable\"><code>name</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u63d0\u793a\u7528\u6237\u63d0\u4f9b\u6587\u672c\uff0c\u5c06\u5176\u8d4b\u503c\u7ed9\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u3002\u53ef\u4ee5\u6307\u5b9a\u4e00\u4e2a\u53ef\u9009\u7684\u63d0\u793a\u5b57\u7b26\u4e32<em class=\"replaceable\"><code>text</code></em>\u3002\uff08\u5bf9\u4e8e\u591a\u4e2a\u5355\u8bcd\u7684\u63d0\u793a\uff0c\u7528\u5355\u5f15\u53f7\u62ec\u8d77\u6587\u672c\u3002\uff09</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"literal\">\\prompt</code> \u4f7f\u7528\u7ec8\u7aef\u8fdb\u884c\u8f93\u5165\u548c\u8f93\u51fa\u3002\u7136\u800c\uff0c\u5982\u679c\u4f7f\u7528\u4e86 <code class=\"option\">-f</code> \u547d\u4ee4\u884c\u5f00\u5173\uff0c<code class=\"literal\">\\prompt</code> \u5c06\u4f7f\u7528\u6807\u51c6\u8f93\u5165\u548c\u6807\u51c6\u8f93\u51fa\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET\"><span class=\"term\"><code class=\"literal\">\\pset [ <em class=\"replaceable\"><code>option</code></em> [ <em class=\"replaceable\"><code>value</code></em> ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u8bbe\u7f6e\u5f71\u54cd\u67e5\u8be2\u7ed3\u679c\u8868\u8f93\u51fa\u7684\u9009\u9879\u3002<em class=\"replaceable\"><code>option</code></em>\u6307\u5b9a\u8981\u8bbe\u7f6e\u54ea\u4e2a\u9009\u9879\u3002<em class=\"replaceable\"><code>value</code></em>\u7684\u542b\u4e49\u53d6\u51b3\u4e8e\u6240\u9009\u7684\u9009\u9879\u3002\u5bf9\u4e8e\u67d0\u4e9b\u9009\u9879\uff0c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\u4f1a\u5207\u6362\u6216\u53d6\u6d88\u8bbe\u7f6e\u8be5\u9009\u9879\uff0c\u5177\u4f53\u89c1\u5404\u9009\u9879\u7684\u8bf4\u660e\u3002\u5982\u679c\u6ca1\u6709\u63d0\u53ca\u8fd9\u7c7b\u884c\u4e3a\uff0c\u90a3\u4e48\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\u53ea\u4f1a\u663e\u793a\u5f53\u524d\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\">\u4e0d\u5e26\u4efb\u4f55\u53c2\u6570\u7684<code class=\"command\">\\pset</code>\u4f1a\u663e\u793a\u6240\u6709\u6253\u5370\u9009\u9879\u7684\u5f53\u524d\u72b6\u6001\u3002</p>\n<p lang=\"zh\">\u53ef\u8c03\u6574\u6253\u5370\u9009\u9879\u6709\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-META-COMMAND-PSET-BORDER\"><span class=\"term\"><code class=\"literal\">border</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><em class=\"replaceable\"><code>value</code></em>\u5fc5\u987b\u662f\u6570\u5b57\u3002\u4e00\u822c\u6765\u8bf4\uff0c\u6570\u5b57\u8d8a\u5927\uff0c\u8868\u683c\u7684\u8fb9\u6846\u548c\u5206\u9694\u7ebf\u5c31\u8d8a\u591a\uff0c\u4f46\u7ec6\u8282\u53d6\u51b3\u4e8e\u5177\u4f53\u683c\u5f0f\u3002\u5728<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u4e2d\uff0c\u5b83\u4f1a\u76f4\u63a5\u8f6c\u6362\u4e3a<code class=\"literal\">border=...</code>\u5c5e\u6027\u3002\u5728\u5927\u591a\u6570\u5176\u4ed6\u683c\u5f0f\u4e2d\uff0c\u53ea\u6709\u503c 0\uff08\u65e0\u8fb9\u6846\uff09\u30011\uff08\u5185\u90e8\u5206\u9694\u7ebf\uff09\u548c 2\uff08\u8868\u683c\u5916\u6846\uff09\u6709\u610f\u4e49\uff0c\u5927\u4e8e 2 \u7684\u503c\u4f1a\u4e0e<code class=\"literal\">border = 2</code>\u4f5c\u76f8\u540c\u5904\u7406\u3002<code class=\"literal\">latex</code>\u548c<code class=\"literal\">latex-longtable</code>\u683c\u5f0f\u8fd8\u5141\u8bb8\u4f7f\u7528\u503c 3\uff0c\u4ee5\u5728\u6570\u636e\u884c\u4e4b\u95f4\u6dfb\u52a0\u5206\u9694\u7ebf\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-COLUMNS\" lang=\"zh\"><em>\u5217</em></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u76ee\u6807\u5bbd\u5ea6\uff0c\u540c\u65f6\u4e5f\u662f\u786e\u5b9a\u8f93\u51fa\u662f\u5426\u8db3\u591f\u5bbd\u4ee5\u9700\u8981\u5206\u9875\u5668\u6216\u5728\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e0b\u5207\u6362\u5230\u5782\u76f4\u663e\u793a\u7684\u5bbd\u5ea6\u9650\u5236\u3002\u96f6\uff08\u9ed8\u8ba4\u503c\uff09\u4f1a\u5bfc\u81f4\u76ee\u6807\u5bbd\u5ea6\u7531\u73af\u5883\u53d8\u91cf<code class=\"envar\">COLUMNS</code>\u63a7\u5236\uff0c\u6216\u8005\u5982\u679c\u672a\u8bbe\u7f6e <code class=\"envar\">COLUMNS</code>\u5219\u7531\u68c0\u6d4b\u5230\u7684\u5c4f\u5e55\u5bbd\u5ea6\u63a7\u5236\u3002\u53e6\u5916\uff0c\u5982\u679c<code class=\"literal\">columns</code>\u4e3a\u96f6\uff0c\u5219<code class=\"literal\">wrapped</code>\u683c\u5f0f\u4ec5\u5f71\u54cd\u5c4f\u5e55\u8f93\u51fa\u3002\u5982\u679c<code class=\"literal\">columns</code>\u4e3a\u975e\u96f6\uff0c\u5219\u6587\u4ef6\u548c\u7ba1\u9053\u8f93\u51fa\u4e5f\u4f1a\u6309\u8be5\u5bbd\u5ea6\u6298\u884c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-CSV-FIELDSEP\"><span class=\"term\"><code class=\"literal\">csv_fieldsep</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728<acronym class=\"acronym\">CSV</acronym>\u8f93\u51fa\u683c\u5f0f\u4e2d\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u5982\u679c\u5206\u9694\u7b26\u5b57\u7b26\u51fa\u73b0\u5728\u5b57\u6bb5\u7684\u503c\u4e2d\uff0c\u5219\u8be5\u5b57\u6bb5\u5c06\u6839\u636e\u6807\u51c6<acronym class=\"acronym\">CSV</acronym>\u89c4\u5219\u5728\u53cc\u5f15\u53f7\u5185\u8f93\u51fa\u3002\u9ed8\u8ba4\u503c\u662f\u9017\u53f7\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-EXPANDED\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">expanded</code>\uff08\u6216<code class=\"literal\">x</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff08\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u6269\u5c55\u6a21\u5f0f\uff09\uff0c\u6216\u8005\u662f<code class=\"literal\">auto</code>\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5f00\u542f\u548c\u5173\u95ed\u8bbe\u7f6e\u4e4b\u95f4\u5207\u6362\u3002\u542f\u7528\u6269\u5c55\u6a21\u5f0f\u65f6\uff0c\u67e5\u8be2\u7ed3\u679c\u4ee5\u4e24\u5217\u663e\u793a\uff0c\u5de6\u4fa7\u4e3a\u5217\u540d\uff0c\u53f3\u4fa7\u4e3a\u6570\u636e\u3002\u5982\u679c\u6570\u636e\u5728\u901a\u5e38\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u6a2a\u5411</span>\u201d</span>\u6a21\u5f0f\u4e0b\u65e0\u6cd5\u9002\u5e94\u5c4f\u5e55\uff0c\u8fd9\u79cd\u6a21\u5f0f\u5c31\u5f88\u6709\u7528\u3002\u5728\u81ea\u52a8\u8bbe\u7f6e\u4e0b\uff0c\u5f53\u67e5\u8be2\u8f93\u51fa\u5305\u542b\u591a\u5217\u4e14\u5bbd\u5ea6\u8d85\u8fc7\u5c4f\u5e55\u65f6\uff0c\u4f1a\u4f7f\u7528\u6269\u5c55\u6a21\u5f0f\uff1b\u5426\u5219\u4f7f\u7528\u5e38\u89c4\u6a21\u5f0f\u3002\u81ea\u52a8\u8bbe\u7f6e\u53ea\u5728\u5bf9\u9f50\u548c\u6298\u884c\u683c\u5f0f\u4e2d\u6709\u6548\u3002\u5728\u5176\u4ed6\u683c\u5f0f\u4e2d\uff0c\u5b83\u7684\u884c\u4e3a\u59cb\u7ec8\u4e0e\u5173\u95ed\u6269\u5c55\u6a21\u5f0f\u76f8\u540c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-FIELDSEP\"><span class=\"term\"><code class=\"literal\">fieldsep</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u6837\u53ef\u4ee5\u521b\u5efa\u4f8b\u5982\u5236\u8868\u7b26\u5206\u9694\u7684\u8f93\u51fa\uff0c\u8fd9\u53ef\u80fd\u66f4\u7b26\u5408\u5176\u4ed6\u7a0b\u5e8f\u7684\u9700\u8981\u3002\u8981\u5c06\u5236\u8868\u7b26\u8bbe\u7f6e\u4e3a\u5b57\u6bb5\u5206\u9694\u7b26\uff0c\u8bf7\u8f93\u5165<code class=\"literal\">\\pset fieldsep '\\t'</code>\u3002\u9ed8\u8ba4\u5b57\u6bb5\u5206\u9694\u7b26\u662f<code class=\"literal\">'|'</code>\uff08\u7ad6\u7ebf\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-FIELDSEP-ZERO\"><span class=\"term\"><code class=\"literal\">fieldsep_zero</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u8bbe\u7f6e\u4e3a\u96f6\u5b57\u8282\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-FOOTER\"><span class=\"term\"><code class=\"literal\">footer</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u8868\u683c\u9875\u811a\uff08<code class=\"literal\">(<em class=\"replaceable\"><code>n</code></em> rows)</code>\u8ba1\u6570\uff09\u7684\u663e\u793a\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5207\u6362\u9875\u811a\u663e\u793a\u7684\u5f00\u5173\u72b6\u6001\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-FORMAT\"><span class=\"term\"><code class=\"literal\">format</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a<code class=\"literal\">aligned</code>\u3001<code class=\"literal\">asciidoc</code>\u3001<code class=\"literal\">csv</code>\u3001<code class=\"literal\">html</code>\u3001<code class=\"literal\">latex</code>\u3001<code class=\"literal\">latex-longtable</code>\u3001<code class=\"literal\">troff-ms</code>\u3001<code class=\"literal\">unaligned</code>\u6216<code class=\"literal\">wrapped</code>\u3002\u5141\u8bb8\u4f7f\u7528\u552f\u4e00\u7f29\u5199\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">aligned</code>\u683c\u5f0f\u662f\u6807\u51c6\u7684\u3001\u9002\u5408\u4eba\u9605\u8bfb\u4e14\u6392\u7248\u6574\u9f50\u7684\u6587\u672c\u8f93\u51fa\uff1b\u8fd9\u662f\u9ed8\u8ba4\u683c\u5f0f\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">unaligned</code>\u683c\u5f0f\u5c06\u4e00\u884c\u4e2d\u7684\u6240\u6709\u5217\u5199\u5728\u4e00\u884c\u4e0a\uff0c\u7531\u5f53\u524d\u6d3b\u52a8\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u5206\u9694\u3002\u8fd9\u5bf9\u4e8e\u521b\u5efa\u53ef\u80fd\u88ab\u5176\u4ed6\u7a0b\u5e8f\u8bfb\u53d6\u7684\u8f93\u51fa\u5f88\u6709\u7528\uff0c\u4f8b\u5982\uff0c\u5236\u8868\u7b26\u5206\u9694\u6216\u9017\u53f7\u5206\u9694\u683c\u5f0f\u3002\u7136\u800c\uff0c\u5982\u679c\u5b57\u6bb5\u5206\u9694\u7b26\u5b57\u7b26\u51fa\u73b0\u5728\u5217\u7684\u503c\u4e2d\uff0c\u5219\u4e0d\u4f1a\u88ab\u7279\u6b8a\u5904\u7406\uff1b\u56e0\u6b64\uff0c<acronym class=\"acronym\">CSV</acronym>\u683c\u5f0f\u53ef\u80fd\u66f4\u9002\u5408\u8fd9\u4e9b\u76ee\u7684\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">csv</code>\u683c\u5f0f<a class=\"indexterm\" id=\"id-1.9.4.21.8.4.10.1.78.2.3.1.8.2.4.2\" name=\"id-1.9.4.21.8.4.10.1.78.2.3.1.8.2.4.2\"></a>\u6309\u9017\u53f7\u5206\u9694\u7684\u5217\u503c\u8f93\u51fa\uff0c\u5e76\u5e94\u7528 <a class=\"ulink\" href=\"https://datatracker.ietf.org/doc/html/rfc4180\" target=\"_top\">RFC 4180</a> \u4e2d\u63cf\u8ff0\u7684\u52a0\u5f15\u53f7\u89c4\u5219\u3002\u6b64\u8f93\u51fa\u4e0e\u670d\u52a1\u5668\u7684CSV\u683c\u5f0f\u7684 <code class=\"command\">COPY</code>\u547d\u4ee4\u517c\u5bb9\u3002\u751f\u6210\u5305\u542b\u5217\u540d\u7684\u8868\u5934\u884c\uff0c\u9664\u975e <code class=\"literal\">tuples_only</code>\u53c2\u6570\u8bbe\u7f6e\u4e3a <code class=\"literal\">on</code>\u3002\u4e0d\u6253\u5370\u8868\u683c\u6807\u9898\u548c\u9875\u811a\u3002\u6bcf\u884c\u4ee5\u7cfb\u7edf\u76f8\u5173\u7684\u884c\u7ed3\u675f\u5b57\u7b26\u7ed3\u675f\uff0c\u5bf9\u4e8e\u7c7bUnix\u7cfb\u7edf\u901a\u5e38\u662f\u5355\u4e2a\u6362\u884c\u7b26\uff08<code class=\"literal\">\\n</code>\uff09\uff0c\u5bf9\u4e8eMicrosoft Windows\u5219\u662f\u56de\u8f66\u548c\u6362\u884c\u5e8f\u5217\uff08<code class=\"literal\">\\r\\n</code>\uff09\u3002\u53ef\u4ee5\u7528<code class=\"command\">\\pset csv_fieldsep</code>\u9009\u62e9\u9017\u53f7\u4ee5\u5916\u7684\u5b57\u6bb5\u5206\u9694\u5b57\u7b26\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">wrapped</code>\u683c\u5f0f\u4e0e<code class=\"literal\">aligned</code>\u76f8\u4f3c\uff0c\u4f46\u4f1a\u5c06\u8f83\u5bbd\u7684\u6570\u636e\u503c\u6298\u6210\u591a\u884c\uff0c\u4f7f\u8f93\u51fa\u9002\u5e94\u76ee\u6807\u5217\u5bbd\u3002\u76ee\u6807\u5bbd\u5ea6\u7684\u786e\u5b9a\u65b9\u5f0f\u89c1<code class=\"literal\">columns</code>\u9009\u9879\u7684\u8bf4\u660e\u3002\u8bf7\u6ce8\u610f\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u5c1d\u8bd5\u5bf9\u5217\u6807\u9898\u6298\u884c\uff1b\u56e0\u6b64\uff0c\u5982\u679c\u5217\u6807\u9898\u6240\u9700\u7684\u603b\u5bbd\u5ea6\u8d85\u8fc7\u76ee\u6807\u5bbd\u5ea6\uff0c<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u884c\u4e3a\u5c31\u4e0e<code class=\"literal\">aligned</code>\u76f8\u540c\u3002</p>\n<p lang=\"zh\">asciidoc\u3001html\u3001latex\u3001latex-longtable \u548c troff-ms \u683c\u5f0f\u8f93\u51fa\u7684\u662f\u53ef\u5d4c\u5165\u76f8\u5e94\u6807\u8bb0\u8bed\u8a00\u6587\u6863\u7684\u8868\u683c\uff0c\u5e76\u975e\u5b8c\u6574\u6587\u6863\u3002HTML \u53ef\u80fd\u4e0d\u8981\u6c42\u5b8c\u6574\u5c01\u88c5\uff0c\u4f46 LaTeX \u5fc5\u987b\u6709\u5b8c\u6574\u6587\u6863\u7ed3\u6784\u3002latex \u4f7f\u7528 LaTeX \u7684 tabular \u73af\u5883\uff1blatex-longtable \u9700\u8981 LaTeX \u7684 longtable \u548c booktabs \u5b8f\u5305\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-LINESTYLE\"><span class=\"term\"><code class=\"literal\">linestyle</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u8fb9\u6846\u7ebf\u7ed8\u5236\u6837\u5f0f\u4e3a<code class=\"literal\">ascii</code>\u3001<code class=\"literal\">old-ascii</code>\u6216<code class=\"literal\">unicode</code>\u4e4b\u4e00\u3002\u5141\u8bb8\u4f7f\u7528\u552f\u4e00\u7f29\u5199\u3002\uff08\u8fd9\u610f\u5473\u7740\u4e00\u4e2a\u5b57\u6bcd\u5c31\u8db3\u591f\u4e86\u3002\uff09\u9ed8\u8ba4\u8bbe\u7f6e\u4e3a<code class=\"literal\">ascii</code>\u3002\u6b64\u9009\u9879\u4ec5\u5f71\u54cd<code class=\"literal\">aligned</code>\u548c<code class=\"literal\">wrapped</code>\u8f93\u51fa\u683c\u5f0f\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">ascii</code>\u6837\u5f0f\u4f7f\u7528\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u53f3\u8fb9\u7f18\u7684<code class=\"literal\">+</code>\u7b26\u53f7\u8868\u793a\u3002\u5f53<code class=\"literal\">wrapped</code>\u683c\u5f0f\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u628a\u6570\u636e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u4f1a\u5728\u7b2c\u4e00\u884c\u7684\u53f3\u8fb9\u7f18\u663e\u793a\u4e00\u4e2a\u70b9\uff08<code class=\"literal\">.</code>\uff09\uff0c\u5e76\u5728\u4e0b\u4e00\u884c\u7684\u5de6\u8fb9\u7f18\u518d\u6b21\u663e\u793a\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">old-ascii</code>\u6837\u5f0f\u4f7f\u7528\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\uff0c\u91c7\u7528<span class=\"productname\">PostgreSQL</span> 8.4 \u53ca\u66f4\u65e9\u7248\u672c\u7684\u683c\u5f0f\u6837\u5f0f\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u66ff\u4ee3\u5de6\u4fa7\u5217\u5206\u9694\u7b26\u7684<code class=\"literal\">:</code>\u7b26\u53f7\u8868\u793a\u3002\u5f53\u6570\u636e\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u5219\u7528<code class=\"literal\">;</code>\u7b26\u53f7\u66ff\u4ee3\u5de6\u4fa7\u5217\u5206\u9694\u7b26\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">unicode</code>\u6837\u5f0f\u4f7f\u7528 Unicode \u6846\u7ebf\u7ed8\u5236\u5b57\u7b26\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u53f3\u8fb9\u7f18\u7684\u56de\u8f66\u7b26\u53f7\u8868\u793a\u3002\u5f53\u6570\u636e\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u4f1a\u5728\u7b2c\u4e00\u884c\u7684\u53f3\u8fb9\u7f18\u663e\u793a\u7701\u7565\u53f7\u7b26\u53f7\uff0c\u5e76\u5728\u4e0b\u4e00\u884c\u7684\u5de6\u8fb9\u7f18\u518d\u6b21\u663e\u793a\u3002</p>\n<p lang=\"zh\">\u5f53<code class=\"literal\">border</code>\u8bbe\u7f6e\u5927\u4e8e\u96f6\u65f6\uff0c<code class=\"literal\">linestyle</code>\u9009\u9879\u8fd8\u51b3\u5b9a\u7528\u54ea\u4e9b\u5b57\u7b26\u7ed8\u5236\u8fb9\u6846\u7ebf\u3002\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\u5728\u4efb\u4f55\u73af\u5883\u4e2d\u90fd\u53ef\u7528\uff0c\u4f46\u5728\u652f\u6301 Unicode \u7684\u663e\u793a\u8bbe\u5907\u4e0a\uff0cUnicode \u5b57\u7b26\u66f4\u7f8e\u89c2\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-NULL\"><span class=\"term\"><code class=\"literal\">null</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u7528\u4e8e\u4ee3\u66ff\u7a7a\u503c\u6253\u5370\u7684\u5b57\u7b26\u4e32\u3002\u9ed8\u8ba4\u4e0d\u6253\u5370\u4efb\u4f55\u5185\u5bb9\uff0c\u8fd9\u5f88\u5bb9\u6613\u88ab\u8bef\u8ba4\u4e3a\u7a7a\u5b57\u7b26\u4e32\u3002\u4f8b\u5982\uff0c\u4f60\u53ef\u80fd\u66f4\u559c\u6b22\u4f7f\u7528<code class=\"literal\">\\pset null '(null)'</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-NUMERICLOCALE\"><span class=\"term\"><code class=\"literal\">numericlocale</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u4f7f\u7528\u533a\u57df\u8bbe\u7f6e\u7279\u5b9a\u7684\u5b57\u7b26\u6765\u5206\u9694\u5c0f\u6570\u70b9\u5de6\u4fa7\u7684\u6570\u5b57\u7ec4\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5e38\u89c4\u6570\u5b57\u8f93\u51fa\u548c\u533a\u57df\u8bbe\u7f6e\u7279\u5b9a\u7684\u6570\u5b57\u8f93\u51fa\u4e4b\u95f4\u5207\u6362\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-PAGER\"><span class=\"term\"><code class=\"literal\">pager</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u63a7\u5236\u67e5\u8be2\u7ed3\u679c\u4e0e psql \u5e2e\u52a9\u8f93\u51fa\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\u7684\u65b9\u5f0f\u3002\u5f53 pager \u4e3a off \u65f6\uff0c\u4e0d\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\uff1b\u4e3a on \u65f6\uff0c\u5728\u9002\u5f53\u60c5\u51b5\u4e0b\u4f7f\u7528\uff0c\u5373\u8f93\u51fa\u76ee\u6807\u662f\u7ec8\u7aef\u4e14\u5185\u5bb9\u65e0\u6cd5\u5728\u5c4f\u5e55\u5185\u663e\u793a\u5b8c\u3002\u8bbe\u4e3a always \u65f6\uff0c\u6240\u6709\u7ec8\u7aef\u8f93\u51fa\u5747\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\uff0c\u65e0\u8bba\u662f\u5426\u80fd\u5728\u5c4f\u5e55\u5185\u663e\u793a\u5b8c\u3002\u4e0d\u5e26\u503c\u7684 \\pset pager \u4f1a\u5207\u6362\u5206\u9875\u7684\u5f00\u5173\u72b6\u6001\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u8bbe\u7f6e\u4e86\u73af\u5883\u53d8\u91cf<code class=\"envar\">PSQL_PAGER</code>\u6216<code class=\"envar\">PAGER</code>\uff0c\u9700\u8981\u5206\u9875\u7684\u8f93\u51fa\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6307\u5b9a\u7a0b\u5e8f\u3002\u5426\u5219\uff0c\u4f7f\u7528\u4e0e\u5e73\u53f0\u6709\u5173\u7684\u9ed8\u8ba4\u7a0b\u5e8f\uff08\u5982<code class=\"filename\">more</code>\uff09\u3002</p>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 <code class=\"literal\">\\watch</code> \u547d\u4ee4\u91cd\u590d\u6267\u884c\u67e5\u8be2\u65f6\uff0c\u5728 Unix \u7cfb\u7edf\u4e0a\u4f1a\u6539\u7528\u73af\u5883\u53d8\u91cf <code class=\"envar\">PSQL_WATCH_PAGER</code> \u6765\u67e5\u627e\u5206\u9875\u5668\u7a0b\u5e8f\u3002\u4e4b\u6240\u4ee5\u5355\u72ec\u914d\u7f6e\u5b83\uff0c\u662f\u56e0\u4e3a\u8fd9\u79cd\u7528\u6cd5\u53ef\u80fd\u4f1a\u8ba9\u4f20\u7edf\u5206\u9875\u5668\u65e0\u6cd5\u6b63\u5e38\u5de5\u4f5c\uff1b\u4f46\u5b83\u53ef\u7528\u4e8e\u628a\u8f93\u51fa\u53d1\u9001\u7ed9\u80fd\u591f\u7406\u89e3 <span class=\"application\">psql</span> \u8f93\u51fa\u683c\u5f0f\u7684\u5de5\u5177\uff08\u4f8b\u5982 <code class=\"filename\">pspg --stream</code>\uff09\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-PAGER-MIN-LINES\"><span class=\"term\"><code class=\"literal\">pager_min_lines</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u82e5 pager_min_lines \u5927\u4e8e\u5c4f\u5e55\u9875\u9ad8\uff0c\u53ea\u6709\u8f93\u51fa\u884c\u6570\u8fbe\u5230\u8be5\u503c\u65f6\u624d\u8c03\u7528\u5206\u9875\u7a0b\u5e8f\u3002\u9ed8\u8ba4\u503c\u4e3a 0\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-RECORDSEP\"><span class=\"term\"><code class=\"literal\">recordsep</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u8bb0\u5f55\uff08\u884c\uff09\u5206\u9694\u7b26\u3002\u9ed8\u8ba4\u4e3a\u6362\u884c\u7b26\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-RECORDSEP-ZERO\"><span class=\"term\"><code class=\"literal\">recordsep_zero</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u8bbe\u7f6e\u4e3a\u96f6\u5b57\u8282\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-TABLEATTR\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">tableattr</code>\uff08\u6216<code class=\"literal\">T</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\u5728<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u4e2d\uff0c\u8fd9\u6307\u5b9a\u8981\u653e\u5728<code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u5c5e\u6027\uff0c\u4f8b\u5982<code class=\"literal\">cellpadding</code>\u6216<code class=\"literal\">bgcolor</code>\u3002\u8bf7\u6ce8\u610f\uff0c\u4f60\u53ef\u80fd\u4e0d\u9700\u8981\u5728\u8fd9\u91cc\u6307\u5b9a<code class=\"literal\">border</code>\uff0c\u56e0\u4e3a<code class=\"literal\">\\pset border</code>\u5df2\u7ecf\u8d1f\u8d23\u5904\u7406\u5b83\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u8868\u683c\u5c5e\u6027\u3002</p>\n<p lang=\"zh\">\u5728<code class=\"literal\">latex-longtable</code>\u683c\u5f0f\u4e2d\uff0c\u8fd9\u63a7\u5236\u6bcf\u4e2a\u5305\u542b\u5de6\u5bf9\u9f50\u6570\u636e\u7c7b\u578b\u7684\u5217\u7684\u5bbd\u5ea6\u6bd4\u4f8b\u3002\u5b83\u4ee5\u7a7a\u767d\u5206\u9694\u7684\u503c\u5217\u8868\u6307\u5b9a\uff0c\u4f8b\u5982<code class=\"literal\">'0.2 0.2 0.6'</code>\u3002\u672a\u6307\u5b9a\u7684\u8f93\u51fa\u5217\u4f7f\u7528\u6700\u540e\u6307\u5b9a\u7684\u503c\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-TITLE\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">title</code>\uff08\u6216<code class=\"literal\">C</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u968f\u540e\u6253\u5370\u7684\u6240\u6709\u8868\u683c\u7684\u6807\u9898\u3002\u8fd9\u53ef\u4ee5\u4e3a\u8f93\u51fa\u63d0\u4f9b\u63cf\u8ff0\u6027\u6807\u7b7e\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u6807\u9898\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-TUPLES-ONLY\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">tuples_only</code>\uff08\u6216<code class=\"literal\">t</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u4ec5\u5143\u7ec4\u6a21\u5f0f\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5e38\u89c4\u8f93\u51fa\u548c\u4ec5\u5143\u7ec4\u8f93\u51fa\u4e4b\u95f4\u5207\u6362\u3002\u5e38\u89c4\u8f93\u51fa\u5305\u542b\u5217\u6807\u9898\u3001\u8868\u683c\u6807\u9898\u548c\u5404\u79cd\u9875\u811a\u7b49\u9644\u52a0\u4fe1\u606f\u3002\u5728\u4ec5\u5143\u7ec4\u6a21\u5f0f\u4e0b\uff0c\u53ea\u663e\u793a\u5b9e\u9645\u7684\u8868\u683c\u6570\u636e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-UNICODE-BORDER-LINESTYLE\"><span class=\"term\"><code class=\"literal\">unicode_border_linestyle</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u8fb9\u6846\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-UNICODE-COLUMN-LINESTYLE\"><span class=\"term\"><code class=\"literal\">unicode_column_linestyle</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u5217\u5206\u9694\u7ebf\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-UNICODE-HEADER-LINESTYLE\"><span class=\"term\"><code class=\"literal\">unicode_header_linestyle</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u8868\u5934\u5206\u9694\u7ebf\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-XHEADER-WIDTH\"><span class=\"term\"><code class=\"literal\">xheader_width</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6269\u5c55\u8f93\u51fa\u6807\u9898\u7684\u6700\u5927\u5bbd\u5ea6\u8bbe\u4e3a full\uff08\u9ed8\u8ba4\u503c\uff09\u3001column\u3001page \u6216\u4e00\u4e2a\u6574\u6570\u503c\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">full</code>\uff1a\u6269\u5c55\u8868\u5934\u4e0d\u622a\u65ad\uff0c\u5176\u5bbd\u5ea6\u4e0e\u6700\u5bbd\u7684\u8f93\u51fa\u884c\u76f8\u540c\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">column</code>\uff1a\u5c06\u8868\u5934\u884c\u622a\u65ad\u4e3a\u7b2c\u4e00\u5217\u7684\u5bbd\u5ea6\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">page</code>\uff1a\u5c06\u8868\u5934\u884c\u622a\u65ad\u4e3a\u7ec8\u7aef\u5bbd\u5ea6\u3002</p>\n<p lang=\"zh\">\u6574\u6570\u503c\uff1a\u7cbe\u786e\u6307\u5b9a\u6807\u9898\u884c\u7684\u6700\u5927\u5bbd\u5ea6\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8fd9\u4e9b\u4e0d\u540c\u683c\u5f0f\u7684\u5916\u89c2\u793a\u4f8b\u53ef\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/17/app-psql.html#APP-PSQL-EXAMPLES\" title=\"\u793a\u4f8b\">\u793a\u4f8b</a>\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u6709\u5404\u79cd\u5feb\u6377\u547d\u4ee4\u7528\u4e8e<code class=\"command\">\\pset</code>\u3002\u8bf7\u53c2\u89c1<code class=\"command\">\\a</code>\u3001<code class=\"command\">\\C</code>\u3001<code class=\"command\">\\f</code>\u3001<code class=\"command\">\\H</code>\u3001<code class=\"command\">\\t</code>\u3001<code class=\"command\">\\T</code>\u548c<code class=\"command\">\\x</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-QUIT\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\q</code>\u6216<code class=\"literal\">\\quit</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9000\u51fa<span class=\"application\">psql</span>\u7a0b\u5e8f\u3002\u5728\u811a\u672c\u6587\u4ef6\u4e2d\uff0c\u53ea\u4f1a\u7ec8\u6b62\u8be5\u811a\u672c\u7684\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-QECHO\"><span class=\"term\"><code class=\"literal\">\\qecho <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u547d\u4ee4\u4e0e<code class=\"command\">\\echo</code>\u76f8\u540c\uff0c\u53ea\u662f\u8f93\u51fa\u4f1a\u5199\u5165\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u7684\u67e5\u8be2\u8f93\u51fa\u901a\u9053\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-RESET\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\r</code>\u6216<code class=\"literal\">\\reset</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u91cd\u7f6e\uff08\u6e05\u7a7a\uff09\u67e5\u8be2\u7f13\u51b2\u533a\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-RESTRICT\"><span class=\"term\"><code class=\"literal\">\\restrict <em class=\"replaceable\"><code>restrict_key</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528\u7ed9\u5b9a\u7684\u5bc6\u94a5\u8fdb\u5165<span class=\"quote\">\u201c<span class=\"quote\">\u53d7\u9650</span>\u201d</span>\u6a21\u5f0f\u3002\u5728\u8be5\u6a21\u5f0f\u4e0b\uff0c\u552f\u4e00\u5141\u8bb8\u7684\u5143\u547d\u4ee4\u662f\u7528\u4e8e\u9000\u51fa\u53d7\u9650\u6a21\u5f0f\u7684<code class=\"command\">\\unrestrict</code>\u3002\u5bc6\u94a5\u53ea\u80fd\u5305\u542b\u5b57\u6bcd\u6570\u5b57\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4e3b\u8981\u7528\u4e8e pg_dump\u3001pg_dumpall \u548c pg_restore \u751f\u6210\u7684\u7eaf\u6587\u672c\u8f6c\u50a8\uff0c\u4e5f\u53ef\u80fd\u9002\u7528\u4e8e\u5176\u4ed6\u573a\u666f\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-S\"><span class=\"term\"><code class=\"literal\">\\s [ <em class=\"replaceable\"><code>filename</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u5386\u53f2\u8bb0\u5f55\u5230<em class=\"replaceable\"><code>filename</code></em>\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5386\u53f2\u8bb0\u5f55\u5c06\u88ab\u5199\u5165\u6807\u51c6\u8f93\u51fa\uff08\u5982\u679c\u9002\u7528\uff0c\u5c06\u4f7f\u7528\u5206\u9875\u5668\uff09\u3002\u5982\u679c<span class=\"application\">psql</span>\u5728\u6784\u5efa\u65f6\u6ca1\u6709\u4f7f\u7528<span class=\"application\">Readline</span>\u652f\u6301\uff0c\u5219\u6b64\u547d\u4ee4\u4e0d\u53ef\u7528\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-SET\"><span class=\"term\"><code class=\"literal\">\\set [ <em class=\"replaceable\"><code>name</code></em> [ <em class=\"replaceable\"><code>value</code></em> [ ... ] ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e<span class=\"application\">psql</span>\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u4e3a<em class=\"replaceable\"><code>value</code></em>\uff0c\u5982\u679c\u7ed9\u51fa\u591a\u4e2a\u503c\uff0c\u5219\u8bbe\u7f6e\u4e3a\u6240\u6709\u503c\u7684\u8fde\u63a5\u3002\u5982\u679c\u53ea\u7ed9\u51fa\u4e00\u4e2a\u53c2\u6570\uff0c\u5219\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\u503c\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u8bbe\u7f6e\uff0c\u8bf7\u4f7f\u7528<code class=\"command\">\\unset</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\"><code class=\"command\">\\set</code>\u6ca1\u6709\u4efb\u4f55\u53c2\u6570\u65f6\uff0c\u663e\u793a\u5f53\u524d\u8bbe\u7f6e\u7684\u6240\u6709<span class=\"application\">psql</span>\u53d8\u91cf\u7684\u540d\u79f0\u548c\u503c\u3002</p>\n<p lang=\"zh\">\u6709\u6548\u7684\u53d8\u91cf\u540d\u53ef\u4ee5\u5305\u542b\u5b57\u6bcd\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u3002\u6709\u5173\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/17/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002\u53d8\u91cf\u540d\u533a\u5206\u5927\u5c0f\u5199\u3002</p>\n<p lang=\"zh\">\u67d0\u4e9b\u53d8\u91cf\u662f\u7279\u6b8a\u7684\uff0c\u5b83\u4eec\u63a7\u5236<span class=\"application\">psql</span>\u7684\u884c\u4e3a\u6216\u8005\u81ea\u52a8\u8bbe\u7f6e\u4ee5\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u3002\u8fd9\u4e9b\u53d8\u91cf\u5728\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/17/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u4e2d\u6709\u6587\u6863\u8bb0\u5f55\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u4e0e<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4<a class=\"link\" href=\"/docs/17/sql-set.html\" title=\"SET\"><code class=\"command\">SET</code></a>\u65e0\u5173\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-SETENV\"><span class=\"term\"><code class=\"literal\">\\setenv <em class=\"replaceable\"><code>name</code></em> [ <em class=\"replaceable\"><code>value</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u4e3a<em class=\"replaceable\"><code>value</code></em>\uff0c\u6216\u8005\u5982\u679c\u672a\u63d0\u4f9b<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3002\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\setenv PAGER less</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>\\setenv LESS -imx4F</code></strong>\n</pre>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-SF\"><span class=\"term\"><code class=\"literal\">\\sf[+] <em class=\"replaceable\"><code>function_description</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u663e\u793a\u6307\u5b9a\u51fd\u6570\u6216\u8fc7\u7a0b\u7684\u5b9a\u4e49\uff0c\u4ee5<code class=\"command\">CREATE OR REPLACE FUNCTION</code>\u6216 <code class=\"command\">CREATE OR REPLACE PROCEDURE</code>\u547d\u4ee4\u7684\u5f62\u5f0f\u5448\u73b0\u3002\u5b9a\u4e49\u5c06\u6253\u5370\u5230\u5f53\u524d\u67e5\u8be2\u8f93\u51fa\u901a\u9053\uff0c\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\">\u76ee\u6807\u51fd\u6570\u53ef\u4ec5\u7528\u540d\u79f0\u6307\u5b9a\uff0c\u4e5f\u53ef\u7528\u540d\u79f0\u548c\u53c2\u6570\u6307\u5b9a\uff0c\u4f8b\u5982 foo(integer, text)\u3002\u82e5\u6709\u591a\u4e2a\u540c\u540d\u51fd\u6570\uff0c\u5219\u5fc5\u987b\u63d0\u4f9b\u53c2\u6570\u7c7b\u578b\u3002</p>\n<p lang=\"zh\">\u5728\u547d\u4ee4\u540d\u540e\u6dfb\u52a0 +\uff0c\u4f1a\u4e3a\u8f93\u51fa\u884c\u7f16\u53f7\uff0c\u51fd\u6570\u4f53\u7b2c\u4e00\u884c\u4e3a\u7b2c 1 \u884c\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\sf</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-SV\"><span class=\"term\"><code class=\"literal\">\\sv[+] <em class=\"replaceable\"><code>view_name</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u6307\u5b9a\u89c6\u56fe\u7684\u5b9a\u4e49\uff0c\u5e76\u4ee5<code class=\"command\">CREATE OR REPLACE VIEW</code>\u547d\u4ee4\u7684\u5f62\u5f0f\u663e\u793a\u3002\u5b9a\u4e49\u4f1a\u6253\u5370\u5230\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u7684\u5f53\u524d\u67e5\u8be2\u8f93\u51fa\u901a\u9053\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u547d\u4ee4\u540d\u79f0\u540e\u6dfb\u52a0<code class=\"literal\">+</code>\uff0c\u90a3\u4e48\u8f93\u51fa\u884c\u5c06\u4ece1\u5f00\u59cb\u7f16\u53f7\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\sv</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-T-LC\"><span class=\"term\"><code class=\"literal\">\\t</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u8f93\u51fa\u4e2d\u7684\u5217\u540d\u6807\u9898\u548c\u884c\u6570\u9875\u811a\u7684\u663e\u793a\u72b6\u6001\u3002\u8fd9\u4e2a\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset tuples_only</code>\uff0c\u63d0\u4f9b\u5b83\u662f\u4e3a\u4e86\u4f7f\u7528\u65b9\u4fbf\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-T-UC\"><span class=\"term\"><code class=\"literal\">\\T <em class=\"replaceable\"><code>table_options</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728<acronym class=\"acronym\">HTML</acronym>\u8f93\u51fa\u683c\u5f0f\u4e2d\u653e\u5728<code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u5c5e\u6027\u3002\u8fd9\u4e2a\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset tableattr <em class=\"replaceable\"><code>table_options</code></em></code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-TIMING\"><span class=\"term\"><code class=\"literal\">\\timing [ <em class=\"replaceable\"><code>on</code></em> | <em class=\"replaceable\"><code>off</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5e26\u53c2\u6570\u65f6\uff0c\u5f00\u542f\u6216\u5173\u95ed\u6bcf\u6761 SQL \u8bed\u53e5\u6267\u884c\u8017\u65f6\u7684\u663e\u793a\u3002\u4e0d\u5e26\u53c2\u6570\u65f6\uff0c\u5207\u6362\u663e\u793a\u7684\u5f00\u5173\u72b6\u6001\u3002\u8017\u65f6\u4ee5\u6beb\u79d2\u663e\u793a\uff1b\u8d85\u8fc7 1 \u79d2\u7684\u65f6\u95f4\u95f4\u9694\u8fd8\u4f1a\u4ee5\u5206\u949f:\u79d2\u7684\u683c\u5f0f\u663e\u793a\uff0c\u5fc5\u8981\u65f6\u6dfb\u52a0\u5c0f\u65f6\u548c\u5929\u5b57\u6bb5\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-UNRESTRICT\"><span class=\"term\"><code class=\"literal\">\\unrestrict <em class=\"replaceable\"><code>restrict_key</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u9000\u51fa<span class=\"quote\">\u201c<span class=\"quote\">\u53d7\u9650</span>\u201d</span>\u6a21\u5f0f\uff08\u5373\u6240\u6709\u5176\u4ed6\u5143\u547d\u4ee4\u90fd\u88ab\u963b\u6b62\u7684\u6a21\u5f0f\uff09\uff0c\u524d\u63d0\u662f\u6307\u5b9a\u7684\u5bc6\u94a5\u4e0e\u8fdb\u5165\u53d7\u9650\u6a21\u5f0f\u65f6\u4f20\u7ed9<code class=\"command\">\\restrict</code>\u7684\u5bc6\u94a5\u5339\u914d\u3002</p>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4e3b\u8981\u7528\u4e8e pg_dump\u3001pg_dumpall \u548c pg_restore \u751f\u6210\u7684\u7eaf\u6587\u672c\u8f6c\u50a8\uff0c\u4e5f\u53ef\u80fd\u9002\u7528\u4e8e\u5176\u4ed6\u573a\u666f\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u5269\u4f59\u884c\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\unrestrict</code>\u7684\u53c2\u6570\uff0c\u5e76\u4e14\u4e0d\u4f1a\u6267\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-UNSET\"><span class=\"term\"><code class=\"literal\">\\unset <em class=\"replaceable\"><code>name</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u53d6\u6d88\u8bbe\u7f6e\uff08\u5220\u9664\uff09<span class=\"application\">psql</span>\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u3002</p>\n<p lang=\"zh\">\u5927\u591a\u6570\u63a7\u5236<span class=\"application\">psql</span>\u884c\u4e3a\u7684\u53d8\u91cf\u4e0d\u80fd\u53d6\u6d88\u8bbe\u7f6e\uff1b\u5bf9\u4e8e\u8fd9\u4e9b\u53d8\u91cf\uff0c<code class=\"literal\">\\unset</code>\u547d\u4ee4\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u5176\u8bbe\u7f6e\u4e3a\u9ed8\u8ba4\u503c\u3002\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/17/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-WRITE\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\w</code> \u6216 <code class=\"literal\">\\write</code> <em class=\"replaceable\"><code>filename</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\w</code> \u6216 <code class=\"literal\">\\write</code> <code class=\"literal\">|</code><em class=\"replaceable\"><code>command</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u5199\u5165\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u9012\u7ed9 shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6539\u4e3a\u5199\u5165\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\uff0c\u5219\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u7684\u5185\u5bb9\u53ea\u4f1a\u539f\u6837\u4f20\u9012\u7ed9 shell\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-WARN\"><span class=\"term\"><code class=\"literal\">\\warn <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u547d\u4ee4\u4e0e<code class=\"command\">\\echo</code>\u547d\u4ee4\u76f8\u540c\uff0c\u53ea\u662f\u8f93\u51fa\u5c06\u88ab\u5199\u5165<span class=\"application\">psql</span>\u7684\u6807\u51c6\u9519\u8bef\u901a\u9053\uff0c\u800c\u4e0d\u662f\u6807\u51c6\u8f93\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-WATCH\"><span class=\"term\"><code class=\"literal\">\\watch [ i[nterval]=<em class=\"replaceable\"><code>seconds</code></em> ] [ c[ount]=<em class=\"replaceable\"><code>times</code></em> ] [ m[in_rows]=<em class=\"replaceable\"><code>rows</code></em> ] [ <em class=\"replaceable\"><code>seconds</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u91cd\u590d\u6267\u884c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\uff08\u5982\u540c <code class=\"literal\">\\g</code> \u4e00\u6837\uff09\uff0c\u76f4\u5230\u88ab\u4e2d\u65ad\u3001\u67e5\u8be2\u5931\u8d25\u3001\u8fbe\u5230\u6267\u884c\u6b21\u6570\u4e0a\u9650\uff08\u5982\u679c\u7ed9\u5b9a\uff09\u6216\u67e5\u8be2\u8fd4\u56de\u7684\u884c\u6570\u4f4e\u4e8e\u6700\u5c0f\u8981\u6c42\u3002\u4e24\u6b21\u6267\u884c\u4e4b\u95f4\u7b49\u5f85\u6307\u5b9a\u7684\u79d2\u6570\uff08\u9ed8\u8ba4 2 \u79d2\uff09\u3002\u4e3a\u4fdd\u6301\u5411\u540e\u517c\u5bb9\uff0c<em class=\"replaceable\"><code>seconds</code></em> \u53ef\u4ee5\u5e26\u6216\u4e0d\u5e26 <code class=\"literal\">interval=</code> \u524d\u7f00\u3002\u6bcf\u6b21\u67e5\u8be2\u7ed3\u679c\u90fd\u4f1a\u5e26\u6709\u4e00\u4e2a\u5934\u90e8\uff0c\u5176\u4e2d\u5305\u542b <code class=\"literal\">\\pset title</code> \u5b57\u7b26\u4e32\uff08\u5982\u679c\u6709\uff09\u3001\u67e5\u8be2\u5f00\u59cb\u65f6\u7684\u65f6\u95f4\u4ee5\u53ca\u5ef6\u8fdf\u95f4\u9694\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-X\"><span class=\"term\"><code class=\"literal\">\\x [ <em class=\"replaceable\"><code>on</code></em> | <em class=\"replaceable\"><code>off</code></em> | <em class=\"replaceable\"><code>auto</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u6216\u5207\u6362\u6269\u5c55\u8868\u683c\u683c\u5f0f\u6a21\u5f0f\u3002\u5b83\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset expanded</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-Z\"><span class=\"term\"><code class=\"literal\">\\z[S] [ <a class=\"link\" href=\"https://pg.center/docs/17/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u53ca\u5176\u76f8\u5173\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n<p lang=\"zh\">\u8fd9\u662f<code class=\"command\">\\dp</code>\u7684\u522b\u540d\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u663e\u793a\u6743\u9650</span>\u201d</span>\uff09\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-EXCLAMATION-MARK\"><span class=\"term\"><code class=\"literal\">\\! [ <em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u5e26\u53c2\u6570\u65f6\uff0c\u8fdb\u5165\u4e00\u4e2a\u5b50 shell\uff1b\u5b50 shell \u9000\u51fa\u540e\uff0c<span class=\"application\">psql</span>\u6062\u590d\u8fd0\u884c\u3002\u5e26\u53c2\u6570\u65f6\uff0c\u6267\u884c shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\!</code>\u7684\u53c2\u6570\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u5185\u5bb9\u4f1a\u539f\u6837\u4f20\u7ed9 shell\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-QUESTION-MARK\"><span class=\"term\"><code class=\"literal\">\\? [ <em class=\"replaceable\"><code>topic</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5e2e\u52a9\u4fe1\u606f\u3002\u53ef\u9009\u7684<em class=\"replaceable\"><code>topic</code></em>\u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a<code class=\"literal\">commands</code>\uff09\u9009\u62e9\u8981\u89e3\u91ca\u7684<span class=\"application\">psql</span>\u7684\u54ea\u4e2a\u90e8\u5206\uff1a<code class=\"literal\">commands</code>\u63cf\u8ff0<span class=\"application\">psql</span>\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b<code class=\"literal\">options</code>\u63cf\u8ff0\u53ef\u4ee5\u4f20\u9012\u7ed9<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c<code class=\"literal\">variables</code>\u663e\u793a\u5173\u4e8e<span class=\"application\">psql</span>\u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-SEMICOLON\"><span class=\"term\"><code class=\"literal\">\\;</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u53cd\u659c\u7ebf\u5206\u53f7\u4e0d\u50cf\u524d\u9762\u7684\u547d\u4ee4\u90a3\u6837\u662f\u4e00\u4e2a\u5143\u547d\u4ee4\uff1b\u76f8\u53cd\uff0c\u5b83\u53ea\u662f\u5728\u4e0d\u8fdb\u884c\u8fdb\u4e00\u6b65\u5904\u7406\u7684\u60c5\u51b5\u4e0b\u5c06\u4e00\u4e2a\u5206\u53f7\u6dfb\u52a0\u5230\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u3002</p>\n<p lang=\"zh\">\u901a\u5e38\uff0c<span class=\"application\">psql</span>\u4f1a\u5728\u5230\u8fbe\u547d\u4ee4\u7ed3\u675f\u7684\u5206\u53f7\u65f6\u7acb\u5373\u5c06SQL\u547d\u4ee4\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u5373\u4f7f\u5f53\u524d\u884c\u8fd8\u6709\u66f4\u591a\u8f93\u5165\u3002\u56e0\u6b64\uff0c\u4f8b\u5982\u8f93\u5165</p>\n<pre class=\"programlisting\">select 1; select 2; select 3;\n</pre>\n<p lang=\"zh\">\u5c06\u5bfc\u81f4\u4e09\u4e2aSQL\u547d\u4ee4\u5206\u522b\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u6bcf\u4e2a\u547d\u4ee4\u7684\u7ed3\u679c\u5728\u7ee7\u7eed\u4e0b\u4e00\u4e2a\u547d\u4ee4\u4e4b\u524d\u663e\u793a\u3002\u7136\u800c\uff0c\u8f93\u5165\u4e3a<code class=\"literal\">\\;</code>\u7684\u5206\u53f7\u4e0d\u4f1a\u89e6\u53d1\u547d\u4ee4\u5904\u7406\uff0c\u56e0\u6b64\u5b83\u4e4b\u524d\u548c\u4e4b\u540e\u7684\u547d\u4ee4\u5b9e\u9645\u4e0a\u88ab\u5408\u5e76\u5e76\u4f5c\u4e3a\u4e00\u4e2a\u8bf7\u6c42\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u56e0\u6b64\uff0c\u4f8b\u5982</p>\n<pre class=\"programlisting\">select 1\\; select 2\\; select 3;\n</pre>\n<p lang=\"zh\">\u4f1a\u5728\u9047\u5230\u524d\u9762\u6ca1\u6709\u53cd\u659c\u7ebf\u7684\u5206\u53f7\u65f6\uff0c\u5c06\u8fd9\u4e09\u4e2a SQL \u547d\u4ee4\u4f5c\u4e3a\u5355\u4e2a\u8bf7\u6c42\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u670d\u52a1\u5668\u4f1a\u5c06\u6b64\u7c7b\u8bf7\u6c42\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff0c\u9664\u975e\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u663e\u5f0f\u7684<code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code>\u547d\u4ee4\u5c06\u5176\u5206\u6210\u591a\u4e2a\u4e8b\u52a1\u3002\uff08\u6709\u5173\u670d\u52a1\u5668\u5982\u4f55\u5904\u7406\u591a\u67e5\u8be2\u5b57\u7b26\u4e32\u7684\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/17/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT\" title=\"53.2.2.1.\u00a0\u4e00\u4e2a\u7b80\u5355\u67e5\u8be2\u4e2d\u7684\u591a\u6761\u8bed\u53e5\">\u7b2c\u00a053.2.2.1\u00a0\u8282</a>\u3002\uff09</p>\n</dd>\n</dl>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-PATTERNS\">\n<h4 lang=\"zh\">\u6a21\u5f0f</h4>\n<p lang=\"zh\">\u5f88\u591a<code class=\"literal\">\\d</code>\u547d\u4ee4\u90fd\u53ef\u4ee5\u7528\u4e00\u4e2a<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\u6765\u6307\u5b9a\u8981\u88ab\u663e\u793a\u7684\u5bf9\u8c61\u540d\u79f0\u3002\u5728\u6700\u7b80\u5355\u7684\u60c5\u51b5\u4e0b\uff0c\u6a21\u5f0f\u6b63\u597d\u5c31\u662f\u8be5\u5bf9\u8c61\u7684\u51c6\u786e\u540d\u79f0\u3002\u5728\u6a21\u5f0f\u4e2d\u7684\u5b57\u7b26\u901a\u5e38\u4f1a\u88ab\u53d8\u6210\u5c0f\u5199\u5f62\u5f0f\uff08\u5c31\u50cf\u5728 SQL \u540d\u79f0\u4e2d\u90a3\u6837\uff09\uff0c\u4f8b\u5982<code class=\"literal\">\\dt FOO</code>\u5c06\u4f1a\u663e\u793a\u540d\u4e3a<code class=\"literal\">foo</code>\u7684\u8868\u3002\u5c31\u50cf\u5728 SQL \u540d\u79f0\u4e2d\u90a3\u6837\uff0c\u628a\u6a21\u5f0f\u653e\u5728\u53cc\u5f15\u53f7\u4e2d\u53ef\u4ee5\u963b\u6b62\u5b83\u88ab\u8f6c\u6362\u6210\u5c0f\u5199\u5f62\u5f0f\u3002\u5982\u679c\u9700\u8981\u5728\u4e00\u4e2a\u6a21\u5f0f\u4e2d\u5305\u62ec\u4e00\u4e2a\u771f\u6b63\u7684\u53cc\u5f15\u53f7\u5b57\u7b26\uff0c\u5219\u9700\u8981\u5728\u53cc\u5f15\u53f7\u5305\u56f4\u7684\u6587\u672c\u5185\u628a\u5b83\u5199\u6210\u4e24\u4e2a\u76f8\u90bb\u7684\u53cc\u5f15\u53f7\uff0c\u8fd9\u540c\u6837\u662f\u7b26\u5408 SQL \u52a0\u5f15\u53f7\u6807\u8bc6\u7b26\u7684\u89c4\u5219\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dt \"FOO\"\"BAR\"</code>\u5c06\u663e\u793a\u540d\u4e3a<code class=\"literal\">FOO\"BAR</code>\uff08\u4e0d\u662f<code class=\"literal\">foo\"bar</code>\uff09\u7684\u8868\u3002\u548c\u666e\u901a\u7684 SQL \u540d\u79f0\u89c4\u5219\u4e0d\u540c\uff0c\u4f60\u53ef\u4ee5\u53ea\u5728\u6a21\u5f0f\u7684\u4e00\u90e8\u5206\u5468\u56f4\u653e\u4e0a\u53cc\u5f15\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">\\dt FOO\"FOO\"BAR</code>\u5c06\u4f1a\u663e\u793a\u540d\u4e3a<code class=\"literal\">fooFOObar</code>\u7684\u8868\u3002</p>\n<p lang=\"zh\">\u53ea\u8981\u5b8c\u5168\u7701\u7565<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\uff0c<code class=\"literal\">\\d</code>\u547d\u4ee4\u5c31\u4f1a\u663e\u793a\u5f53\u524d\u6a21\u5f0f\u641c\u7d22\u8def\u5f84\u4e2d\u53ef\u89c1\u7684\u5168\u90e8\u5bf9\u8c61 \u2014 \u8fd9\u7b49\u4ef7\u4e8e\u7528<code class=\"literal\">*</code>\u4f5c\u4e3a\u6a21\u5f0f\uff08\u5982\u679c\u4e00\u4e2a\u5bf9\u8c61\u6240\u5728\u7684\u6a21\u5f0f\u4f4d\u4e8e\u641c\u7d22\u8def\u5f84\u4e2d\uff0c\u5e76\u4e14\u5728\u641c\u7d22\u8def\u5f84\u4e2d\u8be5\u6a21\u5f0f\u4e4b\u524d\u6ca1\u6709\u540c\u7c7b\u4e14\u540c\u540d\u7684\u5bf9\u8c61\uff0c\u5219\u8be5\u5bf9\u8c61\u5c31\u662f<em class=\"firstterm\">\u53ef\u89c1</em>\u7684\u3002\u8fd9\u8868\u793a\u53ef\u4ee5\u76f4\u63a5\u7528\u540d\u79f0\u5f15\u7528\u8be5\u5bf9\u8c61\uff0c\u800c\u4e0d\u9700\u8981\u7528\u6a21\u5f0f\u6765\u9650\u5b9a\uff09\u3002\u8981\u67e5\u770b\u6570\u636e\u5e93\u4e2d\u6240\u6709\u5bf9\u8c61\u800c\u4e0d\u8003\u8651\u5176\u53ef\u89c1\u6027\uff0c\u53ef\u4ee5\u628a<code class=\"literal\">*.*</code>\u7528\u4f5c\u6a21\u5f0f\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u653e\u5728\u4e00\u4e2a\u6a21\u5f0f\u4e2d\uff0c<code class=\"literal\">*</code>\u5c06\u5339\u914d\u4efb\u610f\u5b57\u7b26\u5e8f\u5217\uff08\u5305\u62ec\u7a7a\u5e8f\u5217\uff09\uff0c\u800c<code class=\"literal\">?</code>\u4f1a\u5339\u914d\u4efb\u610f\u7684\u5355\u4e2a\u5b57\u7b26\uff08\u8fd9\u79cd\u8bb0\u53f7\u65b9\u6cd5\u5c31\u50cf Unix shell \u7684\u6587\u4ef6\u540d\u6a21\u5f0f\u4e00\u6837\uff09\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dt int*</code>\u4f1a\u663e\u793a\u540d\u79f0\u4ee5<code class=\"literal\">int</code>\u5f00\u59cb\u7684\u8868\u3002\u4f46\u662f\u5982\u679c\u88ab\u653e\u5728\u53cc\u5f15\u53f7\u5185\uff0c<code class=\"literal\">*</code>\u548c<code class=\"literal\">?</code>\u5c31\u4f1a\u5931\u53bb\u8fd9\u4e9b\u7279\u6b8a\u542b\u4e49\u800c\u53d8\u6210\u666e\u901a\u7684\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u5305\u542b\u70b9\u53f7\uff08.\uff09\u7684\u5173\u7cfb\u540d\u6a21\u5f0f\u4f1a\u88ab\u89e3\u91ca\u4e3a\u6a21\u5f0f\u540d\u5339\u914d\u6a21\u5f0f\uff0c\u540e\u63a5\u5bf9\u8c61\u540d\u5339\u914d\u6a21\u5f0f\u3002\u4f8b\u5982\uff0c\\dt foo*.*bar* \u4f1a\u663e\u793a\u6240\u6709\u6a21\u5f0f\u540d\u4ee5 foo \u5f00\u5934\u3001\u8868\u540d\u5305\u542b bar \u7684\u8868\u3002\u6ca1\u6709\u70b9\u53f7\u65f6\uff0c\u53ea\u5339\u914d\u5f53\u524d\u6a21\u5f0f\u641c\u7d22\u8def\u5f84\u4e2d\u53ef\u89c1\u7684\u5bf9\u8c61\u3002\u540c\u6837\uff0c\u53cc\u5f15\u53f7\u5185\u7684\u70b9\u53f7\u4e0d\u5177\u6709\u7279\u6b8a\u542b\u4e49\uff0c\u6309\u5b57\u9762\u5339\u914d\u3002\u5305\u542b\u4e24\u4e2a\u70b9\u53f7\uff08.\uff09\u7684\u5173\u7cfb\u540d\u6a21\u5f0f\u4f1a\u88ab\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u540d\uff0c\u540e\u63a5\u6a21\u5f0f\u540d\u5339\u914d\u6a21\u5f0f\uff0c\u518d\u63a5\u5bf9\u8c61\u540d\u5339\u914d\u6a21\u5f0f\u3002\u6570\u636e\u5e93\u540d\u90e8\u5206\u4e0d\u4f5c\u4e3a\u5339\u914d\u6a21\u5f0f\uff0c\u5fc5\u987b\u4e0e\u5f53\u524d\u8fde\u63a5\u7684\u6570\u636e\u5e93\u540d\u79f0\u76f8\u540c\uff0c\u5426\u5219\u4f1a\u62a5\u9519\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7528\u4e8e\u5339\u914d\u6a21\u5f0f\u540d\u7684\u6a21\u5f0f\u5305\u542b\u4e00\u4e2a\u70b9\uff08<code class=\"literal\">.</code>\uff09\uff0c\u5219\u4f1a\u88ab\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u540d\uff0c\u540e\u63a5\u6a21\u5f0f\u540d\u7684\u5339\u914d\u6a21\u5f0f\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dn mydb.*foo*</code>\u4f1a\u663e\u793a\u540d\u79f0\u4e2d\u5305\u542b<code class=\"literal\">foo</code>\u7684\u6240\u6709\u6a21\u5f0f\u3002\u6570\u636e\u5e93\u540d\u90e8\u5206\u4e0d\u4f1a\u88ab\u5f53\u4f5c\u5339\u914d\u6a21\u5f0f\uff0c\u5fc5\u987b\u4e0e\u5f53\u524d\u8fde\u63a5\u7684\u6570\u636e\u5e93\u540d\u76f8\u540c\uff0c\u5426\u5219\u4f1a\u62a5\u9519\u3002</p>\n<p lang=\"zh\">\u9ad8\u7ea7\u7528\u6237\u53ef\u4ee5\u4f7f\u7528\u5b57\u7b26\u7c7b\u7b49\u6b63\u5219\u8868\u8fbe\u5f0f\u8bb0\u6cd5\uff0c\u5982<code class=\"literal\">[0-9]</code>\u53ef\u4ee5\u5339\u914d\u4efb\u610f\u6570\u5b57\u3002\u6240\u6709\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u90fd\u6309\u7167<a class=\"xref\" href=\"/docs/17/functions-matching.html#FUNCTIONS-POSIX-REGEXP\" title=\"9.7.3.\u00a0POSIX\u6b63\u5219\u8868\u8fbe\u5f0f\">\u7b2c\u00a09.7.3\u00a0\u8282</a>\u6240\u8bf4\u7684\u5de5\u4f5c\uff0c\u4ee5\u4e0b\u5b57\u7b26\u9664\u5916\uff1a<code class=\"literal\">.</code>\u4f1a\u6309\u7167\u4e0a\u9762\u6240\u8bf4\u7684\u4f5c\u4e3a\u4e00\u79cd\u5206\u9694\u7b26\uff0c<code class=\"literal\">*</code>\u4f1a\u88ab\u7ffb\u8bd1\u6210\u6b63\u5219\u8868\u8fbe\u5f0f\u8bb0\u53f7<code class=\"literal\">.*</code>\uff0c<code class=\"literal\">?</code>\u4f1a\u88ab\u7ffb\u8bd1\u6210<code class=\"literal\">.</code>\uff0c\u800c<code class=\"literal\">$</code>\u5219\u6309\u5b57\u9762\u610f\u601d\u5339\u914d\u3002\u6839\u636e\u9700\u8981\uff0c\u53ef\u4ee5\u7528<code class=\"literal\">?</code>\u6a21\u62df<code class=\"literal\">.</code>\uff0c\u7528<code class=\"literal\">(<em class=\"replaceable\"><code>R</code></em>+|)</code>\u6a21\u62df<code class=\"literal\"><em class=\"replaceable\"><code>R</code></em>*</code>\uff0c\u6216\u7528<code class=\"literal\">(<em class=\"replaceable\"><code>R</code></em>|)</code>\u6a21\u62df<code class=\"literal\"><em class=\"replaceable\"><code>R</code></em>?</code>\u3002<code class=\"literal\">$</code>\u4e0d\u9700\u8981\u4f5c\u4e3a\u4e00\u4e2a\u6b63\u5219\u8868\u8fbe\u5f0f\u5b57\u7b26\uff0c\u56e0\u4e3a\u6a21\u5f0f\u5fc5\u987b\u5339\u914d\u6574\u4e2a\u540d\u79f0\uff0c\u800c\u4e0d\u662f\u50cf\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5e38\u89c4\u7528\u6cd5\u90a3\u6837\u89e3\u91ca\uff08\u6362\u53e5\u8bdd\u8bf4\uff0c<code class=\"literal\">$</code>\u4f1a\u88ab\u81ea\u52a8\u5730\u8ffd\u52a0\u5230\u6a21\u5f0f\u4e0a\uff09\u3002\u5982\u679c\u4e0d\u5e0c\u671b\u8be5\u6a21\u5f0f\u7684\u5339\u914d\u4f4d\u7f6e\u88ab\u56fa\u5b9a\uff0c\u53ef\u4ee5\u5728\u5f00\u5934\u6216\u8005\u7ed3\u5c3e\u5199\u4e0a<code class=\"literal\">*</code>\u3002\u6ce8\u610f\u5728\u53cc\u5f15\u53f7\u5185\uff0c\u6240\u6709\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u4f1a\u5931\u53bb\u5176\u7279\u6b8a\u542b\u4e49\u5e76\u4e14\u6309\u7167\u5176\u5b57\u9762\u610f\u601d\u8fdb\u884c\u5339\u914d\u3002\u8fd8\u6709\uff0c\u5728\u64cd\u4f5c\u7b26\u540d\u79f0\u6a21\u5f0f\u4e2d\uff08\u5373\u4f5c\u4e3a<code class=\"literal\">\\do</code>\u7684\u53c2\u6570\uff09\uff0c\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u4e5f\u6309\u7167\u5b57\u9762\u610f\u601d\u8fdb\u884c\u5339\u914d\u3002</p>\n</div>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.21.8.5\">\n<h3 lang=\"zh\">\u9ad8\u7ea7\u7279\u6027</h3>\n<div class=\"refsect3\" id=\"APP-PSQL-VARIABLES\">\n<h4 lang=\"zh\">\u53d8\u91cf</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u63d0\u4f9b\u4e86\u548c\u666e\u901a Unix \u547d\u4ee4 shell \u76f8\u4f3c\u7684\u53d8\u91cf\u66ff\u6362\u7279\u6027\u3002\u53d8\u91cf\u7b80\u5355\u6765\u8bf4\u5c31\u662f\u4e00\u5bf9\u540d\u79f0/\u503c\uff0c\u5176\u4e2d\u503c\u53ef\u4ee5\u662f\u4efb\u610f\u957f\u5ea6\u7684\u4efb\u610f\u5b57\u7b26\u4e32\u3002\u540d\u79f0\u5fc5\u987b\u7531\u5b57\u6bcd\uff08\u5305\u62ec\u975e\u62c9\u4e01\u5b57\u6bcd\uff09\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u6784\u6210\u3002</p>\n<p lang=\"zh\">\u8981\u8bbe\u7f6e\u4e00\u4e2a\u53d8\u91cf\uff0c\u53ef\u4ee5\u4f7f\u7528<span class=\"application\">psql</span>\u7684\u5143\u547d\u4ee4<code class=\"command\">\\set</code>\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo bar</code></strong>\n</pre>\n<p lang=\"zh\">\u4f1a\u5c06<code class=\"literal\">foo</code>\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">bar</code>\u3002\u8981\u68c0\u7d22\u8be5\u53d8\u91cf\u7684\u5185\u5bb9\uff0c\u53ef\u4ee5\u5728\u540d\u79f0\u524d\u653e\u4e00\u4e2a\u5192\u53f7\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\echo :foo</code></strong>\nbar\n</pre>\n<p lang=\"zh\">\u8fd9\u5728\u5e38\u89c4 SQL \u547d\u4ee4\u548c\u5143\u547d\u4ee4\u4e2d\u5747\u6709\u6548\uff0c\u4e0b\u6587\u7684<a class=\"xref\" href=\"/docs/17/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL \u63d2\u503c\">SQL \u63d2\u503c</a>\u4e2d\u6709\u66f4\u591a\u7ec6\u8282\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u8c03\u7528<code class=\"command\">\\set</code>\u65f6\u6ca1\u6709\u7b2c\u4e8c\u4e2a\u53c2\u6570\uff0c\u8be5\u53d8\u91cf\u4f1a\u88ab\u8bbe\u7f6e\u4e3a\u4e00\u4e2a\u7a7a\u5b57\u7b26\u4e32\u503c\u3002\u8981\u53d6\u6d88\u8bbe\u7f6e\uff08\u5373\u5220\u9664\uff09\u4e00\u4e2a\u53d8\u91cf\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4<code class=\"command\">\\unset</code>\u3002\u8981\u663e\u793a\u6240\u6709\u53d8\u91cf\u7684\u503c\uff0c\u5728\u8c03\u7528<code class=\"command\">\\set</code>\u65f6\u4e0d\u5e26\u4efb\u4f55\u53c2\u6570\u5373\u53ef\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\"><code class=\"command\">\\set</code>\u7684\u53c2\u6570\u670d\u4ece\u4e0e\u5176\u4ed6\u547d\u4ee4\u76f8\u540c\u7684\u66ff\u6362\u89c4\u5219\u3002\u56e0\u6b64\u53ef\u4ee5\u6784\u9020\u6709\u8da3\u7684\u5f15\u7528\uff0c\u4f8b\u5982<code class=\"literal\">\\set :foo 'something'</code>\u4ee5\u53ca\u5206\u522b\u5f97\u5230<span class=\"productname\">Perl</span>\u6216\u8005<span class=\"productname\"><acronym class=\"acronym\">PHP</acronym></span>\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u8f6f\u94fe\u63a5</span>\u201d</span>\u6216\u8005<span class=\"quote\">\u201c<span class=\"quote\">\u53ef\u53d8\u53d8\u91cf</span>\u201d</span>\u3002\u4e0d\u5e78\u7684\u662f\uff08\u6216\u8005\u5e78\u8fd0\u7684\u662f\uff1f\uff09\uff0c\u8fd9\u4e9b\u6784\u9020\u51fa\u6765\u7684\u4e1c\u897f\u5e76\u6ca1\u6709\u4ec0\u4e48\u7528\u5904\u3002\u5728\u53e6\u4e00\u65b9\u9762\uff0c<code class=\"literal\">\\set bar :foo</code>\u662f\u4e00\u79cd\u5f88\u597d\u7684\u62f7\u8d1d\u53d8\u91cf\u7684\u65b9\u6cd5\u3002</p>\n</div>\n<p lang=\"zh\">\u6709\u4e00\u4e9b\u53d8\u91cf\u4f1a\u88ab<span class=\"application\">psql</span>\u7279\u6b8a\u5bf9\u5f85\u3002\u5b83\u4eec\u8868\u793a\u7279\u5b9a\u7684\u9009\u9879\u8bbe\u7f6e\uff0c\u8fd0\u884c\u65f6\u8fd9\u7c7b\u9009\u9879\u8bbe\u7f6e\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539\u8be5\u53d8\u91cf\u7684\u503c\u6765\u6539\u53d8\uff0c\u6216\u8005\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u5b83\u4eec\u8868\u793a<span class=\"application\">psql</span>\u7684\u53ef\u66f4\u6539\u7684\u72b6\u6001\u3002\u6309\u7167\u60ef\u4f8b\uff0c\u6240\u6709\u88ab\u7279\u6b8a\u5bf9\u5f85\u7684\u53d8\u91cf\u7684\u540d\u79f0\u7531\u5168\u90e8\u5927\u5199\u5f62\u5f0f\u7684 ASCII \u5b57\u6bcd\uff08\u8fd8\u6709\u53ef\u80fd\u662f\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\uff09\u7ec4\u6210\u3002\u4e3a\u4e86\u786e\u4fdd\u672a\u6765\u6700\u5927\u7684\u517c\u5bb9\u6027\uff0c\u6700\u597d\u907f\u514d\u628a\u8fd9\u7c7b\u53d8\u91cf\u540d\u7528\u4e8e\u81ea\u5df1\u7684\u76ee\u7684\u3002</p>\n<p lang=\"zh\">\u63a7\u5236<span class=\"application\">psql</span>\u884c\u4e3a\u7684\u53d8\u91cf\u901a\u5e38\u4e0d\u80fd\u88ab\u53d6\u6d88\u8bbe\u7f6e\u6216\u8005\u8bbe\u7f6e\u4e3a\u65e0\u6548\u503c\u3002\u5141\u8bb8<code class=\"literal\">\\unset</code>\u547d\u4ee4\uff0c\u4f46\u5b83\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u5b83\u7684\u9ed8\u8ba4\u503c\u3002\u6ca1\u6709\u7b2c\u4e8c\u53c2\u6570\u7684<code class=\"literal\">\\set</code>\u547d\u4ee4\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\uff08\u5bf9\u4e8e\u63a5\u53d7\u8be5\u503c\u7684\u63a7\u5236\u53d8\u91cf\uff09\uff0c\u5bf9\u4e0d\u63a5\u53d7\u8be5\u503c\u7684\u53d8\u91cf\u5219\u4f1a\u62d2\u7edd\u8fd9\u4e2a\u547d\u4ee4\u3002\u6b64\u5916\uff0c\u63a5\u53d7\u503c<code class=\"literal\">on</code>\u548c<code class=\"literal\">off</code>\u7684\u63a7\u5236\u53d8\u91cf\u4e5f\u80fd\u63a5\u53d7\u5176\u4ed6\u5e38\u89c1\u7684\u5e03\u5c14\u503c\u62fc\u5199\u65b9\u5f0f\uff0c\u4f8b\u5982<code class=\"literal\">true</code>\u548c<code class=\"literal\">false</code>\u3002</p>\n<p lang=\"zh\">\u88ab\u7279\u6b8a\u5bf9\u5f85\u7684\u53d8\u91cf\u662f\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-VARIABLES-AUTOCOMMIT\"><span class=\"term\"><code class=\"varname\">AUTOCOMMIT</code> </span> </dt>\n<dd>\n<p lang=\"zh\">\u5728\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\uff08\u9ed8\u8ba4\uff09\u65f6\uff0c\u6bcf\u4e00\u4e2a SQL \u547d\u4ee4\u5728\u6210\u529f\u5b8c\u6210\u65f6\u4f1a\u88ab\u81ea\u52a8\u63d0\u4ea4\u3002\u5728\u8fd9\u79cd\u6a21\u5f0f\u4e2d\u8981\u63a8\u8fdf\u63d0\u4ea4\uff0c\u5fc5\u987b\u8f93\u5165\u4e00\u4e2a<code class=\"command\">BEGIN</code>\u6216\u8005<code class=\"command\">START TRANSACTION</code> SQL \u547d\u4ee4\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">off</code>\u6216\u8005\u88ab\u53d6\u6d88\u8bbe\u7f6e\u65f6\uff0c\u5728\u663e\u5f0f\u53d1\u51fa<code class=\"command\">COMMIT</code>\u6216\u8005<code class=\"command\">END</code>\u4e4b\u524d\uff0cSQL \u547d\u4ee4\u4e0d\u4f1a\u88ab\u63d0\u4ea4\u3002\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u4f1a\u4e3a\u4f60\u53d1\u51fa\u4e00\u4e2a\u9690\u5f0f\u7684<code class=\"command\">BEGIN</code>\uff0c\u8fd9\u4f1a\u53d1\u751f\u5728\u547d\u4ee4\u6267\u884c\u4e4b\u524d\uff0c\u524d\u63d0\u662f\u8be5\u547d\u4ee4\u4e0d\u5728\u4e8b\u52a1\u5757\u4e2d\uff0c\u4e14\u5176\u672c\u8eab\u65e2\u4e0d\u662f<code class=\"command\">BEGIN</code>\u6216\u5176\u4ed6\u4e8b\u52a1\u63a7\u5236\u547d\u4ee4\uff0c\u4e5f\u4e0d\u662f\u65e0\u6cd5\u5728\u4e8b\u52a1\u5757\u4e2d\u6267\u884c\u7684\u547d\u4ee4\uff08\u4f8b\u5982<code class=\"command\">VACUUM</code>\uff09\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u4e2d\uff0c\u5fc5\u987b\u901a\u8fc7<code class=\"command\">ABORT</code>\u6216\u8005<code class=\"command\">ROLLBACK</code>\u663e\u5f0f\u5730\u653e\u5f03\u4efb\u4f55\u5931\u8d25\u7684\u4e8b\u52a1\u3002\u8fd8\u8981\u8bb0\u4f4f\uff0c\u5982\u679c\u9000\u51fa\u4f1a\u8bdd\u65f6\u6ca1\u6709\u63d0\u4ea4\uff0c\u5219\u6240\u6709\u7684\u5de5\u4f5c\u90fd\u4f1a\u4e22\u5931\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u81ea\u52a8\u63d0\u4ea4\u6253\u5f00\u6a21\u5f0f\u662f<span class=\"productname\">PostgreSQL</span>\u7684\u4f20\u7edf\u884c\u4e3a\uff0c\u4f46\u662f\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u66f4\u63a5\u8fd1\u4e8e SQL \u7684\u89c4\u8303\u3002\u5982\u679c\u66f4\u559c\u6b22\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\uff0c\u53ef\u4ee5\u5728\u7cfb\u7edf\u7ea7\u7684<code class=\"filename\">psqlrc</code>\u6587\u4ef6\u6216\u8005\u4e2a\u4eba\u7684<code class=\"filename\">~/.psqlrc</code>\u6587\u4ef6\u4e2d\u8bbe\u7f6e\u5b83\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-COMP-KEYWORD-CASE\"><span class=\"term\"><code class=\"varname\">COMP_KEYWORD_CASE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u786e\u5b9a\u5728\u8865\u5168\u4e00\u4e2a SQL \u5173\u952e\u8bcd\u65f6\u8981\u4f7f\u7528\u7684\u5927\u5c0f\u5199\u5f62\u5f0f\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">lower</code>\u6216\u8005<code class=\"literal\">upper</code>\uff0c\u8865\u5168\u540e\u7684\u8bcd\u5c06\u5206\u522b\u662f\u5c0f\u5199\u6216\u8005\u5927\u5199\u5f62\u5f0f\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">preserve-lower</code>\u6216\u8005<code class=\"literal\">preserve-upper</code>\uff08\u9ed8\u8ba4\uff09\uff0c\u8865\u5168\u540e\u7684\u8bcd\u5c06\u4f1a\u4fdd\u6301\u8be5\u8bcd\u5df2\u8f93\u5165\u90e8\u5206\u7684\u5927\u5c0f\u5199\u5f62\u5f0f\uff0c\u4f46\u662f\u5982\u679c\u88ab\u8865\u5168\u7684\u8bcd\u8fd8\u6ca1\u6709\u88ab\u8f93\u5165\uff0c\u5219\u5b83\u4f1a\u88ab\u5206\u522b\u8865\u5168\u6210\u5c0f\u5199\u6216\u8005\u5927\u5199\u5f62\u5f0f\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-DBNAME\"><span class=\"term\"><code class=\"varname\">DBNAME</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u5df2\u8fde\u63a5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u662f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ECHO\"><span class=\"term\"><code class=\"varname\">ECHO</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">all</code>\uff0c\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u4f1a\u5728\u8bfb\u5165\u65f6\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u8bfb\u53d6\u7684\u884c\uff09\u3002\u8981\u5728\u7a0b\u5e8f\u5f00\u59cb\u65f6\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\uff0c\u53ef\u4ee5\u4f7f\u7528\u5f00\u5173<code class=\"option\">-a</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">queries</code>\uff0c<span class=\"application\">psql</span>\u4f1a\u5728\u53d1\u9001\u6bcf\u4e2a\u67e5\u8be2\u7ed9\u670d\u52a1\u5668\u65f6\u5c06\u5b83\u4eec\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\u3002\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\u7684\u5f00\u5173\u662f<code class=\"option\">-e</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">errors</code>\uff0c\u90a3\u4e48\u53ea\u6709\u5931\u8d25\u7684\u67e5\u8be2\u4f1a\u88ab\u663e\u793a\u5728\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u4e0a\u3002\u8fd9\u79cd\u884c\u4e3a\u7684\u5f00\u5173\u662f<code class=\"option\">-b</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">none</code>\uff08\u9ed8\u8ba4\u503c\uff09\u5219\u4e0d\u4f1a\u663e\u793a\u4efb\u4f55\u67e5\u8be2\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ECHO-HIDDEN\"><span class=\"term\"><code class=\"varname\">ECHO_HIDDEN</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u4e14\u4e00\u4e2a\u53cd\u659c\u7ebf\u547d\u4ee4\u67e5\u8be2\u6570\u636e\u5e93\u65f6\uff0c\u76f8\u5e94\u7684\u67e5\u8be2\u4f1a\u88ab\u5148\u663e\u793a\u3002\u8fd9\u79cd\u7279\u6027\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u5b66\u4e60<span class=\"productname\">PostgreSQL</span>\u7684\u5185\u90e8\u5e76\u4e14\u5728\u81ea\u5df1\u7684\u7a0b\u5e8f\u4e2d\u63d0\u4f9b\u7c7b\u4f3c\u7684\u529f\u80fd\uff08\u8981\u5728\u7a0b\u5e8f\u5f00\u59cb\u65f6\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\uff0c\u53ef\u4ee5\u4f7f\u7528\u5f00\u5173<code class=\"option\">-E</code>\uff09\u3002\u5982\u679c\u628a\u8fd9\u4e2a\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">noexec</code>\uff0c\u5219\u5bf9\u5e94\u7684\u67e5\u8be2\u53ea\u4f1a\u88ab\u663e\u793a\u800c\u5e76\u4e0d\u771f\u6b63\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u6267\u884c\u3002\u9ed8\u8ba4\u503c\u662f<code class=\"literal\">off</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ENCODING\"><span class=\"term\"><code class=\"varname\">ENCODING</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u7684\u5ba2\u6237\u7aef\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u6bcf\u4e00\u6b21\u4f60\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\uff09\u65f6\u4ee5\u53ca\u5f53\u4f60\u7528<code class=\"literal\">\\encoding</code>\u66f4\u6539\u7f16\u7801\u65f6\uff0c\u8fd9\u4e2a\u53d8\u91cf\u90fd\u4f1a\u88ab\u8bbe\u7f6e\uff0c\u4f46\u5b83\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ERROR\"><span class=\"term\"><code class=\"varname\">ERROR</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u4e0a\u4e00\u4e2aSQL\u67e5\u8be2\u5931\u8d25\u5219\u4e3a<code class=\"literal\">true</code>\uff0c\u5982\u679c\u6210\u529f\u5219\u662f<code class=\"literal\">false</code>\u3002\u53e6\u89c1<code class=\"varname\">SQLSTATE</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-FETCH-COUNT\"><span class=\"term\"><code class=\"varname\">FETCH_COUNT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a\u4e00\u4e2a\u5927\u4e8e\u96f6\u7684\u6574\u6570\u503c\uff0c<code class=\"command\">SELECT</code>\u67e5\u8be2\u7684\u7ed3\u679c\u4f1a\u4ee5\u4e00\u7ec4\u4e00\u7ec4\u7684\u65b9\u5f0f\u53d6\u51fa\u5e76\u4e14\u663e\u793a\uff08\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u7684\u90a3\u6837\u628a\u6574\u4e2a\u7ed3\u679c\u96c6\u62ff\u5230\u4ee5\u540e\u518d\u663e\u793a\uff09\uff0c\u6bcf\u7ec4\u5305\u542b\u7684\u884c\u6570\u7b49\u4e8e\u8be5\u6574\u6570\u503c\u3002\u56e0\u6b64\uff0c\u8fd9\u79cd\u65b9\u5f0f\u53ea\u4f1a\u4f7f\u7528\u6709\u9650\u7684\u5185\u5b58\u91cf\uff0c\u800c\u4e0d\u7ba1\u6574\u4e2a\u7ed3\u679c\u96c6\u7684\u5927\u5c0f\u3002\u5728\u542f\u7528\u8fd9\u4e2a\u7279\u6027\u65f6\uff0c\u901a\u5e38\u4f1a\u4f7f\u7528 100 \u5230 1000 \u7684\u8bbe\u7f6e\u3002\u8bb0\u4f4f\u5728\u4f7f\u7528\u8fd9\u79cd\u7279\u6027\u65f6\uff0c\u4e00\u4e2a\u67e5\u8be2\u53ef\u80fd\u4f1a\u5728\u5df2\u7ecf\u663e\u793a\u4e86\u4e00\u4e9b\u884c\u4e4b\u540e\u5931\u8d25\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5c3d\u7ba1\u53ef\u4ee5\u628a\u8fd9\u79cd\u7279\u6027\u7528\u4e8e\u4efb\u4f55\u7684\u8f93\u51fa\u683c\u5f0f\uff0c\u4f46\u662f\u9ed8\u8ba4\u7684<code class=\"literal\">aligned</code>\u683c\u5f0f\u770b\u8d77\u6765\u4f1a\u6bd4\u8f83\u7cdf\u7cd5\uff0c\u56e0\u4e3a\u6bcf\u4e00\u7ec4\u7684<code class=\"varname\">FETCH_COUNT</code>\u884c\u5c06\u88ab\u5355\u72ec\u683c\u5f0f\u5316\uff0c\u8fd9\u5c31\u4f1a\u5bfc\u81f4\u4e0d\u540c\u7684\u884c\u7ec4\u7684\u5217\u5bbd\u4e0d\u540c\u3002\u5176\u4ed6\u7684\u8f93\u51fa\u683c\u5f0f\u4f1a\u66f4\u597d\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HIDE-TABLEAM\"><span class=\"term\"><code class=\"varname\">HIDE_TABLEAM</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6b64\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">true</code>\uff0c\u5219\u4e0d\u663e\u793a\u8868\u7684\u8bbf\u95ee\u65b9\u6cd5\u7684\u8be6\u7ec6\u4fe1\u606f\u3002\u8fd9\u4e3b\u8981\u7528\u4e8e\u56de\u5f52\u6d4b\u8bd5\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HIDE-TOAST-COMPRESSION\"><span class=\"term\"><code class=\"varname\">HIDE_TOAST_COMPRESSION</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">true</code>\uff0c\u4e0d\u663e\u793a\u5217\u538b\u7f29\u65b9\u6cd5\u7684\u7ec6\u8282\u3002\u8fd9\u4e3b\u8981\u7528\u4e8e\u56de\u5f52\u6d4b\u8bd5\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HISTCONTROL\"><span class=\"term\"><code class=\"varname\">HISTCONTROL</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">ignorespace</code>\uff0c\u5219\u4ee5\u4e00\u4e2a\u7a7a\u683c\u5f00\u59cb\u7684\u884c\u4e0d\u4f1a\u88ab\u653e\u5165\u5230\u5386\u53f2\u5217\u8868\u4e2d\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">ignoredups</code>\uff0c\u5219\u4e0e\u4e0a\u4e00\u6761\u5386\u53f2\u8bb0\u5f55\u76f8\u540c\u7684\u884c\u4e0d\u4f1a\u88ab\u653e\u5165\u3002\u503c<code class=\"literal\">ignoreboth</code>\u7ec4\u5408\u4e86\u4e0a\u8ff0\u4e24\u79cd\u503c\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">none</code>\uff08\u9ed8\u8ba4\u503c\uff09\uff0c\u6240\u6709\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e2d\u88ab\u8bfb\u5165\u7684\u884c\u90fd\u4f1a\u4fdd\u5b58\u5728\u5386\u53f2\u5217\u8868\u4e2d\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HISTFILE\"><span class=\"term\"><code class=\"varname\">HISTFILE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8be5\u6587\u4ef6\u540d\u5c06\u88ab\u7528\u4e8e\u5b58\u50a8\u5386\u53f2\u5217\u8868\u3002\u5982\u679c\u672a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff0c\u6587\u4ef6\u540d\u5c06\u4ece<code class=\"envar\">PSQL_HISTORY</code>\u73af\u5883\u53d8\u91cf\u4e2d\u53d6\u5f97\u3002\u5982\u679c\u8be5\u73af\u5883\u53d8\u91cf\u4e5f\u6ca1\u6709\u88ab\u8bbe\u7f6e\uff0c\u5219\u9ed8\u8ba4\u503c\u662f<code class=\"filename\">~/.psql_history</code>\uff0c\u5728Windows\u4e0a\u662f<code class=\"filename\">%APPDATA%\\postgresql\\psql_history</code>\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">\\set HISTFILE ~/.psql_history-:DBNAME\n</pre>\n<p lang=\"zh\">\u653e\u5728<code class=\"filename\">~/.psqlrc</code>\u4e2d\u5c06\u4f1a\u5bfc\u81f4<span class=\"application\">psql</span>\u4e3a\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u7ef4\u62a4\u4e00\u4e2a\u5355\u72ec\u7684\u5386\u53f2\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HISTSIZE\"><span class=\"term\"><code class=\"varname\">HISTSIZE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u547d\u4ee4\u5386\u53f2\u4e2d\u6700\u591a\u4fdd\u5b58\u7684\u547d\u4ee4\u6570\uff08\u9ed8\u8ba4 500\uff09\u3002\u8bbe\u4e3a\u8d1f\u503c\u65f6\uff0c\u4e0d\u8bbe\u4e0a\u9650\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HOST\"><span class=\"term\"><code class=\"varname\">HOST</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e3b\u673a\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u4e5f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-IGNOREEOF\"><span class=\"term\"><code class=\"varname\">IGNOREEOF</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8bbe\u4e3a 1 \u6216\u66f4\u5c0f\u7684\u503c\uff0c\u5411 psql \u4ea4\u4e92\u4f1a\u8bdd\u53d1\u9001 EOF \u5b57\u7b26\uff08\u901a\u5e38\u4e3a Control + D\uff09\u5c31\u4f1a\u7ec8\u6b62\u5e94\u7528\u3002\u5982\u679c\u8bbe\u4e3a\u66f4\u5927\u7684\u6570\u503c\uff0c\u5219\u5fc5\u987b\u8fde\u7eed\u8f93\u5165\u76f8\u5e94\u6b21\u6570\u7684 EOF \u5b57\u7b26\u624d\u4f1a\u7ec8\u6b62\u4ea4\u4e92\u4f1a\u8bdd\u3002\u5982\u679c\u53d8\u91cf\u8bbe\u4e3a\u975e\u6570\u503c\uff0c\u4f1a\u88ab\u89e3\u91ca\u4e3a 10\u3002\u9ed8\u8ba4\u503c\u4e3a 0\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-LASTOID\"><span class=\"term\"><code class=\"varname\">LASTOID</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6700\u8fd1\u4e00\u6b21\u53d7\u5f71\u54cd\u7684 OID \u503c\uff0c\u7531 INSERT \u6216 \\lo_import \u547d\u4ee4\u8fd4\u56de\u3002\u6b64\u53d8\u91cf\u4ec5\u4fdd\u8bc1\u5728\u4e0b\u4e00\u6761 SQL \u547d\u4ee4\u7684\u7ed3\u679c\u663e\u793a\u4e4b\u524d\u6709\u6548\u3002\u4ece\u7248\u672c 12 \u8d77\uff0cPostgreSQL \u670d\u52a1\u5668\u4e0d\u518d\u652f\u6301 OID \u7cfb\u7edf\u5217\uff0c\u56e0\u6b64\u8fde\u63a5\u5230\u8fd9\u4e9b\u670d\u52a1\u5668\u65f6\uff0c\u6267\u884c INSERT \u540e LASTOID \u59cb\u7ec8\u4e3a 0\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-LAST-ERROR-MESSAGE\"><span class=\"term\"><code class=\"varname\">LAST_ERROR_MESSAGE</code><br/></span><span class=\"term\"><code class=\"varname\">LAST_ERROR_SQLSTATE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d<span class=\"application\">psql</span>\u4f1a\u8bdd\u4e2d\u6700\u8fd1\u4e00\u4e2a\u5931\u8d25\u67e5\u8be2\u7684\u4e3b\u9519\u8bef\u6d88\u606f\u548c\u76f8\u5173\u7684SQLSTATE\u4ee3\u7801\uff0c\u5982\u679c\u5728\u5f53\u524d\u4f1a\u8bdd\u4e2d\u6ca1\u6709\u53d1\u751f\u9519\u8bef\uff0c\u5219\u662f\u4e00\u4e2a\u7a7a\u5b57\u7b26\u4e32\u548c<code class=\"literal\">00000</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ON-ERROR-ROLLBACK\"><span class=\"term\"><code class=\"varname\">ON_ERROR_ROLLBACK</code> </span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u65f6\uff0c\u5982\u679c\u4e8b\u52a1\u5757\u4e2d\u7684\u4e00\u4e2a\u8bed\u53e5\u4ea7\u751f\u4e00\u4e2a\u9519\u8bef\uff0c\u8be5\u9519\u8bef\u4f1a\u88ab\u5ffd\u7565\u5e76\u4e14\u8be5\u4e8b\u52a1\u4f1a\u7ee7\u7eed\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">interactive</code>\u65f6\uff0c\u53ea\u5728\u4ea4\u4e92\u5f0f\u4f1a\u8bdd\u4e2d\u5ffd\u7565\u8fd9\u7c7b\u9519\u8bef\uff0c\u800c\u8bfb\u53d6\u811a\u672c\u6587\u4ef6\u65f6\u5219\u4e0d\u4f1a\u5ffd\u7565\u9519\u8bef\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">off</code>\uff08\u9ed8\u8ba4\u503c\uff09\u65f6\uff0c\u4e8b\u52a1\u5757\u4e2d\u4ea7\u751f\u9519\u8bef\u7684\u4e00\u4e2a\u8bed\u53e5\u4f1a\u4e2d\u6b62\u6574\u4e2a\u4e8b\u52a1\u3002\u9519\u8bef\u56de\u6eda\u6a21\u5f0f\u7684\u5de5\u4f5c\u539f\u7406\u662f\u5728\u4e8b\u52a1\u5757\u7684\u6bcf\u4e2a\u547d\u4ee4\u4e4b\u524d\u90fd\u4e3a\u4f60\u53d1\u51fa\u4e00\u4e2a\u9690\u5f0f\u7684<code class=\"command\">SAVEPOINT</code>\uff0c\u7136\u540e\u5728\u8be5\u547d\u4ee4\u5931\u8d25\u65f6\u56de\u6eda\u5230\u8be5\u4fdd\u5b58\u70b9\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ON-ERROR-STOP\"><span class=\"term\"><code class=\"varname\">ON_ERROR_STOP</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u51fa\u9519\u540e\u4ecd\u4f1a\u7ee7\u7eed\u5904\u7406\u547d\u4ee4\u3002\u5c06\u6b64\u53d8\u91cf\u8bbe\u4e3a on \u540e\uff0c\u5904\u7406\u4f1a\u7acb\u5373\u505c\u6b62\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\uff0cpsql \u4f1a\u8fd4\u56de\u547d\u4ee4\u63d0\u793a\u7b26\uff1b\u5426\u5219\uff0cpsql \u4f1a\u9000\u51fa\u5e76\u8fd4\u56de\u9519\u8bef\u7801 3\uff0c\u4ee5\u533a\u522b\u4e8e\u9519\u8bef\u7801 1 \u6240\u8868\u793a\u7684\u81f4\u547d\u9519\u8bef\u3002\u65e0\u8bba\u54ea\u79cd\u60c5\u51b5\uff0c\u5f53\u524d\u6b63\u5728\u8fd0\u884c\u7684\u6240\u6709\u811a\u672c\uff08\u5982\u679c\u5b58\u5728\u9876\u5c42\u811a\u672c\uff0c\u5219\u5305\u62ec\u8be5\u811a\u672c\u53ca\u5176\u8c03\u7528\u7684\u5176\u4ed6\u811a\u672c\uff09\u90fd\u4f1a\u7acb\u5373\u7ec8\u6b62\u3002\u5982\u679c\u9876\u5c42\u547d\u4ee4\u5b57\u7b26\u4e32\u5305\u542b\u591a\u6761 SQL \u547d\u4ee4\uff0c\u5219\u4f1a\u5728\u5f53\u524d\u547d\u4ee4\u5904\u505c\u6b62\u5904\u7406\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-PORT\"><span class=\"term\"><code class=\"varname\">PORT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u7aef\u53e3\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u4e5f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-PROMPT\"><span class=\"term\"><code class=\"varname\">PROMPT1</code><br/></span><span class=\"term\"><code class=\"varname\">PROMPT2</code><br/></span><span class=\"term\"><code class=\"varname\">PROMPT3</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e9b\u53d8\u91cf\u6307\u5b9a<span class=\"application\">psql</span>\u53d1\u51fa\u7684\u63d0\u793a\u7b26\u7684\u6a21\u6837\u3002\u89c1\u4e0b\u6587\u7684<a class=\"xref\" href=\"/docs/17/app-psql.html#APP-PSQL-PROMPTING\" title=\"\u63d0\u793a\u7b26\">\u63d0\u793a\u7b26</a>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-QUIET\"><span class=\"term\"><code class=\"varname\">QUIET</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u8fd9\u4e2a\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-q</code>\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\u53ef\u80fd\u7528\u5904\u4e0d\u5927\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ROW-COUNT\"><span class=\"term\"><code class=\"varname\">ROW_COUNT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6700\u8fd1\u4e00\u6761 SQL \u67e5\u8be2\u8fd4\u56de\u6216\u5f71\u54cd\u7684\u884c\u6570\uff1b\u5982\u679c\u67e5\u8be2\u5931\u8d25\u6216\u6ca1\u6709\u62a5\u544a\u884c\u6570\uff0c\u5219\u4e3a 0\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SERVER-VERSION-NAME\"><span class=\"term\"><code class=\"varname\">SERVER_VERSION_NAME</code><br/></span><span class=\"term\"><code class=\"varname\">SERVER_VERSION_NUM</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b57\u7b26\u4e32\u5f62\u5f0f\u7684\u670d\u52a1\u5668\u7248\u672c\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">9.6.2</code>\u3001<code class=\"literal\">10.1</code>\u6216\u8005<code class=\"literal\">11beta1</code>\uff0c\u4ee5\u53ca\u6570\u5b57\u5f62\u5f0f\u7684\u670d\u52a1\u5668\u7248\u672c\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">90602</code>\u6216\u8005<code class=\"literal\">100001</code>\u3002\u6bcf\u6b21\u4f60\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\uff09\u65f6\uff0c\u8fd9\u4e9b\u90fd\u4f1a\u88ab\u8bbe\u7f6e\uff0c\u4f46\u53ef\u4ee5\u88ab\u6539\u53d8\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SHELL-ERROR\"><span class=\"term\"><code class=\"varname\">SHELL_ERROR</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6700\u540e\u4e00\u4e2a shell \u547d\u4ee4\u5931\u8d25\uff0c\u5219\u4e3a <code class=\"literal\">true</code>\uff1b\u5982\u679c\u6210\u529f\uff0c\u5219\u4e3a <code class=\"literal\">false</code>\u3002\u8fd9\u9002\u7528\u4e8e\u901a\u8fc7 <code class=\"literal\">\\!</code>\u3001<code class=\"literal\">\\g</code>\u3001<code class=\"literal\">\\o</code>\u3001<code class=\"literal\">\\w</code> \u548c <code class=\"literal\">\\copy</code> \u5143\u547d\u4ee4\u8c03\u7528\u7684 shell \u547d\u4ee4\uff0c\u4e5f\u9002\u7528\u4e8e\u53cd\u5f15\u53f7\uff08<code class=\"literal\">`</code>\uff09\u6269\u5c55\u3002\u8bf7\u6ce8\u610f\uff0c\u5bf9\u4e8e <code class=\"literal\">\\o</code>\uff0c\u8be5\u53d8\u91cf\u4f1a\u5728\u4e0b\u4e00\u4e2a <code class=\"literal\">\\o</code> \u547d\u4ee4\u5173\u95ed\u8f93\u51fa\u7ba1\u9053\u65f6\u66f4\u65b0\u3002\u53e6\u89c1 <code class=\"varname\">SHELL_EXIT_CODE</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SHELL-EXIT-CODE\"><span class=\"term\"><code class=\"varname\">SHELL_EXIT_CODE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u540e\u4e00\u4e2a shell \u547d\u4ee4\u8fd4\u56de\u7684\u9000\u51fa\u72b6\u6001\u30020\u2013127 \u8868\u793a\u7a0b\u5e8f\u9000\u51fa\u7801\uff0c128\u2013255 \u8868\u793a\u56e0\u4fe1\u53f7\u800c\u7ec8\u6b62\uff0c-1 \u8868\u793a\u672a\u80fd\u542f\u52a8\u7a0b\u5e8f\u6216\u672a\u80fd\u53d6\u5f97\u5176\u9000\u51fa\u72b6\u6001\u3002\u8fd9\u9002\u7528\u4e8e\u901a\u8fc7 <code class=\"literal\">\\!</code>\u3001<code class=\"literal\">\\g</code>\u3001<code class=\"literal\">\\o</code>\u3001<code class=\"literal\">\\w</code> \u548c <code class=\"literal\">\\copy</code> \u5143\u547d\u4ee4\u8c03\u7528\u7684 shell \u547d\u4ee4\uff0c\u4e5f\u9002\u7528\u4e8e\u53cd\u5f15\u53f7\uff08<code class=\"literal\">`</code>\uff09\u6269\u5c55\u3002\u8bf7\u6ce8\u610f\uff0c\u5bf9\u4e8e <code class=\"literal\">\\o</code>\uff0c\u8be5\u53d8\u91cf\u4f1a\u5728\u4e0b\u4e00\u4e2a <code class=\"literal\">\\o</code> \u547d\u4ee4\u5173\u95ed\u8f93\u51fa\u7ba1\u9053\u65f6\u66f4\u65b0\u3002\u53e6\u89c1 <code class=\"varname\">SHELL_ERROR</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SHOW-ALL-RESULTS\"><span class=\"term\"><code class=\"varname\">SHOW_ALL_RESULTS</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u6b64\u53d8\u91cf\u88ab\u8bbe\u4e3a <code class=\"literal\">off</code> \u65f6\uff0c\u7ec4\u5408\u67e5\u8be2\uff08<code class=\"literal\">\\;</code>\uff09\u53ea\u663e\u793a\u6700\u540e\u4e00\u4e2a\u7ed3\u679c\uff0c\u800c\u4e0d\u662f\u663e\u793a\u5168\u90e8\u7ed3\u679c\u3002\u9ed8\u8ba4\u503c\u4e3a <code class=\"literal\">on</code>\u3002\u8bbe\u4e3a off \u7684\u884c\u4e3a\u662f\u4e3a\u4e86\u517c\u5bb9\u65e7\u7248\u672c\u7684 <span class=\"application\">psql</span>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SHOW-CONTEXT\"><span class=\"term\"><code class=\"varname\">SHOW_CONTEXT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u53d8\u91cf\u53ef\u4ee5\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">never</code>\u3001<code class=\"literal\">errors</code>\u6216\u8005<code class=\"literal\">always</code>\u6765\u63a7\u5236\u662f\u5426\u5728\u6765\u81ea\u670d\u52a1\u5668\u7684\u6d88\u606f\u4e2d\u663e\u793a<code class=\"literal\">CONTEXT</code>\u5b57\u6bb5\u3002\u9ed8\u8ba4\u662f<code class=\"literal\">errors</code>\uff08\u8868\u793a\u5728\u9519\u8bef\u6d88\u606f\u4e2d\u663e\u793a\u4e0a\u4e0b\u6587\uff0c\u4f46\u5728\u901a\u77e5\u548c\u8b66\u544a\u6d88\u606f\u4e2d\u4e0d\u663e\u793a\uff09\u3002\u5f53<code class=\"varname\">VERBOSITY</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">terse</code>\u6216<code class=\"literal\">sqlstate</code>\u65f6\uff0c\u8fd9\u4e2a\u8bbe\u7f6e\u65e0\u6548\uff08\u53e6\u89c1<code class=\"command\">\\errverbose</code>\uff0c\u5b83\u53ef\u4ee5\u7528\u6765\u5f97\u5230\u521a\u9047\u5230\u7684\u9519\u8bef\u7684\u8be6\u7ec6\u4fe1\u606f\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SINGLELINE\"><span class=\"term\"><code class=\"varname\">SINGLELINE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u8fd9\u4e2a\u53d8\u91cf\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-S</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SINGLESTEP\"><span class=\"term\"><code class=\"varname\">SINGLESTEP</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u8fd9\u4e2a\u53d8\u91cf\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-s</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SQLSTATE\"><span class=\"term\"><code class=\"varname\">SQLSTATE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0e\u4e0a\u4e00\u4e2aSQL\u67e5\u8be2\u7684\u5931\u8d25\u76f8\u5173\u7684\u9519\u8bef\u4ee3\u7801\uff08\u89c1<a class=\"xref\" href=\"/docs/17/errcodes-appendix.html\" title=\"\u9644\u5f55\u00a0A.\u00a0PostgreSQL\u9519\u8bef\u4ee3\u7801\">\u9644\u5f55\u00a0A</a>\uff09\uff0c\u5982\u679c\u4e0a\u4e00\u4e2a\u67e5\u8be2\u6210\u529f\u5219\u4e3a<code class=\"literal\">00000</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-USER\"><span class=\"term\"><code class=\"varname\">USER</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7528\u6237\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u662f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-VERBOSITY\"><span class=\"term\"><code class=\"varname\">VERBOSITY</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u53d8\u91cf\u53ef\u4ee5\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">default</code>\u3001<code class=\"literal\">verbose</code>\u3001<code class=\"literal\">terse</code>\u6216\u8005<code class=\"literal\">sqlstate</code>\u6765\u63a7\u5236\u9519\u8bef\u62a5\u544a\u7684\u8be6\u7ec6\u7a0b\u5ea6\uff08\u53e6\u89c1<code class=\"command\">\\errverbose</code>\uff0c\u5728\u60f3\u5f97\u5230\u521a\u9047\u5230\u7684\u9519\u8bef\u7684\u8be6\u7ec6\u4fe1\u606f\u65f6\u4f7f\u7528\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-VERSION\"><span class=\"term\"><code class=\"varname\">VERSION</code><br/></span><span class=\"term\"><code class=\"varname\">VERSION_NAME</code><br/></span><span class=\"term\"><code class=\"varname\">VERSION_NUM</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e9b\u53d8\u91cf\u5728\u7a0b\u5e8f\u542f\u52a8\u65f6\u88ab\u8bbe\u7f6e\u4ee5\u53cd\u6620<span class=\"application\">psql</span>\u7684\u7248\u672c\uff0c\u5206\u522b\u662f\u4e00\u4e2a\u8be6\u7ec6\u7684\u5b57\u7b26\u4e32\u3001\u4e00\u4e2a\u77ed\u5b57\u7b26\u4e32\uff08\u4f8b\u5982<code class=\"literal\">9.6.2</code>\u3001<code class=\"literal\">10.1</code>\u6216\u8005<code class=\"literal\">11beta1</code>\uff09\u4ee5\u53ca\u4e00\u4e2a\u6570\u5b57\uff08\u4f8b\u5982<code class=\"literal\">90602</code>\u6216\u8005<code class=\"literal\">100001</code>\uff09\u3002\u5b83\u4eec\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-INTERPOLATION\">\n<h4 lang=\"zh\">SQL \u63d2\u503c</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u53d8\u91cf\u7684\u4e00\u4e2a\u5173\u952e\u7279\u6027\u662f\u53ef\u4ee5\u628a\u5b83\u4eec\u66ff\u6362\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u63d2\u503c</span>\u201d</span>\uff09\u5230\u5e38\u89c4<acronym class=\"acronym\">SQL</acronym>\u8bed\u53e5\u4e2d\uff0c\u4e5f\u53ef\u4ee5\u628a\u5b83\u4eec\u66ff\u6362\u5230\u5143\u547d\u4ee4\u7684\u53c2\u6570\u4e2d\u3002\u6b64\u5916\uff0c<span class=\"application\">psql</span>\u8fd8\u63d0\u4f9b\u4e86\u529f\u80fd\u6765\u786e\u4fdd\u88ab\u7528\u4f5c SQL \u5b57\u9762\u91cf\u548c\u6807\u8bc6\u7b26\u7684\u53d8\u91cf\u503c\u4f1a\u88ab\u6b63\u786e\u5730\u52a0\u5f15\u53f7\u3002\u4e0d\u52a0\u5f15\u53f7\u5730\u63d2\u503c\u4e00\u4e2a\u503c\u7684\u8bed\u6cd5\u662f\u5728\u53d8\u91cf\u540d\u524d\u9762\u52a0\u4e0a\u4e00\u4e2a\u5192\u53f7\uff08<code class=\"literal\">:</code>\uff09\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo 'my_table'</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM :foo;</code></strong>\n</pre>\n<p lang=\"zh\">\u5c06\u67e5\u8be2\u8868<code class=\"literal\">my_table</code>\u3002\u6ce8\u610f\u8fd9\u53ef\u80fd\u4f1a\u4e0d\u5b89\u5168\uff1a\u8be5\u53d8\u91cf\u7684\u503c\u4f1a\u88ab\u6309\u5b57\u9762\u62f7\u8d1d\uff0c\u56e0\u6b64\u5b83\u53ef\u80fd\u5305\u542b\u4e0d\u5e73\u8861\u7684\u5f15\u53f7\u751a\u81f3\u53cd\u659c\u7ebf\u547d\u4ee4\u3002\u5fc5\u987b\u786e\u4fdd\u628a\u5b83\u653e\u5728\u90a3\u91cc\u662f\u6709\u610f\u4e49\u7684\u3002</p>\n<p lang=\"zh\">\u5f53\u4e00\u4e2a\u503c\u8981\u7528\u4f5c SQL \u5b57\u9762\u91cf\u6216\u6807\u8bc6\u7b26\u65f6\uff0c\u6700\u5b89\u5168\u7684\u505a\u6cd5\u662f\u4e3a\u5b83\u52a0\u4e0a\u5f15\u53f7\u3002\u8981\u5c06\u53d8\u91cf\u503c\u4f5c\u4e3a SQL \u5b57\u9762\u91cf\u52a0\u5f15\u53f7\uff0c\u5e94\u5199\u4e00\u4e2a\u5192\u53f7\uff0c\u540e\u9762\u8ddf\u7528\u5355\u5f15\u53f7\u62ec\u8d77\u6765\u7684\u53d8\u91cf\u540d\u3002\u8981\u5c06\u53d8\u91cf\u503c\u4f5c\u4e3a SQL \u6807\u8bc6\u7b26\u52a0\u5f15\u53f7\uff0c\u5219\u5728\u5192\u53f7\u540e\u9762\u7528\u53cc\u5f15\u53f7\u62ec\u8d77\u53d8\u91cf\u540d\u3002\u8fd9\u4e9b\u5199\u6cd5\u80fd\u6b63\u786e\u5904\u7406\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165\u7684\u5f15\u53f7\u548c\u5176\u4ed6\u7279\u6b8a\u5b57\u7b26\u3002\u524d\u9762\u7684\u793a\u4f8b\u53ef\u7528\u4ee5\u4e0b\u66f4\u5b89\u5168\u7684\u5199\u6cd5\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo 'my_table'</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM :\"foo\";</code></strong>\n</pre>\n<p lang=\"zh\">\u5728\u52a0\u5f15\u53f7\u7684<acronym class=\"acronym\">SQL</acronym>\u5b57\u9762\u91cf\u548c\u6807\u8bc6\u7b26\u5185\u90e8\uff0c\u4e0d\u4f1a\u6267\u884c\u53d8\u91cf\u63d2\u503c\u3002\u56e0\u6b64\uff0c<code class=\"literal\">':foo'</code>\u8fd9\u6837\u7684\u5199\u6cd5\u4e0d\u80fd\u6839\u636e\u53d8\u91cf\u503c\u751f\u6210\u52a0\u5f15\u53f7\u7684\u5b57\u9762\u91cf\uff08\u5373\u4f7f\u80fd\u591f\u751f\u6548\uff0c\u4e5f\u4e0d\u5b89\u5168\uff0c\u56e0\u4e3a\u5b83\u65e0\u6cd5\u6b63\u786e\u5904\u7406\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165\u7684\u5f15\u53f7\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8fd9\u79cd\u673a\u5236\u7684\u4e00\u4e2a\u793a\u4f8b\u662f\u628a\u4e00\u4e2a\u6587\u4ef6\u7684\u5185\u5bb9\u62f7\u8d1d\u5230\u4e00\u4e2a\u8868\u5217\u4e2d\u3002\u9996\u5148\u628a\u8be5\u6587\u4ef6\u8f7d\u5165\u5230\u4e00\u4e2a\u53d8\u91cf\uff0c\u7136\u540e\u628a\u8be5\u53d8\u91cf\u7684\u503c\u4f5c\u4e3a\u4e00\u4e2a\u52a0\u5f15\u53f7\u7684\u5b57\u7b26\u4e32\u8fdb\u884c\u63d2\u503c\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set content `cat my_file.txt`</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>INSERT INTO my_table VALUES (:'content');</code></strong>\n</pre>\n<p lang=\"zh\">\uff08\u6ce8\u610f\u5982\u679c<code class=\"filename\">my_file.txt</code>\u5305\u542b NUL \u5b57\u8282\uff0c\u8fd9\u6837\u4e5f\u4e0d\u884c\u3002<span class=\"application\">psql</span>\u4e0d\u652f\u6301\u5728\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165 NUL \u5b57\u8282\uff09\u3002</p>\n<p lang=\"zh\">\u56e0\u4e3a\u5192\u53f7\u53ef\u4ee5\u5408\u6cd5\u5730\u51fa\u73b0\u5728 SQL \u547d\u4ee4\u4e2d\uff0c\u770b\u4f3c\u63d2\u503c\u7684\u5199\u6cd5\uff08\u5373<code class=\"literal\">:name</code>\u3001<code class=\"literal\">:'name'</code>\u6216\u8005<code class=\"literal\">:\"name\"</code>\uff09\u4e0d\u4f1a\u88ab\u66ff\u6362\uff0c\u9664\u975e\u6240\u6307\u7684\u53d8\u91cf\u5f53\u524d\u5df2\u8bbe\u7f6e\u3002\u5728\u4efb\u4f55\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u7528\u4e00\u4e2a\u53cd\u659c\u7ebf\u5bf9\u5192\u53f7\u8fdb\u884c\u8f6c\u4e49\u4ee5\u907f\u514d\u5b83\u88ab\u66ff\u6362\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">:{?<em class=\"replaceable\"><code>name</code></em>}</code>\u7279\u6b8a\u8bed\u6cd5\u4f1a\u6839\u636e\u8be5\u53d8\u91cf\u662f\u5426\u5b58\u5728\u8fd4\u56de TRUE \u6216 FALSE\uff0c\u56e0\u6b64\u603b\u662f\u4f1a\u88ab\u66ff\u6362\uff0c\u9664\u975e\u5192\u53f7\u88ab\u53cd\u659c\u7ebf\u8f6c\u4e49\u3002</p>\n<p lang=\"zh\">\u53d8\u91cf\u7684\u5192\u53f7\u8bed\u6cd5\u5bf9\u5d4c\u5165\u5f0f\u67e5\u8be2\u8bed\u8a00\uff08\u4f8b\u5982<span class=\"application\">ECPG</span>\uff09\u6765\u8bf4\u662f\u6807\u51c6\u7684<acronym class=\"acronym\">SQL</acronym>\u3002\u7528\u4e8e\u6570\u7ec4\u5207\u7247\u548c\u7c7b\u578b\u8f6c\u6362\u7684\u5192\u53f7\u8bed\u6cd5\u662f<span class=\"productname\">PostgreSQL</span>\u6269\u5c55\uff0c\u5b83\u6709\u65f6\u53ef\u80fd\u4f1a\u4e0e\u6807\u51c6\u7528\u6cd5\u51b2\u7a81\u3002\u628a\u4e00\u4e2a\u53d8\u91cf\u503c\u8f6c\u4e49\u6210 SQL \u5b57\u9762\u91cf\u6216\u8005\u6807\u8bc6\u7b26\u7684\u5192\u53f7\u52a0\u5f15\u53f7\u8bed\u6cd5\u662f\u4e00\u79cd<span class=\"application\">psql</span>\u6269\u5c55\u3002</p>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-PROMPTING\">\n<h4 lang=\"zh\">\u63d0\u793a\u7b26</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u53d1\u51fa\u7684\u63d0\u793a\u7b26\u53ef\u4ee5\u6309\u4f60\u7684\u559c\u597d\u8fdb\u884c\u5b9a\u5236\u3002<code class=\"varname\">PROMPT1</code>\u3001<code class=\"varname\">PROMPT2</code> \u548c <code class=\"varname\">PROMPT3</code> \u8fd9\u4e09\u4e2a\u53d8\u91cf\u5305\u542b\u63cf\u8ff0\u63d0\u793a\u7b26\u5916\u89c2\u7684\u5b57\u7b26\u4e32\u548c\u7279\u6b8a\u8f6c\u4e49\u5e8f\u5217\u3002\u63d0\u793a\u7b26 1 \u662f <span class=\"application\">psql</span> \u8bf7\u6c42\u65b0\u547d\u4ee4\u65f6\u53d1\u51fa\u7684\u5e38\u89c4\u63d0\u793a\u7b26\u3002\u63d0\u793a\u7b26 2 \u4f1a\u5728\u5f55\u5165\u547d\u4ee4\u671f\u95f4\u8fd8\u9700\u8981\u66f4\u591a\u8f93\u5165\u65f6\u53d1\u51fa\uff0c\u4f8b\u5982\u547d\u4ee4\u5c1a\u672a\u4ee5\u5206\u53f7\u7ed3\u675f\uff0c\u6216\u8005\u5f15\u53f7\u5c1a\u672a\u95ed\u5408\u65f6\u3002\u5728\u6267\u884c <acronym class=\"acronym\">SQL</acronym> <code class=\"command\">COPY FROM STDIN</code> \u547d\u4ee4\u5e76\u9700\u8981\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4e00\u884c\u503c\u65f6\uff0c\u4f1a\u53d1\u51fa\u63d0\u793a\u7b26 3\u3002</p>\n<p lang=\"zh\">\u9009\u4e2d\u7684\u63d0\u793a\u7b26\u53d8\u91cf\u503c\u4f1a\u6309\u5b57\u9762\u8f93\u51fa\uff0c\u9664\u975e\u9047\u5230\u767e\u5206\u53f7\uff08<code class=\"literal\">%</code>\uff09\u3002\u6839\u636e\u4e0b\u4e00\u4e2a\u5b57\u7b26\u7684\u4e0d\u540c\uff0c\u4f1a\u66ff\u6362\u6210\u67d0\u4e9b\u5176\u4ed6\u6587\u672c\u3002\u5df2\u5b9a\u4e49\u7684\u66ff\u6362\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-PROMPTING-M-UC\"><span class=\"term\"><code class=\"literal\">%M</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5b8c\u6574\u4e3b\u673a\u540d\uff08\u542b\u57df\u540d\uff09\uff1b\u5982\u679c\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\uff0c\u5219\u4e3a<code class=\"literal\">[local]</code>\uff1b\u5982\u679c Unix \u57df\u5957\u63a5\u5b57\u4e0d\u5728\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u9ed8\u8ba4\u4f4d\u7f6e\uff0c\u5219\u4e3a<code class=\"literal\">[local:<em class=\"replaceable\"><code>/dir/name</code></em>]</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-M-LC\"><span class=\"term\"><code class=\"literal\">%m</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\uff0c\u5728\u7b2c\u4e00\u4e2a\u70b9\u53f7\u5904\u622a\u65ad\uff1b\u5982\u679c\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\uff0c\u5219\u4e3a<code class=\"literal\">[local]</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-GT\"><span class=\"term\"><code class=\"literal\">%&gt;</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u76d1\u542c\u7684\u7aef\u53e3\u53f7\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-N\"><span class=\"term\"><code class=\"literal\">%n</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u4f1a\u8bdd\u7528\u6237\u540d\u3002\uff08\u5728\u6570\u636e\u5e93\u4f1a\u8bdd\u671f\u95f4\uff0c<code class=\"command\">SET SESSION AUTHORIZATION</code>\u547d\u4ee4\u53ef\u80fd\u6539\u53d8\u8be5\u503c\u7684\u6269\u5c55\u7ed3\u679c\u3002\uff09</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-SLASH\"><span class=\"term\"><code class=\"literal\">%/</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-TILDE\"><span class=\"term\"><code class=\"literal\">%~</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7c7b\u4f3c <code class=\"literal\">%/</code>\uff0c\u4f46\u5982\u679c\u8be5\u6570\u636e\u5e93\u662f\u4f60\u7684\u9ed8\u8ba4\u6570\u636e\u5e93\uff0c\u5219\u8f93\u51fa <code class=\"literal\">~</code>\uff08\u6ce2\u6d6a\u53f7\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-NUMBERSIGN\"><span class=\"term\"><code class=\"literal\">%#</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u4f1a\u8bdd\u7528\u6237\u662f\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\uff0c\u5219\u4e3a<code class=\"literal\">#</code>\uff0c\u5426\u5219\u4e3a<code class=\"literal\">&gt;</code>\u3002\uff08\u5728\u6570\u636e\u5e93\u4f1a\u8bdd\u671f\u95f4\uff0c<code class=\"command\">SET SESSION AUTHORIZATION</code>\u547d\u4ee4\u53ef\u80fd\u6539\u53d8\u8be5\u503c\u7684\u6269\u5c55\u7ed3\u679c\u3002\uff09</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-P\"><span class=\"term\"><code class=\"literal\">%p</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u6240\u8fde\u63a5\u540e\u7aef\u7684\u8fdb\u7a0b ID\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-R\"><span class=\"term\"><code class=\"literal\">%R</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5728\u63d0\u793a\u7b26 1 \u4e2d\uff0c\u901a\u5e38\u663e\u793a =\uff1b\u4f46\u5982\u679c\u4f1a\u8bdd\u5904\u4e8e\u6761\u4ef6\u5757\u4e2d\u672a\u6fc0\u6d3b\u7684\u5206\u652f\uff0c\u5219\u663e\u793a @\uff1b\u5982\u679c\u5904\u4e8e\u5355\u884c\u6a21\u5f0f\uff0c\u5219\u663e\u793a ^\uff1b\u5982\u679c\u4f1a\u8bdd\u5df2\u65ad\u5f00\u6570\u636e\u5e93\u8fde\u63a5\uff08\u4f8b\u5982 \\connect \u5931\u8d25\u65f6\uff09\uff0c\u5219\u663e\u793a !\u3002\u5728\u63d0\u793a\u7b26 2 \u4e2d\uff0c%R \u4f1a\u66ff\u6362\u4e3a\u8868\u793a psql \u7b49\u5f85\u66f4\u591a\u8f93\u5165\u539f\u56e0\u7684\u5b57\u7b26\uff1a\u547d\u4ee4\u5c1a\u672a\u7ed3\u675f\u65f6\u4e3a -\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684 /* ... */ \u6ce8\u91ca\u65f6\u4e3a *\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u5e26\u5f15\u53f7\u5b57\u7b26\u4e32\u65f6\u4e3a\u5355\u5f15\u53f7\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u5e26\u5f15\u53f7\u6807\u8bc6\u7b26\u65f6\u4e3a\u53cc\u5f15\u53f7\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u7f8e\u5143\u5f15\u7528\u5b57\u7b26\u4e32\u65f6\u4e3a\u7f8e\u5143\u7b26\u53f7\uff1b\u5b58\u5728\u672a\u5339\u914d\u7684\u5de6\u62ec\u53f7\u65f6\u4e3a (\u3002\u5728\u63d0\u793a\u7b26 3 \u4e2d\uff0c%R \u4e0d\u4ea7\u751f\u4efb\u4f55\u5185\u5bb9\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-X\"><span class=\"term\"><code class=\"literal\">%x</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u72b6\u6001\uff1a\u5982\u679c\u5f53\u524d\u4e0d\u5728\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff1b\u5982\u679c\u5904\u4e8e\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a <code class=\"literal\">*</code>\uff1b\u5982\u679c\u5904\u4e8e\u5931\u8d25\u7684\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a <code class=\"literal\">!</code>\uff1b\u5982\u679c\u4e8b\u52a1\u72b6\u6001\u4e0d\u786e\u5b9a\uff08\u4f8b\u5982\u56e0\u4e3a\u5f53\u524d\u6ca1\u6709\u8fde\u63a5\uff09\uff0c\u5219\u4e3a <code class=\"literal\">?</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-L\"><span class=\"term\"><code class=\"literal\">%l</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8bed\u53e5\u4e2d\u7684\u884c\u53f7\uff0c\u4ece <code class=\"literal\">1</code> \u5f00\u59cb\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-DIGITS\"><span class=\"term\"><code class=\"literal\">%</code><em class=\"replaceable\"><code>digits</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u66ff\u6362\u4e3a\u6307\u5b9a\u516b\u8fdb\u5236\u4ee3\u7801\u5bf9\u5e94\u7684\u5b57\u7b26\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-NAME\"><span class=\"term\"><code class=\"literal\">%:</code><em class=\"replaceable\"><code>name</code></em><code class=\"literal\">:</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><span class=\"application\">psql</span> \u53d8\u91cf <em class=\"replaceable\"><code>name</code></em> \u7684\u503c\u3002\u8be6\u89c1\u4e0a\u9762\u7684<a class=\"xref\" href=\"/docs/17/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-COMMAND\"><span class=\"term\"><code class=\"literal\">%`</code><em class=\"replaceable\"><code>command</code></em><code class=\"literal\">`</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><em class=\"replaceable\"><code>command</code></em> \u7684\u8f93\u51fa\uff0c\u7c7b\u4f3c\u666e\u901a\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u53cd\u5f15\u53f7</span>\u201d</span>\u66ff\u6362\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-SQUARE-BRACKETS\"><span class=\"term\"><code class=\"literal\">%[</code> ... <code class=\"literal\">%]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u63d0\u793a\u7b26\u4e2d\u53ef\u4ee5\u5305\u542b\u7ec8\u7aef\u63a7\u5236\u5b57\u7b26\uff0c\u4f8b\u5982\u6539\u53d8\u63d0\u793a\u6587\u672c\u7684\u989c\u8272\u3001\u80cc\u666f\u6216\u6837\u5f0f\uff0c\u6216\u8005\u6539\u53d8\u7ec8\u7aef\u7a97\u53e3\u6807\u9898\u3002\u4e3a\u4e86\u8ba9 <span class=\"application\">Readline</span> \u7684\u884c\u7f16\u8f91\u529f\u80fd\u6b63\u5e38\u5de5\u4f5c\uff0c\u8fd9\u4e9b\u4e0d\u53ef\u6253\u5370\u7684\u63a7\u5236\u5b57\u7b26\u5fc5\u987b\u7528 <code class=\"literal\">%[</code> \u548c <code class=\"literal\">%]</code> \u5305\u56f4\u8d77\u6765\uff0c\u4ee5\u6807\u8bb0\u4e3a\u4e0d\u53ef\u89c1\u5b57\u7b26\u3002\u63d0\u793a\u7b26\u4e2d\u53ef\u4ee5\u51fa\u73b0\u591a\u7ec4\u8fd9\u6837\u7684\u6807\u8bb0\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; \\set PROMPT1 '%[%033[1;33;40m%]%n@%/%R%[%033[0m%]%# '\n</pre>\n<p lang=\"zh\">\u5176\u6548\u679c\u662f\u5728\u517c\u5bb9 VT100 \u4e14\u652f\u6301\u989c\u8272\u7684\u7ec8\u7aef\u4e0a\uff0c\u751f\u6210\u4e00\u4e2a\u7c97\u4f53\uff08<code class=\"literal\">1;</code>\uff09\u7684\u9ed1\u5e95\u9ec4\u5b57\u63d0\u793a\u7b26\uff08<code class=\"literal\">33;40</code>\uff09\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-W\"><span class=\"term\"><code class=\"literal\">%w</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0e\u6700\u8fd1\u4e00\u6b21\u8f93\u51fa\u7684 <code class=\"varname\">PROMPT1</code> \u5177\u6709\u76f8\u540c\u5bbd\u5ea6\u7684\u7a7a\u767d\u3002\u8fd9\u53ef\u7528\u4f5c <code class=\"varname\">PROMPT2</code> \u7684\u8bbe\u7f6e\uff0c\u4f7f\u591a\u884c\u8bed\u53e5\u4e0e\u7b2c\u4e00\u884c\u5bf9\u9f50\uff0c\u4f46\u4e0d\u663e\u793a\u53ef\u89c1\u7684\u4e8c\u7ea7\u63d0\u793a\u7b26\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8981\u5728\u63d0\u793a\u7b26\u4e2d\u63d2\u5165\u767e\u5206\u53f7\uff0c\u8bf7\u5199 %%\u3002\u63d0\u793a\u7b26 1 \u548c 2 \u7684\u9ed8\u8ba4\u503c\u4e3a '%/%R%x%# '\uff0c\u63d0\u793a\u7b26 3 \u7684\u9ed8\u8ba4\u503c\u4e3a '&gt;&gt; '\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">tcsh</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-READLINE\">\n<h4 lang=\"zh\">\u547d\u4ee4\u884c\u7f16\u8f91</h4>\n<p lang=\"zh\">\u5982\u679c\u53ef\u7528\uff0c<span class=\"application\">psql</span> \u4f1a\u4f7f\u7528<span class=\"application\">Readline</span>\u6216<span class=\"application\">libedit</span>\u5e93\uff0c\u4ee5\u4fbf\u8fdb\u884c\u4fbf\u6377\u7684\u884c\u7f16\u8f91\u548c\u5386\u53f2\u68c0\u7d22\u3002\u5f53<span class=\"application\">psql</span>\u9000\u51fa\u65f6\uff0c\u547d\u4ee4\u5386\u53f2\u4f1a\u81ea\u52a8\u4fdd\u5b58\uff1b\u5f53<span class=\"application\">psql</span>\u542f\u52a8\u65f6\uff0c\u53c8\u4f1a\u91cd\u65b0\u8f7d\u5165\u3002\u8f93\u5165\u4e0a\u7bad\u5934\u6216 control-P \u53ef\u4ee5\u53d6\u56de\u4e4b\u524d\u7684\u884c\u3002</p>\n<p lang=\"zh\">\u5728\u8bb8\u591a\uff08\u7edd\u975e\u5168\u90e8\uff09\u4e0a\u4e0b\u6587\u4e2d\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528 TAB \u8865\u5168\u90e8\u5206\u8f93\u5165\u7684\u5173\u952e\u5b57\u548c SQL \u5bf9\u8c61\u540d\u3002\u4f8b\u5982\uff0c\u5728\u547d\u4ee4\u5f00\u5934\u8f93\u5165<code class=\"literal\">ins</code>\u5e76\u6309\u4e0b TAB \u952e\uff0c\u4f1a\u8865\u5168\u4e3a<code class=\"literal\">insert into</code> \u3002\u7136\u540e\u8f93\u5165\u8868\u540d\u6216\u6a21\u5f0f\u540d\u7684\u51e0\u4e2a\u5b57\u7b26\uff0c\u518d\u6309\u4e0b<code class=\"literal\">TAB</code>\u952e\uff0c\u5c31\u4f1a\u8865\u5168\u5c1a\u672a\u8f93\u5b8c\u7684\u540d\u79f0\uff1b\u5982\u679c\u6709\u591a\u4e2a\u5019\u9009\u9879\uff0c\u5219\u4f1a\u7ed9\u51fa\u53ef\u80fd\u7684\u8865\u5168\u83dc\u5355\u3002\uff08\u5177\u4f53\u53d6\u51b3\u4e8e\u6240\u4f7f\u7528\u7684\u5e93\uff0c\u53ef\u80fd\u9700\u8981\u6309\u591a\u6b21<code class=\"literal\">TAB</code>\u952e\u624d\u80fd\u770b\u5230\u83dc\u5355\u3002\uff09</p>\n<p lang=\"zh\">\u5bf9 SQL \u5bf9\u8c61\u540d\u8fdb\u884c TAB \u8865\u5168\u65f6\uff0c\u9700\u8981\u5411\u670d\u52a1\u5668\u53d1\u9001\u67e5\u8be2\u6765\u67e5\u627e\u53ef\u80fd\u7684\u5339\u914d\u9879\u3002\u5728\u67d0\u4e9b\u4e0a\u4e0b\u6587\u4e2d\uff0c\u8fd9\u53ef\u80fd\u4f1a\u5e72\u6270\u5176\u4ed6\u64cd\u4f5c\u3002\u4f8b\u5982\uff0c\u5728<code class=\"command\">BEGIN</code>\u4e4b\u540e\uff0c\u5982\u679c\u4e2d\u95f4\u53d1\u51fa\u4e86\u4e00\u6b21 TAB \u8865\u5168\u67e5\u8be2\uff0c\u90a3\u4e48\u518d\u53d1\u51fa<code class=\"command\">SET TRANSACTION ISOLATION LEVEL</code>\u5c31\u4e3a\u65f6\u5df2\u665a\u4e86\u3002\u5982\u679c\u6839\u672c\u4e0d\u60f3\u4f7f\u7528 TAB \u8865\u5168\uff0c\u53ef\u4ee5\u628a\u4e0b\u9762\u7684\u5185\u5bb9\u653e\u5230\u4e3b\u76ee\u5f55\u4e2d\u540d\u4e3a<code class=\"filename\">.inputrc</code>\u7684\u6587\u4ef6\u91cc\uff0c\u4ece\u800c\u6c38\u4e45\u5173\u95ed\u5b83\uff1a</p>\n<pre class=\"programlisting\">$if psql\nset disable-completion on\n$endif\n</pre>\n<p lang=\"zh\">\uff08\u8fd9\u4e0d\u662f<span class=\"application\">psql</span>\u800c\u662f\u4e00\u4e2a<span class=\"application\">Readline</span>\u529f\u80fd\u3002\u9605\u8bfb\u5176\u6587\u6863\u4ee5\u83b7\u53d6\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\u3002\uff09</p>\n<p lang=\"zh\"><code class=\"option\">-n</code>\uff08<code class=\"option\">--no-readline</code>\uff09\u547d\u4ee4\u884c\u9009\u9879\u4e5f\u53ef\u7528\u4e8e\u5728\u5355\u6b21\u8fd0\u884c<span class=\"application\">psql</span>\u65f6\u7981\u7528 <span class=\"application\">Readline</span>\u3002\u8fd9\u4f1a\u963b\u6b62TAB \u8865\u5168\u3001\u547d\u4ee4\u884c\u5386\u53f2\u7684\u4f7f\u7528\u6216\u8bb0\u5f55\uff0c\u4ee5\u53ca\u591a\u884c\u547d\u4ee4\u7684\u7f16\u8f91\u3002\u5f53\u4f60\u9700\u8981\u590d\u5236\u7c98\u8d34\u5305\u542b <code class=\"literal\">TAB</code> \u5b57\u7b26\u7684\u6587\u672c\u65f6\uff0c\u5b83\u5c24\u5176\u6709\u7528\u3002</p>\n</div>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PSQL-ENVIRONMENT\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-ENVIRONMENT-COLUMNS\"><span class=\"term\"><code class=\"envar\">COLUMNS</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c<code class=\"literal\">\\pset columns</code>\u4e3a\u96f6\uff0c\u8fd9\u4e2a\u73af\u5883\u53d8\u91cf\u63a7\u5236\u7528\u4e8e<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u5bbd\u5ea6\u4ee5\u53ca\u7528\u6765\u786e\u5b9a\u8f83\u5bbd\u7684\u8f93\u51fa\u662f\u5426\u9700\u8981\u5206\u9875\u5668\uff0c\u6216\u8005\u662f\u5426\u5e94\u5207\u6362\u5230\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e2d\u7684\u5782\u76f4\u683c\u5f0f\u7684\u5bbd\u5ea6\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PGDATABASE\"><span class=\"term\"><code class=\"envar\">PGDATABASE</code><br/></span><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\uff08\u89c1<a class=\"xref\" href=\"/docs/17/libpq-envars.html\" title=\"32.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a032.15\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PG-COLOR\"><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PSQL-EDITOR\"><span class=\"term\"><code class=\"envar\">PSQL_EDITOR</code><br/></span><span class=\"term\"><code class=\"envar\">EDITOR</code><br/></span><span class=\"term\"><code class=\"envar\">VISUAL</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"command\">\\e</code>\u3001<code class=\"command\">\\ef</code>\u4ee5\u53ca<code class=\"command\">\\ev</code>\u547d\u4ee4\u6240\u4f7f\u7528\u7684\u7f16\u8f91\u5668\u3002\u4f1a\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u68c0\u67e5\u8fd9\u4e9b\u53d8\u91cf\uff0c\u7b2c\u4e00\u4e2a\u88ab\u8bbe\u7f6e\u7684\u5c06\u88ab\u4f7f\u7528\u3002\u5982\u679c\u90fd\u6ca1\u6709\u88ab\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u662f\u4f7f\u7528Unix\u7cfb\u7edf\u4e0a\u7684<code class=\"filename\">vi</code>\u6216\u8005Windows\u7cfb\u7edf\u4e0a\u7684<code class=\"filename\">notepad.exe</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PSQL-EDITOR-LINENUMBER-ARG\"><span class=\"term\"><code class=\"envar\">PSQL_EDITOR_LINENUMBER_ARG</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5f53 <code class=\"command\">\\e</code>\u3001<code class=\"command\">\\ef</code> \u6216 <code class=\"command\">\\ev</code> \u5e26\u6709\u884c\u53f7\u53c2\u6570\u4f7f\u7528\u65f6\uff0c\u6b64\u53d8\u91cf\u6307\u5b9a\u5c06\u8d77\u59cb\u884c\u53f7\u4f20\u7ed9\u7528\u6237\u7f16\u8f91\u5668\u65f6\u6240\u7528\u7684\u547d\u4ee4\u884c\u53c2\u6570\u3002\u5bf9\u4e8e <span class=\"productname\">Emacs</span> \u6216 <span class=\"productname\">vi</span> \u4e4b\u7c7b\u7684\u7f16\u8f91\u5668\uff0c\u8fd9\u4e2a\u53c2\u6570\u662f\u4e00\u4e2a\u52a0\u53f7\u3002\u5982\u679c\u9009\u9879\u540d\u548c\u884c\u53f7\u4e4b\u95f4\u9700\u8981\u7a7a\u683c\uff0c\u8bf7\u5728\u53d8\u91cf\u503c\u4e2d\u5305\u542b\u672b\u5c3e\u7a7a\u683c\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">PSQL_EDITOR_LINENUMBER_ARG='+'\nPSQL_EDITOR_LINENUMBER_ARG='--line '\n</pre>\n<p lang=\"zh\">\u5728 Unix \u7cfb\u7edf\u4e0a\u9ed8\u8ba4\u662f<code class=\"literal\">+</code>\uff08\u5bf9\u5e94\u4e8e\u9ed8\u8ba4\u7f16\u8f91\u5668<code class=\"filename\">vi</code>\uff0c\u4e14\u5bf9\u5f88\u591a\u5176\u4ed6\u5e38\u89c1\u7f16\u8f91\u5668\u53ef\u7528\uff09\u3002\u5728 Windows \u7cfb\u7edf\u4e0a\u6ca1\u6709\u9ed8\u8ba4\u503c\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PSQL-HISTORY\"><span class=\"term\"><code class=\"envar\">PSQL_HISTORY</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u547d\u4ee4\u5386\u53f2\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08<code class=\"literal\">~</code>\uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PAGER\"><span class=\"term\"><code class=\"envar\">PSQL_PAGER</code><br/></span><span class=\"term\"><code class=\"envar\">PAGER</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u67e5\u8be2\u7ed3\u679c\u65e0\u6cd5\u5728\u5c4f\u5e55\u4e0a\u663e\u793a\u5b8c\u6574\uff0c\u5b83\u4eec\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6b64\u547d\u4ee4\u3002\u5178\u578b\u7684\u503c\u662f<code class=\"literal\">more</code>\u6216<code class=\"literal\">less</code>\u3002\u53ef\u4ee5\u901a\u8fc7\u5c06<code class=\"envar\">PSQL_PAGER</code>\u6216<code class=\"envar\">PAGER</code>\u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u6216\u901a\u8fc7\u8c03\u6574<code class=\"command\">\\pset</code>\u547d\u4ee4\u7684\u4e0e\u5206\u9875\u76f8\u5173\u7684\u9009\u9879\u6765\u7981\u7528\u5206\u9875\u5668\u3002\u8fd9\u4e9b\u53d8\u91cf\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u8fdb\u884c\u68c0\u67e5\uff1b\u4f7f\u7528\u6309\u8be5\u987a\u5e8f\u627e\u5230\u7684\u7b2c\u4e00\u4e2a\u5df2\u8bbe\u7f6e\u7684\u53d8\u91cf\u3002\u5982\u679c\u5b83\u4eec\u90fd\u6ca1\u6709\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5728\u5927\u591a\u6570\u5e73\u53f0\u4e0a\u4f7f\u7528<code class=\"literal\">more</code>\uff0c\u4f46\u5728Cygwin\u4e0a\u4f7f\u7528<code class=\"literal\">less</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PSQL-WATCH-PAGER\"><span class=\"term\"><code class=\"envar\">PSQL_WATCH_PAGER</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528 \\watch \u547d\u4ee4\u53cd\u590d\u6267\u884c\u67e5\u8be2\u65f6\uff0c\u9ed8\u8ba4\u4e0d\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\u3002\u5728 Unix \u7cfb\u7edf\u4e0a\uff0c\u53ef\u4ee5\u5c06 PSQL_WATCH_PAGER \u8bbe\u4e3a\u5206\u9875\u7a0b\u5e8f\u547d\u4ee4\u6765\u6539\u53d8\u6b64\u884c\u4e3a\u3002pspg \u5206\u9875\u7a0b\u5e8f\uff08\u4e0d\u5c5e\u4e8e PostgreSQL\uff0c\u4f46\u8bb8\u591a\u5f00\u6e90\u8f6f\u4ef6\u53d1\u884c\u7248\u90fd\u63d0\u4f9b\u5b83\uff09\u4ee5 --stream \u9009\u9879\u542f\u52a8\u65f6\uff0c\u53ef\u4ee5\u663e\u793a \\watch \u7684\u8f93\u51fa\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PSQLRC\"><span class=\"term\"><code class=\"envar\">PSQLRC</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7528\u6237\u7684<code class=\"filename\">.psqlrc</code>\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08<code class=\"literal\">~</code>\uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-SHELL\"><span class=\"term\"><code class=\"envar\">SHELL</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u88ab<code class=\"command\">\\!</code>\u547d\u4ee4\u6267\u884c\u7684\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-TMPDIR\"><span class=\"term\"><code class=\"envar\">TMPDIR</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b58\u50a8\u4e34\u65f6\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u662f<code class=\"filename\">/tmp</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6 <span class=\"productname\">PostgreSQL</span> \u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528 <span class=\"application\">libpq</span> \u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/17/libpq-envars.html\" title=\"32.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a032.15\u00a0\u8282</a>\uff09\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.21.10\">\n<h2 lang=\"zh\">\u6587\u4ef6</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-FILES-PSQLRC\" lang=\"zh\"><span class=\"term\"><code class=\"filename\">psqlrc</code> \u548c <code class=\"filename\">~/.psqlrc</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u6ca1\u6709<code class=\"option\">-X</code>\u9009\u9879\uff0c\u5728\u8fde\u63a5\u5230\u6570\u636e\u5e93\u540e\u4f46\u5728\u63a5\u6536\u6b63\u5e38\u7684\u547d\u4ee4\u4e4b\u524d\uff0c<span class=\"application\">psql</span>\u4f1a\u5c1d\u8bd5\u4f9d\u6b21\u4ece\u7cfb\u7edf\u7ea7\u7684\u542f\u52a8\u6587\u4ef6\uff08<code class=\"filename\">psqlrc</code>\uff09\u548c\u7528\u6237\u7684\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\uff08<code class=\"filename\">~/.psqlrc</code>\uff09\u4e2d\u8bfb\u53d6\u5e76\u4e14\u6267\u884c\u547d\u4ee4\u3002\u8fd9\u4e9b\u6587\u4ef6\u53ef\u4ee5\u88ab\u7528\u6765\u8bbe\u7f6e\u5ba2\u6237\u7aef\u6216\u8005\u670d\u52a1\u5668\uff0c\u901a\u5e38\u662f\u4e00\u4e9b<code class=\"command\">\\set</code>\u548c<code class=\"command\">SET</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u7cfb\u7edf\u8303\u56f4\u7684\u542f\u52a8\u6587\u4ef6\u540d\u4e3a <code class=\"filename\">psqlrc</code>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4f1a\u5728\u5b89\u88c5\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u7cfb\u7edf\u914d\u7f6e</span>\u201d</span>\u76ee\u5f55\u4e2d\u67e5\u627e\u5b83\uff0c\u6700\u53ef\u9760\u7684\u8bc6\u522b\u65b9\u5f0f\u662f\u8fd0\u884c <code class=\"literal\">pg_config --sysconfdir</code>\u3002\u901a\u5e38\u8fd9\u4e2a\u76ee\u5f55\u662f\u76f8\u5bf9\u4e8e\u5305\u542b <span class=\"productname\">PostgreSQL</span> \u53ef\u6267\u884c\u6587\u4ef6\u7684\u76ee\u5f55\u7684 <code class=\"filename\">../etc/</code>\u3002\u4e5f\u53ef\u4ee5\u901a\u8fc7 <code class=\"envar\">PGSYSCONFDIR</code> \u73af\u5883\u53d8\u91cf\u663e\u5f0f\u6307\u5b9a\u67e5\u627e\u76ee\u5f55\u3002</p>\n<p lang=\"zh\">\u7528\u6237\u7684\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\u540d\u4e3a<code class=\"filename\">.psqlrc</code>\uff0c\u5e76\u4e14\u5728\u8c03\u7528\u7528\u6237\u7684\u4e3b\u76ee\u5f55\u4e2d\u5bfb\u627e\u3002\u5728Windows\u4e0a\uff0c\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\u7684\u540d\u79f0\u6539\u4e3a<code class=\"filename\">%APPDATA%\\postgresql\\psqlrc.conf</code>\u3002\u5728\u4efb\u4f55\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e<code class=\"envar\">PSQLRC</code>\u73af\u5883\u53d8\u91cf\u6765\u8986\u76d6\u6b64\u9ed8\u8ba4\u6587\u4ef6\u8def\u5f84\u3002</p>\n<p lang=\"zh\">\u7cfb\u7edf\u8303\u56f4\u7684\u542f\u52a8\u6587\u4ef6\u548c\u7528\u6237\u4e2a\u4eba\u7684\u542f\u52a8\u6587\u4ef6\u90fd\u53ef\u4ee5\u901a\u8fc7\u5728\u6587\u4ef6\u540d\u540e\u9644\u52a0\u8fde\u5b57\u7b26\u548c<span class=\"productname\">PostgreSQL</span>\u7684\u5927\u7248\u672c\u6216\u5c0f\u7248\u672c\u6807\u8bc6\u7b26\u6765\u4f7f\u5176\u4e0e<span class=\"application\">psql</span>\u7248\u672c\u76f8\u5173\uff0c\u4f8b\u5982<code class=\"filename\">~/.psqlrc-17</code>\u6216<code class=\"filename\">~/.psqlrc-17.11</code>\u3002\u6700\u5177\u4f53\u7248\u672c\u5339\u914d\u7684\u6587\u4ef6\u5c06\u4f18\u5148\u8bfb\u53d6\uff0c\u800c\u4e0d\u662f\u975e\u7279\u5b9a\u7248\u672c\u7684\u6587\u4ef6\u3002\u8fd9\u4e9b\u7248\u672c\u540e\u7f00\u662f\u5728\u786e\u5b9a\u6587\u4ef6\u8def\u5f84\u540e\u6dfb\u52a0\u7684\uff0c\u5982\u4e0a\u6240\u8ff0\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-FILES-PSQL-HISTORY\"><span class=\"term\"><code class=\"filename\">.psql_history</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u547d\u4ee4\u884c\u5386\u53f2\u88ab\u5b58\u50a8\u5728\u6587\u4ef6<code class=\"filename\">~/.psql_history</code>\u4e2d\uff0c\u5728 Windows \u4e0a\u5219\u5b58\u50a8\u5728\u6587\u4ef6<code class=\"filename\">%APPDATA%\\postgresql\\psql_history</code>\u4e2d\u3002</p>\n<p lang=\"zh\">\u5386\u53f2\u6587\u4ef6\u7684\u4f4d\u7f6e\u53ef\u4ee5\u901a\u8fc7<code class=\"varname\">HISTFILE</code> <span class=\"application\">psql</span>\u53d8\u91cf\u6216\u8005<code class=\"envar\">PSQL_HISTORY</code>\u73af\u5883\u53d8\u91cf\u663e\u5f0f\u8bbe\u7f6e\u3002</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.21.11\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">psql</span>\u6700\u9002\u5408\u4e0e\u76f8\u540c\u6216\u8f83\u65e7\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\u914d\u5408\u4f7f\u7528\u3002\u5982\u679c\u670d\u52a1\u5668\u7684\u7248\u672c\u6bd4<span class=\"application\">psql</span>\u672c\u8eab\u66f4\u65b0\uff0c\u53cd\u659c\u7ebf\u547d\u4ee4\u7279\u522b\u5bb9\u6613\u5931\u8d25\u3002\u7136\u800c\uff0c<code class=\"literal\">\\d</code>\u7cfb\u5217\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u5e94\u8be5\u53ef\u4ee5\u5728\u6700\u4f4e\u81f3 9.2 \u7248\u672c\u7684\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\uff0c\u4f46\u4e0d\u4e00\u5b9a\u9002\u7528\u4e8e\u6bd4<span class=\"application\">psql</span>\u672c\u8eab\u66f4\u65b0\u7684\u670d\u52a1\u5668\u3002\u8fd0\u884cSQL\u547d\u4ee4\u548c\u663e\u793a\u67e5\u8be2\u7ed3\u679c\u7684\u4e00\u822c\u529f\u80fd\u4e5f\u5e94\u8be5\u53ef\u4ee5\u5728\u66f4\u65b0\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\uff0c\u4f46\u4e0d\u80fd\u4fdd\u8bc1\u5728\u6240\u6709\u60c5\u51b5\u4e0b\u90fd\u80fd\u5b9e\u73b0\u3002</p>\n<p>\u5982\u679c\u4f60\u60f3\u7528<span class=\"application\">psql</span>\u8fde\u63a5\u5230\u591a\u4e2a\u5177\u6709\u4e0d\u540c\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\uff0c\u63a8\u8350\u4f7f\u7528\u6700\u65b0\u7248\u672c\u7684<span class=\"application\">psql</span>\u3002\u6216\u8005\uff0c\u4f60\u53ef\u4ee5\u4e3a\u6bcf\u4e00\u4e2a\u5927\u7248\u672c\u4fdd\u7559\u4e00\u4efd<span class=\"application\">psql</span>\u62f7\u8d1d\uff0c\u5e76\u4e14\u9488\u5bf9\u76f8\u5e94\u7684\u670d\u52a1\u5668\u4f7f\u7528\u5339\u914d\u7684\u7248\u672c\u3002\u4f46\u5b9e\u9645\u4e0a\uff0c\u8fd9\u79cd\u989d\u5916\u7684\u9ebb\u70e6\u662f\u4e0d\u5fc5\u8981\u7684\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5728 <span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\uff0c<code class=\"option\">-c</code> \u9009\u9879\u610f\u5473\u7740 <code class=\"option\">-X</code>\uff08<code class=\"option\">--no-psqlrc</code>\uff09\uff1b\u73b0\u5728\u5df2\u7ecf\u4e0d\u662f\u8fd9\u6837\u4e86\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5728<span class=\"productname\">PostgreSQL</span> 8.4 \u4e4b\u524d\uff0c<span class=\"application\">psql</span>\u5141\u8bb8\u4e00\u4e2a\u5355\u5b57\u6bcd\u53cd\u659c\u7ebf\u547d\u4ee4\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u76f4\u63a5\u5199\u5728\u8be5\u547d\u4ee4\u540e\u9762\uff0c\u4e2d\u95f4\u4e0d\u9700\u8981\u7a7a\u767d\u3002\u73b0\u5728\u5219\u8981\u6c42\u7528\u7a7a\u767d\u5206\u9694\u3002</p>\n</li>\n</ul>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.21.12\">\n<h2 lang=\"zh\">\u7ed9 Windows \u7528\u6237\u7684\u6ce8\u89e3</h2>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u662f\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u63a7\u5236\u53f0\u5e94\u7528</span>\u201d</span>\u3002\u7531\u4e8e Windows \u7684\u63a7\u5236\u53f0\u7a97\u53e3\u4f7f\u7528\u7684\u662f\u4e00\u79cd\u548c\u7cfb\u7edf\u4e2d\u5176\u4ed6\u5e94\u7528\u4e0d\u540c\u7684\u7f16\u7801\uff0c\u5728<span class=\"application\">psql</span>\u4e2d\u4f7f\u7528 8 \u4f4d\u5b57\u7b26\u65f6\u8981\u7279\u522b\u6ce8\u610f\u3002\u5982\u679c<span class=\"application\">psql</span>\u68c0\u6d4b\u5230\u4e00\u4e2a\u6709\u95ee\u9898\u7684\u63a7\u5236\u53f0\u4ee3\u7801\u9875\uff0c\u5b83\u5c06\u4f1a\u5728\u542f\u52a8\u65f6\u8b66\u544a\u4f60\u3002\u8981\u66f4\u6539\u63a7\u5236\u53f0\u4ee3\u7801\u9875\uff0c\u6709\u4e24\u4ef6\u4e8b\u662f\u5fc5\u8981\u7684\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u8f93\u5165<strong class=\"userinput\"><code>cmd.exe /c chcp 1252</code></strong>\u53ef\u4ee5\u8bbe\u7f6e\u4ee3\u7801\u9875\uff081252 \u662f\u9002\u7528\u4e8e\u5fb7\u8bed\u7684\u4e00\u4e2a\u4ee3\u7801\u9875\uff0c\u8bf7\u5728\u8fd9\u91cc\u66ff\u6362\u6210\u4f60\u7684\u503c\uff09\u3002\u5982\u679c\u6b63\u5728\u4f7f\u7528 Cygwin\uff0c\u53ef\u4ee5\u628a\u8fd9\u4e2a\u547d\u4ee4\u653e\u5728<code class=\"filename\">/etc/profile</code>\u4e2d\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u628a\u63a7\u5236\u53f0\u5b57\u4f53\u8bbe\u7f6e\u4e3a<code class=\"literal\">Lucida Console</code>\uff0c\u56e0\u4e3a\u6805\u683c\u5b57\u4f53\u65e0\u6cd5\u4e0e ANSI \u4ee3\u7801\u9875\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</li>\n</ul>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PSQL-EXAMPLES\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u7b2c\u4e00\u4e2a\u793a\u4f8b\u5c55\u793a\u4e86\u5982\u4f55\u628a\u4e00\u6761\u547d\u4ee4\u5206\u6563\u5230\u591a\u884c\u8f93\u5165\u4e2d\u3002\u6ce8\u610f\u63d0\u793a\u7b26\u7684\u53d8\u5316\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>CREATE TABLE my_table (</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code> first integer not null default 0,</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code> second text)</code></strong>\ntestdb-&gt; <strong class=\"userinput\"><code>;</code></strong>\nCREATE TABLE\n</pre>\n<p lang=\"zh\">\u73b0\u5728\u518d\u6765\u770b\u4e00\u4e0b\u8fd9\u4e2a\u8868\u7684\u5b9a\u4e49\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\d my_table</code></strong>\n              Table \"public.my_table\"\n Column |  Type   | Collation | Nullable | Default\n--------+---------+-----------+----------+---------\n first  | integer |           | not null | 0\n second | text    |           |          |\n</pre>\n<p lang=\"zh\">\u73b0\u5728\u6211\u4eec\u628a\u63d0\u793a\u7b26\u6539\u6210\u66f4\u6709\u8da3\u7684\u5f62\u5f0f\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set PROMPT1 '%n@%m %~%R%# '</code></strong>\npeter@localhost testdb=&gt;\n</pre>\n<p lang=\"zh\">\u5047\u8bbe\u4f60\u5df2\u7ecf\u5411\u8868\u4e2d\u586b\u5165\u6570\u636e\uff0c\u5e76\u60f3\u770b\u4e00\u770b\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; SELECT * FROM my_table;\n first | second\n-------+--------\n     1 | one\n     2 | two\n     3 | three\n     4 | four\n(4 rows)\n</pre>\n<p lang=\"zh\">\u4f60\u53ef\u4ee5\u4f7f\u7528 <code class=\"command\">\\pset</code> \u547d\u4ee4\u4ee5\u4e0d\u540c\u65b9\u5f0f\u663e\u793a\u8868\u683c\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 2</code></strong>\nBorder style is 2.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\n+-------+--------+\n| first | second |\n+-------+--------+\n|     1 | one    |\n|     2 | two    |\n|     3 | three  |\n|     4 | four   |\n+-------+--------+\n(4 rows)\n\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 0</code></strong>\nBorder style is 0.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\nfirst second\n----- ------\n    1 one\n    2 two\n    3 three\n    4 four\n(4 rows)\n\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 1</code></strong>\nBorder style is 1.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset format csv</code></strong>\nOutput format is csv.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset tuples_only</code></strong>\nTuples only is on.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT second, first FROM my_table;</code></strong>\none,1\ntwo,2\nthree,3\nfour,4\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset format unaligned</code></strong>\nOutput format is unaligned.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset fieldsep '\\t'</code></strong>\nField separator is \"    \".\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT second, first FROM my_table;</code></strong>\none     1\ntwo     2\nthree   3\nfour    4\n</pre>\n<p lang=\"zh\">\u6216\u8005\u4f7f\u7528\u77ed\u547d\u4ee4\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\a \\t \\x</code></strong>\nOutput format is aligned.\nTuples only is off.\nExpanded display is on.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\n-[ RECORD 1 ]-\nfirst  | 1\nsecond | one\n-[ RECORD 2 ]-\nfirst  | 2\nsecond | two\n-[ RECORD 3 ]-\nfirst  | 3\nsecond | three\n-[ RECORD 4 ]-\nfirst  | 4\nsecond | four\n</pre>\n<p lang=\"zh\">\u6b64\u5916\uff0c\u53ef\u4ee5\u4f7f\u7528<code class=\"literal\">\\g</code>\u4e3a\u4e00\u4e2a\u67e5\u8be2\u8bbe\u7f6e\u8fd9\u4e9b\u8f93\u51fa\u683c\u5f0f\u9009\u9879\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table</code></strong>\npeter@localhost testdb-&gt; <strong class=\"userinput\"><code>\\g (format=aligned tuples_only=off expanded=on)</code></strong>\n-[ RECORD 1 ]-\nfirst  | 1\nsecond | one\n-[ RECORD 2 ]-\nfirst  | 2\nsecond | two\n-[ RECORD 3 ]-\nfirst  | 3\nsecond | three\n-[ RECORD 4 ]-\nfirst  | 4\nsecond | four\n</pre>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4e00\u4e2a\u4f7f\u7528 <code class=\"command\">\\df</code> \u547d\u4ee4\u53ea\u67e5\u627e\u540d\u79f0\u5339\u914d <code class=\"literal\">int*pl</code> \u4e14\u7b2c\u4e8c\u4e2a\u53c2\u6570\u7c7b\u578b\u4e3a <code class=\"type\">bigint</code> \u7684\u51fd\u6570\u7684\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\df int*pl * bigint</code></strong>\n                          List of functions\n   Schema   |  Name   | Result data type | Argument data types | Type\n------------+---------+------------------+---------------------+------\n pg_catalog | int28pl | bigint           | smallint, bigint    | func\n pg_catalog | int48pl | bigint           | integer, bigint     | func\n pg_catalog | int8pl  | bigint           | bigint, bigint      | func\n(3 rows)\n</pre>\n<p lang=\"zh\">\u5728\u9002\u5408\u7684\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u4f7f\u7528 <code class=\"command\">\\crosstabview</code> \u547d\u4ee4\u5c06\u67e5\u8be2\u7ed3\u679c\u663e\u793a\u4e3a\u4ea4\u53c9\u8868\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>SELECT first, second, first &gt; 2 AS gt2 FROM my_table;</code></strong>\n first | second | gt2\n-------+--------+-----\n     1 | one    | f\n     2 | two    | f\n     3 | three  | t\n     4 | four   | t\n(4 rows)\n\ntestdb=&gt; <strong class=\"userinput\"><code>\\crosstabview first second</code></strong>\n first | one | two | three | four\n-------+-----+-----+-------+------\n     1 | f   |     |       |\n     2 |     | f   |       |\n     3 |     |     | t     |\n     4 |     |     |       | t\n(4 rows)\n</pre>\n<p lang=\"zh\">\u7b2c\u4e8c\u4e2a\u793a\u4f8b\u5c55\u793a\u4e86\u4e00\u4e2a\u4e58\u6cd5\u8868\uff0c\u5176\u4e2d\u884c\u6309\u6570\u5b57\u5012\u5e8f\u6392\u5217\uff0c\u800c\u5217\u6309\u72ec\u7acb\u7684\u5347\u5e8f\u6570\u5b57\u6392\u5217\u3002</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>SELECT t1.first as \"A\", t2.first+100 AS \"B\", t1.first*(t2.first+100) as \"AxB\",</code></strong>\ntestdb-&gt; <strong class=\"userinput\"><code>row_number() over(order by t2.first) AS ord</code></strong>\ntestdb-&gt; <strong class=\"userinput\"><code>FROM my_table t1 CROSS JOIN my_table t2 ORDER BY 1 DESC</code></strong>\ntestdb-&gt; <strong class=\"userinput\"><code>\\crosstabview \"A\" \"B\" \"AxB\" ord</code></strong>\n A | 101 | 102 | 103 | 104\n---+-----+-----+-----+-----\n 4 | 404 | 408 | 412 | 416\n 3 | 303 | 306 | 309 | 312\n 2 | 202 | 204 | 206 | 208\n 1 | 101 | 102 | 103 | 104\n(4 rows)\n</pre>\n</div>\n</div></div>", "manual_path": "app-psql.html", "localization": {"status": "complete", "sources": [{"url": "/docs/17/app-psql.html", "method": "same-major semantic node", "sha256": "820a5ee48a79666cef06bfe375ea9337e7a347b6d32c921738edd824fe5aa9f8", "language": "zh", "matched_nodes": ["#APP-PSQL/div[10]/div[1]/ul[0]/li[0]", "#APP-PSQL/div[10]/div[1]/ul[0]/li[1]", "#APP-PSQL/div[10]/div[1]/ul[0]/li[2]", "#APP-PSQL/div[10]/h2[0]", "#APP-PSQL/div[11]/div[2]/ul[0]/li[0]", "#APP-PSQL/div[11]/div[2]/ul[0]/li[1]", "#APP-PSQL/div[11]/h2[0]", "#APP-PSQL/div[11]/p[1]", "#APP-PSQL/div[12]/p[11]", "#APP-PSQL/div[12]/p[13]", "#APP-PSQL/div[12]/p[15]", "#APP-PSQL/div[12]/p[17]", "#APP-PSQL/div[12]/p[19]", "#APP-PSQL/div[12]/p[1]", "#APP-PSQL/div[12]/p[3]", "#APP-PSQL/div[12]/p[5]", "#APP-PSQL/div[12]/p[7]", "#APP-PSQL/div[12]/p[9]", "#APP-PSQL/div[2]/p[1]", "#APP-PSQL/div[3]/h2[0]", "#APP-PSQL/div[4]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[11]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[13]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[15]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]/p[2]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[19]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[21]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[23]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[25]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[25]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[27]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[29]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[31]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[35]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[37]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[39]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[3]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[41]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]/div[1]/h3[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]/div[1]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[45]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[47]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[49]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[51]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[53]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[55]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[55]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[57]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[57]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[59]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[5]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[61]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[63]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[65]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[67]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[67]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[69]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[3]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[5]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[6]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[7]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[9]", "#APP-PSQL/div[6]/h2[0]", "#APP-PSQL/div[6]/p[1]", "#APP-PSQL/div[7]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[1]/p[1]", "#APP-PSQL/div[7]/div[1]/p[2]", "#APP-PSQL/div[7]/div[1]/p[5]", "#APP-PSQL/div[7]/div[1]/p[6]", "#APP-PSQL/div[7]/div[1]/p[7]", "#APP-PSQL/div[7]/div[2]/h3[0]", "#APP-PSQL/div[7]/div[2]/p[1]", "#APP-PSQL/div[7]/div[2]/p[3]", "#APP-PSQL/div[7]/div[2]/p[4]", "#APP-PSQL/div[7]/div[2]/p[5]", "#APP-PSQL/div[7]/div[2]/p[6]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[101]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[101]/div[4]/p[1]/a[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[101]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[101]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[101]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[101]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[103]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[103]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[103]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[105]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[105]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[105]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[105]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[107]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[109]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[111]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[111]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[111]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[111]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[113]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[115]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[115]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[115]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[115]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[115]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[117]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[117]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[119]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[121]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[123]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[123]/p[0]/a[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[123]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[123]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[123]/p[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[127]/div[2]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[127]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[127]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[129]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[131]/div[2]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[131]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[131]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/p[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[133]/p[6]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[135]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[137]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[139]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[13]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[13]/div[5]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[13]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[13]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[13]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[141]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[141]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[141]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[143]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[145]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[147]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[149]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[151]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[153]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[153]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[15]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[15]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[15]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[15]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[17]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[17]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[17]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[17]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[21]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[23]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[23]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[29]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[31]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[31]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[37]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[41]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[43]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[43]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[43]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dt[30]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dt[32]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dt[34]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[3]/dl[0]/dt[6]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/div[5]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[155]/p[4]/a[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[157]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[159]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[15]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[161]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[163]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[165]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[167]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[167]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[167]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[167]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[167]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[169]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[171]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[171]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[173]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[173]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[173]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[175]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[177]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[179]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[17]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[181]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[181]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[183]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[183]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[185]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[187]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[189]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[191]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[193]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[193]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[195]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[195]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[197]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[199]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[199]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[199]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[199]/p[5]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[19]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[19]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[19]/p[0]/a[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[19]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[19]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[19]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[21]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[23]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[25]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[29]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[31]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[37]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[3]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[41]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[41]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[41]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[43]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[45]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[45]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[47]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[49]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[51]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[53]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[53]/div[1]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[53]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[55]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[57]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[59]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[5]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[5]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[5]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[5]/p[3]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[5]/p[4]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[61]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[63]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[65]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[67]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[69]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[71]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[73]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[75]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[77]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[79]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[79]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[81]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[81]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[81]/p[2]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[83]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[83]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[85]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[85]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[87]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[89]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[91]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[93]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[95]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[97]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[99]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[9]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[9]/div[1]/p[1]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dd[9]/p[0]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[100]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[126]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[128]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[130]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[134]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[136]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[146]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[148]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[156]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[160]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[184]", "#APP-PSQL/div[7]/div[3]/div[10]/dl[0]/dt[4]", "#APP-PSQL/div[7]/div[3]/div[11]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/p[6]", "#APP-PSQL/div[7]/div[3]/div[11]/p[7]", "#APP-PSQL/div[7]/div[3]/h3[0]", "#APP-PSQL/div[7]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/p[2]", "#APP-PSQL/div[7]/div[3]/p[3]", "#APP-PSQL/div[7]/div[3]/p[4]", "#APP-PSQL/div[7]/div[3]/p[4]/a[2]", "#APP-PSQL/div[7]/div[3]/p[5]", "#APP-PSQL/div[7]/div[3]/p[7]", "#APP-PSQL/div[7]/div[3]/p[8]", "#APP-PSQL/div[7]/div[3]/p[9]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[15]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[17]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/div[2]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[21]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[21]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[23]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[23]/p[2]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[41]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[41]/p[0]/a[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[43]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[47]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[49]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[51]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[53]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[55]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[57]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[59]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[61]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[63]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[65]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[67]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[4]/div[1]/div[8]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/p[10]", "#APP-PSQL/div[7]/div[4]/div[1]/p[11]", "#APP-PSQL/div[7]/div[4]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/p[2]", "#APP-PSQL/div[7]/div[4]/div[1]/p[4]", "#APP-PSQL/div[7]/div[4]/div[1]/p[6]", "#APP-PSQL/div[7]/div[4]/div[1]/p[7]", "#APP-PSQL/div[7]/div[4]/div[1]/p[9]", "#APP-PSQL/div[7]/div[4]/div[2]/p[10]", "#APP-PSQL/div[7]/div[4]/div[2]/p[11]", "#APP-PSQL/div[7]/div[4]/div[2]/p[12]", "#APP-PSQL/div[7]/div[4]/div[2]/p[1]", "#APP-PSQL/div[7]/div[4]/div[2]/p[3]", "#APP-PSQL/div[7]/div[4]/div[2]/p[4]", "#APP-PSQL/div[7]/div[4]/div[2]/p[6]", "#APP-PSQL/div[7]/div[4]/div[2]/p[7]", "#APP-PSQL/div[7]/div[4]/div[2]/p[9]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[15]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[21]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[23]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[25]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[29]/p[0]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[29]/p[2]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[31]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[4]/div[3]/div[5]/p[1]", "#APP-PSQL/div[7]/div[4]/div[3]/p[1]", "#APP-PSQL/div[7]/div[4]/div[3]/p[2]", "#APP-PSQL/div[7]/div[4]/div[4]/h4[0]", "#APP-PSQL/div[7]/div[4]/div[4]/p[3]", "#APP-PSQL/div[7]/div[4]/div[4]/p[4]", "#APP-PSQL/div[7]/div[4]/div[4]/p[5]", "#APP-PSQL/div[7]/div[4]/div[4]/p[7]", "#APP-PSQL/div[7]/div[4]/div[4]/p[8]", "#APP-PSQL/div[7]/div[4]/h3[0]", "#APP-PSQL/div[7]/h2[0]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[11]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[13]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[17]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[19]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[1]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[21]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[3]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[5]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[7]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]/p[0]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]/p[2]", "#APP-PSQL/div[8]/p[2]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[0]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[1]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[2]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[3]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[3]/p[0]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[3]/p[1]", "#APP-PSQL/div[9]/div[1]/dl[0]/dt[0]", "#APP-PSQL/div[9]/h2[0]"]}, {"url": "/docs/17/indexes-index-only-scans.html", "method": "same-major semantic node", "sha256": "33d80f0c392ede8e011027ab0f65419d87855ca51b5733ad0e2b323c8eaaa5cc", "language": "zh", "matched_nodes": ["#INDEXES-INDEX-ONLY-SCANS/p[25]/span[2]"]}], "language": "zh", "original_text": {"/versions/17/description/0": "psql \u2014 PostgreSQL interactive terminal", "/versions/17/facts/0/label": "Documented executable", "/versions/17/facts/1/label": "Executable version", "/versions/17/facts/2/label": "Reference inventory", "/versions/17/facts/2/value": "Client applications", "/versions/17/facts/3/label": "Option definition groups", "/versions/17/tables/0/title": "Documented options", "/versions/17/tables/1/title": "Environment variables", "/versions/17/related/0/label": "psql meta-commands", "/versions/17/related/1/label": "libpq connection parameters", "/versions/17/tables/0/rows/0/summary": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all .", "/versions/17/tables/0/rows/1/summary": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned .", "/versions/17/tables/0/rows/2/summary": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors .", "/versions/17/tables/0/rows/3/summary": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence.", "/versions/17/tables/0/rows/4/summary": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv .", "/versions/17/tables/0/rows/5/summary": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "/versions/17/tables/0/rows/6/summary": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries .", "/versions/17/tables/0/rows/7/summary": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on .", "/versions/17/tables/0/rows/8/summary": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i .", "/versions/17/tables/0/rows/9/summary": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f .", "/versions/17/tables/0/columns/0/label": "Option and arguments", "/versions/17/tables/0/columns/1/label": "Description", "/versions/17/tables/0/rows/10/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket.", "/versions/17/tables/0/rows/11/summary": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command.", "/versions/17/tables/0/rows/12/summary": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list .", "/versions/17/tables/0/rows/13/summary": "Write all query output into file filename , in addition to the normal output destination.", "/versions/17/tables/0/rows/14/summary": "Do not use Readline for line editing and do not use the command history (see the section called \u201cCommand-Line Editing\u201d below).", "/versions/17/tables/0/rows/15/summary": "Put all query output into file filename . This is equivalent to the command \\o .", "/versions/17/tables/0/rows/16/summary": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432.", "/versions/17/tables/0/rows/17/summary": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex .", "/versions/17/tables/0/rows/18/summary": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on .", "/versions/17/tables/0/rows/19/summary": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep .", "/versions/17/tables/0/rows/20/summary": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts.", "/versions/17/tables/0/rows/21/summary": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does.", "/versions/17/tables/0/rows/22/summary": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only .", "/versions/17/tables/0/rows/23/summary": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details.", "/versions/17/tables/0/rows/24/summary": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)", "/versions/17/tables/0/rows/25/summary": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later.", "/versions/17/tables/0/rows/26/summary": "Print the psql version and exit.", "/versions/17/tables/0/rows/27/summary": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/17/tables/0/rows/28/summary": "Force psql to prompt for a password before connecting to a database, even if the password will not be used.", "/versions/17/tables/0/rows/29/summary": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded .", "/versions/17/tables/0/rows/30/summary": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file).", "/versions/17/tables/0/rows/31/summary": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero .", "/versions/17/tables/0/rows/32/summary": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero .", "/versions/17/tables/0/rows/33/summary": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied.", "/versions/17/tables/0/rows/34/summary": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables.", "/versions/17/tables/1/columns/0/label": "Variable", "/versions/17/tables/1/columns/1/label": "Meaning", "/versions/17/tables/1/rows/0/description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode.", "/versions/17/tables/1/rows/1/description": "Default connection parameters (see Section 32.15 ).", "/versions/17/tables/1/rows/2/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .", "/versions/17/tables/1/rows/3/description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems.", "/versions/17/tables/1/rows/4/description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems.", "/versions/17/tables/1/rows/5/description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed.", "/versions/17/tables/1/rows/6/description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If neither of them is set, the default is to use more on most platforms, but less on Cygwin.", "/versions/17/tables/1/rows/7/description": "When a query is executed repeatedly with the \\watch command, a pager is not used by default. This behavior can be changed by setting PSQL_WATCH_PAGER to a pager command, on Unix systems. The pspg pager (not part of PostgreSQL but available in many open source software distributions) can display the output of \\watch if started with the option --stream .", "/versions/17/tables/1/rows/8/description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed.", "/versions/17/tables/1/rows/9/description": "Command executed by the \\! command.", "/versions/17/tables/1/rows/10/description": "Directory for storing temporary files. The default is /tmp ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "c4daef5e21f8a88cdfc6a7f3588cb46a1fb0f6516823eec928513a3c62682424"}, "comparison_data": {"options": [{"names": ["-a", "--echo-all"], "signature": "-a --echo-all", "description": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all ."}, {"names": ["-A", "--no-align"], "signature": "-A --no-align", "description": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned ."}, {"names": ["-b", "--echo-errors"], "signature": "-b --echo-errors", "description": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors ."}, {"names": ["-c command", "--command= command"], "signature": "-c command --command= command", "description": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. command must be either a command string that is completely parsable by the server (i.e., it contains no psql -specific features), or a single backslash command. Thus you cannot mix SQL and psql meta-commands within a -c option. To achieve that, you could use repeated -c options or pipe the string into psql , for example: psql -c '\\x' -c 'SELECT * FROM foo;' or echo '\\x \\\\ SELECT * FROM foo;' | psql ( \\\\ is the separator meta-command.) Each SQL command string passed to -c is sent to the server as a single request. Because of this, the server executes it as a single transaction even if the string contains multiple SQL commands, unless there are explicit BEGIN / COMMIT commands included in the string to divide it into multiple transactions. (See Section 53.2.2.1 for more details about how the server handles multi-query strings.) If having several commands executed in one transaction is not desired, use repeated -c commands or feed multiple commands to psql 's standard input, either using echo as illustrated above, or via a shell here-document, for example: psql <<EOF \\x SELECT * FROM foo; EOF"}, {"names": ["--csv"], "signature": "--csv", "description": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv ."}, {"names": ["-d dbname", "--dbname= dbname"], "signature": "-d dbname --dbname= dbname", "description": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--echo-queries"], "signature": "-e --echo-queries", "description": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries ."}, {"names": ["-E", "--echo-hidden"], "signature": "-E --echo-hidden", "description": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on ."}, {"names": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i . If filename is - (hyphen), then standard input is read until an EOF indication or \\q meta-command. This can be used to intersperse interactive input with input from files. Note however that Readline is not used in this case (much as if -n had been specified). Using this option is subtly different from writing psql < filename . In general, both will do what you expect, but using -f enables some nice features such as error messages with line numbers. There is also a slight chance that using this option will reduce the start-up overhead. On the other hand, the variant using the shell's input redirection is (in theory) guaranteed to yield exactly the same output you would have received had you entered everything by hand."}, {"names": ["-F separator", "--field-separator= separator"], "signature": "-F separator --field-separator= separator", "description": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f ."}, {"names": ["-h hostname", "--host= hostname"], "signature": "-h hostname --host= hostname", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket."}, {"names": ["-H", "--html"], "signature": "-H --html", "description": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command."}, {"names": ["-l", "--list"], "signature": "-l --list", "description": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list . When this option is used, psql will connect to the database postgres , unless a different database is named on the command line (option -d or non-option argument, possibly via a service entry, but not via an environment variable)."}, {"names": ["-L filename", "--log-file= filename"], "signature": "-L filename --log-file= filename", "description": "Write all query output into file filename , in addition to the normal output destination."}, {"names": ["-n", "--no-readline"], "signature": "-n --no-readline", "description": "Do not use Readline for line editing and do not use the command history (see the section called \u201cCommand-Line Editing\u201d below)."}, {"names": ["-o filename", "--output= filename"], "signature": "-o filename --output= filename", "description": "Put all query output into file filename . This is equivalent to the command \\o ."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432."}, {"names": ["-P assignment", "--pset= assignment"], "signature": "-P assignment --pset= assignment", "description": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex ."}, {"names": ["-q", "--quiet"], "signature": "-q --quiet", "description": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on ."}, {"names": ["-R separator", "--record-separator= separator"], "signature": "-R separator --record-separator= separator", "description": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep ."}, {"names": ["-s", "--single-step"], "signature": "-s --single-step", "description": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts."}, {"names": ["-S", "--single-line"], "signature": "-S --single-line", "description": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does. Note This mode is provided for those who insist on it, but you are not necessarily encouraged to use it. In particular, if you mix SQL and meta-commands on a line the order of execution might not always be clear to the inexperienced user."}, {"names": ["-t", "--tuples-only"], "signature": "-t --tuples-only", "description": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only ."}, {"names": ["-T table_options", "--table-attr= table_options"], "signature": "-T table_options --table-attr= table_options", "description": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)"}, {"names": ["-v assignment", "--set= assignment", "--variable= assignment"], "signature": "-v assignment --set= assignment --variable= assignment", "description": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the psql version and exit."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Force psql to prompt for a password before connecting to a database, even if the password will not be used. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, psql will prompt for a password in any case. However, psql will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-x", "--expanded"], "signature": "-x --expanded", "description": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded ."}, {"names": ["-X", "--no-psqlrc"], "signature": "-X --no-psqlrc", "description": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file)."}, {"names": ["-z", "--field-separator-zero"], "signature": "-z --field-separator-zero", "description": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero ."}, {"names": ["-0", "--record-separator-zero"], "signature": "-0 --record-separator-zero", "description": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero ."}, {"names": ["-1", "--single-transaction"], "signature": "-1 --single-transaction", "description": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied. If the commands themselves contain BEGIN , COMMIT , or ROLLBACK , this option will not have the desired effects. Also, if an individual command cannot be executed inside a transaction block, specifying this option will cause the whole transaction to fail."}, {"names": ["-?", "--help[= topic ]"], "signature": "-? --help[= topic ]", "description": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables."}], "synopsis": ["psql [ option ...] [ dbname [ username ]]"], "environment": [{"name": "COLUMNS", "description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode."}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters (see Section 32.15 )."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems."}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems."}, {"name": "PSQL_HISTORY", "description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed."}, {"name": "PSQL_PAGER PAGER", "description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If neither of them is set, the default is to use more on most platforms, but less on Cygwin."}, {"name": "PSQL_WATCH_PAGER", "description": "When a query is executed repeatedly with the \\watch command, a pager is not used by default. This behavior can be changed by setting PSQL_WATCH_PAGER to a pager command, on Unix systems. The pspg pager (not part of PostgreSQL but available in many open source software distributions) can display the output of \\watch if started with the option --stream ."}, {"name": "PSQLRC", "description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed."}, {"name": "SHELL", "description": "Command executed by the \\! command."}, {"name": "TMPDIR", "description": "Directory for storing temporary files. The default is /tmp ."}]}, "comparison_hash": "35782f34ffd86927478fe34ea660f98a4f30813f9a647d3ee74bb538203ceee2", "manual_language": "zh"}, "18": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "psql"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "18.6"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "35"}], "tables": [{"key": "options", "rows": [{"summary": "\u5728\u8bfb\u5165\u65f6\u5c06\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u884c\u8bfb\u53d6\uff09\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a all \u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-ALL", "text": "-a --echo-all"}}, {"summary": "\u5207\u6362\u5230\u975e\u5bf9\u9f50\u8f93\u51fa\u6a21\u5f0f\uff08\u9ed8\u8ba4\u8f93\u51fa\u6a21\u5f0f\u662f aligned \uff09\u3002\u8fd9\u7b49\u6548\u4e8e \\pset format unaligned \u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-NO-ALIGN", "text": "-A --no-align"}}, {"summary": "\u628a\u5931\u8d25\u7684 SQL \u547d\u4ee4\u6253\u5370\u5230\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a errors \u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-ERRORS", "text": "-b --echo-errors"}}, {"summary": "\u6307\u5b9a psql \u6267\u884c\u4e00\u4e2a\u7ed9\u5b9a\u7684\u547d\u4ee4\u5b57\u7b26\u4e32 command \u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u591a\u6b21\u5e76\u4e14\u4ee5\u4efb\u4f55\u987a\u5e8f\u4e0e -f \u9009\u9879\u7ec4\u5408\u5728\u4e00\u8d77\u3002\u5f53 -c \u6216\u8005 -f \u88ab\u6307\u5b9a\u65f6\uff0c psql \u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709 -c \u548c -f \u9009\u9879\u540e\u7ec8\u6b62\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-COMMAND", "text": "-c command --command= command"}}, {"summary": "\u5207\u6362\u5230 CSV \uff08\u9017\u53f7\u5206\u9694\u503c\uff09\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u76f8\u5f53\u4e8e \\pset format csv \u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-CSV", "text": "--csv"}}, {"summary": "\u6307\u5b9a\u8981\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002\u8fd9\u7b49\u6548\u4e8e\u6307\u5b9a dbname \u4e3a\u547d\u4ee4\u884c\u4e0a\u7684\u7b2c\u4e00\u4e2a\u975e\u9009\u9879\u53c2\u6570\u3002 dbname \u53ef\u4ee5\u662f \u8fde\u63a5\u5b57\u7b26\u4e32 \u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u5c06\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-DBNAME", "text": "-d dbname --dbname= dbname"}}, {"summary": "\u4e5f\u628a\u53d1\u9001\u5230\u670d\u52a1\u5668\u7684\u6240\u6709 SQL \u547d\u4ee4\u590d\u5236\u5230\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a queries \u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-QUERIES", "text": "-e --echo-queries"}}, {"summary": "\u56de\u663e \\d \u4ee5\u53ca\u5176\u4ed6\u53cd\u659c\u7ebf\u547d\u4ee4\u751f\u6210\u7684\u5b9e\u9645\u67e5\u8be2\u3002\u53ef\u4ee5\u7528\u5b83\u6765\u5b66\u4e60 psql \u7684\u5185\u90e8\u64cd\u4f5c\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO_HIDDEN \u8bbe\u7f6e\u4e3a on \u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-HIDDEN", "text": "-E --echo-hidden"}}, {"summary": "\u4ece\u6587\u4ef6 filename \u800c\u4e0d\u662f\u6807\u51c6\u8f93\u5165\u4e2d\u8bfb\u53d6\u547d\u4ee4\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u6307\u5b9a\uff0c\u4e5f\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u4e0e -c \u9009\u9879\u7ec4\u5408\u4f7f\u7528\u3002\u5f53\u6307\u5b9a\u4e86 -c \u6216 -f \u65f6\uff0c psql \u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709 -c \u548c -f \u9009\u9879\u540e\u7ec8\u6b62\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u7b49\u4ef7\u4e8e\u5143\u547d\u4ee4 \\i \u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-FILE", "text": "-f filename --file= filename"}}, {"summary": "\u4f7f\u7528 separator \u4f5c\u4e3a\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e \\pset fieldsep \u6216\u8005 \\f \u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR", "text": "-F separator --field-separator= separator"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-FIELD-HOST", "text": "-h hostname --host= hostname"}}, {"summary": "\u5207\u6362\u5230 HTML \u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e \\pset format html \u6216\u8005 \\H \u547d\u4ee4\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-HTML", "text": "-H --html"}}, {"summary": "\u5217\u51fa\u6240\u6709\u53ef\u7528\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u9000\u51fa\u3002\u5176\u4ed6\u975e\u8fde\u63a5\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002\u8fd9\u4e0e\u5143\u547d\u4ee4 \\list \u7c7b\u4f3c\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-LIST", "text": "-l --list"}}, {"summary": "\u9664\u4e86\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u5199\u5230\u666e\u901a\u8f93\u51fa\u76ee\u6807\u4e4b\u5916\uff0c\u8fd8\u5199\u5230\u6587\u4ef6 filename \u4e2d\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-LOG-FILE", "text": "-L filename --log-file= filename"}}, {"summary": "\u4e0d\u8981\u4f7f\u7528 Readline \u8fdb\u884c\u884c\u7f16\u8f91\uff0c\u4e5f\u4e0d\u8981\u4f7f\u7528\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\uff08\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684 \u201c\u547d\u4ee4\u884c\u7f16\u8f91\u201d\u4e00\u8282 \uff09\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-NO-READLINE", "text": "-n --no-readline"}}, {"summary": "\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u653e\u5230\u6587\u4ef6 filename \u4e2d\u3002\u8fd9\u7b49\u6548\u4e8e\u547d\u4ee4 \\o \u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-OUTPUT", "text": "-o filename --output= filename"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u7684\u6587\u4ef6\u540d\u540e\u7f00\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u7684\u503c\uff1b\u672a\u8bbe\u7f6e\u65f6\uff0c\u4f7f\u7528\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u7aef\u53e3\uff0c\u901a\u5e38\u4e3a 5432\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-PORT", "text": "-p port --port= port"}}, {"summary": "\u4ee5 \\pset \u7684\u5f62\u5f0f\u6307\u5b9a\u6253\u5370\u9009\u9879\u3002\u6ce8\u610f\uff0c\u8fd9\u91cc\u4f60\u5fc5\u987b\u7528\u4e00\u4e2a\u7b49\u53f7\u800c\u4e0d\u662f\u7a7a\u683c\u6765\u5206\u9694\u540d\u79f0\u548c\u503c\u3002\u4f8b\u5982\uff0c\u8981\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a LaTeX \uff0c\u5e94\u8be5\u5199\u6210 -P format=latex \u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-PSET", "text": "-P assignment --pset= assignment"}}, {"summary": "\u6307\u5b9a psql \u5e94\u8be5\u5b89\u9759\u5730\u5de5\u4f5c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4f1a\u6253\u5370\u51fa\u6b22\u8fce\u6d88\u606f\u548c\u5404\u79cd\u63d0\u793a\u4fe1\u606f\u3002\u5982\u679c\u4f7f\u7528\u4e86\u8fd9\u4e2a\u9009\u9879\uff0c\u4ee5\u4e0a\u90a3\u4e9b\u5c31\u90fd\u4e0d\u4f1a\u8f93\u51fa\u3002\u5728\u4f7f\u7528 -c \u9009\u9879\u65f6\uff0c\u914d\u5408\u8fd9\u4e2a\u9009\u9879\u5f88\u6709\u7528\u3002\u8fd9\u7b49\u6548\u4e8e\u8bbe\u7f6e\u53d8\u91cf QUIET \u4e3a on \u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-QUIET", "text": "-q --quiet"}}, {"summary": "\u628a separator \u7528\u4f5c\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e \\pset recordsep \u547d\u4ee4\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR", "text": "-R separator --record-separator= separator"}}, {"summary": "\u8fd0\u884c\u5728\u5355\u6b65\u6a21\u5f0f\u4e2d\u3002\u8fd9\u610f\u5473\u7740\u5728\u6bcf\u4e2a\u547d\u4ee4\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u4e4b\u524d\u90fd\u4f1a\u63d0\u793a\u7528\u6237\uff0c\u5e76\u5141\u8bb8\u53d6\u6d88\u6267\u884c\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u8c03\u8bd5\u811a\u672c\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-SINGLE-STEP", "text": "-s --single-step"}}, {"summary": "\u8fd0\u884c\u5728\u5355\u884c\u6a21\u5f0f\u4e2d\uff0c\u5176\u4e2d\u6362\u884c\u7b26\u4f1a\u7ec8\u6b62\u4e00\u4e2a SQL \u547d\u4ee4\uff0c\u5c31\u50cf\u5206\u53f7\u7684\u4f5c\u7528\u4e00\u6837\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-SINGLE-LINE", "text": "-S --single-line"}}, {"summary": "\u5173\u95ed\u6253\u5370\u5217\u540d\u548c\u7ed3\u679c\u884c\u8ba1\u6570\u9875\u811a\u7b49\u3002\u8fd9\u7b49\u6548\u4e8e \\t \u6216\u8005 \\pset tuples_only \u547d\u4ee4\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-TUPLES-ONLY", "text": "-t --tuples-only"}}, {"summary": "\u6307\u5b9a\u8981\u653e\u5728 HTML table \u6807\u7b7e\u5185\u7684\u9009\u9879\u3002\u8be6\u89c1 \\pset tableattr \u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-TABLE-ATTR", "text": "-T table_options --table-attr= table_options"}}, {"summary": "\u4f5c\u4e3a\u7528\u6237 username \u800c\u4e0d\u662f\u9ed8\u8ba4\u7528\u6237\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff08\u5f53\u7136\uff0c\u4f60\u5fc5\u987b\u5177\u6709\u8fd9\u6837\u505a\u7684\u6743\u9650\uff09\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-USERNAME", "text": "-U username --username= username"}}, {"summary": "\u6267\u884c\u4e00\u6b21\u53d8\u91cf\u8d4b\u503c\uff0c\u548c \\set \u5143\u547d\u4ee4\u76f8\u4f3c\u3002\u6ce8\u610f\u4f60\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u7528\u7b49\u53f7\u5206\u9694\u540d\u5b57\u548c\u503c\uff08\u5982\u679c\u6709\uff09\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u7684\u8bbe\u7f6e\uff0c\u53bb\u6389\u7b49\u53f7\u5c31\u884c\u3002\u8981\u628a\u4e00\u4e2a\u53d8\u91cf\u8bbe\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u4f7f\u7528\u7b49\u53f7\u4f46\u662f\u53bb\u6389\u503c\u3002\u8fd9\u4e9b\u8d4b\u503c\u5728\u547d\u4ee4\u884c\u5904\u7406\u671f\u95f4\u88ab\u5b8c\u6210\uff0c\u56e0\u6b64\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u7684\u53d8\u91cf\u5c06\u5728\u7a0d\u540e\u88ab\u8986\u76d6\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-VARIABLE", "text": "-v assignment --set= assignment --variable= assignment"}}, {"summary": "\u6253\u5370 psql \u7248\u672c\u5e76\u4e14\u9000\u51fa\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-VERSION", "text": "-V --version"}}, {"summary": "\u6c38\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982 .pgpass \u6587\u4ef6\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u8fd9\u4e2a\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4efb\u52a1\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u65f6\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-NO-PASSWORD", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 psql \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\uff0c\u5373\u4f7f\u8be5\u5bc6\u7801\u5b9e\u9645\u4e0a\u4e0d\u4f1a\u88ab\u4f7f\u7528\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-PASSWORD", "text": "-W --password"}}, {"summary": "\u6253\u5f00\u6269\u5c55\u8868\u683c\u5f0f\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e \\x \u6216\u8005 \\pset expanded \u547d\u4ee4\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-EXPANDED", "text": "-x --expanded"}}, {"summary": "\u4e0d\u8bfb\u53d6\u542f\u52a8\u6587\u4ef6\uff08\u65e2\u4e0d\u8bfb\u53d6\u7cfb\u7edf\u8303\u56f4\u7684 psqlrc \u6587\u4ef6\uff0c\u4e5f\u4e0d\u8bfb\u53d6\u7528\u6237\u7684 ~/.psqlrc \u6587\u4ef6\uff09\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-NO-PSQLRC", "text": "-X --no-psqlrc"}}, {"summary": "\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u8fd9\u7b49\u6548\u4e8e \\pset fieldsep_zero \u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR-ZERO", "text": "-z --field-separator-zero"}}, {"summary": "\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u4f8b\u5982\uff0c\u8fd9\u6709\u52a9\u4e8e\u4e0e xargs -0 \u914d\u5408\u4f7f\u7528\u3002\u8fd9\u7b49\u6548\u4e8e \\pset recordsep_zero \u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR-ZERO", "text": "-0 --record-separator-zero"}}, {"summary": "\u8fd9\u4e2a\u9009\u9879\u53ea\u80fd\u4e0e\u4e00\u4e2a\u6216\u591a\u4e2a -c \u548c/\u6216 -f \u9009\u9879\u7ed3\u5408\u4f7f\u7528\u3002\u5b83\u4f1a\u5bfc\u81f4 psql \u5728\u7b2c\u4e00\u4e2a\u8fd9\u6837\u7684\u9009\u9879\u4e4b\u524d\u53d1\u51fa\u4e00\u4e2a BEGIN \u547d\u4ee4\uff0c\u5e76\u5728\u6700\u540e\u4e00\u4e2a\u9009\u9879\u4e4b\u540e\u53d1\u51fa\u4e00\u4e2a COMMIT \u547d\u4ee4\uff0c\u4ece\u800c\u5c06\u6240\u6709\u547d\u4ee4\u5305\u88c5\u6210\u4e00\u4e2a\u5355\u72ec\u7684\u4e8b\u52a1\u3002\u5982\u679c\u4efb\u4f55\u547d\u4ee4\u5931\u8d25\u4e14\u53d8\u91cf ON_ERROR_STOP \u88ab\u8bbe\u7f6e\uff0c\u5219\u4f1a\u6539\u4e3a\u53d1\u9001\u4e00\u4e2a ROLLBACK \u547d\u4ee4\u3002\u8fd9\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-SINGLE-TRANSACTION", "text": "-1 --single-transaction"}}, {"summary": "\u663e\u793a\u6709\u5173 psql \u7684\u5e2e\u52a9\u5e76\u4e14\u9000\u51fa\u3002\u53ef\u9009\u7684 topic \u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a options \uff09\u9009\u62e9\u8981\u89e3\u91ca psql \u7684\u54ea\u4e00\u90e8\u5206\uff1a commands \u63cf\u8ff0 psql \u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b options \u63cf\u8ff0\u53ef\u4ee5\u88ab\u4f20\u9012\u7ed9 psql \u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c variables \u5219\u663e\u793a\u6709\u5173 psql \u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-HELP", "text": "-? --help[= topic ]"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "COLUMNS", "description": "\u5982\u679c \\pset columns \u4e3a\u96f6\uff0c\u8fd9\u4e2a\u73af\u5883\u53d8\u91cf\u63a7\u5236\u7528\u4e8e wrapped \u683c\u5f0f\u7684\u5bbd\u5ea6\u4ee5\u53ca\u7528\u6765\u786e\u5b9a\u8f83\u5bbd\u7684\u8f93\u51fa\u662f\u5426\u9700\u8981\u5206\u9875\u5668\uff0c\u6216\u8005\u662f\u5426\u5e94\u5207\u6362\u5230\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e2d\u7684\u5782\u76f4\u683c\u5f0f\u7684\u5bbd\u5ea6\u3002"}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\uff08\u89c1 \u7b2c 32.15 \u8282 \uff09\u3002"}, {"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "\\e \u3001 \\ef \u4ee5\u53ca \\ev \u547d\u4ee4\u6240\u4f7f\u7528\u7684\u7f16\u8f91\u5668\u3002\u4f1a\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u68c0\u67e5\u8fd9\u4e9b\u53d8\u91cf\uff0c\u7b2c\u4e00\u4e2a\u88ab\u8bbe\u7f6e\u7684\u5c06\u88ab\u4f7f\u7528\u3002\u5982\u679c\u90fd\u6ca1\u6709\u88ab\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u662f\u4f7f\u7528Unix\u7cfb\u7edf\u4e0a\u7684 vi \u6216\u8005Windows\u7cfb\u7edf\u4e0a\u7684 notepad.exe \u3002"}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "\u5f53 \\e \u3001 \\ef \u6216 \\ev \u5e26\u6709\u884c\u53f7\u53c2\u6570\u4f7f\u7528\u65f6\uff0c\u6b64\u53d8\u91cf\u6307\u5b9a\u5c06\u8d77\u59cb\u884c\u53f7\u4f20\u7ed9\u7528\u6237\u7f16\u8f91\u5668\u65f6\u6240\u7528\u7684\u547d\u4ee4\u884c\u53c2\u6570\u3002\u5bf9\u4e8e Emacs \u6216 vi \u4e4b\u7c7b\u7684\u7f16\u8f91\u5668\uff0c\u8fd9\u4e2a\u53c2\u6570\u662f\u4e00\u4e2a\u52a0\u53f7\u3002\u5982\u679c\u9009\u9879\u540d\u548c\u884c\u53f7\u4e4b\u95f4\u9700\u8981\u7a7a\u683c\uff0c\u8bf7\u5728\u53d8\u91cf\u503c\u4e2d\u5305\u542b\u672b\u5c3e\u7a7a\u683c\u3002\u4f8b\u5982\uff1a PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' \u5728 Unix \u7cfb\u7edf\u4e0a\u9ed8\u8ba4\u662f + \uff08\u5bf9\u5e94\u4e8e\u9ed8\u8ba4\u7f16\u8f91\u5668 vi \uff0c\u4e14\u5bf9\u5f88\u591a\u5176\u4ed6\u5e38\u89c1\u7f16\u8f91\u5668\u53ef\u7528\uff09\u3002\u5728 Windows \u7cfb\u7edf\u4e0a\u6ca1\u6709\u9ed8\u8ba4\u503c\u3002"}, {"name": "PSQL_HISTORY", "description": "\u547d\u4ee4\u5386\u53f2\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08 ~ \uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002"}, {"name": "PSQL_PAGER PAGER", "description": "\u5982\u679c\u67e5\u8be2\u7ed3\u679c\u65e0\u6cd5\u5728\u5c4f\u5e55\u4e0a\u663e\u793a\u5b8c\u6574\uff0c\u5b83\u4eec\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6b64\u547d\u4ee4\u3002\u5178\u578b\u7684\u503c\u662f more \u6216 less \u3002\u53ef\u4ee5\u901a\u8fc7\u5c06 PSQL_PAGER \u6216 PAGER \u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u6216\u901a\u8fc7\u8c03\u6574 \\pset \u547d\u4ee4\u7684\u4e0e\u5206\u9875\u76f8\u5173\u7684\u9009\u9879\u6765\u7981\u7528\u5206\u9875\u5668\u3002\u8fd9\u4e9b\u53d8\u91cf\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u8fdb\u884c\u68c0\u67e5\uff1b\u4f7f\u7528\u6309\u8be5\u987a\u5e8f\u627e\u5230\u7684\u7b2c\u4e00\u4e2a\u5df2\u8bbe\u7f6e\u7684\u53d8\u91cf\u3002\u5982\u679c\u5b83\u4eec\u90fd\u6ca1\u6709\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5728\u5927\u591a\u6570\u5e73\u53f0\u4e0a\u4f7f\u7528 more \uff0c\u4f46\u5728Cygwin\u4e0a\u4f7f\u7528 less \u3002"}, {"name": "PSQL_WATCH_PAGER", "description": "\u4f7f\u7528 \\watch \u547d\u4ee4\u53cd\u590d\u6267\u884c\u67e5\u8be2\u65f6\uff0c\u9ed8\u8ba4\u4e0d\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\u3002\u5728 Unix \u7cfb\u7edf\u4e0a\uff0c\u53ef\u4ee5\u5c06 PSQL_WATCH_PAGER \u8bbe\u4e3a\u5206\u9875\u7a0b\u5e8f\u547d\u4ee4\u6765\u6539\u53d8\u6b64\u884c\u4e3a\u3002pspg \u5206\u9875\u7a0b\u5e8f\uff08\u4e0d\u5c5e\u4e8e PostgreSQL\uff0c\u4f46\u8bb8\u591a\u5f00\u6e90\u8f6f\u4ef6\u53d1\u884c\u7248\u90fd\u63d0\u4f9b\u5b83\uff09\u4ee5 --stream \u9009\u9879\u542f\u52a8\u65f6\uff0c\u53ef\u4ee5\u663e\u793a \\watch \u7684\u8f93\u51fa\u3002"}, {"name": "PSQLRC", "description": "\u7528\u6237\u7684 .psqlrc \u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08 ~ \uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002"}, {"name": "SHELL", "description": "\u88ab \\! \u547d\u4ee4\u6267\u884c\u7684\u547d\u4ee4\u3002"}, {"name": "TMPDIR", "description": "\u5b58\u50a8\u4e34\u65f6\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u662f /tmp \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-a", "--echo-all"], "summary": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all .", "signature": "-a --echo-all", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-ALL", "description": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all ."}, {"names": ["-A", "--no-align"], "summary": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned .", "signature": "-A --no-align", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-NO-ALIGN", "description": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned ."}, {"names": ["-b", "--echo-errors"], "summary": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors .", "signature": "-b --echo-errors", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-ERRORS", "description": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors ."}, {"names": ["-c command", "--command= command"], "summary": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence.", "signature": "-c command --command= command", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-COMMAND", "description": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. command must be either a command string that is completely parsable by the server (i.e., it contains no psql -specific features), or a single backslash command. Thus you cannot mix SQL and psql meta-commands within a -c option. To achieve that, you could use repeated -c options or pipe the string into psql , for example: psql -c '\\x' -c 'SELECT * FROM foo;' or echo '\\x \\\\ SELECT * FROM foo;' | psql ( \\\\ is the separator meta-command.) Each SQL command string passed to -c is sent to the server as a single request. Because of this, the server executes it as a single transaction even if the string contains multiple SQL commands, unless there are explicit BEGIN / COMMIT commands included in the string to divide it into multiple transactions. (See Section 54.2.2.1 for more details about how the server handles multi-query strings.) If having several commands executed in one transaction is not desired, use repeated -c commands or feed multiple commands to psql 's standard input, either using echo as illustrated above, or via a shell here-document, for example: psql <<EOF \\x SELECT * FROM foo; EOF"}, {"names": ["--csv"], "summary": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv .", "signature": "--csv", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-CSV", "description": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv ."}, {"names": ["-d dbname", "--dbname= dbname"], "summary": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "signature": "-d dbname --dbname= dbname", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-DBNAME", "description": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--echo-queries"], "summary": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries .", "signature": "-e --echo-queries", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-QUERIES", "description": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries ."}, {"names": ["-E", "--echo-hidden"], "summary": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on .", "signature": "-E --echo-hidden", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-HIDDEN", "description": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on ."}, {"names": ["-f filename", "--file= filename"], "summary": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i .", "signature": "-f filename --file= filename", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-FILE", "description": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i . If filename is - (hyphen), then standard input is read until an EOF indication or \\q meta-command. This can be used to intersperse interactive input with input from files. Note however that Readline is not used in this case (much as if -n had been specified). Using this option is subtly different from writing psql < filename . In general, both will do what you expect, but using -f enables some nice features such as error messages with line numbers. There is also a slight chance that using this option will reduce the start-up overhead. On the other hand, the variant using the shell's input redirection is (in theory) guaranteed to yield exactly the same output you would have received had you entered everything by hand."}, {"names": ["-F separator", "--field-separator= separator"], "summary": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f .", "signature": "-F separator --field-separator= separator", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR", "description": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f ."}, {"names": ["-h hostname", "--host= hostname"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket.", "signature": "-h hostname --host= hostname", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-FIELD-HOST", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket."}, {"names": ["-H", "--html"], "summary": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command.", "signature": "-H --html", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-HTML", "description": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command."}, {"names": ["-l", "--list"], "summary": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list .", "signature": "-l --list", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-LIST", "description": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list . When this option is used, psql will connect to the database postgres , unless a different database is named on the command line (option -d or non-option argument, possibly via a service entry, but not via an environment variable)."}, {"names": ["-L filename", "--log-file= filename"], "summary": "Write all query output into file filename , in addition to the normal output destination.", "signature": "-L filename --log-file= filename", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-LOG-FILE", "description": "Write all query output into file filename , in addition to the normal output destination."}, {"names": ["-n", "--no-readline"], "summary": "Do not use Readline for line editing and do not use the command history (see the section called \u201cCommand-Line Editing\u201d below).", "signature": "-n --no-readline", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-NO-READLINE", "description": "Do not use Readline for line editing and do not use the command history (see the section called \u201cCommand-Line Editing\u201d below)."}, {"names": ["-o filename", "--output= filename"], "summary": "Put all query output into file filename . This is equivalent to the command \\o .", "signature": "-o filename --output= filename", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-OUTPUT", "description": "Put all query output into file filename . This is equivalent to the command \\o ."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432.", "signature": "-p port --port= port", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-PORT", "description": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432."}, {"names": ["-P assignment", "--pset= assignment"], "summary": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex .", "signature": "-P assignment --pset= assignment", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-PSET", "description": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex ."}, {"names": ["-q", "--quiet"], "summary": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on .", "signature": "-q --quiet", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-QUIET", "description": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on ."}, {"names": ["-R separator", "--record-separator= separator"], "summary": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep .", "signature": "-R separator --record-separator= separator", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR", "description": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep ."}, {"names": ["-s", "--single-step"], "summary": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts.", "signature": "-s --single-step", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-SINGLE-STEP", "description": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts."}, {"names": ["-S", "--single-line"], "summary": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does.", "signature": "-S --single-line", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-SINGLE-LINE", "description": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does. Note This mode is provided for those who insist on it, but you are not necessarily encouraged to use it. In particular, if you mix SQL and meta-commands on a line the order of execution might not always be clear to the inexperienced user."}, {"names": ["-t", "--tuples-only"], "summary": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only .", "signature": "-t --tuples-only", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-TUPLES-ONLY", "description": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only ."}, {"names": ["-T table_options", "--table-attr= table_options"], "summary": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details.", "signature": "-T table_options --table-attr= table_options", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-TABLE-ATTR", "description": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details."}, {"names": ["-U username", "--username= username"], "summary": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)", "signature": "-U username --username= username", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-USERNAME", "description": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)"}, {"names": ["-v assignment", "--set= assignment", "--variable= assignment"], "summary": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later.", "signature": "-v assignment --set= assignment --variable= assignment", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-VARIABLE", "description": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later."}, {"names": ["-V", "--version"], "summary": "Print the psql version and exit.", "signature": "-V --version", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-VERSION", "description": "Print the psql version and exit."}, {"names": ["-w", "--no-password"], "summary": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-NO-PASSWORD", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-W", "--password"], "summary": "Force psql to prompt for a password before connecting to a database, even if the password will not be used.", "signature": "-W --password", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-PASSWORD", "description": "Force psql to prompt for a password before connecting to a database, even if the password will not be used. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, psql will prompt for a password in any case. However, psql will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-x", "--expanded"], "summary": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded .", "signature": "-x --expanded", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-EXPANDED", "description": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded ."}, {"names": ["-X", "--no-psqlrc"], "summary": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file).", "signature": "-X --no-psqlrc", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-NO-PSQLRC", "description": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file)."}, {"names": ["-z", "--field-separator-zero"], "summary": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero .", "signature": "-z --field-separator-zero", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR-ZERO", "description": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero ."}, {"names": ["-0", "--record-separator-zero"], "summary": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero .", "signature": "-0 --record-separator-zero", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR-ZERO", "description": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero ."}, {"names": ["-1", "--single-transaction"], "summary": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied.", "signature": "-1 --single-transaction", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-SINGLE-TRANSACTION", "description": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied. If the commands themselves contain BEGIN , COMMIT , or ROLLBACK , this option will not have the desired effects. Also, if an individual command cannot be executed inside a transaction block, specifying this option will cause the whole transaction to fail."}, {"names": ["-?", "--help[= topic ]"], "summary": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables.", "signature": "-? --help[= topic ]", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-HELP", "description": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables."}], "related": [{"url": "/wiki/psql/?v=18", "label": "psql \u5143\u547d\u4ee4"}, {"url": "/wiki/conn/?v=18", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "label": "18.6", "major": "18", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/18/postgresql-18-A4.pdf", "bytes": 15865106, "pages": 3154, "sha256": "19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/18/postgresql-18-US.pdf", "bytes": 15748059, "pages": 3328, "sha256": "facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319", "built_at": "2026-09-26"}}, "tree": "18", "index": "index.html", "major": "18", "pages": 1148, "release": "18.6", "source_url": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "svg_assets": 3, "source_mode": "en SGML built with pinned official archive", "source_sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}, "revision": "ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8", "evidence_kind": "English manual and source declarations", "source_sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}, "sources": [{"url": "https://pg.center/docs/18/app-psql.html", "file": "app-psql.html", "label": "18.6 English manual \u00b7 app-psql.html", "anchor": "", "sha256": "fa2a1d39294b8854318e82e93f71272c645ed88150ecc2786c28902c3f32782c", "language": "en", "original_url": "/docs/18/app-psql.html"}, {"url": "https://pg.center/docs/18/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "68f726af77272fe73a827be2b7b5958d0f2239a6f8ed44264e9d42496bfa4fd0", "language": "en", "original_url": "/docs/18/reference-client.html"}], "sections": [], "synopsis": ["psql [ option ...] [ dbname [ username ]]"], "signature": "psql [ option ...] [ dbname [ username ]]", "description": ["psql \u2014 PostgreSQL \u7684\u4ea4\u4e92\u5f0f\u7ec8\u7aef"], "environment": [{"name": "COLUMNS", "description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode."}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters (see Section 32.15 )."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems."}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems."}, {"name": "PSQL_HISTORY", "description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed."}, {"name": "PSQL_PAGER PAGER", "description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If neither of them is set, the default is to use more on most platforms, but less on Cygwin."}, {"name": "PSQL_WATCH_PAGER", "description": "When a query is executed repeatedly with the \\watch command, a pager is not used by default. This behavior can be changed by setting PSQL_WATCH_PAGER to a pager command, on Unix systems. The pspg pager (not part of PostgreSQL but available in many open source software distributions) can display the output of \\watch if started with the option --stream ."}, {"name": "PSQLRC", "description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed."}, {"name": "SHELL", "description": "Command executed by the \\! command."}, {"name": "TMPDIR", "description": "Directory for storing temporary files. The default is /tmp ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PSQL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></h2>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u2014 <span class=\"productname\">PostgreSQL</span>\u7684\u4ea4\u4e92\u5f0f\u7ec8\u7aef</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.21.4.1\"><code class=\"command\">psql</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em> [<em class=\"replaceable\"><code>username</code></em>]]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.21.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u662f<span class=\"productname\">PostgreSQL</span>\u7684\u4e00\u4e2a\u57fa\u4e8e\u7ec8\u7aef\u7684\u524d\u7aef\u3002\u5b83\u4f7f\u4f60\u80fd\u591f\u4ea4\u4e92\u5f0f\u5730\u8f93\u5165\u67e5\u8be2\uff0c\u5c06\u5176\u53d1\u9001\u7ed9<span class=\"productname\">PostgreSQL</span>\uff0c\u5e76\u67e5\u770b\u67e5\u8be2\u7ed3\u679c\u3002\u4e5f\u53ef\u4ee5\u4ece\u6587\u4ef6\u6216\u547d\u4ee4\u884c\u53c2\u6570\u63d0\u4f9b\u8f93\u5165\u3002\u6b64\u5916\uff0c<span class=\"application\">psql</span>\u8fd8\u63d0\u4f9b\u4e86\u82e5\u5e72\u5143\u547d\u4ee4\u548c\u591a\u79cd\u7c7b\u4f3c shell \u7684\u7279\u6027\uff0c\u4ee5\u4fbf\u4e8e\u7f16\u5199\u811a\u672c\u548c\u81ea\u52a8\u5316\u6267\u884c\u5404\u79cd\u4efb\u52a1\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-PSQL-3\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-OPTION-ECHO-ALL\"><span class=\"term\"><code class=\"option\">-a</code><br/></span><span class=\"term\"><code class=\"option\">--echo-all</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8bfb\u5165\u65f6\u5c06\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u884c\u8bfb\u53d6\uff09\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a <code class=\"literal\">all</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-NO-ALIGN\"><span class=\"term\"><code class=\"option\">-A</code><br/></span><span class=\"term\"><code class=\"option\">--no-align</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230\u975e\u5bf9\u9f50\u8f93\u51fa\u6a21\u5f0f\uff08\u9ed8\u8ba4\u8f93\u51fa\u6a21\u5f0f\u662f<code class=\"literal\">aligned</code>\uff09\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset format unaligned</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-ECHO-ERRORS\"><span class=\"term\"><code class=\"option\">-b</code><br/></span><span class=\"term\"><code class=\"option\">--echo-errors</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u5931\u8d25\u7684 SQL \u547d\u4ee4\u6253\u5370\u5230\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">errors</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-COMMAND\"><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>command</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--command=<em class=\"replaceable\"><code>command</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a<span class=\"application\">psql</span>\u6267\u884c\u4e00\u4e2a\u7ed9\u5b9a\u7684\u547d\u4ee4\u5b57\u7b26\u4e32<em class=\"replaceable\"><code>command</code></em>\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u591a\u6b21\u5e76\u4e14\u4ee5\u4efb\u4f55\u987a\u5e8f\u4e0e<code class=\"option\">-f</code>\u9009\u9879\u7ec4\u5408\u5728\u4e00\u8d77\u3002\u5f53<code class=\"option\">-c</code>\u6216\u8005<code class=\"option\">-f</code>\u88ab\u6307\u5b9a\u65f6\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709<code class=\"option\">-c</code>\u548c<code class=\"option\">-f</code>\u9009\u9879\u540e\u7ec8\u6b62\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>command</code></em>\u5fc5\u987b\u662f\u4e00\u4e2a\u670d\u52a1\u5668\u5b8c\u5168\u53ef\u89e3\u6790\u7684\u547d\u4ee4\u5b57\u7b26\u4e32\uff08\u5373\u4e0d\u5305\u542b<span class=\"application\">psql</span>\u4e13\u6709\u7684\u7279\u6027\uff09\u6216\u8005\u5355\u4e2a\u53cd\u659c\u7ebf\u547d\u4ee4\u3002\u56e0\u6b64\u4e0d\u80fd\u5728\u4e00\u4e2a<code class=\"option\">-c</code>\u9009\u9879\u4e2d\u6df7\u5408<acronym class=\"acronym\">SQL</acronym>\u548c<span class=\"application\">psql</span>\u5143\u547d\u4ee4\u3002\u8981\u90a3\u6837\u505a\uff0c\u53ef\u4ee5\u4f7f\u7528\u591a\u4e2a<code class=\"option\">-c</code>\u9009\u9879\u6216\u8005\u628a\u5b57\u7b26\u4e32\u7528\u7ba1\u9053\u8f93\u9001\u5230<span class=\"application\">psql</span>\u4e2d\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">psql -c '\\x' -c 'SELECT * FROM foo;'\n</pre>\n<p lang=\"zh\">\u6216\u8005</p>\n<pre class=\"programlisting\">echo '\\x \\\\ SELECT * FROM foo;' | psql\n</pre>\n<p lang=\"zh\">\uff08<code class=\"literal\">\\\\</code>\u662f\u5206\u9694\u7b26\u5143\u547d\u4ee4\uff09\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u5b57\u7b26\u4e32\u4f20\u9012\u7ed9<code class=\"option\">-c</code>\u90fd\u4f5c\u4e3a\u4e00\u4e2a\u5355\u72ec\u7684\u8bf7\u6c42\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u56e0\u6b64\uff0c\u5373\u4f7f\u5b57\u7b26\u4e32\u5305\u542b\u591a\u4e2a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\uff0c\u670d\u52a1\u5668\u4e5f\u4f1a\u5c06\u5176\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff0c\u9664\u975e\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u660e\u786e\u7684<code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code>\u547d\u4ee4\u5c06\u5176\u5206\u6210\u591a\u4e2a\u4e8b\u52a1\u3002\uff08\u6709\u5173\u670d\u52a1\u5668\u5982\u4f55\u5904\u7406\u591a\u67e5\u8be2\u5b57\u7b26\u4e32\u7684\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/18/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT\" title=\"54.2.2.1.\u00a0\u4e00\u4e2a\u7b80\u5355\u67e5\u8be2\u4e2d\u7684\u591a\u6761\u8bed\u53e5\">\u7b2c\u00a054.2.2.1\u00a0\u8282</a>\u3002\uff09</p>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u5e0c\u671b\u5728\u4e00\u4e2a\u4e8b\u52a1\u4e2d\u6267\u884c\u591a\u4e2a\u547d\u4ee4\uff0c\u53ef\u4ee5\u4f7f\u7528\u91cd\u590d\u7684<code class=\"option\">-c</code>\u547d\u4ee4\uff0c\u6216\u5c06\u591a\u4e2a\u547d\u4ee4\u8f93\u5165\u5230<span class=\"application\">psql</span>\u7684\u6807\u51c6\u8f93\u5165\uff0c\u53ef\u4ee5\u50cf\u4e0a\u9762\u793a\u4f8b\u4e2d\u4f7f\u7528<span class=\"application\">echo</span>\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7shell\u7684here-document\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">psql &lt;&lt;EOF\n\\x\nSELECT * FROM foo;\nEOF\n</pre>\n</dd>\n<dt id=\"APP-PSQL-OPTION-CSV\"><span class=\"term\"><code class=\"option\">--csv</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230<acronym class=\"acronym\">CSV</acronym>\uff08\u9017\u53f7\u5206\u9694\u503c\uff09\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u76f8\u5f53\u4e8e<code class=\"command\">\\pset format csv</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-DBNAME\"><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>dbname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>dbname</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002\u8fd9\u7b49\u6548\u4e8e\u6307\u5b9a<em class=\"replaceable\"><code>dbname</code></em>\u4e3a\u547d\u4ee4\u884c\u4e0a\u7684\u7b2c\u4e00\u4e2a\u975e\u9009\u9879\u53c2\u6570\u3002<em class=\"replaceable\"><code>dbname</code></em> \u53ef\u4ee5\u662f<a class=\"link\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u5c06\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-ECHO-QUERIES\"><span class=\"term\"><code class=\"option\">-e</code><br/></span><span class=\"term\"><code class=\"option\">--echo-queries</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e5f\u628a\u53d1\u9001\u5230\u670d\u52a1\u5668\u7684\u6240\u6709 SQL \u547d\u4ee4\u590d\u5236\u5230\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">queries</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-ECHO-HIDDEN\"><span class=\"term\"><code class=\"option\">-E</code><br/></span><span class=\"term\"><code class=\"option\">--echo-hidden</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u56de\u663e<code class=\"command\">\\d</code>\u4ee5\u53ca\u5176\u4ed6\u53cd\u659c\u7ebf\u547d\u4ee4\u751f\u6210\u7684\u5b9e\u9645\u67e5\u8be2\u3002\u53ef\u4ee5\u7528\u5b83\u6765\u5b66\u4e60<span class=\"application\">psql</span>\u7684\u5185\u90e8\u64cd\u4f5c\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO_HIDDEN</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-FILE\"><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u800c\u4e0d\u662f\u6807\u51c6\u8f93\u5165\u4e2d\u8bfb\u53d6\u547d\u4ee4\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u6307\u5b9a\uff0c\u4e5f\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u4e0e<code class=\"option\">-c</code>\u9009\u9879\u7ec4\u5408\u4f7f\u7528\u3002\u5f53\u6307\u5b9a\u4e86<code class=\"option\">-c</code>\u6216<code class=\"option\">-f</code>\u65f6\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709<code class=\"option\">-c</code>\u548c<code class=\"option\">-f</code>\u9009\u9879\u540e\u7ec8\u6b62\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u7b49\u4ef7\u4e8e\u5143\u547d\u4ee4<code class=\"command\">\\i</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c<em class=\"replaceable\"><code>filename</code></em>\u662f<code class=\"literal\">-</code>\uff08\u8fde\u5b57\u7b26\uff09\uff0c\u5219\u4f1a\u8bfb\u53d6\u6807\u51c6\u8f93\u5165\uff0c\u76f4\u5230\u9047\u5230 <acronym class=\"acronym\">EOF</acronym> \u6307\u793a\u6216<code class=\"command\">\\q</code>\u5143\u547d\u4ee4\u3002\u8fd9\u53ef\u7528\u4e8e\u5c06\u4ea4\u4e92\u5f0f\u8f93\u5165\u4e0e\u6587\u4ef6\u8f93\u5165\u4ea4\u9519\u4f7f\u7528\u3002\u4e0d\u8fc7\u8bf7\u6ce8\u610f\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\u4e0d\u4f1a\u4f7f\u7528 <span class=\"application\">Readline</span>\uff08\u5f88\u50cf\u6307\u5b9a\u4e86<code class=\"option\">-n</code>\u65f6\u7684\u60c5\u51b5\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u4e0e\u5199\u6210<code class=\"literal\">psql &lt; <em class=\"replaceable\"><code>filename</code></em></code>\u6709\u7ec6\u5fae\u5dee\u522b\u3002\u901a\u5e38\u4e24\u79cd\u5f62\u5f0f\u90fd\u4f1a\u5f97\u5230\u4f60\u671f\u671b\u7684\u7ed3\u679c\uff0c\u4f46\u4f7f\u7528<code class=\"literal\">-f</code>\u53ef\u4ee5\u542f\u7528\u4e00\u4e9b\u6709\u7528\u7684\u7279\u6027\uff0c\u4f8b\u5982\u5e26\u884c\u53f7\u7684\u9519\u8bef\u6d88\u606f\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u4e5f\u8fd8\u6709\u4e00\u70b9\u673a\u4f1a\u964d\u4f4e\u542f\u52a8\u5f00\u9500\u3002\u53e6\u4e00\u65b9\u9762\uff0c\u4f7f\u7528 shell \u8f93\u5165\u91cd\u5b9a\u5411\u7684\u5f62\u5f0f\u5728\u7406\u8bba\u4e0a\u80fd\u4fdd\u8bc1\u5f97\u5230\u4e0e\u4f60\u624b\u5de5\u9010\u884c\u8f93\u5165\u65f6\u5b8c\u5168\u76f8\u540c\u7684\u8f93\u51fa\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-FIELD-SEPARATOR\"><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>separator</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--field-separator=<em class=\"replaceable\"><code>separator</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f7f\u7528<em class=\"replaceable\"><code>separator</code></em>\u4f5c\u4e3a\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset fieldsep</code>\u6216\u8005<code class=\"command\">\\f</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-FIELD-HOST\"><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>hostname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>hostname</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-HTML\"><span class=\"term\"><code class=\"option\">-H</code><br/></span><span class=\"term\"><code class=\"option\">--html</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230<acronym class=\"acronym\">HTML</acronym>\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset format html</code>\u6216\u8005<code class=\"command\">\\H</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-LIST\"><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--list</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u6240\u6709\u53ef\u7528\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u9000\u51fa\u3002\u5176\u4ed6\u975e\u8fde\u63a5\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002\u8fd9\u4e0e\u5143\u547d\u4ee4<code class=\"command\">\\list</code>\u7c7b\u4f3c\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8be5\u9009\u9879\u65f6\uff0c<span class=\"application\">psql</span>\u5c06\u8fde\u63a5\u5230\u6570\u636e\u5e93<code class=\"literal\">postgres</code>\uff0c\u9664\u975e\u547d\u4ee4\u884c\u4e0a\u6307\u5b9a\u4e86\u5176\u4ed6\u6570\u636e\u5e93\uff08\u901a\u8fc7<code class=\"option\">-d</code>\u9009\u9879\u6216\u975e\u9009\u9879\u53c2\u6570\uff0c\u4e5f\u53ef\u80fd\u901a\u8fc7\u670d\u52a1\u9879\uff0c\u4f46\u4e0d\u80fd\u901a\u8fc7\u73af\u5883\u53d8\u91cf\uff09\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-LOG-FILE\"><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--log-file=<em class=\"replaceable\"><code>filename</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9664\u4e86\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u5199\u5230\u666e\u901a\u8f93\u51fa\u76ee\u6807\u4e4b\u5916\uff0c\u8fd8\u5199\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-NO-READLINE\"><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-readline</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8981\u4f7f\u7528<span class=\"application\">Readline</span>\u8fdb\u884c\u884c\u7f16\u8f91\uff0c\u4e5f\u4e0d\u8981\u4f7f\u7528\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\uff08\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-READLINE\" title=\"\u547d\u4ee4\u884c\u7f16\u8f91\">\u201c\u547d\u4ee4\u884c\u7f16\u8f91\u201d\u4e00\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-OUTPUT\"><span class=\"term\"><code class=\"option\">-o <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--output=<em class=\"replaceable\"><code>filename</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u653e\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u3002\u8fd9\u7b49\u6548\u4e8e\u547d\u4ee4<code class=\"command\">\\o</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-PORT\"><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u7684\u6587\u4ef6\u540d\u540e\u7f00\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u7684\u503c\uff1b\u672a\u8bbe\u7f6e\u65f6\uff0c\u4f7f\u7528\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u7aef\u53e3\uff0c\u901a\u5e38\u4e3a 5432\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-PSET\"><span class=\"term\"><code class=\"option\">-P <em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--pset=<em class=\"replaceable\"><code>assignment</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ee5<code class=\"command\">\\pset</code>\u7684\u5f62\u5f0f\u6307\u5b9a\u6253\u5370\u9009\u9879\u3002\u6ce8\u610f\uff0c\u8fd9\u91cc\u4f60\u5fc5\u987b\u7528\u4e00\u4e2a\u7b49\u53f7\u800c\u4e0d\u662f\u7a7a\u683c\u6765\u5206\u9694\u540d\u79f0\u548c\u503c\u3002\u4f8b\u5982\uff0c\u8981\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a<span class=\"application\">LaTeX</span>\uff0c\u5e94\u8be5\u5199\u6210<code class=\"literal\">-P format=latex</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-QUIET\"><span class=\"term\"><code class=\"option\">-q</code><br/></span><span class=\"term\"><code class=\"option\">--quiet</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a<span class=\"application\">psql</span>\u5e94\u8be5\u5b89\u9759\u5730\u5de5\u4f5c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4f1a\u6253\u5370\u51fa\u6b22\u8fce\u6d88\u606f\u548c\u5404\u79cd\u63d0\u793a\u4fe1\u606f\u3002\u5982\u679c\u4f7f\u7528\u4e86\u8fd9\u4e2a\u9009\u9879\uff0c\u4ee5\u4e0a\u90a3\u4e9b\u5c31\u90fd\u4e0d\u4f1a\u8f93\u51fa\u3002\u5728\u4f7f\u7528<code class=\"option\">-c</code>\u9009\u9879\u65f6\uff0c\u914d\u5408\u8fd9\u4e2a\u9009\u9879\u5f88\u6709\u7528\u3002\u8fd9\u7b49\u6548\u4e8e\u8bbe\u7f6e\u53d8\u91cf<code class=\"varname\">QUIET</code>\u4e3a<code class=\"literal\">on</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-RECORD-SEPARATOR\"><span class=\"term\"><code class=\"option\">-R <em class=\"replaceable\"><code>separator</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--record-separator=<em class=\"replaceable\"><code>separator</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a<em class=\"replaceable\"><code>separator</code></em>\u7528\u4f5c\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset recordsep</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-SINGLE-STEP\"><span class=\"term\"><code class=\"option\">-s</code><br/></span><span class=\"term\"><code class=\"option\">--single-step</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5728\u5355\u6b65\u6a21\u5f0f\u4e2d\u3002\u8fd9\u610f\u5473\u7740\u5728\u6bcf\u4e2a\u547d\u4ee4\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u4e4b\u524d\u90fd\u4f1a\u63d0\u793a\u7528\u6237\uff0c\u5e76\u5141\u8bb8\u53d6\u6d88\u6267\u884c\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u8c03\u8bd5\u811a\u672c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-SINGLE-LINE\"><span class=\"term\"><code class=\"option\">-S</code><br/></span><span class=\"term\"><code class=\"option\">--single-line</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd0\u884c\u5728\u5355\u884c\u6a21\u5f0f\u4e2d\uff0c\u5176\u4e2d\u6362\u884c\u7b26\u4f1a\u7ec8\u6b62\u4e00\u4e2a SQL \u547d\u4ee4\uff0c\u5c31\u50cf\u5206\u53f7\u7684\u4f5c\u7528\u4e00\u6837\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u79cd\u6a21\u5f0f\u662f\u4e3a\u575a\u6301\u4f7f\u7528\u5b83\u7684\u7528\u6237\u63d0\u4f9b\u7684\uff0c\u4f46\u5e76\u4e0d\u4e00\u5b9a\u503c\u5f97\u63a8\u8350\u3002\u7279\u522b\u662f\uff0c\u5982\u679c\u5728\u4e00\u884c\u4e2d\u6df7\u5408\u4e86<acronym class=\"acronym\">SQL</acronym>\u548c\u5143\u547d\u4ee4\uff0c\u5bf9\u4e8e\u6ca1\u6709\u7ecf\u9a8c\u7684\u7528\u6237\u6765\u8bf4\uff0c\u5b83\u4eec\u7684\u6267\u884c\u987a\u5e8f\u672a\u5fc5\u603b\u662f\u6e05\u695a\u7684\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-OPTION-TUPLES-ONLY\"><span class=\"term\"><code class=\"option\">-t</code><br/></span><span class=\"term\"><code class=\"option\">--tuples-only</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5173\u95ed\u6253\u5370\u5217\u540d\u548c\u7ed3\u679c\u884c\u8ba1\u6570\u9875\u811a\u7b49\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\t</code>\u6216\u8005<code class=\"command\">\\pset tuples_only</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-TABLE-ATTR\"><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>table_options</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--table-attr=<em class=\"replaceable\"><code>table_options</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u653e\u5728<acronym class=\"acronym\">HTML</acronym> <code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u9009\u9879\u3002\u8be6\u89c1<code class=\"command\">\\pset tableattr</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-USERNAME\"><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f5c\u4e3a\u7528\u6237<em class=\"replaceable\"><code>username</code></em>\u800c\u4e0d\u662f\u9ed8\u8ba4\u7528\u6237\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff08\u5f53\u7136\uff0c\u4f60\u5fc5\u987b\u5177\u6709\u8fd9\u6837\u505a\u7684\u6743\u9650\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-VARIABLE\"><span class=\"term\"><code class=\"option\">-v <em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--set=<em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--variable=<em class=\"replaceable\"><code>assignment</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6267\u884c\u4e00\u6b21\u53d8\u91cf\u8d4b\u503c\uff0c\u548c<code class=\"command\">\\set</code>\u5143\u547d\u4ee4\u76f8\u4f3c\u3002\u6ce8\u610f\u4f60\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u7528\u7b49\u53f7\u5206\u9694\u540d\u5b57\u548c\u503c\uff08\u5982\u679c\u6709\uff09\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u7684\u8bbe\u7f6e\uff0c\u53bb\u6389\u7b49\u53f7\u5c31\u884c\u3002\u8981\u628a\u4e00\u4e2a\u53d8\u91cf\u8bbe\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u4f7f\u7528\u7b49\u53f7\u4f46\u662f\u53bb\u6389\u503c\u3002\u8fd9\u4e9b\u8d4b\u503c\u5728\u547d\u4ee4\u884c\u5904\u7406\u671f\u95f4\u88ab\u5b8c\u6210\uff0c\u56e0\u6b64\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u7684\u53d8\u91cf\u5c06\u5728\u7a0d\u540e\u88ab\u8986\u76d6\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-VERSION\"><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">psql</span>\u7248\u672c\u5e76\u4e14\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-NO-PASSWORD\"><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6c38\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u8fd9\u4e2a\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4efb\u52a1\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u65f6\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u6574\u4e2a\u4f1a\u8bdd\u671f\u95f4\u90fd\u4f1a\u4fdd\u6301\u751f\u6548\uff0c\u56e0\u6b64\u5b83\u4e0d\u4ec5\u5f71\u54cd\u521d\u59cb\u8fde\u63a5\u5c1d\u8bd5\uff0c\u4e5f\u4f1a\u5f71\u54cd\u5143\u547d\u4ee4<code class=\"command\">\\connect</code>\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-PASSWORD\"><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236<span class=\"application\">psql</span>\u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\uff0c\u5373\u4f7f\u8be5\u5bc6\u7801\u5b9e\u9645\u4e0a\u4e0d\u4f1a\u88ab\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff0c\u5219<span class=\"application\">psql</span>\u65e0\u8bba\u5982\u4f55\u90fd\u4f1a\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">psql</span>\u9700\u8981\u5148\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\uff0c\u624d\u80fd\u77e5\u9053\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u663e\u5f0f\u6307\u5b9a<code class=\"option\">-W</code>\u503c\u5f97\u7528\u6765\u907f\u514d\u8fd9\u6b21\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u6574\u4e2a\u4f1a\u8bdd\u671f\u95f4\u90fd\u4f1a\u4fdd\u6301\u751f\u6548\uff0c\u56e0\u6b64\u5b83\u4e0d\u4ec5\u5f71\u54cd\u521d\u59cb\u8fde\u63a5\u5c1d\u8bd5\uff0c\u4e5f\u4f1a\u5f71\u54cd\u5143\u547d\u4ee4<code class=\"command\">\\connect</code>\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-EXPANDED\"><span class=\"term\"><code class=\"option\">-x</code><br/></span><span class=\"term\"><code class=\"option\">--expanded</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5f00\u6269\u5c55\u8868\u683c\u5f0f\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\x</code>\u6216\u8005<code class=\"command\">\\pset expanded</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-NO-PSQLRC\"><span class=\"term\"><code class=\"option\">-X</code><br/></span><span class=\"term\"><code class=\"option\">--no-psqlrc</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8bfb\u53d6\u542f\u52a8\u6587\u4ef6\uff08\u65e2\u4e0d\u8bfb\u53d6\u7cfb\u7edf\u8303\u56f4\u7684<code class=\"filename\">psqlrc</code>\u6587\u4ef6\uff0c\u4e5f\u4e0d\u8bfb\u53d6\u7528\u6237\u7684<code class=\"filename\">~/.psqlrc</code>\u6587\u4ef6\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-FIELD-SEPARATOR-ZERO\"><span class=\"term\"><code class=\"option\">-z</code><br/></span><span class=\"term\"><code class=\"option\">--field-separator-zero</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset fieldsep_zero</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-RECORD-SEPARATOR-ZERO\"><span class=\"term\"><code class=\"option\">-0</code><br/></span><span class=\"term\"><code class=\"option\">--record-separator-zero</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u4f8b\u5982\uff0c\u8fd9\u6709\u52a9\u4e8e\u4e0e<code class=\"literal\">xargs -0</code>\u914d\u5408\u4f7f\u7528\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset recordsep_zero</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-SINGLE-TRANSACTION\"><span class=\"term\"><code class=\"option\">-1</code><br/></span><span class=\"term\"><code class=\"option\">--single-transaction</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u9009\u9879\u53ea\u80fd\u4e0e\u4e00\u4e2a\u6216\u591a\u4e2a<code class=\"option\">-c</code>\u548c/\u6216<code class=\"option\">-f</code>\u9009\u9879\u7ed3\u5408\u4f7f\u7528\u3002\u5b83\u4f1a\u5bfc\u81f4<span class=\"application\">psql</span>\u5728\u7b2c\u4e00\u4e2a\u8fd9\u6837\u7684\u9009\u9879\u4e4b\u524d\u53d1\u51fa\u4e00\u4e2a<code class=\"command\">BEGIN</code>\u547d\u4ee4\uff0c\u5e76\u5728\u6700\u540e\u4e00\u4e2a\u9009\u9879\u4e4b\u540e\u53d1\u51fa\u4e00\u4e2a<code class=\"command\">COMMIT</code>\u547d\u4ee4\uff0c\u4ece\u800c\u5c06\u6240\u6709\u547d\u4ee4\u5305\u88c5\u6210\u4e00\u4e2a\u5355\u72ec\u7684\u4e8b\u52a1\u3002\u5982\u679c\u4efb\u4f55\u547d\u4ee4\u5931\u8d25\u4e14\u53d8\u91cf<code class=\"varname\">ON_ERROR_STOP</code>\u88ab\u8bbe\u7f6e\uff0c\u5219\u4f1a\u6539\u4e3a\u53d1\u9001\u4e00\u4e2a<code class=\"command\">ROLLBACK</code>\u547d\u4ee4\u3002\u8fd9\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u547d\u4ee4\u672c\u8eab\u5305\u542b<code class=\"command\">BEGIN</code>\u3001<code class=\"command\">COMMIT</code>\u6216<code class=\"command\">ROLLBACK</code>\uff0c\u8fd9\u4e2a\u9009\u9879\u5c31\u4e0d\u4f1a\u4ea7\u751f\u671f\u671b\u7684\u6548\u679c\u3002\u53e6\u5916\uff0c\u5982\u679c\u67d0\u4e2a\u5355\u72ec\u547d\u4ee4\u4e0d\u80fd\u5728\u4e8b\u52a1\u5757\u4e2d\u6267\u884c\uff0c\u6307\u5b9a\u8fd9\u4e2a\u9009\u9879\u5c06\u5bfc\u81f4\u6574\u4e2a\u4e8b\u52a1\u5931\u8d25\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-HELP\"><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help[=<em class=\"replaceable\"><code>topic</code></em>]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u6709\u5173<span class=\"application\">psql</span>\u7684\u5e2e\u52a9\u5e76\u4e14\u9000\u51fa\u3002\u53ef\u9009\u7684<em class=\"replaceable\"><code>topic</code></em>\u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a<code class=\"literal\">options</code>\uff09\u9009\u62e9\u8981\u89e3\u91ca<span class=\"application\">psql</span>\u7684\u54ea\u4e00\u90e8\u5206\uff1a<code class=\"literal\">commands</code>\u63cf\u8ff0<span class=\"application\">psql</span>\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b<code class=\"literal\">options</code>\u63cf\u8ff0\u53ef\u4ee5\u88ab\u4f20\u9012\u7ed9<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c<code class=\"literal\">variables</code>\u5219\u663e\u793a\u6709\u5173<span class=\"application\">psql</span>\u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.21.7\">\n<h2 lang=\"zh\">\u9000\u51fa\u72b6\u6001</h2>\n<p lang=\"zh\">\u5982\u679c<span class=\"application\">psql</span>\u6b63\u5e38\u7ed3\u675f\uff0c\u5b83\u4f1a\u5411 shell \u8fd4\u56de 0\uff1b\u5982\u679c\u5b83\u81ea\u8eab\u53d1\u751f\u81f4\u547d\u9519\u8bef\uff08\u4f8b\u5982\u5185\u5b58\u8017\u5c3d\u3001\u627e\u4e0d\u5230\u6587\u4ef6\uff09\uff0c\u5219\u8fd4\u56de 1\uff1b\u5982\u679c\u5230\u670d\u52a1\u5668\u7684\u8fde\u63a5\u53d1\u751f\u6545\u969c\u4e14\u8be5\u4f1a\u8bdd\u4e0d\u662f\u4ea4\u4e92\u5f0f\u7684\uff0c\u5219\u8fd4\u56de 2\uff1b\u5982\u679c\u811a\u672c\u4e2d\u53d1\u751f\u9519\u8bef\u4e14\u53d8\u91cf<code class=\"varname\">ON_ERROR_STOP</code>\u5df2\u8bbe\u7f6e\uff0c\u5219\u8fd4\u56de 3\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.21.8\">\n<h2 lang=\"zh\">\u7528\u6cd5</h2>\n<div class=\"refsect2\" id=\"R2-APP-PSQL-CONNECTING\">\n<h3 lang=\"zh\">\u8fde\u63a5\u5230\u6570\u636e\u5e93</h3>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u662f\u5e38\u89c4\u7684 <span class=\"productname\">PostgreSQL</span> \u5ba2\u6237\u7aef\u5e94\u7528\u7a0b\u5e8f\u3002\u8981\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff0c\u4f60\u9700\u8981\u77e5\u9053\u76ee\u6807\u6570\u636e\u5e93\u540d\u79f0\u3001\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u548c\u7aef\u53e3\u53f7\uff0c\u4ee5\u53ca\u8981\u4ee5\u54ea\u4e2a\u6570\u636e\u5e93\u7528\u6237\u540d\u8fde\u63a5\u3002<span class=\"application\">psql</span> \u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u9009\u9879 <code class=\"option\">-d</code>\u3001<code class=\"option\">-h</code>\u3001<code class=\"option\">-p</code> \u548c <code class=\"option\">-U</code> \u5206\u522b\u6307\u5b9a\u8fd9\u4e9b\u53c2\u6570\u3002\u5982\u679c\u9047\u5230\u4e00\u4e2a\u4e0d\u5c5e\u4e8e\u4efb\u4f55\u9009\u9879\u7684\u53c2\u6570\uff0c\u5b83\u5c06\u88ab\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u540d\uff08\u5982\u679c\u6570\u636e\u5e93\u540d\u5df2\u7ecf\u7ed9\u51fa\uff0c\u5219\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u7528\u6237\u540d\uff09\u3002\u5e76\u975e\u6240\u6709\u8fd9\u4e9b\u9009\u9879\u90fd\u662f\u5fc5\u9700\u7684\uff1b\u5b83\u4eec\u90fd\u6709\u6709\u7528\u7684\u9ed8\u8ba4\u503c\u3002\u5982\u679c\u7701\u7565\u4e3b\u673a\u540d\uff0c<span class=\"application\">psql</span> \u5728 Unix \u4e0a\u5c06\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u5230\u672c\u5730\u4e3b\u673a\u4e0a\u7684\u670d\u52a1\u5668\uff0c\u5728 Windows \u4e0a\u5219\u901a\u8fc7 TCP/IP \u8fde\u63a5\u5230 <code class=\"literal\">localhost</code>\u3002\u9ed8\u8ba4\u7aef\u53e3\u53f7\u5728\u7f16\u8bd1\u65f6\u786e\u5b9a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u670d\u52a1\u5668\u4f7f\u7528\u76f8\u540c\u7684\u9ed8\u8ba4\u503c\uff0c\u56e0\u6b64\u5728\u5927\u591a\u6570\u60c5\u51b5\u4e0b\u4e0d\u5fc5\u6307\u5b9a\u7aef\u53e3\u3002\u9ed8\u8ba4\u6570\u636e\u5e93\u7528\u6237\u540d\u662f\u4f60\u7684\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\u3002\u6570\u636e\u5e93\u7528\u6237\u540d\u786e\u5b9a\u540e\uff0c\u5b83\u4e5f\u4f1a\u88ab\u7528\u4f5c\u9ed8\u8ba4\u6570\u636e\u5e93\u540d\u3002\u8bf7\u6ce8\u610f\uff0c\u4f60\u4e0d\u80fd\u968f\u610f\u4ee5\u4efb\u610f\u6570\u636e\u5e93\u7528\u6237\u540d\u8fde\u63a5\u5230\u4efb\u610f\u6570\u636e\u5e93\u3002\u6570\u636e\u5e93\u7ba1\u7406\u5458\u5e94\u5f53\u5df2\u7ecf\u544a\u77e5\u4f60\u62e5\u6709\u7684\u8bbf\u95ee\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5f53\u9ed8\u8ba4\u503c\u4e0d\u5b8c\u5168\u5408\u9002\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7\u628a\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGDATABASE</code>\u3001<code class=\"envar\">PGHOST</code>\u3001<code class=\"envar\">PGPORT</code>\u548c<code class=\"envar\">PGUSER</code>\u8bbe\u7f6e\u4e3a\u9002\u5f53\u7684\u503c\u6765\u5c11\u6572\u4e00\u4e9b\u952e\u76d8\uff08\u989d\u5916\u7684\u73af\u5883\u53d8\u91cf\u89c1<a class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a032.15\u00a0\u8282</a>\uff09\u3002\u53e6\u5916\uff0c\u51c6\u5907\u4e00\u4e2a<code class=\"filename\">~/.pgpass</code>\u6587\u4ef6\u4e5f\u5f88\u65b9\u4fbf\uff0c\u8fd9\u6837\u5c31\u4e0d\u5fc5\u7ecf\u5e38\u624b\u5de5\u8f93\u5165\u5bc6\u7801\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/18/libpq-pgpass.html\" title=\"32.16.\u00a0\u5bc6\u7801\u6587\u4ef6\">\u7b2c\u00a032.16\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u53e6\u4e00\u79cd\u6307\u5b9a\u8fde\u63a5\u53c2\u6570\u7684\u65b9\u6cd5\u662f\u4f7f\u7528 conninfo \u5b57\u7b26\u4e32\u6216 URI \u6765\u4ee3\u66ff\u6570\u636e\u5e93\u540d\u3002\u6b64\u673a\u5236\u5141\u8bb8\u5bf9\u8fde\u63a5\u8fdb\u884c\u975e\u5e38\u5e7f\u6cdb\u7684\u63a7\u5236\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">$ <strong class=\"userinput\"><code>psql \"service=myservice sslmode=require\"</code></strong>\n$ <strong class=\"userinput\"><code>psql postgresql://dbmaster:5433/mydb?sslmode=require</code></strong>\n</pre>\n<p lang=\"zh\">\u7528\u8fd9\u79cd\u65b9\u5f0f\uff0c\u4f60\u4e5f\u53ef\u4ee5\u628a<acronym class=\"acronym\">LDAP</acronym>\u7528\u4e8e<a class=\"xref\" href=\"/docs/18/libpq-ldap.html\" title=\"32.18.\u00a0\u8fde\u63a5\u53c2\u6570\u7684 LDAP \u67e5\u627e\">\u7b2c\u00a032.18\u00a0\u8282</a>\u4e2d\u63cf\u8ff0\u7684\u8fde\u63a5\u53c2\u6570\u67e5\u627e\u3002\u53ef\u7528\u8fde\u63a5\u9009\u9879\u7684\u66f4\u591a\u4fe1\u606f\u8bf7\u89c1<a class=\"xref\" href=\"/docs/18/libpq-connect.html#LIBPQ-PARAMKEYWORDS\" title=\"32.1.2.\u00a0\u53c2\u6570\u5173\u952e\u8bcd\">\u7b2c\u00a032.1.2\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7531\u4e8e\u4efb\u4f55\u539f\u56e0\uff08\u4f8b\u5982\u6743\u9650\u4e0d\u8db3\u3001\u670d\u52a1\u5668\u6ca1\u6709\u5728\u76ee\u6807\u4e3b\u673a\u4e0a\u8fd0\u884c\u7b49\uff09\u5bfc\u81f4\u8fde\u63a5\u65e0\u6cd5\u5efa\u7acb\uff0c<span class=\"application\">psql</span>\u5c06\u8fd4\u56de\u4e00\u4e2a\u9519\u8bef\u5e76\u4e14\u7ec8\u6b62\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6807\u51c6\u8f93\u5165\u548c\u6807\u51c6\u8f93\u51fa\u90fd\u662f\u7ec8\u7aef\uff0c\u90a3\u4e48<span class=\"application\">psql</span>\u4f1a\u628a\u5ba2\u6237\u7aef\u7f16\u7801\u8bbe\u7f6e\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">auto</span>\u201d</span>\uff0c\u4ece\u533a\u57df\u8bbe\u7f6e\u4e2d\u68c0\u6d4b\u5408\u9002\u7684\u5ba2\u6237\u7aef\u7f16\u7801\uff08\u5728 Unix \u7cfb\u7edf\u4e0a\u662f<code class=\"envar\">LC_CTYPE</code>\u73af\u5883\u53d8\u91cf\uff09\u3002\u5982\u679c\u7ed3\u679c\u4e0d\u7b26\u5408\u9884\u671f\uff0c\u53ef\u4ee5\u4f7f\u7528\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGCLIENTENCODING</code>\u8986\u76d6\u5ba2\u6237\u7aef\u7f16\u7801\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"R2-APP-PSQL-4\">\n<h3 lang=\"zh\">\u8f93\u5165 SQL \u547d\u4ee4</h3>\n<p lang=\"zh\">\u5728\u6b63\u5e38\u64cd\u4f5c\u65f6\uff0c<span class=\"application\">psql</span>\u4f1a\u63d0\u4f9b\u4e00\u4e2a\u63d0\u793a\u7b26\uff0c\u8be5\u63d0\u793a\u7b26\u662f<span class=\"application\">psql</span>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u540d\u79f0\u540e\u9762\u8ddf\u4e0a\u5b57\u7b26\u4e32<code class=\"literal\">=&gt;</code>\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">$ <strong class=\"userinput\"><code>psql testdb</code></strong>\npsql (18.6)\nType \"help\" for help.\n\ntestdb=&gt;\n</pre>\n<p lang=\"zh\">\u5728\u63d0\u793a\u7b26\u4e0b\uff0c\u7528\u6237\u53ef\u4ee5\u8f93\u5165<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u3002\u901a\u5e38\uff0c\u5f53\u9047\u5230\u8868\u793a\u547d\u4ee4\u7ed3\u675f\u7684\u5206\u53f7\u65f6\uff0c\u8f93\u5165\u7684\u5185\u5bb9\u5c31\u4f1a\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u3002\u884c\u7ed3\u675f\u5e76\u4e0d\u4f1a\u7ec8\u6b62\u4e00\u6761\u547d\u4ee4\uff0c\u56e0\u6b64\u4e3a\u4e86\u63d0\u9ad8\u6e05\u6670\u5ea6\uff0c\u547d\u4ee4\u53ef\u4ee5\u5206\u5e03\u5728\u591a\u884c\u4e0a\u3002\u5982\u679c\u547d\u4ee4\u88ab\u53d1\u9001\u5e76\u6210\u529f\u6267\u884c\uff0c\u5176\u7ed3\u679c\u5c31\u4f1a\u663e\u793a\u5728\u5c4f\u5e55\u4e0a\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u53d7\u4fe1\u4efb\u7684\u7528\u6237\u80fd\u591f\u8bbf\u95ee\u5c1a\u672a\u91c7\u7528<a class=\"link\" href=\"/docs/18/ddl-schemas.html#DDL-SCHEMAS-PATTERNS\" title=\"5.10.6.\u00a0\u4f7f\u7528\u65b9\u5f0f\">\u6a21\u5f0f\u7684\u5b89\u5168\u4f7f\u7528\u65b9\u5f0f</a>\u7684\u6570\u636e\u5e93\uff0c\u8bf7\u5728\u4f1a\u8bdd\u5f00\u59cb\u65f6\u4ece<code class=\"varname\">search_path</code>\u4e2d\u79fb\u9664\u6240\u6709\u516c\u4f17\u53ef\u5199\u7684\u6a21\u5f0f\u3002\u53ef\u4ee5\u5728\u8fde\u63a5\u5b57\u7b26\u4e32\u4e2d\u52a0\u5165<code class=\"literal\">options=-csearch_path=</code>\uff0c\u6216\u8005\u5728\u6267\u884c\u5176\u4ed6 SQL \u547d\u4ee4\u4e4b\u524d\u53d1\u51fa<code class=\"literal\">SELECT pg_catalog.set_config('search_path', '', false)</code>\u3002\u8fd9\u79cd\u8003\u8651\u5e76\u975e<span class=\"application\">psql</span>\u7279\u6709\uff1b\u5b83\u9002\u7528\u4e8e\u4efb\u4f55\u6267\u884c\u4efb\u610f SQL \u547d\u4ee4\u7684\u63a5\u53e3\u3002</p>\n<p lang=\"zh\">\u6bcf\u5f53\u6267\u884c\u547d\u4ee4\u65f6\uff0c<span class=\"application\">psql</span>\u4e5f\u4f1a\u8f6e\u8be2\u7531<a class=\"link\" href=\"/docs/18/sql-listen.html\" title=\"LISTEN\"><code class=\"command\">LISTEN</code></a>\u548c<a class=\"link\" href=\"/docs/18/sql-notify.html\" title=\"NOTIFY\"><code class=\"command\">NOTIFY</code></a>\u751f\u6210\u7684\u5f02\u6b65\u901a\u77e5\u4e8b\u4ef6\u3002</p>\n<p lang=\"zh\">\u867d\u7136 C \u98ce\u683c\u7684\u5757\u6ce8\u91ca\u4f1a\u88ab\u4f20\u7ed9\u670d\u52a1\u5668\u5904\u7406\u5e76\u79fb\u9664\uff0c\u4f46 SQL \u6807\u51c6\u6ce8\u91ca\u4f1a\u7531<span class=\"application\">psql</span>\u81ea\u884c\u79fb\u9664\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"APP-PSQL-META-COMMANDS\">\n<h3 lang=\"zh\">\u5143\u547d\u4ee4</h3>\n<p lang=\"zh\">\u4f60\u8f93\u5165\u5230<span class=\"application\">psql</span>\u4e2d\u7684\u4efb\u4f55\u4ee5\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u5f00\u59cb\u7684\u4e1c\u897f\u90fd\u662f\u4e00\u4e2a<span class=\"application\">psql</span>\u5143\u547d\u4ee4\uff0c\u5b83\u4eec\u7531<span class=\"application\">psql</span>\u81ea\u884c\u5904\u7406\u3002\u8fd9\u4e9b\u547d\u4ee4\u8ba9<span class=\"application\">psql</span>\u5bf9\u7ba1\u7406\u548c\u7f16\u5199\u811a\u672c\u66f4\u6709\u7528\u3002\u5143\u547d\u4ee4\u5e38\u5e38\u88ab\u79f0\u4f5c\u659c\u7ebf\u6216\u8005\u53cd\u659c\u7ebf\u547d\u4ee4\u3002</p>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u547d\u4ee4\u7684\u683c\u5f0f\u662f\u7528\u53cd\u659c\u7ebf\u540e\u9762\u76f4\u63a5\u8ddf\u4e0a\u4e00\u4e2a\u547d\u4ee4\u52a8\u8bcd\uff0c\u7136\u540e\u662f\u4e00\u4e9b\u53c2\u6570\u3002\u53c2\u6570\u4e0e\u547d\u4ee4\u52a8\u8bcd\u548c\u5176\u4ed6\u53c2\u6570\u4e4b\u95f4\u7528\u4efb\u610f\u591a\u4e2a\u7a7a\u767d\u5b57\u7b26\u5206\u9694\u5f00\u3002</p>\n<p lang=\"zh\">\u8981\u5728\u53c2\u6570\u4e2d\u5305\u542b\u7a7a\u767d\uff0c\u53ef\u4ee5\u7528\u5355\u5f15\u53f7\u5c06\u5b83\u62ec\u8d77\u6765\u3002\u8981\u5728\u53c2\u6570\u4e2d\u5305\u542b\u4e00\u4e2a\u5355\u5f15\u53f7\uff0c\u53ef\u4ee5\u5728\u5355\u5f15\u53f7\u6587\u672c\u5185\u5199\u4e24\u4e2a\u5355\u5f15\u53f7\u3002\u5355\u5f15\u53f7\u4e2d\u7684\u5185\u5bb9\u8fd8\u4f1a\u63a5\u53d7\u7c7b\u4f3c C \u8bed\u8a00\u7684\u66ff\u6362\uff1a<code class=\"literal\">\\n</code>\uff08\u6362\u884c\uff09\u3001<code class=\"literal\">\\t</code>\uff08\u5236\u8868\u7b26\uff09\u3001<code class=\"literal\">\\b</code>\uff08\u9000\u683c\uff09\u3001<code class=\"literal\">\\r</code>\uff08\u56de\u8f66\uff09\u3001<code class=\"literal\">\\f</code>\uff08\u6362\u9875\uff09\u3001<code class=\"literal\">\\</code><em class=\"replaceable\"><code>digits</code></em>\uff08\u516b\u8fdb\u5236\uff09\u4ee5\u53ca<code class=\"literal\">\\x</code><em class=\"replaceable\"><code>digits</code></em>\uff08\u5341\u516d\u8fdb\u5236\uff09\u3002\u5728\u5355\u5f15\u53f7\u6587\u672c\u5185\uff0c\u53cd\u659c\u7ebf\u51fa\u73b0\u5728\u4efb\u4f55\u5176\u4ed6\u5b57\u7b26\u524d\u9762\u65f6\uff0c\u53ea\u662f\u5bf9\u8be5\u5355\u4e2a\u5b57\u7b26\u8fdb\u884c\u8f6c\u4e49\uff0c\u4e0d\u8bba\u5b83\u662f\u4ec0\u4e48\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u53c2\u6570\u4e2d\u51fa\u73b0\u4e00\u4e2a\u672a\u52a0\u5f15\u53f7\u7684\u5192\u53f7\uff08<code class=\"literal\">:</code>\uff09\uff0c\u540e\u9762\u7d27\u8ddf\u4e00\u4e2a<span class=\"application\">psql</span>\u53d8\u91cf\u540d\uff0c\u5b83\u5c31\u4f1a\u88ab\u8be5\u53d8\u91cf\u7684\u503c\u66ff\u6362\uff0c\u5982\u4e0b\u9762<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL \u63d2\u503c\">SQL \u63d2\u503c</a>\u6240\u8ff0\u3002\u5176\u4e2d\u4ecb\u7ecd\u7684<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u548c<code class=\"literal\">:\"<em class=\"replaceable\"><code>variable_name</code></em>\"</code>\u5f62\u5f0f\u4e5f\u540c\u6837\u9002\u7528\u3002<code class=\"literal\">:{?<em class=\"replaceable\"><code>variable_name</code></em>}</code>\u8bed\u6cd5\u5141\u8bb8\u6d4b\u8bd5\u53d8\u91cf\u662f\u5426\u5df2\u5b9a\u4e49\uff1b\u5b83\u4f1a\u88ab TRUE \u6216 FALSE \u66ff\u6362\u3002\u7528\u53cd\u659c\u7ebf\u8f6c\u4e49\u8be5\u5192\u53f7\u53ef\u4ee5\u9632\u6b62\u66ff\u6362\u53d1\u751f\u3002</p>\n<p lang=\"zh\">\u5728\u53c2\u6570\u4e2d\uff0c\u7528\u53cd\u5f15\u53f7\uff08<code class=\"literal\">`</code>\uff09\u5305\u56f4\u7684\u6587\u672c\u4f1a\u88ab\u89c6\u4e3a\u4f20\u7ed9 shell \u7684\u547d\u4ee4\u884c\u3002\u8be5\u547d\u4ee4\u7684\u8f93\u51fa\uff08\u53bb\u6389\u672b\u5c3e\u7684\u6362\u884c\u7b26\uff09\u4f1a\u66ff\u6362\u53cd\u5f15\u53f7\u4e2d\u7684\u6587\u672c\u3002\u5728\u53cd\u5f15\u53f7\u5305\u56f4\u7684\u6587\u672c\u5185\u90e8\uff0c\u4e0d\u4f1a\u8fdb\u884c\u7279\u6b8a\u7684\u5f15\u53f7\u5904\u7406\u6216\u5176\u4ed6\u5904\u7406\uff0c\u4f46\u51fa\u73b0<code class=\"literal\">:<em class=\"replaceable\"><code>variable_name</code></em></code>\u65f6\uff0c\u5982\u679c<em class=\"replaceable\"><code>variable_name</code></em>\u662f<span class=\"application\">psql</span>\u53d8\u91cf\u540d\uff0c\u5c31\u4f1a\u88ab\u66ff\u6362\u4e3a\u8be5\u53d8\u91cf\u7684\u503c\u3002\u6b64\u5916\uff0c<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u4e5f\u4f1a\u88ab\u66ff\u6362\u4e3a\u8be5\u53d8\u91cf\u7684\u503c\uff0c\u5e76\u4f1a\u9002\u5f53\u5730\u52a0\u4e0a\u5f15\u53f7\uff0c\u4f7f\u5176\u6210\u4e3a\u5355\u4e2a shell \u547d\u4ee4\u53c2\u6570\u3002\uff08\u540e\u4e00\u79cd\u5f62\u5f0f\u51e0\u4e4e\u603b\u662f\u66f4\u53ef\u53d6\uff0c\u9664\u975e\u4f60\u975e\u5e38\u786e\u5b9a\u53d8\u91cf\u4e2d\u5305\u542b\u4ec0\u4e48\u3002\uff09\u7531\u4e8e\u65e0\u6cd5\u4fdd\u8bc1\u5728\u6240\u6709\u5e73\u53f0\u4e0a\u90fd\u80fd\u5bf9\u56de\u8f66\u548c\u6362\u884c\u5b57\u7b26\u5b89\u5168\u5730\u52a0\u5f15\u53f7\uff0c\u5f53\u53d8\u91cf\u503c\u4e2d\u51fa\u73b0\u8fd9\u7c7b\u5b57\u7b26\u65f6\uff0c<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u5f62\u5f0f\u4f1a\u6253\u5370\u9519\u8bef\u6d88\u606f\uff0c\u5e76\u4e14\u4e0d\u4f1a\u66ff\u6362\u53d8\u91cf\u503c\u3002</p>\n<p lang=\"zh\">\u4e00\u4e9b\u547d\u4ee4\u63a5\u53d7 SQL \u6807\u8bc6\u7b26\uff08\u4f8b\u5982\u8868\u540d\uff09\u4f5c\u4e3a\u53c2\u6570\u3002\u8fd9\u4e9b\u53c2\u6570\u9075\u5faa SQL \u8bed\u6cd5\u89c4\u5219\uff1a\u672a\u52a0\u5f15\u53f7\u7684\u5b57\u6bcd\u4f1a\u5f3a\u5236\u8f6c\u6362\u4e3a\u5c0f\u5199\uff0c\u800c\u53cc\u5f15\u53f7\uff08\"\uff09\u4f1a\u4fdd\u62a4\u5b57\u6bcd\u4e0d\u88ab\u8f6c\u6362\u5927\u5c0f\u5199\uff0c\u5e76\u5141\u8bb8\u6807\u8bc6\u7b26\u5305\u542b\u7a7a\u767d\u5b57\u7b26\u3002\u5728\u53cc\u5f15\u53f7\u5185\u90e8\uff0c\u8fde\u7eed\u4e24\u4e2a\u53cc\u5f15\u53f7\u4f1a\u5728\u6700\u7ec8\u540d\u79f0\u4e2d\u53d8\u4e3a\u4e00\u4e2a\u53cc\u5f15\u53f7\u3002\u4f8b\u5982\uff0cFOO\"BAR\"BAZ \u4f1a\u88ab\u89e3\u91ca\u4e3a fooBARbaz\uff0c\u800c \"A weird\"\" name\" \u4f1a\u53d8\u4e3a A weird\" name\u3002</p>\n<p lang=\"zh\">\u53c2\u6570\u89e3\u6790\u4f1a\u5728\u884c\u5c3e\u6216\u9047\u5230\u53e6\u4e00\u4e2a\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u65f6\u505c\u6b62\u3002\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u4f1a\u88ab\u89c6\u4e3a\u65b0\u5143\u547d\u4ee4\u7684\u5f00\u59cb\u3002\u7279\u6b8a\u5e8f\u5217<code class=\"literal\">\\\\</code>\uff08\u4e24\u4e2a\u53cd\u659c\u7ebf\uff09\u8868\u793a\u53c2\u6570\u7ed3\u675f\uff0c\u5e76\u7ee7\u7eed\u89e3\u6790<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\uff08\u5982\u679c\u8fd8\u6709\uff09\u3002\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u548c<span class=\"application\">psql</span>\u547d\u4ee4\u53ef\u4ee5\u81ea\u7531\u5730\u6df7\u5408\u5728\u540c\u4e00\u884c\u4e2d\u3002\u4f46\u65e0\u8bba\u5982\u4f55\uff0c\u5143\u547d\u4ee4\u7684\u53c2\u6570\u90fd\u4e0d\u80fd\u5ef6\u7eed\u5230\u4e0b\u4e00\u884c\u3002</p>\n<p lang=\"zh\">\u8bb8\u591a\u5143\u547d\u4ee4\u4f5c\u7528\u4e8e<em class=\"firstterm\">\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a</em>\u3002\u8fd9\u53ea\u662f\u4e00\u4e2a\u4fdd\u5b58\u5df2\u8f93\u5165\u4f46\u5c1a\u672a\u53d1\u9001\u5230\u670d\u52a1\u5668\u6267\u884c\u7684 SQL \u547d\u4ee4\u6587\u672c\u7684\u7f13\u51b2\u533a\u3002\u5176\u4e2d\u65e2\u5305\u62ec\u5148\u524d\u8f93\u5165\u7684\u884c\uff0c\u4e5f\u5305\u62ec\u540c\u4e00\u884c\u4e0a\u4f4d\u4e8e\u5143\u547d\u4ee4\u4e4b\u524d\u7684\u6587\u672c\u3002</p>\n<p lang=\"zh\">\u8bb8\u591a\u5143\u547d\u4ee4\u8fd8\u5141\u8bb8\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code> \u4f5c\u4e3a\u9009\u9879\u3002\u8fd9\u4f1a\u4f7f\u7ed3\u679c\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\uff0c\u5c31\u50cf\u4f7f\u7528\u4e86 <code class=\"command\">\\x</code> \u6216 <code class=\"command\">\\pset expanded</code> \u4e00\u6837\u3002</p>\n<p lang=\"zh\">\u5b9a\u4e49\u4e86\u4ee5\u4e0b\u5143\u547d\u4ee4\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-META-COMMAND-A\"><span class=\"term\"><code class=\"literal\">\\a</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u5f53\u524d\u8868\u683c\u8f93\u51fa\u683c\u5f0f\u662f\u975e\u5bf9\u9f50\uff0c\u5219\u5207\u6362\u4e3a\u5bf9\u9f50\uff1b\u5426\u5219\u5207\u6362\u4e3a\u975e\u5bf9\u9f50\u3002\u4fdd\u7559\u6b64\u547d\u4ee4\u662f\u4e3a\u4e86\u5411\u540e\u517c\u5bb9\u3002\u66f4\u901a\u7528\u7684\u89e3\u51b3\u65b9\u6848\u8bf7\u53c2\u89c1<code class=\"command\">\\pset</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-BIND\"><span class=\"term\"><code class=\"literal\">\\bind</code> [ <em class=\"replaceable\"><code>parameter</code></em> ] ...</span> </dt>\n<dd>\n<p lang=\"zh\">\u4e3a\u4e0b\u4e00\u6b21\u67e5\u8be2\u6267\u884c\u8bbe\u7f6e\u67e5\u8be2\u53c2\u6570\uff0c\u5e76\u5c06\u6307\u5b9a\u53c2\u6570\u4f20\u7ed9\u4efb\u610f\u53c2\u6570\u5360\u4f4d\u7b26\uff08<code class=\"literal\">$1</code> \u7b49\uff09\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">INSERT INTO tbl1 VALUES ($1, $2) \\bind 'first value' 'second value' \\g\n</pre>\n<p lang=\"zh\">\u8fd9\u5bf9\u9664 <code class=\"literal\">\\g</code> \u4e4b\u5916\u7684\u67e5\u8be2\u6267\u884c\u547d\u4ee4\u4e5f\u6709\u6548\uff0c\u4f8b\u5982 <code class=\"literal\">\\gx</code> \u548c <code class=\"literal\">\\gset</code>\u3002</p>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4f1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/18/protocol-overview.html#PROTOCOL-QUERY-CONCEPTS\" title=\"54.1.2.\u00a0\u6269\u5c55\u67e5\u8be2\u6982\u8ff0\">\u7b2c\u00a054.1.2\u00a0\u8282</a>\uff09\uff0c\u4e0d\u540c\u4e8e<span class=\"application\">psql</span>\u901a\u5e38\u4f7f\u7528\u7684\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002\u56e0\u6b64\uff0c\u53ef\u4ee5\u7528\u5b83\u5728<span class=\"application\">psql</span>\u4e2d\u6d4b\u8bd5\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002\uff08\u5373\u4f7f\u67e5\u8be2\u6ca1\u6709\u53c2\u6570\uff0c\u800c\u4e14\u6b64\u547d\u4ee4\u6307\u5b9a\u4e86\u96f6\u4e2a\u53c2\u6570\uff0c\u4e5f\u4f1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002\uff09\u6b64\u547d\u4ee4\u53ea\u5f71\u54cd\u4e0b\u4e00\u6761\u88ab\u6267\u884c\u7684\u67e5\u8be2\uff1b\u4e4b\u540e\u7684\u6240\u6709\u67e5\u8be2\u9ed8\u8ba4\u4ecd\u4f1a\u4f7f\u7528\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-BIND-NAMED\"><span class=\"term\"><code class=\"literal\">\\bind_named</code> <em class=\"replaceable\"><code>statement_name</code></em> [ <em class=\"replaceable\"><code>parameter</code></em> ] ...</span> </dt>\n<dd>\n<p lang=\"zh\"><code class=\"literal\">\\bind_named</code> \u7b49\u540c\u4e8e <code class=\"literal\">\\bind</code>\uff0c\u4e0d\u540c\u4e4b\u5904\u5728\u4e8e\u5b83\u628a\u73b0\u6709\u9884\u5907\u8bed\u53e5\u7684\u540d\u79f0\u4f5c\u4e3a\u7b2c\u4e00\u4e2a\u53c2\u6570\u3002\u7a7a\u5b57\u7b26\u4e32\u8868\u793a\u672a\u547d\u540d\u7684\u9884\u5907\u8bed\u53e5\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">INSERT INTO tbls1 VALUES ($1, $2) \\parse stmt1\n\\bind_named stmt1 'first value' 'second value' \\g\n</pre>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4f1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/18/protocol-overview.html#PROTOCOL-QUERY-CONCEPTS\" title=\"54.1.2.\u00a0\u6269\u5c55\u67e5\u8be2\u6982\u8ff0\">\u7b2c\u00a054.1.2\u00a0\u8282</a>\uff09\uff0c\u4e0d\u540c\u4e8e<span class=\"application\">psql</span>\u901a\u5e38\u4f7f\u7528\u7684\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002\u56e0\u6b64\uff0c\u53ef\u4ee5\u7528\u5b83\u5728<span class=\"application\">psql</span>\u4e2d\u6d4b\u8bd5\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-C-LC\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\c</code> \u6216 <code class=\"literal\">\\connect [ -reuse-previous=<em class=\"replaceable\"><code>on|off</code></em> ] [ <em class=\"replaceable\"><code>dbname</code></em> [ <em class=\"replaceable\"><code>username</code></em> ] [ <em class=\"replaceable\"><code>host</code></em> ] [ <em class=\"replaceable\"><code>port</code></em> ] | <em class=\"replaceable\"><code>conninfo</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5efa\u7acb\u5230<span class=\"productname\">PostgreSQL</span>\u670d\u52a1\u5668\u7684\u65b0\u8fde\u63a5\u3002\u53ef\u4ee5\u4f7f\u7528\u4f4d\u7f6e\u8bed\u6cd5\uff08\u6570\u636e\u5e93\u540d\u79f0\u3001\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\u4e2d\u7684\u4e00\u4e2a\u6216\u591a\u4e2a\uff09\u6307\u5b9a\u8981\u4f7f\u7528\u7684\u8fde\u63a5\u53c2\u6570\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528<em class=\"replaceable\"><code>conninfo</code></em>\u8fde\u63a5\u5b57\u7b26\u4e32\uff0c\u8be6\u89c1<a class=\"xref\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u7b2c\u00a032.1.1\u00a0\u8282</a>\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa\u53c2\u6570\uff0c\u5219\u4f7f\u7528\u4e0e\u4e4b\u524d\u76f8\u540c\u7684\u53c2\u6570\u5efa\u7acb\u65b0\u8fde\u63a5\u3002</p>\n<p lang=\"zh\">\u5c06<em class=\"replaceable\"><code>dbname</code></em>\u3001<em class=\"replaceable\"><code>username</code></em>\u3001<em class=\"replaceable\"><code>host</code></em>\u6216 <em class=\"replaceable\"><code>port</code></em>\u4e2d\u7684\u4efb\u610f\u4e00\u4e2a\u6307\u5b9a\u4e3a <code class=\"literal\">-</code>\uff0c\u7b49\u540c\u4e8e\u7701\u7565\u8be5\u53c2\u6570\u3002</p>\n<p lang=\"zh\">\u65b0\u8fde\u63a5\u53ef\u4ee5\u91cd\u7528\u524d\u4e00\u4e2a\u8fde\u63a5\u7684\u8fde\u63a5\u53c2\u6570\uff1b\u4e0d\u4ec5\u5305\u62ec\u6570\u636e\u5e93\u540d\u79f0\u3001\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\uff0c\u8fd8\u5305\u62ec\u5176\u4ed6\u8bbe\u7f6e\uff0c\u5982<em class=\"replaceable\"><code>sslmode</code></em>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53c2\u6570\u5728\u4f4d\u7f6e\u8bed\u6cd5\u4e2d\u88ab\u91cd\u7528\uff0c\u4f46\u5728\u7ed9\u5b9a<em class=\"replaceable\"><code>conninfo</code></em>\u5b57\u7b26\u4e32\u65f6\u4e0d\u4f1a\u88ab\u91cd\u7528\u3002\u4f20\u9012<code class=\"literal\">-reuse-previous=on</code>\u6216<code class=\"literal\">-reuse-previous=off</code>\u4f5c\u4e3a\u7b2c\u4e00\u4e2a\u53c2\u6570\u5c06\u8986\u76d6\u8be5\u9ed8\u8ba4\u8bbe\u7f6e\u3002\u5982\u679c\u53c2\u6570\u88ab\u91cd\u7528\uff0c\u5219\u4efb\u4f55\u672a\u660e\u786e\u6307\u5b9a\u4e3a\u4f4d\u7f6e\u53c2\u6570\u6216\u5728<em class=\"replaceable\"><code>conninfo</code></em>\u5b57\u7b26\u4e32\u4e2d\u7684\u53c2\u6570\u5c06\u4ece\u73b0\u6709\u8fde\u63a5\u7684\u53c2\u6570\u4e2d\u83b7\u53d6\u3002\u4e00\u4e2a\u4f8b\u5916\u662f\uff0c\u5982\u679c\u4f7f\u7528\u4f4d\u7f6e\u8bed\u6cd5\u66f4\u6539<em class=\"replaceable\"><code>host</code></em>\u8bbe\u7f6e\uff0c\u4f7f\u5176\u4e0d\u540c\u4e8e\u5148\u524d\u7684\u503c\uff0c\u5219\u73b0\u6709\u8fde\u63a5\u53c2\u6570\u4e2d\u5b58\u5728\u7684\u4efb\u4f55<em class=\"replaceable\"><code>hostaddr</code></em>\u8bbe\u7f6e\u5c06\u88ab\u5220\u9664\u3002\u6b64\u5916\uff0c\u4ec5\u5f53\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\u8bbe\u7f6e\u672a\u66f4\u6539\u65f6\uff0c\u624d\u4f1a\u91cd\u7528\u73b0\u6709\u8fde\u63a5\u4f7f\u7528\u7684\u4efb\u4f55\u5bc6\u7801\u3002\u5f53\u547d\u4ee4\u65e2\u4e0d\u6307\u5b9a\u4e5f\u4e0d\u91cd\u7528\u7279\u5b9a\u53c2\u6570\u65f6\uff0c\u5c06\u4f7f\u7528<span class=\"application\">libpq</span>\u7684\u9ed8\u8ba4\u503c\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u65b0\u8fde\u63a5\u6210\u529f\u5efa\u7acb\uff0c\u5219\u5173\u95ed\u5148\u524d\u7684\u8fde\u63a5\u3002\u5982\u679c\u8fde\u63a5\u5c1d\u8bd5\u5931\u8d25\uff08\u7528\u6237\u540d\u9519\u8bef\uff0c\u8bbf\u95ee\u88ab\u62d2\u7edd\u7b49\uff09\uff0c\u4e14<span class=\"application\">psql</span>\u5904\u4e8e\u4ea4\u4e92\u6a21\u5f0f\uff0c\u5219\u4fdd\u7559\u5148\u524d\u7684\u8fde\u63a5\u3002\u4f46\u5728\u6267\u884c\u975e\u4ea4\u4e92\u811a\u672c\u65f6\uff0c\u65e7\u8fde\u63a5\u5c06\u88ab\u5173\u95ed\u5e76\u62a5\u544a\u9519\u8bef\u3002\u8fd9\u53ef\u80fd\u4f1a\u6216\u53ef\u80fd\u4e0d\u4f1a\u7ec8\u6b62\u811a\u672c\uff1b\u5982\u679c\u6ca1\u6709\u7ec8\u6b62\uff0c\u76f4\u5230\u6210\u529f\u6267\u884c\u53e6\u4e00\u4e2a<code class=\"literal\">\\connect</code>\u547d\u4ee4\u4e4b\u524d\uff0c\u6240\u6709\u8bbf\u95ee\u6570\u636e\u5e93\u7684\u547d\u4ee4\u90fd\u5c06\u5931\u8d25\u3002\u91c7\u7528\u8fd9\u79cd\u533a\u522b\uff0c\u4e00\u65b9\u9762\u662f\u4e3a\u4e86\u65b9\u4fbf\u7528\u6237\u5e94\u5bf9\u8f93\u5165\u7b14\u8bef\uff0c\u53e6\u4e00\u65b9\u9762\u662f\u4e3a\u4e86\u9632\u6b62\u811a\u672c\u610f\u5916\u64cd\u4f5c\u9519\u8bef\u7684\u6570\u636e\u5e93\u3002\u8bf7\u6ce8\u610f\uff0c\u6bcf\u5f53<code class=\"literal\">\\connect</code>\u547d\u4ee4\u5c1d\u8bd5\u91cd\u65b0\u4f7f\u7528\u53c2\u6570\u65f6\uff0c\u91cd\u65b0\u4f7f\u7528\u7684\u503c\u662f\u6700\u540e\u4e00\u4e2a\u6210\u529f\u8fde\u63a5\u7684\u503c\uff0c\u800c\u4e0d\u662f\u968f\u540e\u7684\u4efb\u4f55\u5931\u8d25\u5c1d\u8bd5\u7684\u503c\u3002\u4f46\u662f\uff0c\u5728\u975e\u4ea4\u4e92<code class=\"literal\">\\connect</code>\u5931\u8d25\u7684\u60c5\u51b5\u4e0b\uff0c\u4e0d\u5141\u8bb8\u7a0d\u540e\u91cd\u65b0\u4f7f\u7528\u53c2\u6570\uff0c\u56e0\u4e3a\u811a\u672c\u53ef\u80fd\u671f\u671b\u4ece\u5931\u8d25\u7684<code class=\"literal\">\\connect</code>\u4e2d\u91cd\u65b0\u4f7f\u7528\u503c\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">=&gt; \\c mydb myuser host.dom 6432\n=&gt; \\c service=foo\n=&gt; \\c \"host=localhost port=5432 dbname=mydb connect_timeout=10 sslmode=disable\"\n=&gt; \\c -reuse-previous=on sslmode=require    -- changes only sslmode\n=&gt; \\c postgresql://tom@localhost/mydb?application_name=myapp\n</pre>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-C-UC\"><span class=\"term\"><code class=\"literal\">\\C [ <em class=\"replaceable\"><code>title</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u4f5c\u4e3a\u67e5\u8be2\u7ed3\u679c\u6253\u5370\u7684\u8868\u7684\u6807\u9898\uff0c\u6216\u53d6\u6d88\u6b64\u7c7b\u6807\u9898\u3002\u8be5\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset title <em class=\"replaceable\"><code>title</code></em></code>\u3002\uff08\u6b64\u547d\u4ee4\u7684\u540d\u79f0\u6e90\u81ea<span class=\"quote\">\u201c<span class=\"quote\">caption</span>\u201d</span>\uff0c\u56e0\u4e3a\u5b83\u8fc7\u53bb\u53ea\u7528\u4e8e\u8bbe\u7f6e<acronym class=\"acronym\">HTML</acronym>\u8868\u7684\u6807\u9898\u3002\uff09</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-CD\"><span class=\"term\"><code class=\"literal\">\\cd [ <em class=\"replaceable\"><code>directory</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u66f4\u6539\u4e3a <em class=\"replaceable\"><code>directory</code></em>\u3002\u5982\u679c\u6ca1\u6709\u53c2\u6570\uff0c\u5219\u5207\u6362\u5230\u5f53\u524d\u7528\u6237\u7684\u4e3b\u76ee\u5f55\u3002\u5173\u4e8e\u5982\u4f55\u786e\u5b9a\u4e3b\u76ee\u5f55\uff0c\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/18/libpq-pgpass.html\" title=\"32.16.\u00a0\u5bc6\u7801\u6587\u4ef6\">\u7b2c\u00a032.16\u00a0\u8282</a>\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8981\u6253\u5370\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\uff0c\u8bf7\u4f7f\u7528<code class=\"literal\">\\! pwd</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-CLOSE-PREPARED\"><span class=\"term\"><code class=\"literal\">\\close_prepared</code> <em class=\"replaceable\"><code>prepared_statement_name</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u5173\u95ed\u6307\u5b9a\u7684\u9884\u5907\u8bed\u53e5\u3002\u7a7a\u5b57\u7b26\u4e32\u8868\u793a\u672a\u547d\u540d\u7684\u9884\u5907\u8bed\u53e5\u3002\u5982\u679c\u4e0d\u5b58\u5728\u8be5\u540d\u79f0\u7684\u9884\u5907\u8bed\u53e5\uff0c\u5219\u4e0d\u6267\u884c\u4efb\u4f55\u64cd\u4f5c\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">SELECT $1 \\parse stmt1\n\\close_prepared stmt1\n</pre>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4f1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\uff0c\u4e0d\u540c\u4e8e<span class=\"application\">psql</span>\u901a\u5e38\u4f7f\u7528\u7684\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002\u56e0\u6b64\uff0c\u53ef\u4ee5\u7528\u5b83\u5728<span class=\"application\">psql</span>\u4e2d\u6d4b\u8bd5\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-CONNINFO\"><span class=\"term\"><code class=\"literal\">\\conninfo</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8f93\u51fa\u5f53\u524d\u6570\u636e\u5e93\u8fde\u63a5\u7684\u4fe1\u606f\uff1b\u5982\u679c\u6b63\u5728\u4f7f\u7528 SSL\uff0c\u4e5f\u5305\u62ec\u4e0e SSL \u76f8\u5173\u7684\u4fe1\u606f\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c<code class=\"structfield\">Client User</code> \u5b57\u6bb5\u663e\u793a\u7684\u662f\u8fde\u63a5\u5efa\u7acb\u65f6\u7684\u7528\u6237\uff0c\u800c <code class=\"structfield\">Superuser</code> \u5b57\u6bb5\u8868\u793a\u5f53\u524d\u7528\u6237\uff08\u5728\u5f53\u524d\u6267\u884c\u4e0a\u4e0b\u6587\u4e2d\uff09\u662f\u5426\u5177\u6709\u8d85\u7ea7\u7528\u6237\u6743\u9650\u3002\u8fd9\u4e24\u4e2a\u7528\u6237\u901a\u5e38\u76f8\u540c\uff0c\u4f46\u4e5f\u53ef\u80fd\u4e0d\u540c\uff0c\u4f8b\u5982\u5f53\u524d\u7528\u6237\u66fe\u901a\u8fc7 <code class=\"command\">SET ROLE</code> \u547d\u4ee4\u88ab\u66f4\u6539\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMANDS-COPY\"><span class=\"term\"><code class=\"literal\">\\copy { <em class=\"replaceable\"><code>table</code></em> [ ( <em class=\"replaceable\"><code>column_list</code></em> ) ] } <code class=\"literal\">from</code> { <em class=\"replaceable\"><code>'filename'</code></em> | program <em class=\"replaceable\"><code>'command'</code></em> | stdin | pstdin } [ [ with ] ( <em class=\"replaceable\"><code>option</code></em> [, ...] ) ] [ where <em class=\"replaceable\"><code>condition</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\copy { <em class=\"replaceable\"><code>table</code></em> [ ( <em class=\"replaceable\"><code>column_list</code></em> ) ] | ( <em class=\"replaceable\"><code>query</code></em> ) } <code class=\"literal\">to</code> { <em class=\"replaceable\"><code>'filename'</code></em> | program <em class=\"replaceable\"><code>'command'</code></em> | stdout | pstdout } [ [ with ] ( <em class=\"replaceable\"><code>option</code></em> [, ...] ) ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6267\u884c\u524d\u7aef\uff08\u5ba2\u6237\u7aef\uff09\u590d\u5236\u3002\u8be5\u64cd\u4f5c\u4f1a\u8fd0\u884c\u4e00\u4e2a<acronym class=\"acronym\">SQL</acronym> <a class=\"link\" href=\"/docs/18/sql-copy.html\" title=\"COPY\"><code class=\"command\">COPY</code></a>\u547d\u4ee4\uff0c\u4f46\u5e76\u4e0d\u662f\u7531\u670d\u52a1\u5668\u8bfb\u53d6\u6216\u5199\u5165\u6307\u5b9a\u6587\u4ef6\uff0c\u800c\u662f\u7531<span class=\"application\">psql</span>\u8bfb\u53d6\u6216\u5199\u5165\u6587\u4ef6\uff0c\u5e76\u5728\u670d\u52a1\u5668\u4e0e\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e4b\u95f4\u8f6c\u9001\u6570\u636e\u3002\u8fd9\u610f\u5473\u7740\u6587\u4ef6\u53ef\u8bbf\u95ee\u6027\u548c\u6743\u9650\u53d6\u51b3\u4e8e\u672c\u5730\u7528\u6237\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\uff0c\u4e5f\u4e0d\u9700\u8981 SQL \u8d85\u7ea7\u7528\u6237\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5f53\u6307\u5b9a<code class=\"literal\">program</code>\u65f6\uff0c<em class=\"replaceable\"><code>command</code></em> \u7531<span class=\"application\">psql</span>\u6267\u884c\uff0c\u4f20\u7ed9<em class=\"replaceable\"><code>command</code></em>\u7684\u6570\u636e\u6216\u4ece\u5176\u4e2d\u8bfb\u51fa\u7684\u6570\u636e\u90fd\u4f1a\u5728\u670d\u52a1\u5668\u4e0e\u5ba2\u6237\u7aef\u4e4b\u95f4\u8f6c\u9001\u3002\u518d\u6b21\u5f3a\u8c03\uff0c\u6267\u884c\u6743\u9650\u5c5e\u4e8e\u672c\u5730\u7528\u6237\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\uff0c\u4e5f\u4e0d\u9700\u8981 SQL \u8d85\u7ea7\u7528\u6237\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e \\copy ... from stdin\uff0c\u4ece\u53d1\u51fa\u547d\u4ee4\u7684\u540c\u4e00\u8f93\u5165\u6e90\u8bfb\u53d6\u6570\u636e\u884c\uff0c\u76f4\u5230\u8bfb\u53d6\u5230\u4ec5\u542b \\. \u7684\u4e00\u884c\u6216\u8f93\u5165\u6d41\u5230\u8fbe EOF\u3002\u8fd9\u9002\u5408\u5728 SQL \u811a\u672c\u4e2d\u5185\u8054\u586b\u5145\u8868\u3002\u5bf9\u4e8e \\copy ... to stdout\uff0c\u8f93\u51fa\u53d1\u5f80\u4e0e psql \u547d\u4ee4\u8f93\u51fa\u76f8\u540c\u7684\u4f4d\u7f6e\uff0c\u4e14\u4e0d\u6253\u5370 COPY count \u547d\u4ee4\u72b6\u6001\uff0c\u4ee5\u514d\u4e0e\u6570\u636e\u884c\u6df7\u6dc6\u3002\u82e5\u8981\u59cb\u7ec8\u8bfb\u5199 psql \u7684\u6807\u51c6\u8f93\u5165\u6216\u8f93\u51fa\uff0c\u800c\u4e0d\u53d7\u5f53\u524d\u547d\u4ee4\u6765\u6e90\u6216 \\o \u9009\u9879\u5f71\u54cd\uff0c\u8bf7\u4f7f\u7528 from pstdin \u6216 to pstdout\u3002</p>\n<p lang=\"zh\">\u8be5\u547d\u4ee4\u7684\u8bed\u6cd5\u4e0e<acronym class=\"acronym\">SQL</acronym> <a class=\"link\" href=\"/docs/18/sql-copy.html\" title=\"COPY\"><code class=\"command\">COPY</code></a>\u547d\u4ee4\u7c7b\u4f3c\u3002\u9664\u6570\u636e\u6e90\u6216\u76ee\u6807\u4e4b\u5916\uff0c\u5176\u4ed6\u6240\u6709\u9009\u9879\u90fd\u4e0e<code class=\"command\">COPY</code>\u547d\u4ee4\u4e2d\u7684\u6307\u5b9a\u76f8\u540c\u3002\u56e0\u6b64\uff0c\u7279\u6b8a\u7684\u89e3\u6790\u89c4\u5219\u9002\u7528\u4e8e<code class=\"command\">\\copy</code>\u5143\u547d\u4ee4\u3002\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u5269\u4f59\u884c\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\copy</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u6267\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u53e6\u4e00\u79cd\u83b7\u5f97\u4e0e<code class=\"literal\">\\copy ... to</code>\u76f8\u540c\u7ed3\u679c\u7684\u65b9\u6cd5\u662f\u4f7f\u7528<acronym class=\"acronym\">SQL</acronym> <code class=\"literal\">COPY ... TO STDOUT</code>\u547d\u4ee4\uff0c\u5e76\u4ee5<code class=\"literal\">\\g <em class=\"replaceable\"><code>filename</code></em></code> \u6216<code class=\"literal\">\\g |<em class=\"replaceable\"><code>program</code></em></code>\u7ed3\u675f\u3002\u4e0e<code class=\"literal\">\\copy</code>\u4e0d\u540c\uff0c\u8fd9\u79cd\u65b9\u6cd5\u5141\u8bb8\u547d\u4ee4\u8de8\u8d8a\u591a\u884c\uff1b\u6b64\u5916\uff0c\u53ef\u4ee5\u4f7f\u7528\u53d8\u91cf\u63d2\u503c\u548c\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</div>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8fd9\u4e9b\u64cd\u4f5c\u4e0d\u5982\u4ee5\u6587\u4ef6\u6216\u7a0b\u5e8f\u4f5c\u4e3a\u6570\u636e\u6e90\u6216\u76ee\u6807\u7684 <acronym class=\"acronym\">SQL</acronym> <code class=\"command\">COPY</code> \u547d\u4ee4\u9ad8\u6548\uff0c\u56e0\u4e3a\u6240\u6709\u6570\u636e\u90fd\u5fc5\u987b\u901a\u8fc7\u5ba2\u6237\u7aef/\u670d\u52a1\u5668\u8fde\u63a5\u4f20\u8f93\u3002\u5bf9\u4e8e\u5927\u91cf\u6570\u636e\uff0c\u4f7f\u7528 <acronym class=\"acronym\">SQL</acronym> \u547d\u4ee4\u53ef\u80fd\u66f4\u5408\u9002\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-COPYRIGHT\"><span class=\"term\"><code class=\"literal\">\\copyright</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"productname\">PostgreSQL</span>\u7684\u7248\u6743\u548c\u5206\u53d1\u6761\u6b3e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMANDS-CROSSTABVIEW\"><span class=\"term\"><code class=\"literal\">\\crosstabview [ <em class=\"replaceable\"><code>colV</code></em> [ <em class=\"replaceable\"><code>colH</code></em> [ <em class=\"replaceable\"><code>colD</code></em> [ <em class=\"replaceable\"><code>sortcolH</code></em> ] ] ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6267\u884c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\uff08\u4e0e<code class=\"literal\">\\g</code>\u7c7b\u4f3c\uff09\uff0c\u5e76\u4ee5\u4ea4\u53c9\u8868\u7f51\u683c\u663e\u793a\u7ed3\u679c\u3002\u67e5\u8be2\u5fc5\u987b\u8fd4\u56de\u81f3\u5c11\u4e09\u5217\u3002\u7531<em class=\"replaceable\"><code>colV</code></em>\u6807\u8bc6\u7684\u8f93\u51fa\u5217\u6210\u4e3a\u7eb5\u5411\u8868\u5934\uff0c\u7531<em class=\"replaceable\"><code>colH</code></em>\u6807\u8bc6\u7684\u8f93\u51fa\u5217\u6210\u4e3a\u6a2a\u5411\u8868\u5934\u3002<em class=\"replaceable\"><code>colD</code></em>\u6807\u8bc6\u8981\u5728\u7f51\u683c\u4e2d\u663e\u793a\u7684\u8f93\u51fa\u5217\u3002<em class=\"replaceable\"><code>sortcolH</code></em>\u6807\u8bc6\u6a2a\u5411\u8868\u5934\u7684\u53ef\u9009\u6392\u5e8f\u5217\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a\u5217\u6307\u5b9a\u9879\u53ef\u4ee5\u662f\u4ece 1 \u5f00\u59cb\u7684\u5217\u53f7\uff0c\u4e5f\u53ef\u4ee5\u662f\u5217\u540d\uff1b\u5217\u540d\u9075\u5faa\u5e38\u89c4 SQL \u5927\u5c0f\u5199\u6298\u53e0\u548c\u5f15\u53f7\u89c4\u5219\u3002\u7701\u7565\u65f6\uff0ccolV \u9ed8\u8ba4\u4e3a\u7b2c 1 \u5217\uff0ccolH \u9ed8\u8ba4\u4e3a\u7b2c 2 \u5217\u3002colH \u5fc5\u987b\u4e0e colV \u4e0d\u540c\u3002\u82e5\u4e0d\u6307\u5b9a colD\uff0c\u67e5\u8be2\u7ed3\u679c\u5fc5\u987b\u6070\u6709\u4e09\u5217\uff0c\u65e2\u975e colV \u4e5f\u975e colH \u7684\u90a3\u4e00\u5217\u4f5c\u4e3a colD\u3002</p>\n<p lang=\"zh\">\u7eb5\u5411\u8868\u5934\u663e\u793a\u4e3a\u6700\u5de6\u5217\uff0c\u5305\u542b<em class=\"replaceable\"><code>colV</code></em>\u5217\u4e2d\u7684\u503c\uff0c\u5176\u987a\u5e8f\u4e0e\u67e5\u8be2\u7ed3\u679c\u4e2d\u76f8\u540c\uff0c\u4f46\u4f1a\u79fb\u9664\u91cd\u590d\u503c\u3002</p>\n<p lang=\"zh\">\u6a2a\u5411\u8868\u5934\u663e\u793a\u4e3a\u7b2c\u4e00\u884c\uff0c\u5305\u542b<em class=\"replaceable\"><code>colH</code></em>\u5217\u4e2d\u7684\u503c\uff0c\u5e76\u79fb\u9664\u91cd\u590d\u503c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4eec\u6309\u67e5\u8be2\u7ed3\u679c\u4e2d\u7684\u76f8\u540c\u987a\u5e8f\u663e\u793a\u3002\u4f46\u5982\u679c\u7ed9\u51fa\u4e86\u53ef\u9009\u7684<em class=\"replaceable\"><code>sortcolH</code></em>\u53c2\u6570\uff0c\u5b83\u6240\u6807\u8bc6\u7684\u5217\u7684\u503c\u5fc5\u987b\u662f\u6574\u6570\uff0c\u800c<em class=\"replaceable\"><code>colH</code></em>\u4e2d\u7684\u503c\u4f1a\u6309\u7167\u5bf9\u5e94\u7684<em class=\"replaceable\"><code>sortcolH</code></em>\u503c\u6392\u5e8f\u540e\u663e\u793a\u5728\u6a2a\u5411\u8868\u5934\u4e2d\u3002</p>\n<p lang=\"zh\">\u4ea4\u53c9\u8868\u4e2d\uff0c\u5bf9\u4e8e colH \u7684\u6bcf\u4e2a\u4e0d\u540c\u503c x \u548c colV \u7684\u6bcf\u4e2a\u4e0d\u540c\u503c y\uff0c\u4ea4\u70b9 (x,y) \u7684\u5355\u5143\u683c\u4fdd\u5b58\u67e5\u8be2\u7ed3\u679c\u4e2d colH=x \u4e14 colV=y \u90a3\u4e00\u884c\u7684 colD \u503c\u3002\u6ca1\u6709\u5339\u914d\u884c\u65f6\u5355\u5143\u683c\u4e3a\u7a7a\uff1b\u5b58\u5728\u591a\u884c\u65f6\u4f1a\u62a5\u9519\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-D\"><span class=\"term\"><code class=\"literal\">\\d[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5bf9\u4e8e\u6bcf\u4e2a\u4e0e<em class=\"replaceable\"><code>pattern</code></em>\u5339\u914d\u7684\u5173\u7cfb\uff08\u8868\u3001\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u7d22\u5f15\u3001\u5e8f\u5217\u6216\u5916\u90e8\u8868\uff09\u6216\u590d\u5408\u7c7b\u578b\uff0c\u663e\u793a\u6240\u6709\u5217\u3001\u5b83\u4eec\u7684\u7c7b\u578b\u3001\u8868\u7a7a\u95f4\uff08\u5982\u679c\u4e0d\u662f\u9ed8\u8ba4\u7684\uff09\u4ee5\u53ca\u4efb\u4f55\u7279\u6b8a\u5c5e\u6027\uff0c\u5982<code class=\"literal\">NOT NULL</code>\u6216\u9ed8\u8ba4\u503c\u3002\u8fd8\u663e\u793a\u76f8\u5173\u7684\u7d22\u5f15\u3001\u7ea6\u675f\u3001\u89c4\u5219\u548c\u89e6\u53d1\u5668\u3002\u5bf9\u4e8e\u5916\u90e8\u8868\uff0c\u8fd8\u663e\u793a\u5173\u8054\u7684\u5916\u90e8\u670d\u52a1\u5668\u3002\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u5339\u914d\u6a21\u5f0f</span>\u201d</span>\u7684\u5b9a\u4e49\u5728\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"\u6a21\u5f0f\">\u6a21\u5f0f</a>\u4e2d\u3002\uff09</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u67d0\u4e9b\u7c7b\u578b\u7684\u5173\u7cfb\uff0c<code class=\"literal\">\\d</code>\u663e\u793a\u6bcf\u5217\u7684\u9644\u52a0\u4fe1\u606f\uff1a\u5e8f\u5217\u7684\u5217\u503c\uff0c\u7d22\u5f15\u7684\u7d22\u5f15\u8868\u8fbe\u5f0f\uff0c\u5916\u90e8\u8868\u7684\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u547d\u4ee4\u5f62\u5f0f<code class=\"literal\">\\d+</code>\u4e0e\u524d\u8005\u76f8\u540c\uff0c\u4f46\u4f1a\u663e\u793a\u66f4\u591a\u4fe1\u606f\uff1a\u8868\u5217\u5173\u8054\u7684\u6ce8\u91ca\u3001\u8868\u662f\u5426\u5305\u542b OID\u3001\u5f53\u5173\u7cfb\u4e3a\u89c6\u56fe\u65f6\u7684\u89c6\u56fe\u5b9a\u4e49\u3001\u975e\u9ed8\u8ba4\u7684<a class=\"link\" href=\"/docs/18/sql-altertable.html#SQL-ALTERTABLE-REPLICA-IDENTITY\">\u590d\u5236\u6807\u8bc6</a>\u8bbe\u7f6e\uff0c\u4ee5\u53ca\u5f53\u5173\u7cfb\u5177\u6709\u8bbf\u95ee\u65b9\u6cd5\u65f6\u7684<a class=\"link\" href=\"/docs/18/sql-create-access-method.html\" title=\"CREATE ACCESS METHOD\">\u8bbf\u95ee\u65b9\u6cd5</a>\u540d\u79f0\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u4e00\u4e2a\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u4ee5\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528<code class=\"command\">\\d</code>\u800c\u6ca1\u6709<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\uff0c\u5b83\u7b49\u540c\u4e8e<code class=\"command\">\\dtvmsE</code>\uff0c\u5b83\u5c06\u663e\u793a\u6240\u6709\u53ef\u89c1\u7684\u8868\u3001\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u7684\u5217\u8868\u3002\u8fd9\u7eaf\u7cb9\u662f\u4e00\u79cd\u4fbf\u5229\u63aa\u65bd\u3002</p>\n<p lang=\"zh\">\u4e0e\u8bb8\u591a\u5176\u4ed6\u547d\u4ee4\u4e00\u6837\uff0c\u5728\u547d\u4ee4\u540d\u540e\u6dfb\u52a0 x \u4f1a\u4f7f\u7528\u6269\u5c55\u663e\u793a\u6a21\u5f0f\u3002\u4f46\u8fd9\u4ec5\u9002\u7528\u4e8e\u4e0d\u5e26 pattern \u53c2\u6570\u7684 \\d\uff0c\u4e14 x \u4e0d\u80fd\u7d27\u8ddf \\d\uff08\u56e0\u4e3a \\dx \u662f\u53e6\u4e00\u4e2a\u547d\u4ee4\uff09\uff0c\u53ea\u80fd\u4f4d\u4e8e S \u6216 + \u4fee\u9970\u7b26\u4e4b\u540e\u3002\u4f8b\u5982\uff0c\\d+x \u7b49\u4ef7\u4e8e \\dtvmsE+x\uff0c\u5c06\u4ee5\u6269\u5c55\u6a21\u5f0f\u5217\u51fa\u6240\u6709\u5173\u7cfb\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DA-LC\"><span class=\"term\"><code class=\"literal\">\\da[Sx] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u805a\u5408\u51fd\u6570\uff0c\u4ee5\u53ca\u5b83\u4eec\u7684\u8fd4\u56de\u7c7b\u578b\u548c\u6240\u4f5c\u7528\u7684\u6570\u636e\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u805a\u5408\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DA-UC\"><span class=\"term\"><code class=\"literal\">\\dA[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8bbf\u95ee\u65b9\u6cd5\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bbf\u95ee\u65b9\u6cd5\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u8bbf\u95ee\u65b9\u6cd5\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u7684\u5904\u7406\u5668\u51fd\u6570\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DAC\"><span class=\"term\"><code class=\"literal\">\\dAc[x+] [<a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>input-type-pattern</code></em></a>]]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u64cd\u4f5c\u7b26\u7c7b\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/18/xindex.html#XINDEX-OPCLASS\" title=\"36.16.1.\u00a0\u7d22\u5f15\u65b9\u6cd5\u548c\u64cd\u4f5c\u7b26\u7c7b\">\u7b2c\u00a036.16.1\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u7c7b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>input-type-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8f93\u5165\u7c7b\u578b\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u7c7b\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u7c7b\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u548c\u6240\u6709\u8005\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DAF\"><span class=\"term\"><code class=\"literal\">\\dAf[x+] [<a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>input-type-pattern</code></em></a>]]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u64cd\u4f5c\u7b26\u65cf\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/18/xindex.html#XINDEX-OPFAMILY\" title=\"36.16.5.\u00a0\u64cd\u4f5c\u7b26\u7c7b\u548c\u64cd\u4f5c\u7b26\u65cf\">\u7b2c\u00a036.16.5\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>input-type-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8f93\u5165\u7c7b\u578b\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u65cf\u90fd\u4f1a\u8fde\u540c\u5176\u6240\u6709\u8005\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DAO\"><span class=\"term\"><code class=\"literal\">\\dAo[x+] [<a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>operator-family-pattern</code></em></a>]]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u4e0e\u64cd\u4f5c\u7b26\u65cf\u5173\u8054\u7684\u64cd\u4f5c\u7b26\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/18/xindex.html#XINDEX-STRATEGIES\" title=\"36.16.2.\u00a0\u7d22\u5f15\u65b9\u6cd5\u7b56\u7565\">\u7b2c\u00a036.16.2\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u6240\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u6210\u5458\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>operator-family-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u8be5\u6a21\u5f0f\u5339\u914d\u7684\u64cd\u4f5c\u7b26\u65cf\u6210\u5458\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u90fd\u4f1a\u8fde\u540c\u5176\u6392\u5e8f\u64cd\u4f5c\u7b26\u65cf\uff08\u5982\u679c\u5b83\u662f\u6392\u5e8f\u64cd\u4f5c\u7b26\uff09\u4ee5\u53ca\u5176\u5e95\u5c42\u51fd\u6570\u662f\u5426\u9632\u6f0f\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DAP\"><span class=\"term\"><code class=\"literal\">\\dAp[x+] [<a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>operator-family-pattern</code></em></a>]]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u4e0e\u64cd\u4f5c\u7b26\u65cf\u5173\u8054\u7684\u652f\u6301\u51fd\u6570\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/18/xindex.html#XINDEX-SUPPORT\" title=\"36.16.3.\u00a0\u7d22\u5f15\u65b9\u6cd5\u652f\u6301\u4f8b\u7a0b\">\u7b2c\u00a036.16.3\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u6240\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u51fd\u6570\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>operator-family-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u8be5\u6a21\u5f0f\u5339\u914d\u7684\u64cd\u4f5c\u7b26\u65cf\u51fd\u6570\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u51fd\u6570\u4f1a\u4ee5\u8be6\u7ec6\u5f62\u5f0f\u663e\u793a\uff0c\u5e76\u5e26\u6709\u5176\u5b9e\u9645\u53c2\u6570\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DB\"><span class=\"term\"><code class=\"literal\">\\db[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8868\u7a7a\u95f4\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8868\u7a7a\u95f4\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u8868\u7a7a\u95f4\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u9009\u9879\u3001\u78c1\u76d8\u5927\u5c0f\u3001\u6743\u9650\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DC-LC\"><span class=\"term\"><code class=\"literal\">\\dc[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5b57\u7b26\u96c6\u7f16\u7801\u4e4b\u95f4\u7684\u8f6c\u6362\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8f6c\u6362\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DCONFIG\"><span class=\"term\"><code class=\"literal\">\\dconfig[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u670d\u52a1\u5668\u914d\u7f6e\u53c2\u6570\u53ca\u5176\u503c\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u53c2\u6570\u3002\u4e0d\u5e26 <em class=\"replaceable\"><code>pattern</code></em> \u65f6\uff0c\u53ea\u5217\u51fa\u88ab\u8bbe\u7f6e\u4e3a\u975e\u9ed8\u8ba4\u503c\u7684\u53c2\u6570\u3002\uff08\u4f7f\u7528 <code class=\"literal\">\\dconfig *</code> \u53ef\u67e5\u770b\u6240\u6709\u53c2\u6570\u3002\uff09\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u53c2\u6570\u90fd\u4f1a\u8fde\u540c\u5176\u6570\u636e\u7c7b\u578b\u3001\u8be5\u53c2\u6570\u53ef\u8bbe\u7f6e\u7684\u4e0a\u4e0b\u6587\u4ee5\u53ca\u8bbf\u95ee\u6743\u9650\uff08\u5982\u679c\u5df2\u6388\u4e88\u975e\u9ed8\u8ba4\u8bbf\u95ee\u6743\u9650\uff09\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DC-UC\"><span class=\"term\"><code class=\"literal\">\\dC[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u7c7b\u578b\u8f6c\u6362\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u5176\u6e90\u7c7b\u578b\u6216\u76ee\u6807\u7c7b\u578b\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u7c7b\u578b\u8f6c\u6362\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u7c7b\u578b\u8f6c\u6362\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5176\u5e95\u5c42\u51fd\u6570\u662f\u5426\u9632\u6f0f\uff0c\u4ee5\u53ca\u8be5\u7c7b\u578b\u8f6c\u6362\u7684\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DD-LC\"><span class=\"term\"><code class=\"literal\">\\dd[Sx] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u663e\u793a<code class=\"literal\">constraint</code>\u3001<code class=\"literal\">operator class</code>\u3001<code class=\"literal\">operator family</code>\u3001<code class=\"literal\">rule</code>\u548c <code class=\"literal\">trigger</code>\u7c7b\u578b\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002\u5176\u4ed6\u6ce8\u91ca\u53ef\u901a\u8fc7\u5bf9\u5e94\u5bf9\u8c61\u7c7b\u578b\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u67e5\u770b\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">\\dd</code> \u663e\u793a\u4e0e <em class=\"replaceable\"><code>pattern</code></em> \u5339\u914d\u7684\u5bf9\u8c61\u63cf\u8ff0\uff1b\u5982\u679c\u6ca1\u6709\u7ed9\u51fa\u53c2\u6570\uff0c\u5219\u663e\u793a\u76f8\u5e94\u7c7b\u578b\u7684\u53ef\u89c1\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002\u4f46\u65e0\u8bba\u54ea\u79cd\u60c5\u51b5\uff0c\u53ea\u5217\u51fa\u90a3\u4e9b\u5df2\u6709\u63cf\u8ff0\u7684\u5bf9\u8c61\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528 <a class=\"link\" href=\"/docs/18/sql-comment.html\" title=\"COMMENT\"><code class=\"command\">COMMENT</code></a> <acronym class=\"acronym\">SQL</acronym> \u547d\u4ee4\u521b\u5efa\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DD-UC\"><span class=\"term\"><code class=\"literal\">\\dD[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u57df\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u57df\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u6743\u9650\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DDP\"><span class=\"term\"><code class=\"literal\">\\ddp[x] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u9ed8\u8ba4\u8bbf\u95ee\u6743\u9650\u8bbe\u7f6e\u3002\u5bf9\u4e8e\u6bcf\u4e2a\u9ed8\u8ba4\u6743\u9650\u8bbe\u7f6e\u5df2\u504f\u79bb\u5185\u7f6e\u9ed8\u8ba4\u503c\u7684\u89d2\u8272\uff08\u4ee5\u53ca\u9002\u7528\u65f6\u7684\u6a21\u5f0f\uff09\uff0c\u90fd\u4f1a\u663e\u793a\u4e00\u6761\u8bb0\u5f55\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u89d2\u8272\u540d\u6216\u6a21\u5f0f\u540d\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bb0\u5f55\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002</p>\n<p lang=\"zh\"><a class=\"link\" href=\"/docs/18/sql-alterdefaultprivileges.html\" title=\"ALTER DEFAULT PRIVILEGES\"><code class=\"command\">ALTER DEFAULT PRIVILEGES</code></a>\u547d\u4ee4\u7528\u4e8e\u8bbe\u7f6e\u9ed8\u8ba4\u8bbf\u95ee\u6743\u9650\u3002\u6743\u9650\u663e\u793a\u7684\u542b\u4e49\u5728<a class=\"xref\" href=\"/docs/18/ddl-priv.html\" title=\"5.8.\u00a0\u6743\u9650\">\u7b2c\u00a05.8\u00a0\u8282</a>\u4e2d\u6709\u89e3\u91ca\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DE\"><span class=\"term\"><code class=\"literal\">\\dE[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\di[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dm[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\ds[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dt[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dv[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd9\u7ec4\u547d\u4ee4\u4e2d\uff0c\u5b57\u6bcd <code class=\"literal\">E</code>\u3001<code class=\"literal\">i</code>\u3001<code class=\"literal\">m</code>\u3001<code class=\"literal\">s</code>\u3001<code class=\"literal\">t</code> \u548c <code class=\"literal\">v</code> \u5206\u522b\u8868\u793a\u5916\u90e8\u8868\u3001\u7d22\u5f15\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u3001\u8868\u548c\u89c6\u56fe\u3002\u4f60\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u6307\u5b9a\u5176\u4e2d\u4efb\u610f\u4e00\u4e2a\u6216\u591a\u4e2a\u5b57\u6bcd\uff0c\u4ee5\u83b7\u53d6\u8fd9\u4e9b\u7c7b\u578b\u5bf9\u8c61\u7684\u5217\u8868\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dti</code> \u4f1a\u5217\u51fa\u8868\u548c\u7d22\u5f15\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u6301\u4e45\u6027\u72b6\u6001\uff08\u6c38\u4e45\u3001\u4e34\u65f6\u6216\u4e0d\u8bb0\u5f55 WAL\uff09\u3001\u78c1\u76d8\u4e0a\u7684\u7269\u7406\u5927\u5c0f\u4ee5\u53ca\u76f8\u5173\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u4e00\u8d77\u5217\u51fa\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u5bf9\u8c61\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DES\"><span class=\"term\"><code class=\"literal\">\\des[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u670d\u52a1\u5668\uff08\u52a9\u8bb0\u7b26\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external servers</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u670d\u52a1\u5668\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u670d\u52a1\u5668\u7684\u5b8c\u6574\u63cf\u8ff0\uff0c\u5305\u62ec\u670d\u52a1\u5668\u7684\u8bbf\u95ee\u6743\u9650\u3001\u7c7b\u578b\u3001\u7248\u672c\u3001\u9009\u9879\u548c\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DET\"><span class=\"term\"><code class=\"literal\">\\det[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u8868\uff08\u52a9\u8bb0\u7b26\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external tables</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u8868\u540d\u6216\u6a21\u5f0f\u540d\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6761\u76ee\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u8fd8\u4f1a\u663e\u793a\u901a\u7528\u9009\u9879\u4ee5\u53ca\u5916\u90e8\u8868\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DEU\"><span class=\"term\"><code class=\"literal\">\\deu[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u7528\u6237\u6620\u5c04\uff08\u52a9\u8bb0\u7b26\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external users</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u7528\u6237\u540d\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6620\u5c04\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u6620\u5c04\u7684\u9644\u52a0\u4fe1\u606f\u3002</p>\n<div class=\"caution\">\n<h3 class=\"title\" lang=\"zh\">\u5c0f\u5fc3</h3>\n<p lang=\"zh\"><code class=\"literal\">\\deu+</code>\u53ef\u80fd\u8fd8\u4f1a\u663e\u793a\u8fdc\u7a0b\u7528\u6237\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u56e0\u6b64\u5e94\u6ce8\u610f\u4e0d\u8981\u6cc4\u9732\u5b83\u4eec\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DEW\"><span class=\"term\"><code class=\"literal\">\\dew[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\uff08\u52a9\u8bb0\u7b26\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external wrappers</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u8fd8\u4f1a\u663e\u793a\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u7684\u8bbf\u95ee\u6743\u9650\u3001\u9009\u9879\u548c\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DF-LC\"><span class=\"term\"><code class=\"literal\">\\df[anptwSx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> [ <em class=\"replaceable\"><code>arg_pattern</code></em> ... ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u51fd\u6570\uff0c\u4ee5\u53ca\u5b83\u4eec\u7684\u7ed3\u679c\u6570\u636e\u7c7b\u578b\u3001\u53c2\u6570\u6570\u636e\u7c7b\u578b\u548c\u51fd\u6570\u7c7b\u578b\uff0c\u51fd\u6570\u7c7b\u578b\u5206\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">agg</span>\u201d</span>\uff08\u805a\u5408\uff09\u3001<span class=\"quote\">\u201c<span class=\"quote\">normal</span>\u201d</span>\u3001<span class=\"quote\">\u201c<span class=\"quote\">procedure</span>\u201d</span>\u3001<span class=\"quote\">\u201c<span class=\"quote\">trigger</span>\u201d</span>\u6216<span class=\"quote\">\u201c<span class=\"quote\">window</span>\u201d</span>\u3002\u8981\u53ea\u663e\u793a\u7279\u5b9a\u7c7b\u578b\u7684\u51fd\u6570\uff0c\u8bf7\u5728\u547d\u4ee4\u540e\u6dfb\u52a0\u76f8\u5e94\u7684\u5b57\u6bcd <code class=\"literal\">a</code>\u3001<code class=\"literal\">n</code>\u3001<code class=\"literal\">p</code>\u3001<code class=\"literal\">t</code> \u6216 <code class=\"literal\">w</code>\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u51fd\u6570\u3002\u4efb\u4f55\u9644\u52a0\u53c2\u6570\u90fd\u662f\u7c7b\u578b\u540d\u6a21\u5f0f\uff0c\u5206\u522b\u4e0e\u51fd\u6570\u7b2c\u4e00\u3001\u7b2c\u4e8c\u7b49\u53c2\u6570\u7684\u7c7b\u578b\u540d\u5339\u914d\u3002\uff08\u5339\u914d\u5230\u7684\u51fd\u6570\u53ef\u4ee5\u6bd4\u4f60\u6307\u5b9a\u7684\u53c2\u6570\u66f4\u591a\uff1b\u82e5\u8981\u9632\u6b62\u8fd9\u79cd\u60c5\u51b5\uff0c\u53ef\u5c06\u8fde\u5b57\u7b26 <code class=\"literal\">-</code> \u5199\u6210\u6700\u540e\u4e00\u4e2a <em class=\"replaceable\"><code>arg_pattern</code></em>\u3002\uff09\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u51fd\u6570\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u6613\u53d8\u6027\u3001\u5e76\u884c\u5b89\u5168\u6027\u3001\u6240\u6709\u8005\u3001\u5b89\u5168\u5206\u7c7b\u3001\u662f\u5426\u9632\u6f0f\u3001\u8bbf\u95ee\u6743\u9650\u3001\u8bed\u8a00\u3001\u5185\u90e8\u540d\u79f0\uff08\u4ec5\u9002\u7528\u4e8e C \u548c internal \u51fd\u6570\uff09\u4ee5\u53ca\u63cf\u8ff0\u3002\u7279\u5b9a\u51fd\u6570\u7684\u6e90\u4ee3\u7801\u53ef\u901a\u8fc7 <code class=\"literal\">\\sf</code> \u67e5\u770b\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DF-UC\"><span class=\"term\"><code class=\"literal\">\\dF[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u914d\u7f6e\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u914d\u7f6e\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u914d\u7f6e\u7684\u5b8c\u6574\u63cf\u8ff0\uff0c\u5305\u62ec\u5e95\u5c42\u5168\u6587\u68c0\u7d22\u89e3\u6790\u5668\u4ee5\u53ca\u6bcf\u79cd\u89e3\u6790\u5668\u8bcd\u5143\u7c7b\u578b\u5bf9\u5e94\u7684\u8bcd\u5178\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DFD\"><span class=\"term\"><code class=\"literal\">\\dFd[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u8bcd\u5178\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bcd\u5178\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u6240\u9009\u8bcd\u5178\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5e95\u5c42\u5168\u6587\u68c0\u7d22\u6a21\u677f\u548c\u9009\u9879\u503c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DFP\"><span class=\"term\"><code class=\"literal\">\\dFp[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u89e3\u6790\u5668\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u89e3\u6790\u5668\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u89e3\u6790\u5668\u7684\u5b8c\u6574\u63cf\u8ff0\uff0c\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u548c\u53ef\u8bc6\u522b\u7684\u8bcd\u5143\u7c7b\u578b\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DFT\"><span class=\"term\"><code class=\"literal\">\\dFt[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u6a21\u677f\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6a21\u677f\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u6a21\u677f\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u540d\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DG\"><span class=\"term\"><code class=\"literal\">\\dg[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u5e93\u89d2\u8272\u3002\uff08\u7531\u4e8e<span class=\"quote\">\u201c<span class=\"quote\">\u7528\u6237</span>\u201d</span>\u548c<span class=\"quote\">\u201c<span class=\"quote\">\u7ec4</span>\u201d</span>\u7684\u6982\u5ff5\u5df2\u7ecf\u7edf\u4e00\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">\u89d2\u8272</span>\u201d</span>\uff0c\u6b64\u547d\u4ee4\u73b0\u5728\u7b49\u540c\u4e8e <code class=\"literal\">\\du</code>\u3002\uff09\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u89d2\u8272\uff1b\u63d0\u4f9b <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u89d2\u8272\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u89d2\u8272\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u89d2\u8272\u7684\u9644\u52a0\u4fe1\u606f\uff1b\u76ee\u524d\u8fd9\u4f1a\u589e\u52a0\u6bcf\u4e2a\u89d2\u8272\u7684\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DL-LC\"><span class=\"term\"><code class=\"literal\">\\dl[x+]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u662f <code class=\"command\">\\lo_list</code> \u7684\u522b\u540d\uff0c\u540e\u8005\u4f1a\u663e\u793a\u5927\u5bf9\u8c61\u5217\u8868\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u5217\u51fa\u6bcf\u4e2a\u5927\u5bf9\u8c61\u7684\u76f8\u5173\u6743\u9650\uff08\u5982\u679c\u6709\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DL-UC\"><span class=\"term\"><code class=\"literal\">\\dL[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8fc7\u7a0b\u8bed\u8a00\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bed\u8a00\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u8bed\u8a00\uff1b\u63d0\u4f9b <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u79cd\u8bed\u8a00\u90fd\u4f1a\u8fde\u540c\u5176\u8c03\u7528\u5904\u7406\u5668\u3001\u9a8c\u8bc1\u5668\u3001\u8bbf\u95ee\u6743\u9650\u4ee5\u53ca\u5b83\u662f\u5426\u4e3a\u7cfb\u7edf\u5bf9\u8c61\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DN\"><span class=\"term\"><code class=\"literal\">\\dn[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6a21\u5f0f\uff08\u547d\u540d\u7a7a\u95f4\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6a21\u5f0f\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u6743\u9650\u548c\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DO-LC\"><span class=\"term\"><code class=\"literal\">\\do[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> [ <em class=\"replaceable\"><code>arg_pattern</code></em> [ <em class=\"replaceable\"><code>arg_pattern</code></em> ] ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u64cd\u4f5c\u7b26\u53ca\u5176\u64cd\u4f5c\u6570\u7c7b\u578b\u548c\u7ed3\u679c\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u64cd\u4f5c\u7b26\u3002\u5982\u679c\u6307\u5b9a\u4e86\u4e00\u4e2a <em class=\"replaceable\"><code>arg_pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u5176\u53f3\u53c2\u6570\u7c7b\u578b\u540d\u79f0\u4e0e\u8be5\u6a21\u5f0f\u5339\u914d\u7684\u524d\u7f00\u64cd\u4f5c\u7b26\u3002\u5982\u679c\u6307\u5b9a\u4e86\u4e24\u4e2a <em class=\"replaceable\"><code>arg_pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u53c2\u6570\u7c7b\u578b\u540d\u79f0\u4e0e\u8fd9\u4e9b\u6a21\u5f0f\u5339\u914d\u7684\u4e8c\u5143\u64cd\u4f5c\u7b26\u3002\uff08\u5bf9\u4e8e\u4e00\u5143\u64cd\u4f5c\u7b26\u672a\u4f7f\u7528\u7684\u53c2\u6570\uff0c\u4e5f\u53ef\u4ee5\u5199\u6210 <code class=\"literal\">-</code>\u3002\uff09\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u540d\u4ee5\u53ca\u5b83\u662f\u5426\u9632\u6f0f\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DO-UC\"><span class=\"term\"><code class=\"literal\">\\dO[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6392\u5e8f\u89c4\u5219\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6392\u5e8f\u89c4\u5219\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u6392\u5e8f\u89c4\u5219\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u4e00\u8d77\u5217\u51fa\u3002\u8bf7\u6ce8\u610f\uff0c\u53ea\u4f1a\u663e\u793a\u4e0e\u5f53\u524d\u6570\u636e\u5e93\u7f16\u7801\u517c\u5bb9\u7684\u6392\u5e8f\u89c4\u5219\uff0c\u56e0\u6b64\u5728\u540c\u4e00\u5b89\u88c5\u4e2d\u7684\u4e0d\u540c\u6570\u636e\u5e93\u91cc\u7ed3\u679c\u53ef\u80fd\u4e0d\u540c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DP-LC\"><span class=\"term\"><code class=\"literal\">\\dp[Sx] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u53ca\u5176\u76f8\u5173\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002</p>\n<p lang=\"zh\"><a class=\"link\" href=\"/docs/18/sql-grant.html\" title=\"GRANT\"><code class=\"command\">GRANT</code></a>\u548c <a class=\"link\" href=\"/docs/18/sql-revoke.html\" title=\"REVOKE\"><code class=\"command\">REVOKE</code></a> \u547d\u4ee4\u7528\u4e8e\u8bbe\u7f6e\u8bbf\u95ee\u6743\u9650\u3002\u6743\u9650\u663e\u793a\u7684\u542b\u4e49\u5728<a class=\"xref\" href=\"/docs/18/ddl-priv.html\" title=\"5.8.\u00a0\u6743\u9650\">\u7b2c\u00a05.8\u00a0\u8282</a>\u4e2d\u6709\u89e3\u91ca\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DP-UC\"><span class=\"term\"><code class=\"literal\">\\dP[itnx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5206\u533a\u5173\u7cfb\u3002\u5982\u679c<em class=\"replaceable\"><code>pattern</code></em>\u88ab\u6307\u5b9a\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6761\u76ee\u3002\u4fee\u9970\u7b26<code class=\"literal\">t</code>\uff08\u8868\uff09\u548c<code class=\"literal\">i</code>\uff08\u7d22\u5f15\uff09\u53ef\u4ee5\u9644\u52a0\u5230\u547d\u4ee4\uff0c\u8fc7\u6ee4\u8981\u5217\u51fa\u7684\u5173\u7cfb\u7c7b\u578b\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5217\u51fa\u5206\u533a\u8868\u548c\u7d22\u5f15\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528\u4fee\u9970\u7b26<code class=\"literal\">n</code>\uff08<span class=\"quote\">\u201c<span class=\"quote\">nested</span>\u201d</span>\uff09\uff0c\u6216\u6307\u5b9a\u4e86\u6a21\u5f0f\uff0c\u5219\u5c06\u5305\u62ec\u975e\u6839\u5206\u533a\u5173\u7cfb\uff0c\u5e76\u663e\u793a\u4e00\u5217\uff0c\u7ed9\u51fa\u6bcf\u4e2a\u5206\u533a\u5173\u7cfb\u7684\u7236\u7ea7\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u5173\u7cfb\u5206\u533a\u5927\u5c0f\u7684\u603b\u548c\u4ee5\u53ca\u5173\u7cfb\u63cf\u8ff0\u3002\u5982\u679c <code class=\"literal\">n</code> \u4e0e <code class=\"literal\">+</code> \u7ec4\u5408\u4f7f\u7528\uff0c\u5219\u4f1a\u663e\u793a\u4e24\u4e2a\u5927\u5c0f\uff1a\u4e00\u4e2a\u5305\u62ec\u76f4\u63a5\u9644\u52a0\u7684\u53f6\u5206\u533a\u7684\u603b\u5927\u5c0f\uff0c\u53e6\u4e00\u4e2a\u663e\u793a\u5305\u62ec\u95f4\u63a5\u9644\u52a0\u5b50\u5206\u533a\u5728\u5185\u7684\u6240\u6709\u5206\u533a\u603b\u5927\u5c0f\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DRDS\"><span class=\"term\"><code class=\"literal\">\\drds[x] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>role-pattern</code></em></a> [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>database-pattern</code></em></a> ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5df2\u5b9a\u4e49\u7684\u914d\u7f6e\u8bbe\u7f6e\u3002\u8fd9\u4e9b\u8bbe\u7f6e\u53ef\u4ee5\u7279\u5b9a\u4e8e\u89d2\u8272\u3001\u7279\u5b9a\u4e8e\u6570\u636e\u5e93\uff0c\u6216\u540c\u65f6\u7279\u5b9a\u4e8e\u4e24\u8005\u3002<em class=\"replaceable\"><code>role-pattern</code></em>\u548c<em class=\"replaceable\"><code>database-pattern</code></em>\u5206\u522b\u7528\u4e8e\u9009\u62e9\u8981\u5217\u51fa\u7684\u89d2\u8272\u548c\u6570\u636e\u5e93\u3002\u7701\u7565\u67d0\u4e2a\u6a21\u5f0f\u53c2\u6570\u6216\u5c06\u5176\u6307\u5b9a\u4e3a<code class=\"literal\">*</code>\u65f6\uff0c\u4e0d\u4f1a\u6309\u8be5\u53c2\u6570\u7b5b\u9009\uff0c\u8fd8\u4f1a\u5206\u522b\u5305\u542b\u4e0d\u7279\u5b9a\u4e8e\u89d2\u8272\u6216\u4e0d\u7279\u5b9a\u4e8e\u6570\u636e\u5e93\u7684\u8bbe\u7f6e\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0<code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002</p>\n<p lang=\"zh\"><a class=\"link\" href=\"/docs/18/sql-alterrole.html\" title=\"ALTER ROLE\"><code class=\"command\">ALTER ROLE</code></a>\u548c <a class=\"link\" href=\"/docs/18/sql-alterdatabase.html\" title=\"ALTER DATABASE\"><code class=\"command\">ALTER DATABASE</code></a> \u547d\u4ee4\u7528\u4e8e\u5b9a\u4e49\u6bcf\u4e2a\u89d2\u8272\u548c\u6bcf\u4e2a\u6570\u636e\u5e93\u7684\u914d\u7f6e\u8bbe\u7f6e\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DRG\"><span class=\"term\"><code class=\"literal\">\\drg[Sx] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u6bcf\u4e2a\u88ab\u6388\u4e88\u89d2\u8272\u6210\u5458\u8eab\u4efd\u7684\u4fe1\u606f\uff0c\u5305\u62ec\u88ab\u6388\u4e88\u7684\u9009\u9879\uff08<code class=\"literal\">ADMIN</code>\u3001<code class=\"literal\">INHERIT</code> \u548c/\u6216 <code class=\"literal\">SET</code>\uff09\u4ee5\u53ca\u6388\u4e88\u8005\u3002\u5173\u4e8e\u89d2\u8272\u6210\u5458\u8eab\u4efd\uff0c\u53c2\u89c1 <a class=\"link\" href=\"/docs/18/sql-grant.html\" title=\"GRANT\"><code class=\"command\">GRANT</code></a> \u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u6388\u4e88\u7528\u6237\u521b\u5efa\u89d2\u8272\u7684\u6210\u5458\u8eab\u4efd\uff1b\u63d0\u4f9b <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u89d2\u8272\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u6388\u4e88\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u89d2\u8272\u7684\u6210\u5458\u8eab\u4efd\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DRP\"><span class=\"term\"><code class=\"literal\">\\dRp[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u903b\u8f91\u590d\u5236\u53d1\u5e03\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u53d1\u5e03\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u8fd8\u4f1a\u663e\u793a\u4e0e\u6bcf\u4e2a\u53d1\u5e03\u5173\u8054\u7684\u8868\u548c\u6a21\u5f0f\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DRS\"><span class=\"term\"><code class=\"literal\">\\dRs[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u903b\u8f91\u590d\u5236\u8ba2\u9605\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8ba2\u9605\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u8ba2\u9605\u7684\u5176\u4ed6\u5c5e\u6027\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DT\"><span class=\"term\"><code class=\"literal\">\\dT[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u7c7b\u578b\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u7c7b\u578b\u90fd\u4f1a\u8fde\u540c\u5176\u5185\u90e8\u540d\u79f0\u3001\u5927\u5c0f\u548c\u76f8\u5173\u6743\u9650\u4e00\u8d77\u5217\u51fa\uff1b\u5bf9\u4e8e <code class=\"type\">enum</code> \u7c7b\u578b\uff0c\u8fd8\u4f1a\u663e\u793a\u5176\u5141\u8bb8\u503c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DU\"><span class=\"term\"><code class=\"literal\">\\du[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u5e93\u89d2\u8272\u3002\uff08\u7531\u4e8e<span class=\"quote\">\u201c<span class=\"quote\">\u7528\u6237</span>\u201d</span>\u548c<span class=\"quote\">\u201c<span class=\"quote\">\u7ec4</span>\u201d</span>\u7684\u6982\u5ff5\u5df2\u7ecf\u7edf\u4e00\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">\u89d2\u8272</span>\u201d</span>\uff0c\u6b64\u547d\u4ee4\u73b0\u5728\u7b49\u540c\u4e8e <code class=\"literal\">\\dg</code>\u3002\uff09\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u89d2\u8272\uff1b\u63d0\u4f9b <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u89d2\u8272\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u89d2\u8272\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u89d2\u8272\u7684\u9644\u52a0\u4fe1\u606f\uff1b\u76ee\u524d\u8fd9\u4f1a\u589e\u52a0\u6bcf\u4e2a\u89d2\u8272\u7684\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DX-LC\"><span class=\"term\"><code class=\"literal\">\\dx[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5df2\u5b89\u88c5\u7684\u6269\u5c55\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6269\u5c55\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u5217\u51fa\u5c5e\u4e8e\u6bcf\u4e2a\u5339\u914d\u6269\u5c55\u7684\u5168\u90e8\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DX-UC\"><span class=\"term\"><code class=\"literal\">\\dX[x] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u6269\u5c55\u7edf\u8ba1\u4fe1\u606f\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6269\u5c55\u7edf\u8ba1\u4fe1\u606f\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002</p>\n<p lang=\"zh\">\u6bcf\u79cd\u6269\u5c55\u7edf\u8ba1\u7684\u72b6\u6001\u663e\u793a\u5728\u4ee5\u7edf\u8ba1\u79cd\u7c7b\u547d\u540d\u7684\u5217\u4e2d\uff0c\u4f8b\u5982 Ndistinct\u3002defined \u8868\u793a\u521b\u5efa\u7edf\u8ba1\u65f6\u8bf7\u6c42\u4e86\u8be5\u7edf\u8ba1\uff0cNULL \u8868\u793a\u672a\u8bf7\u6c42\u3002\u82e5\u8981\u5224\u65ad ANALYZE \u662f\u5426\u8fd0\u884c\u8fc7\u3001\u7edf\u8ba1\u662f\u5426\u53ef\u4f9b\u89c4\u5212\u5668\u4f7f\u7528\uff0c\u53ef\u67e5\u8be2 pg_stats_ext\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DY\"><span class=\"term\"><code class=\"literal\">\\dy[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u4e8b\u4ef6\u89e6\u53d1\u5668\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u4e8b\u4ef6\u89e6\u53d1\u5668\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-EDIT\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\e</code> \u6216 <code class=\"literal\">\\edit</code> <code class=\"literal\">[ <span class=\"optional\"><em class=\"replaceable\"><code>filename</code></em></span> ] [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5219\u7f16\u8f91\u8be5\u6587\u4ef6\uff1b\u7f16\u8f91\u5668\u9000\u51fa\u540e\uff0c\u6587\u4ef6\u5185\u5bb9\u5c06\u88ab\u590d\u5236\u5230\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5219\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u590d\u5236\u5230\u4e34\u65f6\u6587\u4ef6\u4e2d\uff0c\u7136\u540e\u4ee5\u76f8\u540c\u65b9\u5f0f\u8fdb\u884c\u7f16\u8f91\u3002\u6216\u8005\uff0c\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u5c06\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u590d\u5236\u5230\u4e34\u65f6\u6587\u4ef6\u4e2d\uff0c\u5e76\u4ee5\u76f8\u540c\u65b9\u5f0f\u8fdb\u884c\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7f16\u8f91\u6587\u4ef6\u6216\u4e0a\u4e00\u4e2a\u67e5\u8be2\u540e\u5728\u672a\u4fee\u6539\u6587\u4ef6\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5219\u67e5\u8be2\u7f13\u51b2\u533a\u5c06\u88ab\u6e05\u9664\u3002\u5426\u5219\uff0c\u67e5\u8be2\u7f13\u51b2\u533a\u7684\u65b0\u5185\u5bb9\u5c06\u6839\u636e<span class=\"application\">psql</span>\u7684\u6b63\u5e38\u89c4\u5219\u91cd\u65b0\u89e3\u6790\uff0c\u5c06\u6574\u4e2a\u7f13\u51b2\u533a\u89c6\u4e3a\u5355\u884c\u3002\u4efb\u4f55\u5b8c\u6574\u7684\u67e5\u8be2\u5c06\u7acb\u5373\u6267\u884c\uff1b\u4e5f\u5c31\u662f\u8bf4\uff0c\u5982\u679c\u67e5\u8be2\u7f13\u51b2\u533a\u5305\u542b\u5206\u53f7\u6216\u4ee5\u5206\u53f7\u7ed3\u5c3e\uff0c\u5219\u6267\u884c\u5e76\u4ece\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u5220\u9664\u5230\u8be5\u70b9\u7684\u6240\u6709\u5185\u5bb9\u3002\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u5269\u4f59\u7684\u5185\u5bb9\u5c06\u91cd\u65b0\u663e\u793a\u3002\u8f93\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u8f93\u5165<code class=\"literal\">\\r</code>\u901a\u8fc7\u6e05\u9664\u67e5\u8be2\u7f13\u51b2\u533a\u6765\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u5c06\u7f13\u51b2\u533a\u89c6\u4e3a\u5355\u884c\u4e3b\u8981\u5f71\u54cd\u5143\u547d\u4ee4\uff1a\u5728\u5143\u547d\u4ee4\u540e\u7684\u7f13\u51b2\u533a\u5c06\u88ab\u89c6\u4e3a\u5143\u547d\u4ee4\u7684\u53c2\u6570\uff0c\u5373\u4f7f\u5b83\u8de8\u8d8a\u591a\u884c\u3002\uff08\u56e0\u6b64\uff0c\u4e0d\u80fd\u7528\u8fd9\u79cd\u65b9\u5f0f\u521b\u5efa\u4f7f\u7528\u5143\u547d\u4ee4\u7684\u811a\u672c\u3002\u8bf7\u4f7f\u7528<code class=\"command\">\\i</code>\u3002\uff09</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u5c06\u5149\u6807\u5b9a\u4f4d\u5728\u6587\u4ef6\u6216\u67e5\u8be2\u7f13\u51b2\u533a\u7684\u6307\u5b9a\u884c\u4e0a\u3002\u8bf7\u6ce8\u610f\uff0c\u5982\u679c\u53ea\u7ed9\u51fa\u4e00\u4e2a\u5168\u662f\u6570\u5b57\u7684\u53c2\u6570\uff0c<span class=\"application\">psql</span>\u4f1a\u5047\u5b9a\u5b83\u662f\u4e00\u4e2a\u884c\u53f7\uff0c\u800c\u4e0d\u662f\u6587\u4ef6\u540d\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5173\u4e8e\u5982\u4f55\u914d\u7f6e\u548c\u81ea\u5b9a\u4e49\u7f16\u8f91\u5668\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"\u73af\u5883\">\u73af\u5883</a>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-ECHO\"><span class=\"term\"><code class=\"literal\">\\echo <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6c42\u503c\u540e\u7684\u53c2\u6570\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff0c\u7528\u7a7a\u683c\u5206\u9694\uff0c\u5e76\u5728\u672b\u5c3e\u52a0\u4e0a\u6362\u884c\u7b26\u3002\u8fd9\u5bf9\u4e8e\u5728\u811a\u672c\u8f93\u51fa\u4e2d\u7a7f\u63d2\u4fe1\u606f\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>\\echo `date`</code></strong>\nTue Oct 26 21:40:57 CEST 1999\n</pre>\n<p lang=\"zh\">\u5982\u679c\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f\u672a\u52a0\u5f15\u53f7\u7684<code class=\"literal\">-n</code>\uff0c\u5219\u4e0d\u4f1a\u5199\u5165\u5c3e\u968f\u7684\u6362\u884c\u7b26\uff08\u4e5f\u4e0d\u4f1a\u5199\u5165\u7b2c\u4e00\u4e2a\u53c2\u6570\uff09\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528<code class=\"command\">\\o</code>\u547d\u4ee4\u91cd\u5b9a\u5411\u67e5\u8be2\u8f93\u51fa\uff0c\u53ef\u80fd\u4f1a\u60f3\u7528<code class=\"command\">\\qecho</code>\u4ee3\u66ff\u8fd9\u4e2a\u547d\u4ee4\u3002\u53e6\u8bf7\u53c2\u9605<code class=\"command\">\\warn</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-EF\"><span class=\"term\"><code class=\"literal\">\\ef [ <span class=\"optional\"><em class=\"replaceable\"><code>function_description</code></em> [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</span> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u7f16\u8f91\u6307\u5b9a\u51fd\u6570\u6216\u8fc7\u7a0b\u7684\u5b9a\u4e49\uff0c\u5f62\u5f0f\u4e3a<code class=\"command\">CREATE OR REPLACE FUNCTION</code>\u6216 <code class=\"command\">CREATE OR REPLACE PROCEDURE</code>\u547d\u4ee4\u3002\u7f16\u8f91\u65b9\u5f0f\u4e0e<code class=\"literal\">\\edit</code>\u76f8\u540c\u3002\u5982\u679c\u5728\u4e0d\u4fdd\u5b58\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5219\u8be5\u8bed\u53e5\u4f1a\u88ab\u4e22\u5f03\u3002\u5982\u679c\u4fdd\u5b58\u5e76\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5e76\u5728\u5176\u4e2d\u6dfb\u52a0\u4e86\u5206\u53f7\uff0c\u5219\u66f4\u65b0\u540e\u7684\u547d\u4ee4\u4f1a\u7acb\u5373\u6267\u884c\u3002\u5426\u5219\u5b83\u4f1a\u91cd\u65b0\u663e\u793a\uff1b\u952e\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u7528<code class=\"literal\">\\r</code>\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u76ee\u6807\u51fd\u6570\u53ef\u4ec5\u7528\u540d\u79f0\u6307\u5b9a\uff0c\u4e5f\u53ef\u7528\u540d\u79f0\u548c\u53c2\u6570\u6307\u5b9a\uff0c\u4f8b\u5982 foo(integer, text)\u3002\u82e5\u6709\u591a\u4e2a\u540c\u540d\u51fd\u6570\uff0c\u5219\u5fc5\u987b\u63d0\u4f9b\u53c2\u6570\u7c7b\u578b\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u51fd\u6570\uff0c\u5219\u4f1a\u5448\u73b0\u4e00\u4e2a\u7a7a\u7684<code class=\"command\">CREATE FUNCTION</code>\u6a21\u677f\u4f9b\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u5c06\u5149\u6807\u5b9a\u4f4d\u5728\u51fd\u6570\u4f53\u7684\u6307\u5b9a\u884c\u4e0a\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u51fd\u6570\u4f53\u901a\u5e38\u4e0d\u4f1a\u4ece\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u5f00\u59cb\u3002\uff09</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\ef</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5173\u4e8e\u5982\u4f55\u914d\u7f6e\u548c\u81ea\u5b9a\u4e49\u7f16\u8f91\u5668\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"\u73af\u5883\">\u73af\u5883</a>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-ENCODING\"><span class=\"term\"><code class=\"literal\">\\encoding [ <em class=\"replaceable\"><code>encoding</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5ba2\u6237\u7aef\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u6ca1\u6709\u53c2\u6570\u65f6\uff0c\u6b64\u547d\u4ee4\u663e\u793a\u5f53\u524d\u7f16\u7801\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-ERRVERBOSE\"><span class=\"term\"><code class=\"literal\">\\errverbose</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ee5\u6700\u5927\u7684\u8be6\u7ec6\u7a0b\u5ea6\u91cd\u590d\u6700\u8fd1\u7684\u670d\u52a1\u5668\u9519\u8bef\u6d88\u606f\uff0c\u5c31\u597d\u50cf<code class=\"varname\">VERBOSITY</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">verbose</code>\uff0c<code class=\"varname\">SHOW_CONTEXT</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">always</code>\u4e00\u6837\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-EV\"><span class=\"term\"><code class=\"literal\">\\ev [ <span class=\"optional\"><em class=\"replaceable\"><code>view_name</code></em> [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</span> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u7f16\u8f91\u6307\u5b9a\u89c6\u56fe\u7684\u5b9a\u4e49\uff0c\u5f62\u5f0f\u4e3a<code class=\"command\">CREATE OR REPLACE VIEW</code>\u547d\u4ee4\u3002\u7f16\u8f91\u65b9\u5f0f\u4e0e<code class=\"literal\">\\edit</code>\u76f8\u540c\u3002\u5982\u679c\u5728\u4e0d\u4fdd\u5b58\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5219\u8be5\u8bed\u53e5\u4f1a\u88ab\u4e22\u5f03\u3002\u5982\u679c\u4fdd\u5b58\u5e76\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5e76\u5728\u5176\u4e2d\u6dfb\u52a0\u4e86\u5206\u53f7\uff0c\u5219\u66f4\u65b0\u540e\u7684\u547d\u4ee4\u4f1a\u7acb\u5373\u6267\u884c\uff1b\u5426\u5219\u5c06\u91cd\u65b0\u663e\u793a\uff1b\u8f93\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u7528<code class=\"literal\">\\r</code>\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u89c6\u56fe\uff0c\u5219\u4f1a\u5448\u73b0\u4e00\u4e2a\u7a7a\u7684<code class=\"command\">CREATE VIEW</code>\u6a21\u677f\u4f9b\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u5c06\u5149\u6807\u5b9a\u4f4d\u5728\u89c6\u56fe\u5b9a\u4e49\u7684\u6307\u5b9a\u884c\u4e0a\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\ev</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-F\"><span class=\"term\"><code class=\"literal\">\\f [ <em class=\"replaceable\"><code>string</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u67e5\u8be2\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u9ed8\u8ba4\u503c\u662f\u7ad6\u7ebf\uff08<code class=\"literal\">|</code>\uff09\u3002\u5b83\u7b49\u540c\u4e8e<code class=\"command\">\\pset fieldsep</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-G\"><span class=\"term\"><code class=\"literal\">\\g [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\g [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u6267\u884c\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728<code class=\"literal\">\\g</code>\u540e\u9762\u51fa\u73b0\u62ec\u53f7\uff0c\u5219\u62ec\u53f7\u4e2d\u662f\u7528\u7a7a\u683c\u5206\u9694\u7684<em class=\"replaceable\"><code>option</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em>\u683c\u5f0f\u9009\u9879\u5b50\u53e5\u5217\u8868\u3002\u8fd9\u4e9b\u5b50\u53e5\u7684\u89e3\u91ca\u65b9\u5f0f\u4e0e<code class=\"literal\">\\pset</code> <em class=\"replaceable\"><code>option</code></em> <em class=\"replaceable\"><code>value</code></em>\u547d\u4ee4\u76f8\u540c\uff0c\u4f46\u4ec5\u5728\u6b64\u67e5\u8be2\u6267\u884c\u671f\u95f4\u751f\u6548\u3002\u5728\u6b64\u5217\u8868\u4e2d\uff0c<code class=\"literal\">=</code>\u7b26\u53f7\u5468\u56f4\u4e0d\u5141\u8bb8\u6709\u7a7a\u683c\uff0c\u4f46\u9009\u9879\u5b50\u53e5\u4e4b\u95f4\u5fc5\u987b\u6709\u7a7a\u683c\u3002\u5982\u679c<code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em>\u88ab\u7701\u7565\uff0c\u5219\u6307\u5b9a\u7684<em class=\"replaceable\"><code>option</code></em>\u4f1a\u6309\u4ee5\u4e0b\u547d\u4ee4\u7684\u65b9\u5f0f\u66f4\u6539\uff1a<code class=\"literal\">\\pset</code> <em class=\"replaceable\"><code>option</code></em>\uff0c\u5176\u4e2d\u4e0d\u663e\u5f0f\u6307\u5b9a<em class=\"replaceable\"><code>value</code></em>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7ed9\u51fa\u4e86<em class=\"replaceable\"><code>filename</code></em>\u6216<code class=\"literal\">|</code><em class=\"replaceable\"><code>command</code></em>\u53c2\u6570\uff0c\u67e5\u8be2\u8f93\u51fa\u5c31\u4f1a\u5199\u5165\u6307\u5b9a\u6587\u4ef6\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6307\u5b9a\u7684 shell \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u7167\u5e38\u663e\u793a\u3002\u53ea\u6709\u5f53\u67e5\u8be2\u6210\u529f\u8fd4\u56de\u96f6\u4e2a\u6216\u591a\u4e2a\u5143\u7ec4\u65f6\uff0c\u624d\u4f1a\u5411\u6587\u4ef6\u6216\u547d\u4ee4\u5199\u5165\uff1b\u5982\u679c\u67e5\u8be2\u5931\u8d25\uff0c\u6216\u6267\u884c\u7684\u662f\u4e0d\u8fd4\u56de\u6570\u636e\u7684 SQL \u547d\u4ee4\uff0c\u5219\u4e0d\u4f1a\u5199\u5165\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u5c06\u88ab\u91cd\u65b0\u6267\u884c\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u6ca1\u6709\u4efb\u4f55\u53c2\u6570\u7684<code class=\"literal\">\\g</code>\u57fa\u672c\u4e0a\u7b49\u540c\u4e8e\u4e00\u4e2a\u5206\u53f7\u3002\u5e26\u6709\u53c2\u6570\u7684<code class=\"literal\">\\g</code>\u63d0\u4f9b\u4e86\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u4e00\u6b21\u6027</span>\u201d</span>\u66ff\u4ee3<code class=\"command\">\\o</code>\u547d\u4ee4\u7684\u9009\u62e9\uff0c\u5e76\u4e14\u8fd8\u5141\u8bb8\u4e00\u6b21\u6027\u8c03\u6574\u901a\u5e38\u7531<code class=\"literal\">\\pset</code>\u8bbe\u7f6e\u7684\u8f93\u51fa\u683c\u5f0f\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u5f53\u6700\u540e\u4e00\u4e2a\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\u65f6\uff0c\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u90fd\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u65e2\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\uff0c\u4e5f\u4e0d\u8fdb\u884c\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u90e8\u5206\u4f1a\u76f4\u63a5\u6309\u5b57\u9762\u4f20\u7ed9 shell\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-GDESC\"><span class=\"term\"><code class=\"literal\">\\gdesc</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u663e\u793a\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u67e5\u8be2\u7ed3\u679c\u7684\u63cf\u8ff0\uff08\u5373\u5217\u540d\u548c\u6570\u636e\u7c7b\u578b\uff09\u3002\u67e5\u8be2\u5e76\u4e0d\u4f1a\u5b9e\u9645\u6267\u884c\uff1b\u4e0d\u8fc7\uff0c\u5982\u679c\u5176\u4e2d\u5b58\u5728\u8bed\u6cd5\u9519\u8bef\uff0c\u4f1a\u6309\u901a\u5e38\u7684\u65b9\u5f0f\u62a5\u544a\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6539\u4e3a\u63cf\u8ff0\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-GETENV\"><span class=\"term\"><code class=\"literal\">\\getenv <em class=\"replaceable\"><code>psql_var</code></em> <em class=\"replaceable\"><code>env_var</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u83b7\u53d6\u73af\u5883\u53d8\u91cf<em class=\"replaceable\"><code>env_var</code></em>\u7684\u503c\uff0c\u5e76\u5c06\u5176\u8d4b\u7ed9<span class=\"application\">psql</span>\u53d8\u91cf<em class=\"replaceable\"><code>psql_var</code></em>\u3002\u5982\u679c<em class=\"replaceable\"><code>env_var</code></em>\u5728<span class=\"application\">psql</span>\u8fdb\u7a0b\u7684\u73af\u5883\u4e2d\u672a\u5b9a\u4e49\uff0c<em class=\"replaceable\"><code>psql_var</code></em>\u4e0d\u4f1a\u88ab\u6539\u53d8\u3002\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>\\getenv home HOME</code></strong>\n=&gt; <strong class=\"userinput\"><code>\\echo :home</code></strong>\n/home/postgres\n</pre>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-GEXEC\"><span class=\"term\"><code class=\"literal\">\\gexec</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u7136\u540e\u5c06\u67e5\u8be2\u8f93\u51fa\u7684\u6bcf\u884c\u6bcf\u5217\u89c6\u4e3a\u8981\u6267\u884c\u7684SQL\u8bed\u53e5\u3002\u4f8b\u5982\uff0c\u8981\u5728<code class=\"structname\">my_table</code>\u7684\u6bcf\u4e00\u5217\u4e0a\u521b\u5efa\u7d22\u5f15\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT format('create index on my_table(%I)', attname)</code></strong>\n-&gt; <strong class=\"userinput\"><code>FROM pg_attribute</code></strong>\n-&gt; <strong class=\"userinput\"><code>WHERE attrelid = 'my_table'::regclass AND attnum &gt; 0</code></strong>\n-&gt; <strong class=\"userinput\"><code>ORDER BY attnum</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gexec</code></strong>\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\n</pre>\n<p lang=\"zh\">\u751f\u6210\u7684\u67e5\u8be2\u6309\u8fd4\u56de\u884c\u7684\u987a\u5e8f\u6267\u884c\uff1b\u540c\u4e00\u884c\u6709\u591a\u5217\u65f6\u4ece\u5de6\u5230\u53f3\u6267\u884c\uff0c\u5ffd\u7565 NULL \u5b57\u6bb5\u3002\u67e5\u8be2\u539f\u6837\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u56e0\u6b64\u4e0d\u80fd\u662f psql \u5143\u547d\u4ee4\uff0c\u4e5f\u4e0d\u80fd\u5305\u542b psql \u53d8\u91cf\u5f15\u7528\u3002\u9664\u975e\u8bbe\u7f6e ON_ERROR_STOP\uff0c\u67d0\u6761\u67e5\u8be2\u5931\u8d25\u540e\u4ecd\u7ee7\u7eed\u6267\u884c\u5176\u4f59\u67e5\u8be2\u3002\u6bcf\u6761\u67e5\u8be2\u5747\u9075\u5faa ECHO \u8bbe\u7f6e\uff08\u4f7f\u7528 \\gexec \u65f6\uff0c\u901a\u5e38\u5efa\u8bae\u5c06 ECHO \u8bbe\u4e3a all \u6216 queries\uff09\uff0c\u67e5\u8be2\u65e5\u5fd7\u3001\u5355\u6b65\u6a21\u5f0f\u3001\u8ba1\u65f6\u7b49\u6267\u884c\u529f\u80fd\u4e5f\u5206\u522b\u5e94\u7528\u4e8e\u6bcf\u6761\u751f\u6210\u7684\u67e5\u8be2\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-GSET\"><span class=\"term\"><code class=\"literal\">\\gset [ <em class=\"replaceable\"><code>prefix</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u5e76\u5c06\u67e5\u8be2\u8f93\u51fa\u5b58\u5165 <span class=\"application\">psql</span> \u53d8\u91cf\uff08\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\uff09\u3002\u8981\u6267\u884c\u7684\u67e5\u8be2\u5fc5\u987b\u6070\u597d\u8fd4\u56de\u4e00\u884c\u3002\u8be5\u884c\u7684\u6bcf\u4e00\u5217\u5206\u522b\u5b58\u5165\u4e00\u4e2a\u53d8\u91cf\uff0c\u53d8\u91cf\u540d\u4e0e\u5217\u540d\u76f8\u540c\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT 'hello' AS var1, 10 AS var2</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gset</code></strong>\n=&gt; <strong class=\"userinput\"><code>\\echo :var1 :var2</code></strong>\nhello 10\n</pre>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>prefix</code></em>\uff0c\u5219\u4f1a\u5c06\u8be5\u5b57\u7b26\u4e32\u52a0\u5230\u67e5\u8be2\u7684\u5217\u540d\u524d\u9762\uff0c\u4ee5\u6784\u6210\u8981\u4f7f\u7528\u7684\u53d8\u91cf\u540d\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT 'hello' AS var1, 10 AS var2</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gset result_</code></strong>\n=&gt; <strong class=\"userinput\"><code>\\echo :result_var1 :result_var2</code></strong>\nhello 10\n</pre>\n<p lang=\"zh\">\u5982\u679c\u67d0\u4e00\u5217\u7684\u7ed3\u679c\u4e3a NULL\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u5bf9\u5e94\u7684\u53d8\u91cf\uff0c\u800c\u4e0d\u662f\u8bbe\u7f6e\u5b83\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u67e5\u8be2\u5931\u8d25\u6216\u6ca1\u6709\u6070\u597d\u8fd4\u56de\u4e00\u884c\uff0c\u5219\u4e0d\u4f1a\u66f4\u6539\u4efb\u4f55\u53d8\u91cf\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-GX\"><span class=\"term\"><code class=\"literal\">\\gx [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\gx [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\\gx \u4e0e \\g \u7b49\u4ef7\uff0c\u4f46\u4f1a\u5f3a\u5236\u6b64\u67e5\u8be2\u4f7f\u7528\u6269\u5c55\u8f93\u51fa\u6a21\u5f0f\uff0c\u76f8\u5f53\u4e8e\u5728 \\pset \u9009\u9879\u5217\u8868\u4e2d\u6307\u5b9a expanded=on\u3002\u53e6\u89c1 \\x\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-HELP\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\h</code>\u6216<code class=\"literal\">\\help</code> <code class=\"literal\">[ <em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u7ed9\u51fa\u6307\u5b9a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u7684\u8bed\u6cd5\u5e2e\u52a9\u3002\u5982\u679c\u672a\u6307\u5b9a<em class=\"replaceable\"><code>command</code></em>\uff0c\u5219<span class=\"application\">psql</span>\u5c06\u5217\u51fa\u6240\u6709\u53ef\u7528\u8bed\u6cd5\u5e2e\u52a9\u7684\u547d\u4ee4\u3002\u5982\u679c<em class=\"replaceable\"><code>command</code></em>\u662f\u661f\u53f7\uff08<code class=\"literal\">*</code>\uff09\uff0c\u5219\u663e\u793a\u6240\u6709<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u7684\u8bed\u6cd5\u5e2e\u52a9\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\help</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u4e3a\u4e86\u7b80\u5316\u8f93\u5165\uff0c\u7531\u591a\u4e2a\u5355\u8bcd\u7ec4\u6210\u7684\u547d\u4ee4\u4e0d\u9700\u8981\u52a0\u5f15\u53f7\u3002\u56e0\u6b64\uff0c\u53ef\u4ee5\u76f4\u63a5\u8f93\u5165<strong class=\"userinput\"><code>\\help alter table</code></strong>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-HTML\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\H</code> \u6216 <code class=\"literal\">\\html</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5f00<acronym class=\"acronym\">HTML</acronym>\u67e5\u8be2\u8f93\u51fa\u683c\u5f0f\u3002\u5982\u679c<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u5df2\u7ecf\u6253\u5f00\uff0c\u5219\u5207\u6362\u56de\u9ed8\u8ba4\u7684\u5bf9\u9f50\u6587\u672c\u683c\u5f0f\u3002\u6b64\u547d\u4ee4\u662f\u4e3a\u517c\u5bb9\u6027\u548c\u4fbf\u5229\u6027\u800c\u4fdd\u7559\u7684\uff1b\u8bbe\u7f6e\u5176\u4ed6\u8f93\u51fa\u9009\u9879\u7684\u65b9\u6cd5\u89c1<code class=\"command\">\\pset</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-INCLUDE\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\i</code> \u6216 <code class=\"literal\">\\include</code> <em class=\"replaceable\"><code>filename</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u8bfb\u53d6\u8f93\u5165\uff0c\u5e76\u50cf\u5728\u952e\u76d8\u4e0a\u8f93\u5165\u4e00\u6837\u6267\u884c\u5b83\u3002</p>\n<p lang=\"zh\">\u5982\u679c<em class=\"replaceable\"><code>filename</code></em>\u662f<code class=\"literal\">-</code>\uff08\u8fde\u5b57\u7b26\uff09\uff0c\u5219\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\uff0c\u76f4\u5230\u9047\u5230 EOF \u6307\u793a\u6216<code class=\"command\">\\q</code>\u5143\u547d\u4ee4\u3002\u8fd9\u53ef\u7528\u4e8e\u5c06\u4ea4\u4e92\u5f0f\u8f93\u5165\u4e0e\u6587\u4ef6\u8f93\u5165\u4ea4\u9519\u4f7f\u7528\u3002\u8bf7\u6ce8\u610f\uff0c\u53ea\u6709\u5728\u6700\u5916\u5c42\u542f\u7528\u4e86 Readline\uff0c\u6b64\u5904\u624d\u4f1a\u4f7f\u7528 Readline \u529f\u80fd\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5982\u679c\u60f3\u5728\u5c4f\u5e55\u4e0a\u770b\u5230\u88ab\u8bfb\u5165\u7684\u5404\u884c\uff0c\u8bf7\u5c06\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">all</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"PSQL-METACOMMAND-IF\"><span class=\"term\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\elif</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\else</code><br/></span><span class=\"term\"><code class=\"literal\">\\endif</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u7ec4\u547d\u4ee4\u5b9e\u73b0\u4e86\u53ef\u5d4c\u5957\u7684\u6761\u4ef6\u5757\u3002\u6761\u4ef6\u5757\u5fc5\u987b\u4ee5<code class=\"command\">\\if</code>\u5f00\u59cb\uff0c\u5e76\u4ee5<code class=\"command\">\\endif</code>\u7ed3\u675f\u3002\u5728\u4e24\u8005\u4e4b\u95f4\u53ef\u4ee5\u6709\u4efb\u610f\u6570\u91cf\u7684<code class=\"command\">\\elif</code>\u5b50\u53e5\uff0c\u540e\u9762\u53ef\u4ee5\u9009\u62e9\u6027\u5730\u8ddf\u7740\u4e00\u4e2a<code class=\"command\">\\else</code>\u5b50\u53e5\u3002\u5728\u5f62\u6210\u6761\u4ef6\u5757\u7684\u547d\u4ee4\u4e4b\u95f4\u901a\u5e38\u4f1a\u51fa\u73b0\u666e\u901a\u67e5\u8be2\u548c\u5176\u4ed6\u7c7b\u578b\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\\if \u548c \\elif \u8bfb\u53d6\u53c2\u6570\u5e76\u5c06\u5176\u4f5c\u4e3a\u5e03\u5c14\u8868\u8fbe\u5f0f\u6c42\u503c\u3002\u7ed3\u679c\u4e3a\u771f\u65f6\u7ee7\u7eed\u6b63\u5e38\u5904\u7406\uff0c\u5426\u5219\u8df3\u8fc7\u540e\u7eed\u884c\uff0c\u76f4\u5230\u9047\u5230\u5339\u914d\u7684 \\elif\u3001\\else \u6216 \\endif\u3002\u67d0\u4e2a \\if \u6216 \\elif \u6761\u4ef6\u6210\u7acb\u540e\uff0c\u540c\u4e00\u5757\u4e2d\u540e\u7eed \\elif \u7684\u53c2\u6570\u4e0d\u518d\u6c42\u503c\uff0c\u76f4\u63a5\u89c6\u4e3a\u5047\u3002\u53ea\u6709\u4e4b\u524d\u5339\u914d\u7684 \\if \u548c \\elif \u5747\u672a\u6210\u7acb\uff0c\u624d\u5904\u7406 \\else \u540e\u7684\u884c\u3002</p>\n<p lang=\"zh\">\u4e0e\u5176\u4ed6\u53cd\u659c\u6760\u547d\u4ee4\u53c2\u6570\u4e00\u6837\uff0c\\if \u6216 \\elif \u7684\u8868\u8fbe\u5f0f\u53c2\u6570\u5148\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u548c\u53cd\u5f15\u53f7\u5c55\u5f00\uff0c\u7136\u540e\u50cf\u5f00\u5173\u9009\u9879\u53d8\u91cf\u4e00\u6837\u6c42\u503c\u3002\u6709\u6548\u503c\u4e3a true\u3001false\u30011\u30010\u3001on\u3001off\u3001yes\u3001no \u7684\u4efb\u610f\u65e0\u6b67\u4e49\u3001\u4e0d\u533a\u5206\u5927\u5c0f\u5199\u7684\u5339\u914d\u3002\u4f8b\u5982 t\u3001T \u548c tR \u90fd\u4f1a\u89c6\u4e3a\u771f\u3002</p>\n<p lang=\"zh\">\u4e0d\u80fd\u6b63\u786e\u6c42\u503c\u4e3a\u771f\u6216\u5047\u7684\u8868\u8fbe\u5f0f\u4f1a\u4ea7\u751f\u8b66\u544a\uff0c\u5e76\u88ab\u89c6\u4e3a\u5047\u3002</p>\n<p lang=\"zh\">\u88ab\u8df3\u8fc7\u7684\u884c\u4f1a\u88ab\u6b63\u5e38\u89e3\u6790\u4ee5\u8bc6\u522b\u67e5\u8be2\u548c\u53cd\u659c\u7ebf\u547d\u4ee4\uff0c\u4f46\u67e5\u8be2\u4e0d\u4f1a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u4e14\u9664\u4e86\u6761\u4ef6\u547d\u4ee4\uff08<code class=\"command\">\\if</code>\u3001<code class=\"command\">\\elif</code>\u3001<code class=\"command\">\\else</code>\u3001<code class=\"command\">\\endif</code>\uff09\u4e4b\u5916\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u4f1a\u88ab\u5ffd\u7565\u3002\u4ec5\u68c0\u67e5\u8df3\u8fc7\u884c\u4e2d\u6761\u4ef6\u547d\u4ee4\u7684\u6709\u6548\u5d4c\u5957\u3002\u8df3\u8fc7\u884c\u4e2d\u7684\u53d8\u91cf\u5f15\u7528\u4e0d\u4f1a\u88ab\u5c55\u5f00\uff0c\u4e5f\u4e0d\u4f1a\u6267\u884c\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<p lang=\"zh\">\u540c\u4e00\u4e2a\u6761\u4ef6\u5757\u7684\u6240\u6709\u53cd\u659c\u7ebf\u547d\u4ee4\u5fc5\u987b\u51fa\u73b0\u5728\u540c\u4e00\u4e2a\u6e90\u6587\u4ef6\u4e2d\u3002\u5982\u679c\u4e3b\u8f93\u5165\u6587\u4ef6\u6216\u901a\u8fc7<code class=\"command\">\\include</code>\u5f15\u5165\u7684\u6587\u4ef6\u5230\u8fbe EOF \u65f6\uff0c\u4ecd\u6709\u672c\u5730<code class=\"command\">\\if</code>\u5757\u672a\u5173\u95ed\uff0c<span class=\"application\">psql</span>\u5c31\u4f1a\u62a5\u9519\u3002</p>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4e00\u4e2a\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">-- check for the existence of two separate records in the database and store\n-- the results in separate psql variables\nSELECT\n    EXISTS(SELECT 1 FROM customer WHERE customer_id = 123) as is_customer,\n    EXISTS(SELECT 1 FROM employee WHERE employee_id = 456) as is_employee\n\\gset\n\\if :is_customer\n    SELECT * FROM customer WHERE customer_id = 123;\n\\elif :is_employee\n    \\echo 'is not a customer but is an employee'\n    SELECT * FROM employee WHERE employee_id = 456;\n\\else\n    \\if yes\n        \\echo 'not a customer or employee'\n    \\else\n        \\echo 'this will never print'\n    \\endif\n\\endif\n</pre>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-INCLUDE-RELATIVE\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\ir</code> \u6216 <code class=\"literal\">\\include_relative</code> <em class=\"replaceable\"><code>filename</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"literal\">\\ir</code>\u547d\u4ee4\u4e0e<code class=\"literal\">\\i</code>\u76f8\u4f3c\uff0c\u4f46\u89e3\u6790\u76f8\u5bf9\u6587\u4ef6\u540d\u7684\u65b9\u5f0f\u4e0d\u540c\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\u6267\u884c\u65f6\uff0c\u8fd9\u4e24\u4e2a\u547d\u4ee4\u7684\u884c\u4e3a\u76f8\u540c\u3002\u4e0d\u8fc7\uff0c\u5728\u811a\u672c\u4e2d\u8c03\u7528\u65f6\uff0c<code class=\"literal\">\\ir</code>\u4f1a\u76f8\u5bf9\u4e8e\u811a\u672c\u6240\u5728\u7684\u76ee\u5f55\u6765\u89e3\u91ca\u6587\u4ef6\u540d\uff0c\u800c\u4e0d\u662f\u76f8\u5bf9\u4e8e\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-LIST\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\l[x+]</code>\u6216<code class=\"literal\">\\list[x+] [ <a class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"\u6a21\u5f0f\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u670d\u52a1\u5668\u4e2d\u7684\u6570\u636e\u5e93\uff0c\u5e76\u663e\u793a\u5176\u540d\u79f0\u3001\u6240\u6709\u8005\u3001\u5b57\u7b26\u96c6\u7f16\u7801\u548c\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6570\u636e\u5e93\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u8fd8\u4f1a\u663e\u793a\u6570\u636e\u5e93\u5927\u5c0f\u3001\u9ed8\u8ba4\u8868\u7a7a\u95f4\u548c\u63cf\u8ff0\u3002\u5f53\u524d\u7528\u6237\u5bf9\u5176\u62e5\u6709 <code class=\"literal\">CONNECT</code> \u6743\u9650\u7684\u6570\u636e\u5e93\u53ef\u4ee5\u663e\u793a\u5927\u5c0f\u4fe1\u606f\uff1b\u5982\u679c\u5f53\u524d\u7528\u6237\u662f\u8d85\u7ea7\u7528\u6237\u6216\u5177\u6709 <code class=\"literal\">pg_read_all_stats</code> \u89d2\u8272\u7684\u6743\u9650\uff0c\u4e5f\u53ef\u4ee5\u663e\u793a\u5927\u5c0f\u4fe1\u606f\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-LO-EXPORT\"><span class=\"term\"><code class=\"literal\">\\lo_export <em class=\"replaceable\"><code>loid</code></em> <em class=\"replaceable\"><code>filename</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6570\u636e\u5e93\u4e2d\u8bfb\u53d6\u5177\u6709<acronym class=\"acronym\">OID</acronym><em class=\"replaceable\"><code>loid</code></em>\u7684\u5927\u5bf9\u8c61\uff0c\u5e76\u5c06\u5176\u5199\u5165<em class=\"replaceable\"><code>filename</code></em>\u3002\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e0e\u670d\u52a1\u5668\u51fd\u6570 <code class=\"function\">lo_export</code>\u7565\u6709\u4e0d\u540c\uff0c\u540e\u8005\u4f7f\u7528\u8fd0\u884c\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7528\u6237\u7684\u6743\u9650\uff0c\u5e76\u5728\u670d\u52a1\u5668\u7684\u6587\u4ef6\u7cfb\u7edf\u4e0a\u64cd\u4f5c\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u4f7f\u7528 \\lo_list \u67e5\u627e\u5927\u5bf9\u8c61\u7684 OID\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-LO-IMPORT\"><span class=\"term\"><code class=\"literal\">\\lo_import <em class=\"replaceable\"><code>filename</code></em> [ <em class=\"replaceable\"><code>comment</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6587\u4ef6\u5b58\u50a8\u5230\u4e00\u4e2a<span class=\"productname\">PostgreSQL</span>\u5927\u5bf9\u8c61\u4e2d\u3002\u53ef\u9009\u5730\uff0c\u5b83\u5c06\u7ed9\u5b9a\u7684\u6ce8\u91ca\u4e0e\u5bf9\u8c61\u5173\u8054\u8d77\u6765\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">foo=&gt; <strong class=\"userinput\"><code>\\lo_import '/home/peter/pictures/photo.xcf' 'a picture of me'</code></strong>\nlo_import 152801\n</pre>\n<p lang=\"zh\">\u54cd\u5e94\u8868\u660e\u5927\u5bf9\u8c61\u83b7\u5f97\u4e86\u5bf9\u8c61 ID 152801\uff0c\u8fd9\u4e2a ID \u53ef\u4ee5\u7528\u6765\u5728\u5c06\u6765\u8bbf\u95ee\u65b0\u521b\u5efa\u7684\u5927\u5bf9\u8c61\u3002\u4e3a\u4fbf\u4e8e\u9605\u8bfb\uff0c\u5efa\u8bae\u59cb\u7ec8\u4e3a\u6bcf\u4e2a\u5bf9\u8c61\u5173\u8054\u4e00\u6761\u4fbf\u4e8e\u4eba\u9605\u8bfb\u7684\u6ce8\u91ca\u3002\u67e5\u770b OID \u548c\u6ce8\u91ca\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528<code class=\"command\">\\lo_list</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u6b64\u547d\u4ee4\u4e0e\u670d\u52a1\u5668\u7aef\u7684<code class=\"function\">lo_import</code>\u7565\u6709\u4e0d\u540c\uff0c\u56e0\u4e3a\u5b83\u4f5c\u4e3a\u672c\u5730\u7528\u6237\u5728\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e0a\u64cd\u4f5c\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\u7684\u7528\u6237\u548c\u6587\u4ef6\u7cfb\u7edf\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-LO-LIST\"><span class=\"term\"><code class=\"literal\">\\lo_list[x+]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5f53\u524d\u5b58\u50a8\u5728\u6570\u636e\u5e93\u4e2d\u7684\u5168\u90e8 <span class=\"productname\">PostgreSQL</span> \u5927\u5bf9\u8c61\u5217\u8868\uff0c\u4ee5\u53ca\u4e3a\u5b83\u4eec\u63d0\u4f9b\u7684\u4efb\u4f55\u6ce8\u91ca\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u5217\u51fa\u6bcf\u4e2a\u5927\u5bf9\u8c61\u7684\u76f8\u5173\u6743\u9650\uff08\u5982\u679c\u6709\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-LO-UNLINK\"><span class=\"term\"><code class=\"literal\">\\lo_unlink <em class=\"replaceable\"><code>loid</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6570\u636e\u5e93\u4e2d\u5220\u9664<acronym class=\"acronym\">OID</acronym> \u4e3a <em class=\"replaceable\"><code>loid</code></em>\u7684\u5927\u5bf9\u8c61\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u4f7f\u7528 \\lo_list \u67e5\u627e\u5927\u5bf9\u8c61\u7684 OID\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-OUT\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\o</code> \u6216 <code class=\"literal\">\\out [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\o</code> \u6216 <code class=\"literal\">\\out [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u540e\u7eed\u67e5\u8be2\u7ed3\u679c\u4fdd\u5b58\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9 shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002\u5982\u679c\u6ca1\u6709\u6307\u5b9a\u53c2\u6570\uff0c\u67e5\u8be2\u8f93\u51fa\u5c06\u6062\u590d\u4e3a\u6807\u51c6\u8f93\u51fa\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\uff0c\u5219\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u7684\u5185\u5bb9\u53ea\u4f1a\u539f\u6837\u4f20\u9012\u7ed9 shell\u3002</p>\n<p lang=\"zh\"><span class=\"quote\">\u201c<span class=\"quote\">\u67e5\u8be2\u7ed3\u679c</span>\u201d</span>\u5305\u62ec\u4ece\u6570\u636e\u5e93\u670d\u52a1\u5668\u83b7\u53d6\u7684\u6240\u6709\u8868\u683c\u3001\u547d\u4ee4\u54cd\u5e94\u548c\u901a\u77e5\uff0c\u4ee5\u53ca\u67e5\u8be2\u6570\u636e\u5e93\u7684\u5404\u79cd\u53cd\u659c\u6760\u547d\u4ee4\u7684\u8f93\u51fa\uff08\u4f8b\u5982<code class=\"command\">\\d</code>\uff09\uff1b\u4f46\u4e0d\u5305\u62ec\u9519\u8bef\u6d88\u606f\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8981\u5728\u67e5\u8be2\u7ed3\u679c\u4e4b\u95f4\u63d2\u5165\u6587\u672c\u8f93\u51fa\uff0c\u4f7f\u7528<code class=\"command\">\\qecho</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PRINT\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\p</code>\u6216<code class=\"literal\">\\print</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\u3002\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6253\u5370\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PARSE\"><span class=\"term\"><code class=\"literal\">\\parse <em class=\"replaceable\"><code>statement_name</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u57fa\u4e8e\u76ee\u6807\u9884\u5907\u8bed\u53e5\u5bf9\u8c61\u7684\u540d\u79f0\uff0c\u4ece\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u521b\u5efa\u4e00\u4e2a\u9884\u5907\u8bed\u53e5\u3002\u7a7a\u5b57\u7b26\u4e32\u8868\u793a\u672a\u547d\u540d\u7684\u9884\u5907\u8bed\u53e5\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">SELECT $1 \\parse stmt1\n</pre>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4f1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\uff0c\u4e0d\u540c\u4e8e<span class=\"application\">psql</span>\u901a\u5e38\u4f7f\u7528\u7684\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002\u8be5\u547d\u4ee4\u4f1a\u53d1\u51fa\u4e00\u6761<a class=\"xref\" href=\"/docs/18/protocol-message-formats.html#PROTOCOL-MESSAGE-FORMATS-PARSE\">Parse (F)</a>\u6d88\u606f\uff0c\u56e0\u6b64\u53ef\u7528\u4e8e\u5728<span class=\"application\">psql</span>\u4e2d\u6d4b\u8bd5\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002\u6b64\u547d\u4ee4\u53ea\u5f71\u54cd\u4e0b\u4e00\u6761\u88ab\u6267\u884c\u7684\u67e5\u8be2\uff1b\u4e4b\u540e\u7684\u6240\u6709\u67e5\u8be2\u9ed8\u8ba4\u4ecd\u4f1a\u4f7f\u7528\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PASSWORD\"><span class=\"term\"><code class=\"literal\">\\password [ <em class=\"replaceable\"><code>username</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u66f4\u6539\u6307\u5b9a\u7528\u6237\uff08\u9ed8\u8ba4\u4e3a\u5f53\u524d\u7528\u6237\uff09\u7684\u5bc6\u7801\u3002\u6b64\u547d\u4ee4\u63d0\u793a\u8f93\u5165\u65b0\u5bc6\u7801\uff0c\u5bf9\u5176\u8fdb\u884c\u52a0\u5bc6\uff0c\u5e76\u5c06\u5176\u4f5c\u4e3a<code class=\"command\">ALTER ROLE</code>\u547d\u4ee4\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u65b0\u5bc6\u7801\u4e0d\u4f1a\u4ee5\u660e\u6587\u5f62\u5f0f\u51fa\u73b0\u5728\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\u3001\u670d\u52a1\u5668\u65e5\u5fd7\u6216\u5176\u4ed6\u5730\u65b9\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PROMPT\"><span class=\"term\"><code class=\"literal\">\\prompt [ <em class=\"replaceable\"><code>text</code></em> ] <em class=\"replaceable\"><code>name</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u63d0\u793a\u7528\u6237\u63d0\u4f9b\u6587\u672c\uff0c\u5c06\u5176\u8d4b\u503c\u7ed9\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u3002\u53ef\u4ee5\u6307\u5b9a\u4e00\u4e2a\u53ef\u9009\u7684\u63d0\u793a\u5b57\u7b26\u4e32<em class=\"replaceable\"><code>text</code></em>\u3002\uff08\u5bf9\u4e8e\u591a\u4e2a\u5355\u8bcd\u7684\u63d0\u793a\uff0c\u7528\u5355\u5f15\u53f7\u62ec\u8d77\u6587\u672c\u3002\uff09</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"literal\">\\prompt</code> \u4f7f\u7528\u7ec8\u7aef\u8fdb\u884c\u8f93\u5165\u548c\u8f93\u51fa\u3002\u7136\u800c\uff0c\u5982\u679c\u4f7f\u7528\u4e86 <code class=\"option\">-f</code> \u547d\u4ee4\u884c\u5f00\u5173\uff0c<code class=\"literal\">\\prompt</code> \u5c06\u4f7f\u7528\u6807\u51c6\u8f93\u5165\u548c\u6807\u51c6\u8f93\u51fa\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET\"><span class=\"term\"><code class=\"literal\">\\pset [ <em class=\"replaceable\"><code>option</code></em> [ <em class=\"replaceable\"><code>value</code></em> ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u8bbe\u7f6e\u5f71\u54cd\u67e5\u8be2\u7ed3\u679c\u8868\u8f93\u51fa\u7684\u9009\u9879\u3002<em class=\"replaceable\"><code>option</code></em>\u6307\u5b9a\u8981\u8bbe\u7f6e\u54ea\u4e2a\u9009\u9879\u3002<em class=\"replaceable\"><code>value</code></em>\u7684\u542b\u4e49\u53d6\u51b3\u4e8e\u6240\u9009\u7684\u9009\u9879\u3002\u5bf9\u4e8e\u67d0\u4e9b\u9009\u9879\uff0c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\u4f1a\u5207\u6362\u6216\u53d6\u6d88\u8bbe\u7f6e\u8be5\u9009\u9879\uff0c\u5177\u4f53\u89c1\u5404\u9009\u9879\u7684\u8bf4\u660e\u3002\u5982\u679c\u6ca1\u6709\u63d0\u53ca\u8fd9\u7c7b\u884c\u4e3a\uff0c\u90a3\u4e48\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\u53ea\u4f1a\u663e\u793a\u5f53\u524d\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\">\u4e0d\u5e26\u4efb\u4f55\u53c2\u6570\u7684<code class=\"command\">\\pset</code>\u4f1a\u663e\u793a\u6240\u6709\u6253\u5370\u9009\u9879\u7684\u5f53\u524d\u72b6\u6001\u3002</p>\n<p lang=\"zh\">\u53ef\u8c03\u6574\u6253\u5370\u9009\u9879\u6709\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-META-COMMAND-PSET-BORDER\"><span class=\"term\"><code class=\"literal\">border</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><em class=\"replaceable\"><code>value</code></em>\u5fc5\u987b\u662f\u6570\u5b57\u3002\u4e00\u822c\u6765\u8bf4\uff0c\u6570\u5b57\u8d8a\u5927\uff0c\u8868\u683c\u7684\u8fb9\u6846\u548c\u5206\u9694\u7ebf\u5c31\u8d8a\u591a\uff0c\u4f46\u7ec6\u8282\u53d6\u51b3\u4e8e\u5177\u4f53\u683c\u5f0f\u3002\u5728<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u4e2d\uff0c\u5b83\u4f1a\u76f4\u63a5\u8f6c\u6362\u4e3a<code class=\"literal\">border=...</code>\u5c5e\u6027\u3002\u5728\u5927\u591a\u6570\u5176\u4ed6\u683c\u5f0f\u4e2d\uff0c\u53ea\u6709\u503c 0\uff08\u65e0\u8fb9\u6846\uff09\u30011\uff08\u5185\u90e8\u5206\u9694\u7ebf\uff09\u548c 2\uff08\u8868\u683c\u5916\u6846\uff09\u6709\u610f\u4e49\uff0c\u5927\u4e8e 2 \u7684\u503c\u4f1a\u4e0e<code class=\"literal\">border = 2</code>\u4f5c\u76f8\u540c\u5904\u7406\u3002<code class=\"literal\">latex</code>\u548c<code class=\"literal\">latex-longtable</code>\u683c\u5f0f\u8fd8\u5141\u8bb8\u4f7f\u7528\u503c 3\uff0c\u4ee5\u5728\u6570\u636e\u884c\u4e4b\u95f4\u6dfb\u52a0\u5206\u9694\u7ebf\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-COLUMNS\" lang=\"zh\"><em>\u5217</em></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u76ee\u6807\u5bbd\u5ea6\uff0c\u540c\u65f6\u4e5f\u662f\u786e\u5b9a\u8f93\u51fa\u662f\u5426\u8db3\u591f\u5bbd\u4ee5\u9700\u8981\u5206\u9875\u5668\u6216\u5728\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e0b\u5207\u6362\u5230\u5782\u76f4\u663e\u793a\u7684\u5bbd\u5ea6\u9650\u5236\u3002\u96f6\uff08\u9ed8\u8ba4\u503c\uff09\u4f1a\u5bfc\u81f4\u76ee\u6807\u5bbd\u5ea6\u7531\u73af\u5883\u53d8\u91cf<code class=\"envar\">COLUMNS</code>\u63a7\u5236\uff0c\u6216\u8005\u5982\u679c\u672a\u8bbe\u7f6e <code class=\"envar\">COLUMNS</code>\u5219\u7531\u68c0\u6d4b\u5230\u7684\u5c4f\u5e55\u5bbd\u5ea6\u63a7\u5236\u3002\u53e6\u5916\uff0c\u5982\u679c<code class=\"literal\">columns</code>\u4e3a\u96f6\uff0c\u5219<code class=\"literal\">wrapped</code>\u683c\u5f0f\u4ec5\u5f71\u54cd\u5c4f\u5e55\u8f93\u51fa\u3002\u5982\u679c<code class=\"literal\">columns</code>\u4e3a\u975e\u96f6\uff0c\u5219\u6587\u4ef6\u548c\u7ba1\u9053\u8f93\u51fa\u4e5f\u4f1a\u6309\u8be5\u5bbd\u5ea6\u6298\u884c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-CSV-FIELDSEP\"><span class=\"term\"><code class=\"literal\">csv_fieldsep</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728<acronym class=\"acronym\">CSV</acronym>\u8f93\u51fa\u683c\u5f0f\u4e2d\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u5982\u679c\u5206\u9694\u7b26\u5b57\u7b26\u51fa\u73b0\u5728\u5b57\u6bb5\u7684\u503c\u4e2d\uff0c\u5219\u8be5\u5b57\u6bb5\u5c06\u6839\u636e\u6807\u51c6<acronym class=\"acronym\">CSV</acronym>\u89c4\u5219\u5728\u53cc\u5f15\u53f7\u5185\u8f93\u51fa\u3002\u9ed8\u8ba4\u503c\u662f\u9017\u53f7\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-EXPANDED\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">expanded</code>\uff08\u6216<code class=\"literal\">x</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff08\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u6269\u5c55\u6a21\u5f0f\uff09\uff0c\u6216\u8005\u662f<code class=\"literal\">auto</code>\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5f00\u542f\u548c\u5173\u95ed\u8bbe\u7f6e\u4e4b\u95f4\u5207\u6362\u3002\u542f\u7528\u6269\u5c55\u6a21\u5f0f\u65f6\uff0c\u67e5\u8be2\u7ed3\u679c\u4ee5\u4e24\u5217\u663e\u793a\uff0c\u5de6\u4fa7\u4e3a\u5217\u540d\uff0c\u53f3\u4fa7\u4e3a\u6570\u636e\u3002\u5982\u679c\u6570\u636e\u5728\u901a\u5e38\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u6a2a\u5411</span>\u201d</span>\u6a21\u5f0f\u4e0b\u65e0\u6cd5\u9002\u5e94\u5c4f\u5e55\uff0c\u8fd9\u79cd\u6a21\u5f0f\u5c31\u5f88\u6709\u7528\u3002\u5728\u81ea\u52a8\u8bbe\u7f6e\u4e0b\uff0c\u5f53\u67e5\u8be2\u8f93\u51fa\u5305\u542b\u591a\u5217\u4e14\u5bbd\u5ea6\u8d85\u8fc7\u5c4f\u5e55\u65f6\uff0c\u4f1a\u4f7f\u7528\u6269\u5c55\u6a21\u5f0f\uff1b\u5426\u5219\u4f7f\u7528\u5e38\u89c4\u6a21\u5f0f\u3002\u81ea\u52a8\u8bbe\u7f6e\u53ea\u5728\u5bf9\u9f50\u548c\u6298\u884c\u683c\u5f0f\u4e2d\u6709\u6548\u3002\u5728\u5176\u4ed6\u683c\u5f0f\u4e2d\uff0c\u5b83\u7684\u884c\u4e3a\u59cb\u7ec8\u4e0e\u5173\u95ed\u6269\u5c55\u6a21\u5f0f\u76f8\u540c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-FIELDSEP\"><span class=\"term\"><code class=\"literal\">fieldsep</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u6837\u53ef\u4ee5\u521b\u5efa\u4f8b\u5982\u5236\u8868\u7b26\u5206\u9694\u7684\u8f93\u51fa\uff0c\u8fd9\u53ef\u80fd\u66f4\u7b26\u5408\u5176\u4ed6\u7a0b\u5e8f\u7684\u9700\u8981\u3002\u8981\u5c06\u5236\u8868\u7b26\u8bbe\u7f6e\u4e3a\u5b57\u6bb5\u5206\u9694\u7b26\uff0c\u8bf7\u8f93\u5165<code class=\"literal\">\\pset fieldsep '\\t'</code>\u3002\u9ed8\u8ba4\u5b57\u6bb5\u5206\u9694\u7b26\u662f<code class=\"literal\">'|'</code>\uff08\u7ad6\u7ebf\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-FIELDSEP-ZERO\"><span class=\"term\"><code class=\"literal\">fieldsep_zero</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u8bbe\u7f6e\u4e3a\u96f6\u5b57\u8282\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-FOOTER\"><span class=\"term\"><code class=\"literal\">footer</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u8868\u683c\u9875\u811a\uff08<code class=\"literal\">(<em class=\"replaceable\"><code>n</code></em> rows)</code>\u8ba1\u6570\uff09\u7684\u663e\u793a\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5207\u6362\u9875\u811a\u663e\u793a\u7684\u5f00\u5173\u72b6\u6001\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-FORMAT\"><span class=\"term\"><code class=\"literal\">format</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a<code class=\"literal\">aligned</code>\u3001<code class=\"literal\">asciidoc</code>\u3001<code class=\"literal\">csv</code>\u3001<code class=\"literal\">html</code>\u3001<code class=\"literal\">latex</code>\u3001<code class=\"literal\">latex-longtable</code>\u3001<code class=\"literal\">troff-ms</code>\u3001<code class=\"literal\">unaligned</code>\u6216<code class=\"literal\">wrapped</code>\u3002\u5141\u8bb8\u4f7f\u7528\u552f\u4e00\u7f29\u5199\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">aligned</code>\u683c\u5f0f\u662f\u6807\u51c6\u7684\u3001\u9002\u5408\u4eba\u9605\u8bfb\u4e14\u6392\u7248\u6574\u9f50\u7684\u6587\u672c\u8f93\u51fa\uff1b\u8fd9\u662f\u9ed8\u8ba4\u683c\u5f0f\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">unaligned</code>\u683c\u5f0f\u5c06\u4e00\u884c\u4e2d\u7684\u6240\u6709\u5217\u5199\u5728\u4e00\u884c\u4e0a\uff0c\u7531\u5f53\u524d\u6d3b\u52a8\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u5206\u9694\u3002\u8fd9\u5bf9\u4e8e\u521b\u5efa\u53ef\u80fd\u88ab\u5176\u4ed6\u7a0b\u5e8f\u8bfb\u53d6\u7684\u8f93\u51fa\u5f88\u6709\u7528\uff0c\u4f8b\u5982\uff0c\u5236\u8868\u7b26\u5206\u9694\u6216\u9017\u53f7\u5206\u9694\u683c\u5f0f\u3002\u7136\u800c\uff0c\u5982\u679c\u5b57\u6bb5\u5206\u9694\u7b26\u5b57\u7b26\u51fa\u73b0\u5728\u5217\u7684\u503c\u4e2d\uff0c\u5219\u4e0d\u4f1a\u88ab\u7279\u6b8a\u5904\u7406\uff1b\u56e0\u6b64\uff0c<acronym class=\"acronym\">CSV</acronym>\u683c\u5f0f\u53ef\u80fd\u66f4\u9002\u5408\u8fd9\u4e9b\u76ee\u7684\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">csv</code>\u683c\u5f0f<a class=\"indexterm\" id=\"id-1.9.4.21.8.4.11.1.81.2.3.1.8.2.4.2\" name=\"id-1.9.4.21.8.4.11.1.81.2.3.1.8.2.4.2\"></a>\u6309\u9017\u53f7\u5206\u9694\u7684\u5217\u503c\u8f93\u51fa\uff0c\u5e76\u5e94\u7528 <a class=\"ulink\" href=\"https://datatracker.ietf.org/doc/html/rfc4180\" target=\"_top\">RFC 4180</a> \u4e2d\u63cf\u8ff0\u7684\u52a0\u5f15\u53f7\u89c4\u5219\u3002\u6b64\u8f93\u51fa\u4e0e\u670d\u52a1\u5668\u7684CSV\u683c\u5f0f\u7684 <code class=\"command\">COPY</code>\u547d\u4ee4\u517c\u5bb9\u3002\u751f\u6210\u5305\u542b\u5217\u540d\u7684\u8868\u5934\u884c\uff0c\u9664\u975e <code class=\"literal\">tuples_only</code>\u53c2\u6570\u8bbe\u7f6e\u4e3a <code class=\"literal\">on</code>\u3002\u4e0d\u6253\u5370\u8868\u683c\u6807\u9898\u548c\u9875\u811a\u3002\u6bcf\u884c\u4ee5\u7cfb\u7edf\u76f8\u5173\u7684\u884c\u7ed3\u675f\u5b57\u7b26\u7ed3\u675f\uff0c\u5bf9\u4e8e\u7c7bUnix\u7cfb\u7edf\u901a\u5e38\u662f\u5355\u4e2a\u6362\u884c\u7b26\uff08<code class=\"literal\">\\n</code>\uff09\uff0c\u5bf9\u4e8eMicrosoft Windows\u5219\u662f\u56de\u8f66\u548c\u6362\u884c\u5e8f\u5217\uff08<code class=\"literal\">\\r\\n</code>\uff09\u3002\u53ef\u4ee5\u7528<code class=\"command\">\\pset csv_fieldsep</code>\u9009\u62e9\u9017\u53f7\u4ee5\u5916\u7684\u5b57\u6bb5\u5206\u9694\u5b57\u7b26\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">wrapped</code>\u683c\u5f0f\u4e0e<code class=\"literal\">aligned</code>\u76f8\u4f3c\uff0c\u4f46\u4f1a\u5c06\u8f83\u5bbd\u7684\u6570\u636e\u503c\u6298\u6210\u591a\u884c\uff0c\u4f7f\u8f93\u51fa\u9002\u5e94\u76ee\u6807\u5217\u5bbd\u3002\u76ee\u6807\u5bbd\u5ea6\u7684\u786e\u5b9a\u65b9\u5f0f\u89c1<code class=\"literal\">columns</code>\u9009\u9879\u7684\u8bf4\u660e\u3002\u8bf7\u6ce8\u610f\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u5c1d\u8bd5\u5bf9\u5217\u6807\u9898\u6298\u884c\uff1b\u56e0\u6b64\uff0c\u5982\u679c\u5217\u6807\u9898\u6240\u9700\u7684\u603b\u5bbd\u5ea6\u8d85\u8fc7\u76ee\u6807\u5bbd\u5ea6\uff0c<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u884c\u4e3a\u5c31\u4e0e<code class=\"literal\">aligned</code>\u76f8\u540c\u3002</p>\n<p lang=\"zh\">asciidoc\u3001html\u3001latex\u3001latex-longtable \u548c troff-ms \u683c\u5f0f\u8f93\u51fa\u7684\u662f\u53ef\u5d4c\u5165\u76f8\u5e94\u6807\u8bb0\u8bed\u8a00\u6587\u6863\u7684\u8868\u683c\uff0c\u5e76\u975e\u5b8c\u6574\u6587\u6863\u3002HTML \u53ef\u80fd\u4e0d\u8981\u6c42\u5b8c\u6574\u5c01\u88c5\uff0c\u4f46 LaTeX \u5fc5\u987b\u6709\u5b8c\u6574\u6587\u6863\u7ed3\u6784\u3002latex \u4f7f\u7528 LaTeX \u7684 tabular \u73af\u5883\uff1blatex-longtable \u9700\u8981 LaTeX \u7684 longtable \u548c booktabs \u5b8f\u5305\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-LINESTYLE\"><span class=\"term\"><code class=\"literal\">linestyle</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u8fb9\u6846\u7ebf\u7ed8\u5236\u6837\u5f0f\u4e3a<code class=\"literal\">ascii</code>\u3001<code class=\"literal\">old-ascii</code>\u6216<code class=\"literal\">unicode</code>\u4e4b\u4e00\u3002\u5141\u8bb8\u4f7f\u7528\u552f\u4e00\u7f29\u5199\u3002\uff08\u8fd9\u610f\u5473\u7740\u4e00\u4e2a\u5b57\u6bcd\u5c31\u8db3\u591f\u4e86\u3002\uff09\u9ed8\u8ba4\u8bbe\u7f6e\u4e3a<code class=\"literal\">ascii</code>\u3002\u6b64\u9009\u9879\u4ec5\u5f71\u54cd<code class=\"literal\">aligned</code>\u548c<code class=\"literal\">wrapped</code>\u8f93\u51fa\u683c\u5f0f\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">ascii</code>\u6837\u5f0f\u4f7f\u7528\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u53f3\u8fb9\u7f18\u7684<code class=\"literal\">+</code>\u7b26\u53f7\u8868\u793a\u3002\u5f53<code class=\"literal\">wrapped</code>\u683c\u5f0f\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u628a\u6570\u636e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u4f1a\u5728\u7b2c\u4e00\u884c\u7684\u53f3\u8fb9\u7f18\u663e\u793a\u4e00\u4e2a\u70b9\uff08<code class=\"literal\">.</code>\uff09\uff0c\u5e76\u5728\u4e0b\u4e00\u884c\u7684\u5de6\u8fb9\u7f18\u518d\u6b21\u663e\u793a\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">old-ascii</code>\u6837\u5f0f\u4f7f\u7528\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\uff0c\u91c7\u7528<span class=\"productname\">PostgreSQL</span> 8.4 \u53ca\u66f4\u65e9\u7248\u672c\u7684\u683c\u5f0f\u6837\u5f0f\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u66ff\u4ee3\u5de6\u4fa7\u5217\u5206\u9694\u7b26\u7684<code class=\"literal\">:</code>\u7b26\u53f7\u8868\u793a\u3002\u5f53\u6570\u636e\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u5219\u7528<code class=\"literal\">;</code>\u7b26\u53f7\u66ff\u4ee3\u5de6\u4fa7\u5217\u5206\u9694\u7b26\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">unicode</code>\u6837\u5f0f\u4f7f\u7528 Unicode \u6846\u7ebf\u7ed8\u5236\u5b57\u7b26\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u53f3\u8fb9\u7f18\u7684\u56de\u8f66\u7b26\u53f7\u8868\u793a\u3002\u5f53\u6570\u636e\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u4f1a\u5728\u7b2c\u4e00\u884c\u7684\u53f3\u8fb9\u7f18\u663e\u793a\u7701\u7565\u53f7\u7b26\u53f7\uff0c\u5e76\u5728\u4e0b\u4e00\u884c\u7684\u5de6\u8fb9\u7f18\u518d\u6b21\u663e\u793a\u3002</p>\n<p lang=\"zh\">\u5f53<code class=\"literal\">border</code>\u8bbe\u7f6e\u5927\u4e8e\u96f6\u65f6\uff0c<code class=\"literal\">linestyle</code>\u9009\u9879\u8fd8\u51b3\u5b9a\u7528\u54ea\u4e9b\u5b57\u7b26\u7ed8\u5236\u8fb9\u6846\u7ebf\u3002\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\u5728\u4efb\u4f55\u73af\u5883\u4e2d\u90fd\u53ef\u7528\uff0c\u4f46\u5728\u652f\u6301 Unicode \u7684\u663e\u793a\u8bbe\u5907\u4e0a\uff0cUnicode \u5b57\u7b26\u66f4\u7f8e\u89c2\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-NULL\"><span class=\"term\"><code class=\"literal\">null</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u7528\u4e8e\u4ee3\u66ff\u7a7a\u503c\u6253\u5370\u7684\u5b57\u7b26\u4e32\u3002\u9ed8\u8ba4\u4e0d\u6253\u5370\u4efb\u4f55\u5185\u5bb9\uff0c\u8fd9\u5f88\u5bb9\u6613\u88ab\u8bef\u8ba4\u4e3a\u7a7a\u5b57\u7b26\u4e32\u3002\u4f8b\u5982\uff0c\u4f60\u53ef\u80fd\u66f4\u559c\u6b22\u4f7f\u7528<code class=\"literal\">\\pset null '(null)'</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-NUMERICLOCALE\"><span class=\"term\"><code class=\"literal\">numericlocale</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u4f7f\u7528\u533a\u57df\u8bbe\u7f6e\u7279\u5b9a\u7684\u5b57\u7b26\u6765\u5206\u9694\u5c0f\u6570\u70b9\u5de6\u4fa7\u7684\u6570\u5b57\u7ec4\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5e38\u89c4\u6570\u5b57\u8f93\u51fa\u548c\u533a\u57df\u8bbe\u7f6e\u7279\u5b9a\u7684\u6570\u5b57\u8f93\u51fa\u4e4b\u95f4\u5207\u6362\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-PAGER\"><span class=\"term\"><code class=\"literal\">pager</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u63a7\u5236\u67e5\u8be2\u7ed3\u679c\u4e0e psql \u5e2e\u52a9\u8f93\u51fa\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\u7684\u65b9\u5f0f\u3002\u5f53 pager \u4e3a off \u65f6\uff0c\u4e0d\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\uff1b\u4e3a on \u65f6\uff0c\u5728\u9002\u5f53\u60c5\u51b5\u4e0b\u4f7f\u7528\uff0c\u5373\u8f93\u51fa\u76ee\u6807\u662f\u7ec8\u7aef\u4e14\u5185\u5bb9\u65e0\u6cd5\u5728\u5c4f\u5e55\u5185\u663e\u793a\u5b8c\u3002\u8bbe\u4e3a always \u65f6\uff0c\u6240\u6709\u7ec8\u7aef\u8f93\u51fa\u5747\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\uff0c\u65e0\u8bba\u662f\u5426\u80fd\u5728\u5c4f\u5e55\u5185\u663e\u793a\u5b8c\u3002\u4e0d\u5e26\u503c\u7684 \\pset pager \u4f1a\u5207\u6362\u5206\u9875\u7684\u5f00\u5173\u72b6\u6001\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u8bbe\u7f6e\u4e86\u73af\u5883\u53d8\u91cf<code class=\"envar\">PSQL_PAGER</code>\u6216<code class=\"envar\">PAGER</code>\uff0c\u9700\u8981\u5206\u9875\u7684\u8f93\u51fa\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6307\u5b9a\u7a0b\u5e8f\u3002\u5426\u5219\uff0c\u4f7f\u7528\u4e0e\u5e73\u53f0\u6709\u5173\u7684\u9ed8\u8ba4\u7a0b\u5e8f\uff08\u5982<code class=\"filename\">more</code>\uff09\u3002</p>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 <code class=\"literal\">\\watch</code> \u547d\u4ee4\u91cd\u590d\u6267\u884c\u67e5\u8be2\u65f6\uff0c\u5728 Unix \u7cfb\u7edf\u4e0a\u4f1a\u6539\u7528\u73af\u5883\u53d8\u91cf <code class=\"envar\">PSQL_WATCH_PAGER</code> \u6765\u67e5\u627e\u5206\u9875\u5668\u7a0b\u5e8f\u3002\u4e4b\u6240\u4ee5\u5355\u72ec\u914d\u7f6e\u5b83\uff0c\u662f\u56e0\u4e3a\u8fd9\u79cd\u7528\u6cd5\u53ef\u80fd\u4f1a\u8ba9\u4f20\u7edf\u5206\u9875\u5668\u65e0\u6cd5\u6b63\u5e38\u5de5\u4f5c\uff1b\u4f46\u5b83\u53ef\u7528\u4e8e\u628a\u8f93\u51fa\u53d1\u9001\u7ed9\u80fd\u591f\u7406\u89e3 <span class=\"application\">psql</span> \u8f93\u51fa\u683c\u5f0f\u7684\u5de5\u5177\uff08\u4f8b\u5982 <code class=\"filename\">pspg --stream</code>\uff09\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-PAGER-MIN-LINES\"><span class=\"term\"><code class=\"literal\">pager_min_lines</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u82e5 pager_min_lines \u5927\u4e8e\u5c4f\u5e55\u9875\u9ad8\uff0c\u53ea\u6709\u8f93\u51fa\u884c\u6570\u8fbe\u5230\u8be5\u503c\u65f6\u624d\u8c03\u7528\u5206\u9875\u7a0b\u5e8f\u3002\u9ed8\u8ba4\u503c\u4e3a 0\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-RECORDSEP\"><span class=\"term\"><code class=\"literal\">recordsep</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u8bb0\u5f55\uff08\u884c\uff09\u5206\u9694\u7b26\u3002\u9ed8\u8ba4\u4e3a\u6362\u884c\u7b26\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-RECORDSEP-ZERO\"><span class=\"term\"><code class=\"literal\">recordsep_zero</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u8bbe\u7f6e\u4e3a\u96f6\u5b57\u8282\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-TABLEATTR\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">tableattr</code>\uff08\u6216<code class=\"literal\">T</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\u5728<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u4e2d\uff0c\u8fd9\u6307\u5b9a\u8981\u653e\u5728<code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u5c5e\u6027\uff0c\u4f8b\u5982<code class=\"literal\">cellpadding</code>\u6216<code class=\"literal\">bgcolor</code>\u3002\u8bf7\u6ce8\u610f\uff0c\u4f60\u53ef\u80fd\u4e0d\u9700\u8981\u5728\u8fd9\u91cc\u6307\u5b9a<code class=\"literal\">border</code>\uff0c\u56e0\u4e3a<code class=\"literal\">\\pset border</code>\u5df2\u7ecf\u8d1f\u8d23\u5904\u7406\u5b83\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u8868\u683c\u5c5e\u6027\u3002</p>\n<p lang=\"zh\">\u5728<code class=\"literal\">latex-longtable</code>\u683c\u5f0f\u4e2d\uff0c\u8fd9\u63a7\u5236\u6bcf\u4e2a\u5305\u542b\u5de6\u5bf9\u9f50\u6570\u636e\u7c7b\u578b\u7684\u5217\u7684\u5bbd\u5ea6\u6bd4\u4f8b\u3002\u5b83\u4ee5\u7a7a\u767d\u5206\u9694\u7684\u503c\u5217\u8868\u6307\u5b9a\uff0c\u4f8b\u5982<code class=\"literal\">'0.2 0.2 0.6'</code>\u3002\u672a\u6307\u5b9a\u7684\u8f93\u51fa\u5217\u4f7f\u7528\u6700\u540e\u6307\u5b9a\u7684\u503c\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-TITLE\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">title</code>\uff08\u6216<code class=\"literal\">C</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u968f\u540e\u6253\u5370\u7684\u6240\u6709\u8868\u683c\u7684\u6807\u9898\u3002\u8fd9\u53ef\u4ee5\u4e3a\u8f93\u51fa\u63d0\u4f9b\u63cf\u8ff0\u6027\u6807\u7b7e\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u6807\u9898\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-TUPLES-ONLY\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">tuples_only</code>\uff08\u6216<code class=\"literal\">t</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u4ec5\u5143\u7ec4\u6a21\u5f0f\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5e38\u89c4\u8f93\u51fa\u548c\u4ec5\u5143\u7ec4\u8f93\u51fa\u4e4b\u95f4\u5207\u6362\u3002\u5e38\u89c4\u8f93\u51fa\u5305\u542b\u5217\u6807\u9898\u3001\u8868\u683c\u6807\u9898\u548c\u5404\u79cd\u9875\u811a\u7b49\u9644\u52a0\u4fe1\u606f\u3002\u5728\u4ec5\u5143\u7ec4\u6a21\u5f0f\u4e0b\uff0c\u53ea\u663e\u793a\u5b9e\u9645\u7684\u8868\u683c\u6570\u636e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-UNICODE-BORDER-LINESTYLE\"><span class=\"term\"><code class=\"literal\">unicode_border_linestyle</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u8fb9\u6846\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-UNICODE-COLUMN-LINESTYLE\"><span class=\"term\"><code class=\"literal\">unicode_column_linestyle</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u5217\u5206\u9694\u7ebf\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-UNICODE-HEADER-LINESTYLE\"><span class=\"term\"><code class=\"literal\">unicode_header_linestyle</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u8868\u5934\u5206\u9694\u7ebf\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-XHEADER-WIDTH\"><span class=\"term\"><code class=\"literal\">xheader_width</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6269\u5c55\u8f93\u51fa\u6807\u9898\u7684\u6700\u5927\u5bbd\u5ea6\u8bbe\u4e3a full\uff08\u9ed8\u8ba4\u503c\uff09\u3001column\u3001page \u6216\u4e00\u4e2a\u6574\u6570\u503c\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">full</code>\uff1a\u6269\u5c55\u8868\u5934\u4e0d\u622a\u65ad\uff0c\u5176\u5bbd\u5ea6\u4e0e\u6700\u5bbd\u7684\u8f93\u51fa\u884c\u76f8\u540c\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">column</code>\uff1a\u5c06\u8868\u5934\u884c\u622a\u65ad\u4e3a\u7b2c\u4e00\u5217\u7684\u5bbd\u5ea6\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">page</code>\uff1a\u5c06\u8868\u5934\u884c\u622a\u65ad\u4e3a\u7ec8\u7aef\u5bbd\u5ea6\u3002</p>\n<p lang=\"zh\">\u6574\u6570\u503c\uff1a\u7cbe\u786e\u6307\u5b9a\u6807\u9898\u884c\u7684\u6700\u5927\u5bbd\u5ea6\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8fd9\u4e9b\u4e0d\u540c\u683c\u5f0f\u7684\u5916\u89c2\u793a\u4f8b\u53ef\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-EXAMPLES\" title=\"\u793a\u4f8b\">\u793a\u4f8b</a>\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u6709\u5404\u79cd\u5feb\u6377\u547d\u4ee4\u7528\u4e8e<code class=\"command\">\\pset</code>\u3002\u8bf7\u53c2\u89c1<code class=\"command\">\\a</code>\u3001<code class=\"command\">\\C</code>\u3001<code class=\"command\">\\f</code>\u3001<code class=\"command\">\\H</code>\u3001<code class=\"command\">\\t</code>\u3001<code class=\"command\">\\T</code>\u548c<code class=\"command\">\\x</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-QUIT\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\q</code>\u6216<code class=\"literal\">\\quit</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9000\u51fa<span class=\"application\">psql</span>\u7a0b\u5e8f\u3002\u5728\u811a\u672c\u6587\u4ef6\u4e2d\uff0c\u53ea\u4f1a\u7ec8\u6b62\u8be5\u811a\u672c\u7684\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-QECHO\"><span class=\"term\"><code class=\"literal\">\\qecho <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u547d\u4ee4\u4e0e<code class=\"command\">\\echo</code>\u76f8\u540c\uff0c\u53ea\u662f\u8f93\u51fa\u4f1a\u5199\u5165\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u7684\u67e5\u8be2\u8f93\u51fa\u901a\u9053\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-RESET\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\r</code>\u6216<code class=\"literal\">\\reset</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u91cd\u7f6e\uff08\u6e05\u7a7a\uff09\u67e5\u8be2\u7f13\u51b2\u533a\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-RESTRICT\"><span class=\"term\"><code class=\"literal\">\\restrict <em class=\"replaceable\"><code>restrict_key</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528\u7ed9\u5b9a\u7684\u5bc6\u94a5\u8fdb\u5165<span class=\"quote\">\u201c<span class=\"quote\">\u53d7\u9650</span>\u201d</span>\u6a21\u5f0f\u3002\u5728\u8be5\u6a21\u5f0f\u4e0b\uff0c\u552f\u4e00\u5141\u8bb8\u7684\u5143\u547d\u4ee4\u662f\u7528\u4e8e\u9000\u51fa\u53d7\u9650\u6a21\u5f0f\u7684<code class=\"command\">\\unrestrict</code>\u3002\u5bc6\u94a5\u53ea\u80fd\u5305\u542b\u5b57\u6bcd\u6570\u5b57\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4e3b\u8981\u7528\u4e8e pg_dump\u3001pg_dumpall \u548c pg_restore \u751f\u6210\u7684\u7eaf\u6587\u672c\u8f6c\u50a8\uff0c\u4e5f\u53ef\u80fd\u9002\u7528\u4e8e\u5176\u4ed6\u573a\u666f\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-S\"><span class=\"term\"><code class=\"literal\">\\s [ <em class=\"replaceable\"><code>filename</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u5386\u53f2\u8bb0\u5f55\u5230<em class=\"replaceable\"><code>filename</code></em>\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5386\u53f2\u8bb0\u5f55\u5c06\u88ab\u5199\u5165\u6807\u51c6\u8f93\u51fa\uff08\u5982\u679c\u9002\u7528\uff0c\u5c06\u4f7f\u7528\u5206\u9875\u5668\uff09\u3002\u5982\u679c<span class=\"application\">psql</span>\u5728\u6784\u5efa\u65f6\u6ca1\u6709\u4f7f\u7528<span class=\"application\">Readline</span>\u652f\u6301\uff0c\u5219\u6b64\u547d\u4ee4\u4e0d\u53ef\u7528\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-SET\"><span class=\"term\"><code class=\"literal\">\\set [ <em class=\"replaceable\"><code>name</code></em> [ <em class=\"replaceable\"><code>value</code></em> [ ... ] ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e<span class=\"application\">psql</span>\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u4e3a<em class=\"replaceable\"><code>value</code></em>\uff0c\u5982\u679c\u7ed9\u51fa\u591a\u4e2a\u503c\uff0c\u5219\u8bbe\u7f6e\u4e3a\u6240\u6709\u503c\u7684\u8fde\u63a5\u3002\u5982\u679c\u53ea\u7ed9\u51fa\u4e00\u4e2a\u53c2\u6570\uff0c\u5219\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\u503c\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u8bbe\u7f6e\uff0c\u8bf7\u4f7f\u7528<code class=\"command\">\\unset</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\"><code class=\"command\">\\set</code>\u6ca1\u6709\u4efb\u4f55\u53c2\u6570\u65f6\uff0c\u663e\u793a\u5f53\u524d\u8bbe\u7f6e\u7684\u6240\u6709<span class=\"application\">psql</span>\u53d8\u91cf\u7684\u540d\u79f0\u548c\u503c\u3002</p>\n<p lang=\"zh\">\u6709\u6548\u7684\u53d8\u91cf\u540d\u53ef\u4ee5\u5305\u542b\u5b57\u6bcd\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u3002\u6709\u5173\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002\u53d8\u91cf\u540d\u533a\u5206\u5927\u5c0f\u5199\u3002</p>\n<p lang=\"zh\">\u67d0\u4e9b\u53d8\u91cf\u662f\u7279\u6b8a\u7684\uff0c\u5b83\u4eec\u63a7\u5236<span class=\"application\">psql</span>\u7684\u884c\u4e3a\u6216\u8005\u81ea\u52a8\u8bbe\u7f6e\u4ee5\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u3002\u8fd9\u4e9b\u53d8\u91cf\u5728\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u4e2d\u6709\u6587\u6863\u8bb0\u5f55\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u4e0e<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4<a class=\"link\" href=\"/docs/18/sql-set.html\" title=\"SET\"><code class=\"command\">SET</code></a>\u65e0\u5173\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-SETENV\"><span class=\"term\"><code class=\"literal\">\\setenv <em class=\"replaceable\"><code>name</code></em> [ <em class=\"replaceable\"><code>value</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u4e3a<em class=\"replaceable\"><code>value</code></em>\uff0c\u6216\u8005\u5982\u679c\u672a\u63d0\u4f9b<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3002\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\setenv PAGER less</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>\\setenv LESS -imx4F</code></strong>\n</pre>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-SF\"><span class=\"term\"><code class=\"literal\">\\sf[+] <em class=\"replaceable\"><code>function_description</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u663e\u793a\u6307\u5b9a\u51fd\u6570\u6216\u8fc7\u7a0b\u7684\u5b9a\u4e49\uff0c\u4ee5<code class=\"command\">CREATE OR REPLACE FUNCTION</code>\u6216 <code class=\"command\">CREATE OR REPLACE PROCEDURE</code>\u547d\u4ee4\u7684\u5f62\u5f0f\u5448\u73b0\u3002\u5b9a\u4e49\u5c06\u6253\u5370\u5230\u5f53\u524d\u67e5\u8be2\u8f93\u51fa\u901a\u9053\uff0c\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\">\u76ee\u6807\u51fd\u6570\u53ef\u4ec5\u7528\u540d\u79f0\u6307\u5b9a\uff0c\u4e5f\u53ef\u7528\u540d\u79f0\u548c\u53c2\u6570\u6307\u5b9a\uff0c\u4f8b\u5982 foo(integer, text)\u3002\u82e5\u6709\u591a\u4e2a\u540c\u540d\u51fd\u6570\uff0c\u5219\u5fc5\u987b\u63d0\u4f9b\u53c2\u6570\u7c7b\u578b\u3002</p>\n<p lang=\"zh\">\u5728\u547d\u4ee4\u540d\u540e\u6dfb\u52a0 +\uff0c\u4f1a\u4e3a\u8f93\u51fa\u884c\u7f16\u53f7\uff0c\u51fd\u6570\u4f53\u7b2c\u4e00\u884c\u4e3a\u7b2c 1 \u884c\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\sf</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-SV\"><span class=\"term\"><code class=\"literal\">\\sv[+] <em class=\"replaceable\"><code>view_name</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u6307\u5b9a\u89c6\u56fe\u7684\u5b9a\u4e49\uff0c\u5e76\u4ee5<code class=\"command\">CREATE OR REPLACE VIEW</code>\u547d\u4ee4\u7684\u5f62\u5f0f\u663e\u793a\u3002\u5b9a\u4e49\u4f1a\u6253\u5370\u5230\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u7684\u5f53\u524d\u67e5\u8be2\u8f93\u51fa\u901a\u9053\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u547d\u4ee4\u540d\u79f0\u540e\u6dfb\u52a0<code class=\"literal\">+</code>\uff0c\u90a3\u4e48\u8f93\u51fa\u884c\u5c06\u4ece1\u5f00\u59cb\u7f16\u53f7\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\sv</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PIPELINE\"><span class=\"term\"><code class=\"literal\">\\startpipeline</code><br/></span><span class=\"term\"><code class=\"literal\">\\sendpipeline</code><br/></span><span class=\"term\"><code class=\"literal\">\\syncpipeline</code><br/></span><span class=\"term\"><code class=\"literal\">\\endpipeline</code><br/></span><span class=\"term\"><code class=\"literal\">\\flushrequest</code><br/></span><span class=\"term\"><code class=\"literal\">\\flush</code><br/></span><span class=\"term\"><code class=\"literal\">\\getresults [ <em class=\"replaceable\"><code>number_results</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u7ec4\u547d\u4ee4\u5b9e\u73b0 SQL \u8bed\u53e5\u7684\u7ba1\u9053\u5316\u3002\u4e00\u4e2a\u7ba1\u9053\u5fc5\u987b\u4ee5 <code class=\"command\">\\startpipeline</code> \u5f00\u59cb\uff0c\u5e76\u4ee5 <code class=\"command\">\\endpipeline</code> \u7ed3\u675f\u3002\u5176\u95f4\u53ef\u4ee5\u51fa\u73b0\u4efb\u610f\u6570\u91cf\u7684 <code class=\"command\">\\syncpipeline</code> \u547d\u4ee4\uff0c\u5b83\u4f1a\u53d1\u9001\u4e00\u6761<a class=\"link\" href=\"/docs/18/protocol-flow.html#PROTOCOL-FLOW-EXT-QUERY\" title=\"54.2.3.\u00a0\u6269\u5c55\u67e5\u8be2\">\u540c\u6b65\u6d88\u606f</a>\uff0c\u800c\u4e0d\u4f1a\u7ed3\u675f\u5f53\u524d\u7ba1\u9053\uff0c\u4e5f\u4e0d\u4f1a\u5237\u65b0\u53d1\u9001\u7f13\u51b2\u533a\u3002\u5728\u7ba1\u9053\u6a21\u5f0f\u4e0b\uff0c\u8bed\u53e5\u4f1a\u88ab\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u4e0d\u7b49\u5f85\u524d\u9762\u8bed\u53e5\u7684\u7ed3\u679c\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/18/libpq-pipeline-mode.html\" title=\"32.5.\u00a0\u7ba1\u9053\u6a21\u5f0f\">\u7b2c\u00a032.5\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u7ba1\u9053\u8fdb\u884c\u671f\u95f4\u6267\u884c\u7684\u6240\u6709\u67e5\u8be2\u90fd\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002\u4ee5\u5206\u53f7\u7ed3\u675f\u7684\u67e5\u8be2\u4f1a\u88ab\u8ffd\u52a0\u5230\u7ba1\u9053\u4e2d\u3002\u5143\u547d\u4ee4 <code class=\"literal\">\\bind</code>\u3001<code class=\"literal\">\\bind_named</code>\u3001<code class=\"literal\">\\close_prepared</code> \u548c <code class=\"literal\">\\parse</code> \u53ef\u4ee5\u5728\u8fdb\u884c\u4e2d\u7684\u7ba1\u9053\u91cc\u4f7f\u7528\u3002\u7ba1\u9053\u8fdb\u884c\u671f\u95f4\uff0c<code class=\"literal\">\\sendpipeline</code> \u4f1a\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u8ffd\u52a0\u5230\u7ba1\u9053\u4e2d\u3002\u5176\u4ed6\u5143\u547d\u4ee4\uff0c\u5982 <code class=\"literal\">\\g</code>\u3001<code class=\"literal\">\\gx</code> \u6216 <code class=\"literal\">\\gdesc</code>\uff0c\u5219\u4e0d\u5141\u8bb8\u5728\u7ba1\u9053\u6a21\u5f0f\u4e2d\u4f7f\u7528\u3002</p>\n<p lang=\"zh\"><code class=\"command\">\\flushrequest</code> \u4f1a\u5411\u7ba1\u9053\u8ffd\u52a0\u4e00\u6761 flush \u547d\u4ee4\uff0c\u4f7f\u5f97\u53ef\u4ee5\u5728\u4e0d\u53d1\u9001 sync \u6216\u7ed3\u675f\u7ba1\u9053\u7684\u60c5\u51b5\u4e0b\u901a\u8fc7 <code class=\"command\">\\getresults</code> \u8bfb\u53d6\u7ed3\u679c\u3002<code class=\"command\">\\getresults</code> \u4f1a\u81ea\u52a8\u5c06\u5c1a\u672a\u53d1\u9001\u7684\u6570\u636e\u63a8\u9001\u5230\u670d\u52a1\u5668\u3002<code class=\"command\">\\flush</code> \u53ef\u7528\u4e8e\u624b\u52a8\u63a8\u9001\u672a\u53d1\u9001\u7684\u6570\u636e\u3002</p>\n<p lang=\"zh\"><code class=\"command\">\\getresults</code> \u63a5\u53d7\u4e00\u4e2a\u53ef\u9009\u7684 <em class=\"replaceable\"><code>number_results</code></em> \u53c2\u6570\u3002\u5982\u679c\u63d0\u4f9b\uff0c\u5219\u53ea\u8bfb\u53d6\u524d <em class=\"replaceable\"><code>number_results</code></em> \u4e2a\u5f85\u5904\u7406\u7ed3\u679c\u3002\u82e5\u7701\u7565\u8be5\u53c2\u6570\u6216\u5176\u503c\u4e3a <code class=\"literal\">0</code>\uff0c\u5219\u8bfb\u53d6\u6240\u6709\u5f85\u5904\u7406\u7ed3\u679c\u3002</p>\n<p lang=\"zh\">\u5f53\u7ba1\u9053\u6a21\u5f0f\u5904\u4e8e\u6d3b\u52a8\u72b6\u6001\u65f6\uff0c\u53ef\u4f7f\u7528\u4e00\u4e2a\u4e13\u7528\u7684\u63d0\u793a\u7b26\u53d8\u91cf\u6765\u62a5\u544a\u7ba1\u9053\u72b6\u6001\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PROMPTING-P-UC\"><code class=\"literal\">%P</code></a>\u3002</p>\n<p lang=\"zh\"><code class=\"command\">COPY</code> \u5728\u7ba1\u9053\u6a21\u5f0f\u4e2d\u4e0d\u652f\u6301\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\startpipeline\nSELECT * FROM pg_class;\nSELECT 1 \\bind \\sendpipeline\n\\flushrequest\n\\getresults\n\\endpipeline\n</pre>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-T-LC\"><span class=\"term\"><code class=\"literal\">\\t</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u8f93\u51fa\u4e2d\u7684\u5217\u540d\u6807\u9898\u548c\u884c\u6570\u9875\u811a\u7684\u663e\u793a\u72b6\u6001\u3002\u8fd9\u4e2a\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset tuples_only</code>\uff0c\u63d0\u4f9b\u5b83\u662f\u4e3a\u4e86\u4f7f\u7528\u65b9\u4fbf\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-T-UC\"><span class=\"term\"><code class=\"literal\">\\T <em class=\"replaceable\"><code>table_options</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728<acronym class=\"acronym\">HTML</acronym>\u8f93\u51fa\u683c\u5f0f\u4e2d\u653e\u5728<code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u5c5e\u6027\u3002\u8fd9\u4e2a\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset tableattr <em class=\"replaceable\"><code>table_options</code></em></code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-TIMING\"><span class=\"term\"><code class=\"literal\">\\timing [ <em class=\"replaceable\"><code>on</code></em> | <em class=\"replaceable\"><code>off</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5e26\u53c2\u6570\u65f6\uff0c\u5f00\u542f\u6216\u5173\u95ed\u6bcf\u6761 SQL \u8bed\u53e5\u6267\u884c\u8017\u65f6\u7684\u663e\u793a\u3002\u4e0d\u5e26\u53c2\u6570\u65f6\uff0c\u5207\u6362\u663e\u793a\u7684\u5f00\u5173\u72b6\u6001\u3002\u8017\u65f6\u4ee5\u6beb\u79d2\u663e\u793a\uff1b\u8d85\u8fc7 1 \u79d2\u7684\u65f6\u95f4\u95f4\u9694\u8fd8\u4f1a\u4ee5\u5206\u949f:\u79d2\u7684\u683c\u5f0f\u663e\u793a\uff0c\u5fc5\u8981\u65f6\u6dfb\u52a0\u5c0f\u65f6\u548c\u5929\u5b57\u6bb5\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-UNRESTRICT\"><span class=\"term\"><code class=\"literal\">\\unrestrict <em class=\"replaceable\"><code>restrict_key</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u9000\u51fa<span class=\"quote\">\u201c<span class=\"quote\">\u53d7\u9650</span>\u201d</span>\u6a21\u5f0f\uff08\u5373\u6240\u6709\u5176\u4ed6\u5143\u547d\u4ee4\u90fd\u88ab\u963b\u6b62\u7684\u6a21\u5f0f\uff09\uff0c\u524d\u63d0\u662f\u6307\u5b9a\u7684\u5bc6\u94a5\u4e0e\u8fdb\u5165\u53d7\u9650\u6a21\u5f0f\u65f6\u4f20\u7ed9<code class=\"command\">\\restrict</code>\u7684\u5bc6\u94a5\u5339\u914d\u3002</p>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4e3b\u8981\u7528\u4e8e pg_dump\u3001pg_dumpall \u548c pg_restore \u751f\u6210\u7684\u7eaf\u6587\u672c\u8f6c\u50a8\uff0c\u4e5f\u53ef\u80fd\u9002\u7528\u4e8e\u5176\u4ed6\u573a\u666f\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u5269\u4f59\u884c\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\unrestrict</code>\u7684\u53c2\u6570\uff0c\u5e76\u4e14\u4e0d\u4f1a\u6267\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-UNSET\"><span class=\"term\"><code class=\"literal\">\\unset <em class=\"replaceable\"><code>name</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u53d6\u6d88\u8bbe\u7f6e\uff08\u5220\u9664\uff09<span class=\"application\">psql</span>\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u3002</p>\n<p lang=\"zh\">\u5927\u591a\u6570\u63a7\u5236<span class=\"application\">psql</span>\u884c\u4e3a\u7684\u53d8\u91cf\u4e0d\u80fd\u53d6\u6d88\u8bbe\u7f6e\uff1b\u5bf9\u4e8e\u8fd9\u4e9b\u53d8\u91cf\uff0c<code class=\"literal\">\\unset</code>\u547d\u4ee4\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u5176\u8bbe\u7f6e\u4e3a\u9ed8\u8ba4\u503c\u3002\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-WRITE\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\w</code> \u6216 <code class=\"literal\">\\write</code> <em class=\"replaceable\"><code>filename</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\w</code> \u6216 <code class=\"literal\">\\write</code> <code class=\"literal\">|</code><em class=\"replaceable\"><code>command</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u5199\u5165\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u9012\u7ed9 shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6539\u4e3a\u5199\u5165\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\uff0c\u5219\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u7684\u5185\u5bb9\u53ea\u4f1a\u539f\u6837\u4f20\u9012\u7ed9 shell\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-WARN\"><span class=\"term\"><code class=\"literal\">\\warn <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u547d\u4ee4\u4e0e<code class=\"command\">\\echo</code>\u547d\u4ee4\u76f8\u540c\uff0c\u53ea\u662f\u8f93\u51fa\u5c06\u88ab\u5199\u5165<span class=\"application\">psql</span>\u7684\u6807\u51c6\u9519\u8bef\u901a\u9053\uff0c\u800c\u4e0d\u662f\u6807\u51c6\u8f93\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-WATCH\"><span class=\"term\"><code class=\"literal\">\\watch [ i[nterval]=<em class=\"replaceable\"><code>seconds</code></em> ] [ c[ount]=<em class=\"replaceable\"><code>times</code></em> ] [ m[in_rows]=<em class=\"replaceable\"><code>rows</code></em> ] [ <em class=\"replaceable\"><code>seconds</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u91cd\u590d\u6267\u884c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\uff08\u5982\u540c <code class=\"literal\">\\g</code> \u4e00\u6837\uff09\uff0c\u76f4\u5230\u88ab\u4e2d\u65ad\u3001\u67e5\u8be2\u5931\u8d25\u3001\u8fbe\u5230\u6267\u884c\u6b21\u6570\u4e0a\u9650\uff08\u5982\u679c\u7ed9\u5b9a\uff09\u6216\u67e5\u8be2\u8fd4\u56de\u7684\u884c\u6570\u4f4e\u4e8e\u6700\u5c0f\u8981\u6c42\u3002\u4e24\u6b21\u6267\u884c\u4e4b\u95f4\u7b49\u5f85\u6307\u5b9a\u7684\u79d2\u6570\uff08\u9ed8\u8ba4 2 \u79d2\uff09\u3002\u9ed8\u8ba4\u7b49\u5f85\u65f6\u95f4\u53ef\u901a\u8fc7\u53d8\u91cf<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-VARIABLES-WATCH-INTERVAL\"><code class=\"varname\">WATCH_INTERVAL</code></a>\u4fee\u6539\u3002\u4e3a\u4fdd\u6301\u5411\u540e\u517c\u5bb9\uff0c<em class=\"replaceable\"><code>seconds</code></em> \u53ef\u4ee5\u5e26\u6216\u4e0d\u5e26 <code class=\"literal\">interval=</code> \u524d\u7f00\u3002\u6bcf\u6b21\u67e5\u8be2\u7ed3\u679c\u90fd\u4f1a\u5e26\u6709\u4e00\u4e2a\u5934\u90e8\uff0c\u5176\u4e2d\u5305\u542b <code class=\"literal\">\\pset title</code> \u5b57\u7b26\u4e32\uff08\u5982\u679c\u6709\uff09\u3001\u67e5\u8be2\u5f00\u59cb\u65f6\u7684\u65f6\u95f4\u4ee5\u53ca\u5ef6\u8fdf\u95f4\u9694\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-X\"><span class=\"term\"><code class=\"literal\">\\x [ <em class=\"replaceable\"><code>on</code></em> | <em class=\"replaceable\"><code>off</code></em> | <em class=\"replaceable\"><code>auto</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u6216\u5207\u6362\u6269\u5c55\u8868\u683c\u683c\u5f0f\u6a21\u5f0f\u3002\u5b83\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset expanded</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-Z\"><span class=\"term\"><code class=\"literal\">\\z[Sx] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u53ca\u5176\u76f8\u5173\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002</p>\n<p lang=\"zh\">\u8fd9\u662f<code class=\"command\">\\dp</code>\u7684\u522b\u540d\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u663e\u793a\u6743\u9650</span>\u201d</span>\uff09\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-EXCLAMATION-MARK\"><span class=\"term\"><code class=\"literal\">\\! [ <em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u5e26\u53c2\u6570\u65f6\uff0c\u8fdb\u5165\u4e00\u4e2a\u5b50 shell\uff1b\u5b50 shell \u9000\u51fa\u540e\uff0c<span class=\"application\">psql</span>\u6062\u590d\u8fd0\u884c\u3002\u5e26\u53c2\u6570\u65f6\uff0c\u6267\u884c shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\!</code>\u7684\u53c2\u6570\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u5185\u5bb9\u4f1a\u539f\u6837\u4f20\u7ed9 shell\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-QUESTION-MARK\"><span class=\"term\"><code class=\"literal\">\\? [ <em class=\"replaceable\"><code>topic</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5e2e\u52a9\u4fe1\u606f\u3002\u53ef\u9009\u7684<em class=\"replaceable\"><code>topic</code></em>\u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a<code class=\"literal\">commands</code>\uff09\u9009\u62e9\u8981\u89e3\u91ca\u7684<span class=\"application\">psql</span>\u7684\u54ea\u4e2a\u90e8\u5206\uff1a<code class=\"literal\">commands</code>\u63cf\u8ff0<span class=\"application\">psql</span>\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b<code class=\"literal\">options</code>\u63cf\u8ff0\u53ef\u4ee5\u4f20\u9012\u7ed9<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c<code class=\"literal\">variables</code>\u663e\u793a\u5173\u4e8e<span class=\"application\">psql</span>\u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-SEMICOLON\"><span class=\"term\"><code class=\"literal\">\\;</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u53cd\u659c\u7ebf\u5206\u53f7\u4e0d\u50cf\u524d\u9762\u7684\u547d\u4ee4\u90a3\u6837\u662f\u4e00\u4e2a\u5143\u547d\u4ee4\uff1b\u76f8\u53cd\uff0c\u5b83\u53ea\u662f\u5728\u4e0d\u8fdb\u884c\u8fdb\u4e00\u6b65\u5904\u7406\u7684\u60c5\u51b5\u4e0b\u5c06\u4e00\u4e2a\u5206\u53f7\u6dfb\u52a0\u5230\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u3002</p>\n<p lang=\"zh\">\u901a\u5e38\uff0c<span class=\"application\">psql</span>\u4f1a\u5728\u5230\u8fbe\u547d\u4ee4\u7ed3\u675f\u7684\u5206\u53f7\u65f6\u7acb\u5373\u5c06SQL\u547d\u4ee4\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u5373\u4f7f\u5f53\u524d\u884c\u8fd8\u6709\u66f4\u591a\u8f93\u5165\u3002\u56e0\u6b64\uff0c\u4f8b\u5982\u8f93\u5165</p>\n<pre class=\"programlisting\">select 1; select 2; select 3;\n</pre>\n<p lang=\"zh\">\u5c06\u5bfc\u81f4\u4e09\u4e2aSQL\u547d\u4ee4\u5206\u522b\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u6bcf\u4e2a\u547d\u4ee4\u7684\u7ed3\u679c\u5728\u7ee7\u7eed\u4e0b\u4e00\u4e2a\u547d\u4ee4\u4e4b\u524d\u663e\u793a\u3002\u7136\u800c\uff0c\u8f93\u5165\u4e3a<code class=\"literal\">\\;</code>\u7684\u5206\u53f7\u4e0d\u4f1a\u89e6\u53d1\u547d\u4ee4\u5904\u7406\uff0c\u56e0\u6b64\u5b83\u4e4b\u524d\u548c\u4e4b\u540e\u7684\u547d\u4ee4\u5b9e\u9645\u4e0a\u88ab\u5408\u5e76\u5e76\u4f5c\u4e3a\u4e00\u4e2a\u8bf7\u6c42\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u56e0\u6b64\uff0c\u4f8b\u5982</p>\n<pre class=\"programlisting\">select 1\\; select 2\\; select 3;\n</pre>\n<p lang=\"zh\">\u4f1a\u5728\u9047\u5230\u524d\u9762\u6ca1\u6709\u53cd\u659c\u7ebf\u7684\u5206\u53f7\u65f6\uff0c\u5c06\u8fd9\u4e09\u4e2a SQL \u547d\u4ee4\u4f5c\u4e3a\u5355\u4e2a\u8bf7\u6c42\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u670d\u52a1\u5668\u4f1a\u5c06\u6b64\u7c7b\u8bf7\u6c42\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff0c\u9664\u975e\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u663e\u5f0f\u7684<code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code>\u547d\u4ee4\u5c06\u5176\u5206\u6210\u591a\u4e2a\u4e8b\u52a1\u3002\uff08\u6709\u5173\u670d\u52a1\u5668\u5982\u4f55\u5904\u7406\u591a\u67e5\u8be2\u5b57\u7b26\u4e32\u7684\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/18/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT\" title=\"54.2.2.1.\u00a0\u4e00\u4e2a\u7b80\u5355\u67e5\u8be2\u4e2d\u7684\u591a\u6761\u8bed\u53e5\">\u7b2c\u00a054.2.2.1\u00a0\u8282</a>\u3002\uff09</p>\n</dd>\n</dl>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-PATTERNS\">\n<h4 lang=\"zh\">\u6a21\u5f0f</h4>\n<p lang=\"zh\">\u5f88\u591a<code class=\"literal\">\\d</code>\u547d\u4ee4\u90fd\u53ef\u4ee5\u7528\u4e00\u4e2a<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\u6765\u6307\u5b9a\u8981\u88ab\u663e\u793a\u7684\u5bf9\u8c61\u540d\u79f0\u3002\u5728\u6700\u7b80\u5355\u7684\u60c5\u51b5\u4e0b\uff0c\u6a21\u5f0f\u6b63\u597d\u5c31\u662f\u8be5\u5bf9\u8c61\u7684\u51c6\u786e\u540d\u79f0\u3002\u5728\u6a21\u5f0f\u4e2d\u7684\u5b57\u7b26\u901a\u5e38\u4f1a\u88ab\u53d8\u6210\u5c0f\u5199\u5f62\u5f0f\uff08\u5c31\u50cf\u5728 SQL \u540d\u79f0\u4e2d\u90a3\u6837\uff09\uff0c\u4f8b\u5982<code class=\"literal\">\\dt FOO</code>\u5c06\u4f1a\u663e\u793a\u540d\u4e3a<code class=\"literal\">foo</code>\u7684\u8868\u3002\u5c31\u50cf\u5728 SQL \u540d\u79f0\u4e2d\u90a3\u6837\uff0c\u628a\u6a21\u5f0f\u653e\u5728\u53cc\u5f15\u53f7\u4e2d\u53ef\u4ee5\u963b\u6b62\u5b83\u88ab\u8f6c\u6362\u6210\u5c0f\u5199\u5f62\u5f0f\u3002\u5982\u679c\u9700\u8981\u5728\u4e00\u4e2a\u6a21\u5f0f\u4e2d\u5305\u62ec\u4e00\u4e2a\u771f\u6b63\u7684\u53cc\u5f15\u53f7\u5b57\u7b26\uff0c\u5219\u9700\u8981\u5728\u53cc\u5f15\u53f7\u5305\u56f4\u7684\u6587\u672c\u5185\u628a\u5b83\u5199\u6210\u4e24\u4e2a\u76f8\u90bb\u7684\u53cc\u5f15\u53f7\uff0c\u8fd9\u540c\u6837\u662f\u7b26\u5408 SQL \u52a0\u5f15\u53f7\u6807\u8bc6\u7b26\u7684\u89c4\u5219\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dt \"FOO\"\"BAR\"</code>\u5c06\u663e\u793a\u540d\u4e3a<code class=\"literal\">FOO\"BAR</code>\uff08\u4e0d\u662f<code class=\"literal\">foo\"bar</code>\uff09\u7684\u8868\u3002\u548c\u666e\u901a\u7684 SQL \u540d\u79f0\u89c4\u5219\u4e0d\u540c\uff0c\u4f60\u53ef\u4ee5\u53ea\u5728\u6a21\u5f0f\u7684\u4e00\u90e8\u5206\u5468\u56f4\u653e\u4e0a\u53cc\u5f15\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">\\dt FOO\"FOO\"BAR</code>\u5c06\u4f1a\u663e\u793a\u540d\u4e3a<code class=\"literal\">fooFOObar</code>\u7684\u8868\u3002</p>\n<p lang=\"zh\">\u53ea\u8981\u5b8c\u5168\u7701\u7565<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\uff0c<code class=\"literal\">\\d</code>\u547d\u4ee4\u5c31\u4f1a\u663e\u793a\u5f53\u524d\u6a21\u5f0f\u641c\u7d22\u8def\u5f84\u4e2d\u53ef\u89c1\u7684\u5168\u90e8\u5bf9\u8c61 \u2014 \u8fd9\u7b49\u4ef7\u4e8e\u7528<code class=\"literal\">*</code>\u4f5c\u4e3a\u6a21\u5f0f\uff08\u5982\u679c\u4e00\u4e2a\u5bf9\u8c61\u6240\u5728\u7684\u6a21\u5f0f\u4f4d\u4e8e\u641c\u7d22\u8def\u5f84\u4e2d\uff0c\u5e76\u4e14\u5728\u641c\u7d22\u8def\u5f84\u4e2d\u8be5\u6a21\u5f0f\u4e4b\u524d\u6ca1\u6709\u540c\u7c7b\u4e14\u540c\u540d\u7684\u5bf9\u8c61\uff0c\u5219\u8be5\u5bf9\u8c61\u5c31\u662f<em class=\"firstterm\">\u53ef\u89c1</em>\u7684\u3002\u8fd9\u8868\u793a\u53ef\u4ee5\u76f4\u63a5\u7528\u540d\u79f0\u5f15\u7528\u8be5\u5bf9\u8c61\uff0c\u800c\u4e0d\u9700\u8981\u7528\u6a21\u5f0f\u6765\u9650\u5b9a\uff09\u3002\u8981\u67e5\u770b\u6570\u636e\u5e93\u4e2d\u6240\u6709\u5bf9\u8c61\u800c\u4e0d\u8003\u8651\u5176\u53ef\u89c1\u6027\uff0c\u53ef\u4ee5\u628a<code class=\"literal\">*.*</code>\u7528\u4f5c\u6a21\u5f0f\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u653e\u5728\u4e00\u4e2a\u6a21\u5f0f\u4e2d\uff0c<code class=\"literal\">*</code>\u5c06\u5339\u914d\u4efb\u610f\u5b57\u7b26\u5e8f\u5217\uff08\u5305\u62ec\u7a7a\u5e8f\u5217\uff09\uff0c\u800c<code class=\"literal\">?</code>\u4f1a\u5339\u914d\u4efb\u610f\u7684\u5355\u4e2a\u5b57\u7b26\uff08\u8fd9\u79cd\u8bb0\u53f7\u65b9\u6cd5\u5c31\u50cf Unix shell \u7684\u6587\u4ef6\u540d\u6a21\u5f0f\u4e00\u6837\uff09\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dt int*</code>\u4f1a\u663e\u793a\u540d\u79f0\u4ee5<code class=\"literal\">int</code>\u5f00\u59cb\u7684\u8868\u3002\u4f46\u662f\u5982\u679c\u88ab\u653e\u5728\u53cc\u5f15\u53f7\u5185\uff0c<code class=\"literal\">*</code>\u548c<code class=\"literal\">?</code>\u5c31\u4f1a\u5931\u53bb\u8fd9\u4e9b\u7279\u6b8a\u542b\u4e49\u800c\u53d8\u6210\u666e\u901a\u7684\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u5305\u542b\u70b9\u53f7\uff08.\uff09\u7684\u5173\u7cfb\u540d\u6a21\u5f0f\u4f1a\u88ab\u89e3\u91ca\u4e3a\u6a21\u5f0f\u540d\u5339\u914d\u6a21\u5f0f\uff0c\u540e\u63a5\u5bf9\u8c61\u540d\u5339\u914d\u6a21\u5f0f\u3002\u4f8b\u5982\uff0c\\dt foo*.*bar* \u4f1a\u663e\u793a\u6240\u6709\u6a21\u5f0f\u540d\u4ee5 foo \u5f00\u5934\u3001\u8868\u540d\u5305\u542b bar \u7684\u8868\u3002\u6ca1\u6709\u70b9\u53f7\u65f6\uff0c\u53ea\u5339\u914d\u5f53\u524d\u6a21\u5f0f\u641c\u7d22\u8def\u5f84\u4e2d\u53ef\u89c1\u7684\u5bf9\u8c61\u3002\u540c\u6837\uff0c\u53cc\u5f15\u53f7\u5185\u7684\u70b9\u53f7\u4e0d\u5177\u6709\u7279\u6b8a\u542b\u4e49\uff0c\u6309\u5b57\u9762\u5339\u914d\u3002\u5305\u542b\u4e24\u4e2a\u70b9\u53f7\uff08.\uff09\u7684\u5173\u7cfb\u540d\u6a21\u5f0f\u4f1a\u88ab\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u540d\uff0c\u540e\u63a5\u6a21\u5f0f\u540d\u5339\u914d\u6a21\u5f0f\uff0c\u518d\u63a5\u5bf9\u8c61\u540d\u5339\u914d\u6a21\u5f0f\u3002\u6570\u636e\u5e93\u540d\u90e8\u5206\u4e0d\u4f5c\u4e3a\u5339\u914d\u6a21\u5f0f\uff0c\u5fc5\u987b\u4e0e\u5f53\u524d\u8fde\u63a5\u7684\u6570\u636e\u5e93\u540d\u79f0\u76f8\u540c\uff0c\u5426\u5219\u4f1a\u62a5\u9519\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7528\u4e8e\u5339\u914d\u6a21\u5f0f\u540d\u7684\u6a21\u5f0f\u5305\u542b\u4e00\u4e2a\u70b9\uff08<code class=\"literal\">.</code>\uff09\uff0c\u5219\u4f1a\u88ab\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u540d\uff0c\u540e\u63a5\u6a21\u5f0f\u540d\u7684\u5339\u914d\u6a21\u5f0f\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dn mydb.*foo*</code>\u4f1a\u663e\u793a\u540d\u79f0\u4e2d\u5305\u542b<code class=\"literal\">foo</code>\u7684\u6240\u6709\u6a21\u5f0f\u3002\u6570\u636e\u5e93\u540d\u90e8\u5206\u4e0d\u4f1a\u88ab\u5f53\u4f5c\u5339\u914d\u6a21\u5f0f\uff0c\u5fc5\u987b\u4e0e\u5f53\u524d\u8fde\u63a5\u7684\u6570\u636e\u5e93\u540d\u76f8\u540c\uff0c\u5426\u5219\u4f1a\u62a5\u9519\u3002</p>\n<p lang=\"zh\">\u9ad8\u7ea7\u7528\u6237\u53ef\u4ee5\u4f7f\u7528\u5b57\u7b26\u7c7b\u7b49\u6b63\u5219\u8868\u8fbe\u5f0f\u8bb0\u6cd5\uff0c\u5982<code class=\"literal\">[0-9]</code>\u53ef\u4ee5\u5339\u914d\u4efb\u610f\u6570\u5b57\u3002\u6240\u6709\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u90fd\u6309\u7167<a class=\"xref\" href=\"/docs/18/functions-matching.html#FUNCTIONS-POSIX-REGEXP\" title=\"9.7.3.\u00a0POSIX\u6b63\u5219\u8868\u8fbe\u5f0f\">\u7b2c\u00a09.7.3\u00a0\u8282</a>\u6240\u8bf4\u7684\u5de5\u4f5c\uff0c\u4ee5\u4e0b\u5b57\u7b26\u9664\u5916\uff1a<code class=\"literal\">.</code>\u4f1a\u6309\u7167\u4e0a\u9762\u6240\u8bf4\u7684\u4f5c\u4e3a\u4e00\u79cd\u5206\u9694\u7b26\uff0c<code class=\"literal\">*</code>\u4f1a\u88ab\u7ffb\u8bd1\u6210\u6b63\u5219\u8868\u8fbe\u5f0f\u8bb0\u53f7<code class=\"literal\">.*</code>\uff0c<code class=\"literal\">?</code>\u4f1a\u88ab\u7ffb\u8bd1\u6210<code class=\"literal\">.</code>\uff0c\u800c<code class=\"literal\">$</code>\u5219\u6309\u5b57\u9762\u610f\u601d\u5339\u914d\u3002\u6839\u636e\u9700\u8981\uff0c\u53ef\u4ee5\u7528<code class=\"literal\">?</code>\u6a21\u62df<code class=\"literal\">.</code>\uff0c\u7528<code class=\"literal\">(<em class=\"replaceable\"><code>R</code></em>+|)</code>\u6a21\u62df<code class=\"literal\"><em class=\"replaceable\"><code>R</code></em>*</code>\uff0c\u6216\u7528<code class=\"literal\">(<em class=\"replaceable\"><code>R</code></em>|)</code>\u6a21\u62df<code class=\"literal\"><em class=\"replaceable\"><code>R</code></em>?</code>\u3002<code class=\"literal\">$</code>\u4e0d\u9700\u8981\u4f5c\u4e3a\u4e00\u4e2a\u6b63\u5219\u8868\u8fbe\u5f0f\u5b57\u7b26\uff0c\u56e0\u4e3a\u6a21\u5f0f\u5fc5\u987b\u5339\u914d\u6574\u4e2a\u540d\u79f0\uff0c\u800c\u4e0d\u662f\u50cf\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5e38\u89c4\u7528\u6cd5\u90a3\u6837\u89e3\u91ca\uff08\u6362\u53e5\u8bdd\u8bf4\uff0c<code class=\"literal\">$</code>\u4f1a\u88ab\u81ea\u52a8\u5730\u8ffd\u52a0\u5230\u6a21\u5f0f\u4e0a\uff09\u3002\u5982\u679c\u4e0d\u5e0c\u671b\u8be5\u6a21\u5f0f\u7684\u5339\u914d\u4f4d\u7f6e\u88ab\u56fa\u5b9a\uff0c\u53ef\u4ee5\u5728\u5f00\u5934\u6216\u8005\u7ed3\u5c3e\u5199\u4e0a<code class=\"literal\">*</code>\u3002\u6ce8\u610f\u5728\u53cc\u5f15\u53f7\u5185\uff0c\u6240\u6709\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u4f1a\u5931\u53bb\u5176\u7279\u6b8a\u542b\u4e49\u5e76\u4e14\u6309\u7167\u5176\u5b57\u9762\u610f\u601d\u8fdb\u884c\u5339\u914d\u3002\u8fd8\u6709\uff0c\u5728\u64cd\u4f5c\u7b26\u540d\u79f0\u6a21\u5f0f\u4e2d\uff08\u5373\u4f5c\u4e3a<code class=\"literal\">\\do</code>\u7684\u53c2\u6570\uff09\uff0c\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u4e5f\u6309\u7167\u5b57\u9762\u610f\u601d\u8fdb\u884c\u5339\u914d\u3002</p>\n</div>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.21.8.5\">\n<h3 lang=\"zh\">\u9ad8\u7ea7\u7279\u6027</h3>\n<div class=\"refsect3\" id=\"APP-PSQL-VARIABLES\">\n<h4 lang=\"zh\">\u53d8\u91cf</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u63d0\u4f9b\u4e86\u548c\u666e\u901a Unix \u547d\u4ee4 shell \u76f8\u4f3c\u7684\u53d8\u91cf\u66ff\u6362\u7279\u6027\u3002\u53d8\u91cf\u7b80\u5355\u6765\u8bf4\u5c31\u662f\u4e00\u5bf9\u540d\u79f0/\u503c\uff0c\u5176\u4e2d\u503c\u53ef\u4ee5\u662f\u4efb\u610f\u957f\u5ea6\u7684\u4efb\u610f\u5b57\u7b26\u4e32\u3002\u540d\u79f0\u5fc5\u987b\u7531\u5b57\u6bcd\uff08\u5305\u62ec\u975e\u62c9\u4e01\u5b57\u6bcd\uff09\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u6784\u6210\u3002</p>\n<p lang=\"zh\">\u8981\u8bbe\u7f6e\u4e00\u4e2a\u53d8\u91cf\uff0c\u53ef\u4ee5\u4f7f\u7528<span class=\"application\">psql</span>\u7684\u5143\u547d\u4ee4<code class=\"command\">\\set</code>\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo bar</code></strong>\n</pre>\n<p lang=\"zh\">\u4f1a\u5c06<code class=\"literal\">foo</code>\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">bar</code>\u3002\u8981\u68c0\u7d22\u8be5\u53d8\u91cf\u7684\u5185\u5bb9\uff0c\u53ef\u4ee5\u5728\u540d\u79f0\u524d\u653e\u4e00\u4e2a\u5192\u53f7\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\echo :foo</code></strong>\nbar\n</pre>\n<p lang=\"zh\">\u8fd9\u5728\u5e38\u89c4 SQL \u547d\u4ee4\u548c\u5143\u547d\u4ee4\u4e2d\u5747\u6709\u6548\uff0c\u4e0b\u6587\u7684<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL \u63d2\u503c\">SQL \u63d2\u503c</a>\u4e2d\u6709\u66f4\u591a\u7ec6\u8282\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u8c03\u7528<code class=\"command\">\\set</code>\u65f6\u6ca1\u6709\u7b2c\u4e8c\u4e2a\u53c2\u6570\uff0c\u8be5\u53d8\u91cf\u4f1a\u88ab\u8bbe\u7f6e\u4e3a\u4e00\u4e2a\u7a7a\u5b57\u7b26\u4e32\u503c\u3002\u8981\u53d6\u6d88\u8bbe\u7f6e\uff08\u5373\u5220\u9664\uff09\u4e00\u4e2a\u53d8\u91cf\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4<code class=\"command\">\\unset</code>\u3002\u8981\u663e\u793a\u6240\u6709\u53d8\u91cf\u7684\u503c\uff0c\u5728\u8c03\u7528<code class=\"command\">\\set</code>\u65f6\u4e0d\u5e26\u4efb\u4f55\u53c2\u6570\u5373\u53ef\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\"><code class=\"command\">\\set</code>\u7684\u53c2\u6570\u670d\u4ece\u4e0e\u5176\u4ed6\u547d\u4ee4\u76f8\u540c\u7684\u66ff\u6362\u89c4\u5219\u3002\u56e0\u6b64\u53ef\u4ee5\u6784\u9020\u6709\u8da3\u7684\u5f15\u7528\uff0c\u4f8b\u5982<code class=\"literal\">\\set :foo 'something'</code>\u4ee5\u53ca\u5206\u522b\u5f97\u5230<span class=\"productname\">Perl</span>\u6216\u8005<span class=\"productname\"><acronym class=\"acronym\">PHP</acronym></span>\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u8f6f\u94fe\u63a5</span>\u201d</span>\u6216\u8005<span class=\"quote\">\u201c<span class=\"quote\">\u53ef\u53d8\u53d8\u91cf</span>\u201d</span>\u3002\u4e0d\u5e78\u7684\u662f\uff08\u6216\u8005\u5e78\u8fd0\u7684\u662f\uff1f\uff09\uff0c\u8fd9\u4e9b\u6784\u9020\u51fa\u6765\u7684\u4e1c\u897f\u5e76\u6ca1\u6709\u4ec0\u4e48\u7528\u5904\u3002\u5728\u53e6\u4e00\u65b9\u9762\uff0c<code class=\"literal\">\\set bar :foo</code>\u662f\u4e00\u79cd\u5f88\u597d\u7684\u62f7\u8d1d\u53d8\u91cf\u7684\u65b9\u6cd5\u3002</p>\n</div>\n<p lang=\"zh\">\u6709\u4e00\u4e9b\u53d8\u91cf\u4f1a\u88ab<span class=\"application\">psql</span>\u7279\u6b8a\u5bf9\u5f85\u3002\u5b83\u4eec\u8868\u793a\u7279\u5b9a\u7684\u9009\u9879\u8bbe\u7f6e\uff0c\u8fd0\u884c\u65f6\u8fd9\u7c7b\u9009\u9879\u8bbe\u7f6e\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539\u8be5\u53d8\u91cf\u7684\u503c\u6765\u6539\u53d8\uff0c\u6216\u8005\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u5b83\u4eec\u8868\u793a<span class=\"application\">psql</span>\u7684\u53ef\u66f4\u6539\u7684\u72b6\u6001\u3002\u6309\u7167\u60ef\u4f8b\uff0c\u6240\u6709\u88ab\u7279\u6b8a\u5bf9\u5f85\u7684\u53d8\u91cf\u7684\u540d\u79f0\u7531\u5168\u90e8\u5927\u5199\u5f62\u5f0f\u7684 ASCII \u5b57\u6bcd\uff08\u8fd8\u6709\u53ef\u80fd\u662f\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\uff09\u7ec4\u6210\u3002\u4e3a\u4e86\u786e\u4fdd\u672a\u6765\u6700\u5927\u7684\u517c\u5bb9\u6027\uff0c\u6700\u597d\u907f\u514d\u628a\u8fd9\u7c7b\u53d8\u91cf\u540d\u7528\u4e8e\u81ea\u5df1\u7684\u76ee\u7684\u3002</p>\n<p lang=\"zh\">\u63a7\u5236<span class=\"application\">psql</span>\u884c\u4e3a\u7684\u53d8\u91cf\u901a\u5e38\u4e0d\u80fd\u88ab\u53d6\u6d88\u8bbe\u7f6e\u6216\u8005\u8bbe\u7f6e\u4e3a\u65e0\u6548\u503c\u3002\u5141\u8bb8<code class=\"literal\">\\unset</code>\u547d\u4ee4\uff0c\u4f46\u5b83\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u5b83\u7684\u9ed8\u8ba4\u503c\u3002\u6ca1\u6709\u7b2c\u4e8c\u53c2\u6570\u7684<code class=\"literal\">\\set</code>\u547d\u4ee4\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\uff08\u5bf9\u4e8e\u63a5\u53d7\u8be5\u503c\u7684\u63a7\u5236\u53d8\u91cf\uff09\uff0c\u5bf9\u4e0d\u63a5\u53d7\u8be5\u503c\u7684\u53d8\u91cf\u5219\u4f1a\u62d2\u7edd\u8fd9\u4e2a\u547d\u4ee4\u3002\u6b64\u5916\uff0c\u63a5\u53d7\u503c<code class=\"literal\">on</code>\u548c<code class=\"literal\">off</code>\u7684\u63a7\u5236\u53d8\u91cf\u4e5f\u80fd\u63a5\u53d7\u5176\u4ed6\u5e38\u89c1\u7684\u5e03\u5c14\u503c\u62fc\u5199\u65b9\u5f0f\uff0c\u4f8b\u5982<code class=\"literal\">true</code>\u548c<code class=\"literal\">false</code>\u3002</p>\n<p lang=\"zh\">\u88ab\u7279\u6b8a\u5bf9\u5f85\u7684\u53d8\u91cf\u662f\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-VARIABLES-AUTOCOMMIT\"><span class=\"term\"><code class=\"varname\">AUTOCOMMIT</code> </span> </dt>\n<dd>\n<p lang=\"zh\">\u5728\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\uff08\u9ed8\u8ba4\uff09\u65f6\uff0c\u6bcf\u4e00\u4e2a SQL \u547d\u4ee4\u5728\u6210\u529f\u5b8c\u6210\u65f6\u4f1a\u88ab\u81ea\u52a8\u63d0\u4ea4\u3002\u5728\u8fd9\u79cd\u6a21\u5f0f\u4e2d\u8981\u63a8\u8fdf\u63d0\u4ea4\uff0c\u5fc5\u987b\u8f93\u5165\u4e00\u4e2a<code class=\"command\">BEGIN</code>\u6216\u8005<code class=\"command\">START TRANSACTION</code> SQL \u547d\u4ee4\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">off</code>\u6216\u8005\u88ab\u53d6\u6d88\u8bbe\u7f6e\u65f6\uff0c\u5728\u663e\u5f0f\u53d1\u51fa<code class=\"command\">COMMIT</code>\u6216\u8005<code class=\"command\">END</code>\u4e4b\u524d\uff0cSQL \u547d\u4ee4\u4e0d\u4f1a\u88ab\u63d0\u4ea4\u3002\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u4f1a\u4e3a\u4f60\u53d1\u51fa\u4e00\u4e2a\u9690\u5f0f\u7684<code class=\"command\">BEGIN</code>\uff0c\u8fd9\u4f1a\u53d1\u751f\u5728\u547d\u4ee4\u6267\u884c\u4e4b\u524d\uff0c\u524d\u63d0\u662f\u8be5\u547d\u4ee4\u4e0d\u5728\u4e8b\u52a1\u5757\u4e2d\uff0c\u4e14\u5176\u672c\u8eab\u65e2\u4e0d\u662f<code class=\"command\">BEGIN</code>\u6216\u5176\u4ed6\u4e8b\u52a1\u63a7\u5236\u547d\u4ee4\uff0c\u4e5f\u4e0d\u662f\u65e0\u6cd5\u5728\u4e8b\u52a1\u5757\u4e2d\u6267\u884c\u7684\u547d\u4ee4\uff08\u4f8b\u5982<code class=\"command\">VACUUM</code>\uff09\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u4e2d\uff0c\u5fc5\u987b\u901a\u8fc7<code class=\"command\">ABORT</code>\u6216\u8005<code class=\"command\">ROLLBACK</code>\u663e\u5f0f\u5730\u653e\u5f03\u4efb\u4f55\u5931\u8d25\u7684\u4e8b\u52a1\u3002\u8fd8\u8981\u8bb0\u4f4f\uff0c\u5982\u679c\u9000\u51fa\u4f1a\u8bdd\u65f6\u6ca1\u6709\u63d0\u4ea4\uff0c\u5219\u6240\u6709\u7684\u5de5\u4f5c\u90fd\u4f1a\u4e22\u5931\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u81ea\u52a8\u63d0\u4ea4\u6253\u5f00\u6a21\u5f0f\u662f<span class=\"productname\">PostgreSQL</span>\u7684\u4f20\u7edf\u884c\u4e3a\uff0c\u4f46\u662f\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u66f4\u63a5\u8fd1\u4e8e SQL \u7684\u89c4\u8303\u3002\u5982\u679c\u66f4\u559c\u6b22\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\uff0c\u53ef\u4ee5\u5728\u7cfb\u7edf\u7ea7\u7684<code class=\"filename\">psqlrc</code>\u6587\u4ef6\u6216\u8005\u4e2a\u4eba\u7684<code class=\"filename\">~/.psqlrc</code>\u6587\u4ef6\u4e2d\u8bbe\u7f6e\u5b83\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-COMP-KEYWORD-CASE\"><span class=\"term\"><code class=\"varname\">COMP_KEYWORD_CASE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u786e\u5b9a\u5728\u8865\u5168\u4e00\u4e2a SQL \u5173\u952e\u8bcd\u65f6\u8981\u4f7f\u7528\u7684\u5927\u5c0f\u5199\u5f62\u5f0f\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">lower</code>\u6216\u8005<code class=\"literal\">upper</code>\uff0c\u8865\u5168\u540e\u7684\u8bcd\u5c06\u5206\u522b\u662f\u5c0f\u5199\u6216\u8005\u5927\u5199\u5f62\u5f0f\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">preserve-lower</code>\u6216\u8005<code class=\"literal\">preserve-upper</code>\uff08\u9ed8\u8ba4\uff09\uff0c\u8865\u5168\u540e\u7684\u8bcd\u5c06\u4f1a\u4fdd\u6301\u8be5\u8bcd\u5df2\u8f93\u5165\u90e8\u5206\u7684\u5927\u5c0f\u5199\u5f62\u5f0f\uff0c\u4f46\u662f\u5982\u679c\u88ab\u8865\u5168\u7684\u8bcd\u8fd8\u6ca1\u6709\u88ab\u8f93\u5165\uff0c\u5219\u5b83\u4f1a\u88ab\u5206\u522b\u8865\u5168\u6210\u5c0f\u5199\u6216\u8005\u5927\u5199\u5f62\u5f0f\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-DBNAME\"><span class=\"term\"><code class=\"varname\">DBNAME</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u5df2\u8fde\u63a5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u662f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ECHO\"><span class=\"term\"><code class=\"varname\">ECHO</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">all</code>\uff0c\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u4f1a\u5728\u8bfb\u5165\u65f6\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u8bfb\u53d6\u7684\u884c\uff09\u3002\u8981\u5728\u7a0b\u5e8f\u5f00\u59cb\u65f6\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\uff0c\u53ef\u4ee5\u4f7f\u7528\u5f00\u5173<code class=\"option\">-a</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">queries</code>\uff0c<span class=\"application\">psql</span>\u4f1a\u5728\u53d1\u9001\u6bcf\u4e2a\u67e5\u8be2\u7ed9\u670d\u52a1\u5668\u65f6\u5c06\u5b83\u4eec\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\u3002\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\u7684\u5f00\u5173\u662f<code class=\"option\">-e</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">errors</code>\uff0c\u90a3\u4e48\u53ea\u6709\u5931\u8d25\u7684\u67e5\u8be2\u4f1a\u88ab\u663e\u793a\u5728\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u4e0a\u3002\u8fd9\u79cd\u884c\u4e3a\u7684\u5f00\u5173\u662f<code class=\"option\">-b</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">none</code>\uff08\u9ed8\u8ba4\u503c\uff09\u5219\u4e0d\u4f1a\u663e\u793a\u4efb\u4f55\u67e5\u8be2\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ECHO-HIDDEN\"><span class=\"term\"><code class=\"varname\">ECHO_HIDDEN</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u4e14\u4e00\u4e2a\u53cd\u659c\u7ebf\u547d\u4ee4\u67e5\u8be2\u6570\u636e\u5e93\u65f6\uff0c\u76f8\u5e94\u7684\u67e5\u8be2\u4f1a\u88ab\u5148\u663e\u793a\u3002\u8fd9\u79cd\u7279\u6027\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u5b66\u4e60<span class=\"productname\">PostgreSQL</span>\u7684\u5185\u90e8\u5e76\u4e14\u5728\u81ea\u5df1\u7684\u7a0b\u5e8f\u4e2d\u63d0\u4f9b\u7c7b\u4f3c\u7684\u529f\u80fd\uff08\u8981\u5728\u7a0b\u5e8f\u5f00\u59cb\u65f6\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\uff0c\u53ef\u4ee5\u4f7f\u7528\u5f00\u5173<code class=\"option\">-E</code>\uff09\u3002\u5982\u679c\u628a\u8fd9\u4e2a\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">noexec</code>\uff0c\u5219\u5bf9\u5e94\u7684\u67e5\u8be2\u53ea\u4f1a\u88ab\u663e\u793a\u800c\u5e76\u4e0d\u771f\u6b63\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u6267\u884c\u3002\u9ed8\u8ba4\u503c\u662f<code class=\"literal\">off</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ENCODING\"><span class=\"term\"><code class=\"varname\">ENCODING</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u7684\u5ba2\u6237\u7aef\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u6bcf\u4e00\u6b21\u4f60\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\uff09\u65f6\u4ee5\u53ca\u5f53\u4f60\u7528<code class=\"literal\">\\encoding</code>\u66f4\u6539\u7f16\u7801\u65f6\uff0c\u8fd9\u4e2a\u53d8\u91cf\u90fd\u4f1a\u88ab\u8bbe\u7f6e\uff0c\u4f46\u5b83\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ERROR\"><span class=\"term\"><code class=\"varname\">ERROR</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u4e0a\u4e00\u4e2aSQL\u67e5\u8be2\u5931\u8d25\u5219\u4e3a<code class=\"literal\">true</code>\uff0c\u5982\u679c\u6210\u529f\u5219\u662f<code class=\"literal\">false</code>\u3002\u53e6\u89c1<code class=\"varname\">SQLSTATE</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-FETCH-COUNT\"><span class=\"term\"><code class=\"varname\">FETCH_COUNT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a\u4e00\u4e2a\u5927\u4e8e\u96f6\u7684\u6574\u6570\u503c\uff0c<code class=\"command\">SELECT</code>\u67e5\u8be2\u7684\u7ed3\u679c\u4f1a\u4ee5\u4e00\u7ec4\u4e00\u7ec4\u7684\u65b9\u5f0f\u53d6\u51fa\u5e76\u4e14\u663e\u793a\uff08\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u7684\u90a3\u6837\u628a\u6574\u4e2a\u7ed3\u679c\u96c6\u62ff\u5230\u4ee5\u540e\u518d\u663e\u793a\uff09\uff0c\u6bcf\u7ec4\u5305\u542b\u7684\u884c\u6570\u7b49\u4e8e\u8be5\u6574\u6570\u503c\u3002\u56e0\u6b64\uff0c\u8fd9\u79cd\u65b9\u5f0f\u53ea\u4f1a\u4f7f\u7528\u6709\u9650\u7684\u5185\u5b58\u91cf\uff0c\u800c\u4e0d\u7ba1\u6574\u4e2a\u7ed3\u679c\u96c6\u7684\u5927\u5c0f\u3002\u5728\u542f\u7528\u8fd9\u4e2a\u7279\u6027\u65f6\uff0c\u901a\u5e38\u4f1a\u4f7f\u7528 100 \u5230 1000 \u7684\u8bbe\u7f6e\u3002\u8bb0\u4f4f\u5728\u4f7f\u7528\u8fd9\u79cd\u7279\u6027\u65f6\uff0c\u4e00\u4e2a\u67e5\u8be2\u53ef\u80fd\u4f1a\u5728\u5df2\u7ecf\u663e\u793a\u4e86\u4e00\u4e9b\u884c\u4e4b\u540e\u5931\u8d25\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5c3d\u7ba1\u53ef\u4ee5\u628a\u8fd9\u79cd\u7279\u6027\u7528\u4e8e\u4efb\u4f55\u7684\u8f93\u51fa\u683c\u5f0f\uff0c\u4f46\u662f\u9ed8\u8ba4\u7684<code class=\"literal\">aligned</code>\u683c\u5f0f\u770b\u8d77\u6765\u4f1a\u6bd4\u8f83\u7cdf\u7cd5\uff0c\u56e0\u4e3a\u6bcf\u4e00\u7ec4\u7684<code class=\"varname\">FETCH_COUNT</code>\u884c\u5c06\u88ab\u5355\u72ec\u683c\u5f0f\u5316\uff0c\u8fd9\u5c31\u4f1a\u5bfc\u81f4\u4e0d\u540c\u7684\u884c\u7ec4\u7684\u5217\u5bbd\u4e0d\u540c\u3002\u5176\u4ed6\u7684\u8f93\u51fa\u683c\u5f0f\u4f1a\u66f4\u597d\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HIDE-TABLEAM\"><span class=\"term\"><code class=\"varname\">HIDE_TABLEAM</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6b64\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">true</code>\uff0c\u5219\u4e0d\u663e\u793a\u8868\u7684\u8bbf\u95ee\u65b9\u6cd5\u7684\u8be6\u7ec6\u4fe1\u606f\u3002\u8fd9\u4e3b\u8981\u7528\u4e8e\u56de\u5f52\u6d4b\u8bd5\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HIDE-TOAST-COMPRESSION\"><span class=\"term\"><code class=\"varname\">HIDE_TOAST_COMPRESSION</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">true</code>\uff0c\u4e0d\u663e\u793a\u5217\u538b\u7f29\u65b9\u6cd5\u7684\u7ec6\u8282\u3002\u8fd9\u4e3b\u8981\u7528\u4e8e\u56de\u5f52\u6d4b\u8bd5\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HISTCONTROL\"><span class=\"term\"><code class=\"varname\">HISTCONTROL</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">ignorespace</code>\uff0c\u5219\u4ee5\u4e00\u4e2a\u7a7a\u683c\u5f00\u59cb\u7684\u884c\u4e0d\u4f1a\u88ab\u653e\u5165\u5230\u5386\u53f2\u5217\u8868\u4e2d\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">ignoredups</code>\uff0c\u5219\u4e0e\u4e0a\u4e00\u6761\u5386\u53f2\u8bb0\u5f55\u76f8\u540c\u7684\u884c\u4e0d\u4f1a\u88ab\u653e\u5165\u3002\u503c<code class=\"literal\">ignoreboth</code>\u7ec4\u5408\u4e86\u4e0a\u8ff0\u4e24\u79cd\u503c\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">none</code>\uff08\u9ed8\u8ba4\u503c\uff09\uff0c\u6240\u6709\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e2d\u88ab\u8bfb\u5165\u7684\u884c\u90fd\u4f1a\u4fdd\u5b58\u5728\u5386\u53f2\u5217\u8868\u4e2d\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HISTFILE\"><span class=\"term\"><code class=\"varname\">HISTFILE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8be5\u6587\u4ef6\u540d\u5c06\u88ab\u7528\u4e8e\u5b58\u50a8\u5386\u53f2\u5217\u8868\u3002\u5982\u679c\u672a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff0c\u6587\u4ef6\u540d\u5c06\u4ece<code class=\"envar\">PSQL_HISTORY</code>\u73af\u5883\u53d8\u91cf\u4e2d\u53d6\u5f97\u3002\u5982\u679c\u8be5\u73af\u5883\u53d8\u91cf\u4e5f\u6ca1\u6709\u88ab\u8bbe\u7f6e\uff0c\u5219\u9ed8\u8ba4\u503c\u662f<code class=\"filename\">~/.psql_history</code>\uff0c\u5728Windows\u4e0a\u662f<code class=\"filename\">%APPDATA%\\postgresql\\psql_history</code>\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">\\set HISTFILE ~/.psql_history-:DBNAME\n</pre>\n<p lang=\"zh\">\u653e\u5728<code class=\"filename\">~/.psqlrc</code>\u4e2d\u5c06\u4f1a\u5bfc\u81f4<span class=\"application\">psql</span>\u4e3a\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u7ef4\u62a4\u4e00\u4e2a\u5355\u72ec\u7684\u5386\u53f2\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HISTSIZE\"><span class=\"term\"><code class=\"varname\">HISTSIZE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u547d\u4ee4\u5386\u53f2\u4e2d\u6700\u591a\u4fdd\u5b58\u7684\u547d\u4ee4\u6570\uff08\u9ed8\u8ba4 500\uff09\u3002\u8bbe\u4e3a\u8d1f\u503c\u65f6\uff0c\u4e0d\u8bbe\u4e0a\u9650\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HOST\"><span class=\"term\"><code class=\"varname\">HOST</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e3b\u673a\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u4e5f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-IGNOREEOF\"><span class=\"term\"><code class=\"varname\">IGNOREEOF</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8bbe\u4e3a 1 \u6216\u66f4\u5c0f\u7684\u503c\uff0c\u5411 psql \u4ea4\u4e92\u4f1a\u8bdd\u53d1\u9001 EOF \u5b57\u7b26\uff08\u901a\u5e38\u4e3a Control + D\uff09\u5c31\u4f1a\u7ec8\u6b62\u5e94\u7528\u3002\u5982\u679c\u8bbe\u4e3a\u66f4\u5927\u7684\u6570\u503c\uff0c\u5219\u5fc5\u987b\u8fde\u7eed\u8f93\u5165\u76f8\u5e94\u6b21\u6570\u7684 EOF \u5b57\u7b26\u624d\u4f1a\u7ec8\u6b62\u4ea4\u4e92\u4f1a\u8bdd\u3002\u5982\u679c\u53d8\u91cf\u8bbe\u4e3a\u975e\u6570\u503c\uff0c\u4f1a\u88ab\u89e3\u91ca\u4e3a 10\u3002\u9ed8\u8ba4\u503c\u4e3a 0\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-LASTOID\"><span class=\"term\"><code class=\"varname\">LASTOID</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6700\u8fd1\u4e00\u6b21\u53d7\u5f71\u54cd\u7684 OID \u503c\uff0c\u7531 INSERT \u6216 \\lo_import \u547d\u4ee4\u8fd4\u56de\u3002\u6b64\u53d8\u91cf\u4ec5\u4fdd\u8bc1\u5728\u4e0b\u4e00\u6761 SQL \u547d\u4ee4\u7684\u7ed3\u679c\u663e\u793a\u4e4b\u524d\u6709\u6548\u3002\u4ece\u7248\u672c 12 \u8d77\uff0cPostgreSQL \u670d\u52a1\u5668\u4e0d\u518d\u652f\u6301 OID \u7cfb\u7edf\u5217\uff0c\u56e0\u6b64\u8fde\u63a5\u5230\u8fd9\u4e9b\u670d\u52a1\u5668\u65f6\uff0c\u6267\u884c INSERT \u540e LASTOID \u59cb\u7ec8\u4e3a 0\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-LAST-ERROR-MESSAGE\"><span class=\"term\"><code class=\"varname\">LAST_ERROR_MESSAGE</code><br/></span><span class=\"term\"><code class=\"varname\">LAST_ERROR_SQLSTATE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d<span class=\"application\">psql</span>\u4f1a\u8bdd\u4e2d\u6700\u8fd1\u4e00\u4e2a\u5931\u8d25\u67e5\u8be2\u7684\u4e3b\u9519\u8bef\u6d88\u606f\u548c\u76f8\u5173\u7684SQLSTATE\u4ee3\u7801\uff0c\u5982\u679c\u5728\u5f53\u524d\u4f1a\u8bdd\u4e2d\u6ca1\u6709\u53d1\u751f\u9519\u8bef\uff0c\u5219\u662f\u4e00\u4e2a\u7a7a\u5b57\u7b26\u4e32\u548c<code class=\"literal\">00000</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ON-ERROR-ROLLBACK\"><span class=\"term\"><code class=\"varname\">ON_ERROR_ROLLBACK</code> </span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u65f6\uff0c\u5982\u679c\u4e8b\u52a1\u5757\u4e2d\u7684\u4e00\u4e2a\u8bed\u53e5\u4ea7\u751f\u4e00\u4e2a\u9519\u8bef\uff0c\u8be5\u9519\u8bef\u4f1a\u88ab\u5ffd\u7565\u5e76\u4e14\u8be5\u4e8b\u52a1\u4f1a\u7ee7\u7eed\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">interactive</code>\u65f6\uff0c\u53ea\u5728\u4ea4\u4e92\u5f0f\u4f1a\u8bdd\u4e2d\u5ffd\u7565\u8fd9\u7c7b\u9519\u8bef\uff0c\u800c\u8bfb\u53d6\u811a\u672c\u6587\u4ef6\u65f6\u5219\u4e0d\u4f1a\u5ffd\u7565\u9519\u8bef\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">off</code>\uff08\u9ed8\u8ba4\u503c\uff09\u65f6\uff0c\u4e8b\u52a1\u5757\u4e2d\u4ea7\u751f\u9519\u8bef\u7684\u4e00\u4e2a\u8bed\u53e5\u4f1a\u4e2d\u6b62\u6574\u4e2a\u4e8b\u52a1\u3002\u9519\u8bef\u56de\u6eda\u6a21\u5f0f\u7684\u5de5\u4f5c\u539f\u7406\u662f\u5728\u4e8b\u52a1\u5757\u7684\u6bcf\u4e2a\u547d\u4ee4\u4e4b\u524d\u90fd\u4e3a\u4f60\u53d1\u51fa\u4e00\u4e2a\u9690\u5f0f\u7684<code class=\"command\">SAVEPOINT</code>\uff0c\u7136\u540e\u5728\u8be5\u547d\u4ee4\u5931\u8d25\u65f6\u56de\u6eda\u5230\u8be5\u4fdd\u5b58\u70b9\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ON-ERROR-STOP\"><span class=\"term\"><code class=\"varname\">ON_ERROR_STOP</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u51fa\u9519\u540e\u4ecd\u4f1a\u7ee7\u7eed\u5904\u7406\u547d\u4ee4\u3002\u5c06\u6b64\u53d8\u91cf\u8bbe\u4e3a on \u540e\uff0c\u5904\u7406\u4f1a\u7acb\u5373\u505c\u6b62\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\uff0cpsql \u4f1a\u8fd4\u56de\u547d\u4ee4\u63d0\u793a\u7b26\uff1b\u5426\u5219\uff0cpsql \u4f1a\u9000\u51fa\u5e76\u8fd4\u56de\u9519\u8bef\u7801 3\uff0c\u4ee5\u533a\u522b\u4e8e\u9519\u8bef\u7801 1 \u6240\u8868\u793a\u7684\u81f4\u547d\u9519\u8bef\u3002\u65e0\u8bba\u54ea\u79cd\u60c5\u51b5\uff0c\u5f53\u524d\u6b63\u5728\u8fd0\u884c\u7684\u6240\u6709\u811a\u672c\uff08\u5982\u679c\u5b58\u5728\u9876\u5c42\u811a\u672c\uff0c\u5219\u5305\u62ec\u8be5\u811a\u672c\u53ca\u5176\u8c03\u7528\u7684\u5176\u4ed6\u811a\u672c\uff09\u90fd\u4f1a\u7acb\u5373\u7ec8\u6b62\u3002\u5982\u679c\u9876\u5c42\u547d\u4ee4\u5b57\u7b26\u4e32\u5305\u542b\u591a\u6761 SQL \u547d\u4ee4\uff0c\u5219\u4f1a\u5728\u5f53\u524d\u547d\u4ee4\u5904\u505c\u6b62\u5904\u7406\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-PIPELINE-COMMAND-COUNT\"><span class=\"term\"><code class=\"varname\">PIPELINE_COMMAND_COUNT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6b63\u5728\u8fd0\u884c\u7684\u7ba1\u9053\u4e2d\u6392\u961f\u7684\u547d\u4ee4\u6570\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-PIPELINE-RESULT-COUNT\"><span class=\"term\"><code class=\"varname\">PIPELINE_RESULT_COUNT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6b63\u5728\u8fdb\u884c\u7684\u7ba1\u9053\u4e2d\uff0c\u6709\u591a\u5c11\u6761\u547d\u4ee4\u540e\u9762\u8ddf\u7740 <code class=\"command\">\\flushrequest</code> \u6216 <code class=\"command\">\\syncpipeline</code>\uff0c\u4ece\u800c\u5f3a\u5236\u670d\u52a1\u5668\u53d1\u9001\u7ed3\u679c\u3002\u8fd9\u4e9b\u7ed3\u679c\u53ef\u4ee5\u901a\u8fc7 <code class=\"command\">\\getresults</code> \u53d6\u56de\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-PIPELINE-SYNC-COUNT\"><span class=\"term\"><code class=\"varname\">PIPELINE_SYNC_COUNT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6b63\u5728\u8fd0\u884c\u7684\u7ba1\u9053\u4e2d\u6392\u961f\u7684\u540c\u6b65\u6d88\u606f\u6570\u91cf\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-PORT\"><span class=\"term\"><code class=\"varname\">PORT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u7aef\u53e3\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u4e5f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-PROMPT\"><span class=\"term\"><code class=\"varname\">PROMPT1</code><br/></span><span class=\"term\"><code class=\"varname\">PROMPT2</code><br/></span><span class=\"term\"><code class=\"varname\">PROMPT3</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e9b\u53d8\u91cf\u6307\u5b9a<span class=\"application\">psql</span>\u53d1\u51fa\u7684\u63d0\u793a\u7b26\u7684\u6a21\u6837\u3002\u89c1\u4e0b\u6587\u7684<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PROMPTING\" title=\"\u63d0\u793a\u7b26\">\u63d0\u793a\u7b26</a>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-QUIET\"><span class=\"term\"><code class=\"varname\">QUIET</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u8fd9\u4e2a\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-q</code>\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\u53ef\u80fd\u7528\u5904\u4e0d\u5927\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ROW-COUNT\"><span class=\"term\"><code class=\"varname\">ROW_COUNT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6700\u8fd1\u4e00\u6761 SQL \u67e5\u8be2\u8fd4\u56de\u6216\u5f71\u54cd\u7684\u884c\u6570\uff1b\u5982\u679c\u67e5\u8be2\u5931\u8d25\u6216\u6ca1\u6709\u62a5\u544a\u884c\u6570\uff0c\u5219\u4e3a 0\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SERVER-VERSION-NAME\"><span class=\"term\"><code class=\"varname\">SERVER_VERSION_NAME</code><br/></span><span class=\"term\"><code class=\"varname\">SERVER_VERSION_NUM</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b57\u7b26\u4e32\u5f62\u5f0f\u7684\u670d\u52a1\u5668\u7248\u672c\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">9.6.2</code>\u3001<code class=\"literal\">10.1</code>\u6216\u8005<code class=\"literal\">11beta1</code>\uff0c\u4ee5\u53ca\u6570\u5b57\u5f62\u5f0f\u7684\u670d\u52a1\u5668\u7248\u672c\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">90602</code>\u6216\u8005<code class=\"literal\">100001</code>\u3002\u6bcf\u6b21\u4f60\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\uff09\u65f6\uff0c\u8fd9\u4e9b\u90fd\u4f1a\u88ab\u8bbe\u7f6e\uff0c\u4f46\u53ef\u4ee5\u88ab\u6539\u53d8\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SERVICE\"><span class=\"term\"><code class=\"varname\">SERVICE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u670d\u52a1\u540d\u79f0\uff08\u5982\u679c\u9002\u7528\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SHELL-ERROR\"><span class=\"term\"><code class=\"varname\">SHELL_ERROR</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6700\u540e\u4e00\u4e2a shell \u547d\u4ee4\u5931\u8d25\uff0c\u5219\u4e3a <code class=\"literal\">true</code>\uff1b\u5982\u679c\u6210\u529f\uff0c\u5219\u4e3a <code class=\"literal\">false</code>\u3002\u8fd9\u9002\u7528\u4e8e\u901a\u8fc7 <code class=\"literal\">\\!</code>\u3001<code class=\"literal\">\\g</code>\u3001<code class=\"literal\">\\o</code>\u3001<code class=\"literal\">\\w</code> \u548c <code class=\"literal\">\\copy</code> \u5143\u547d\u4ee4\u8c03\u7528\u7684 shell \u547d\u4ee4\uff0c\u4e5f\u9002\u7528\u4e8e\u53cd\u5f15\u53f7\uff08<code class=\"literal\">`</code>\uff09\u6269\u5c55\u3002\u8bf7\u6ce8\u610f\uff0c\u5bf9\u4e8e <code class=\"literal\">\\o</code>\uff0c\u8be5\u53d8\u91cf\u4f1a\u5728\u4e0b\u4e00\u4e2a <code class=\"literal\">\\o</code> \u547d\u4ee4\u5173\u95ed\u8f93\u51fa\u7ba1\u9053\u65f6\u66f4\u65b0\u3002\u53e6\u89c1 <code class=\"varname\">SHELL_EXIT_CODE</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SHELL-EXIT-CODE\"><span class=\"term\"><code class=\"varname\">SHELL_EXIT_CODE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u540e\u4e00\u4e2a shell \u547d\u4ee4\u8fd4\u56de\u7684\u9000\u51fa\u72b6\u6001\u30020\u2013127 \u8868\u793a\u7a0b\u5e8f\u9000\u51fa\u7801\uff0c128\u2013255 \u8868\u793a\u56e0\u4fe1\u53f7\u800c\u7ec8\u6b62\uff0c-1 \u8868\u793a\u672a\u80fd\u542f\u52a8\u7a0b\u5e8f\u6216\u672a\u80fd\u53d6\u5f97\u5176\u9000\u51fa\u72b6\u6001\u3002\u8fd9\u9002\u7528\u4e8e\u901a\u8fc7 <code class=\"literal\">\\!</code>\u3001<code class=\"literal\">\\g</code>\u3001<code class=\"literal\">\\o</code>\u3001<code class=\"literal\">\\w</code> \u548c <code class=\"literal\">\\copy</code> \u5143\u547d\u4ee4\u8c03\u7528\u7684 shell \u547d\u4ee4\uff0c\u4e5f\u9002\u7528\u4e8e\u53cd\u5f15\u53f7\uff08<code class=\"literal\">`</code>\uff09\u6269\u5c55\u3002\u8bf7\u6ce8\u610f\uff0c\u5bf9\u4e8e <code class=\"literal\">\\o</code>\uff0c\u8be5\u53d8\u91cf\u4f1a\u5728\u4e0b\u4e00\u4e2a <code class=\"literal\">\\o</code> \u547d\u4ee4\u5173\u95ed\u8f93\u51fa\u7ba1\u9053\u65f6\u66f4\u65b0\u3002\u53e6\u89c1 <code class=\"varname\">SHELL_ERROR</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SHOW-ALL-RESULTS\"><span class=\"term\"><code class=\"varname\">SHOW_ALL_RESULTS</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u6b64\u53d8\u91cf\u88ab\u8bbe\u4e3a <code class=\"literal\">off</code> \u65f6\uff0c\u7ec4\u5408\u67e5\u8be2\uff08<code class=\"literal\">\\;</code>\uff09\u53ea\u663e\u793a\u6700\u540e\u4e00\u4e2a\u7ed3\u679c\uff0c\u800c\u4e0d\u662f\u663e\u793a\u5168\u90e8\u7ed3\u679c\u3002\u9ed8\u8ba4\u503c\u4e3a <code class=\"literal\">on</code>\u3002\u8bbe\u4e3a off \u7684\u884c\u4e3a\u662f\u4e3a\u4e86\u517c\u5bb9\u65e7\u7248\u672c\u7684 <span class=\"application\">psql</span>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SHOW-CONTEXT\"><span class=\"term\"><code class=\"varname\">SHOW_CONTEXT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u53d8\u91cf\u53ef\u4ee5\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">never</code>\u3001<code class=\"literal\">errors</code>\u6216\u8005<code class=\"literal\">always</code>\u6765\u63a7\u5236\u662f\u5426\u5728\u6765\u81ea\u670d\u52a1\u5668\u7684\u6d88\u606f\u4e2d\u663e\u793a<code class=\"literal\">CONTEXT</code>\u5b57\u6bb5\u3002\u9ed8\u8ba4\u662f<code class=\"literal\">errors</code>\uff08\u8868\u793a\u5728\u9519\u8bef\u6d88\u606f\u4e2d\u663e\u793a\u4e0a\u4e0b\u6587\uff0c\u4f46\u5728\u901a\u77e5\u548c\u8b66\u544a\u6d88\u606f\u4e2d\u4e0d\u663e\u793a\uff09\u3002\u5f53<code class=\"varname\">VERBOSITY</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">terse</code>\u6216<code class=\"literal\">sqlstate</code>\u65f6\uff0c\u8fd9\u4e2a\u8bbe\u7f6e\u65e0\u6548\uff08\u53e6\u89c1<code class=\"command\">\\errverbose</code>\uff0c\u5b83\u53ef\u4ee5\u7528\u6765\u5f97\u5230\u521a\u9047\u5230\u7684\u9519\u8bef\u7684\u8be6\u7ec6\u4fe1\u606f\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SINGLELINE\"><span class=\"term\"><code class=\"varname\">SINGLELINE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u8fd9\u4e2a\u53d8\u91cf\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-S</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SINGLESTEP\"><span class=\"term\"><code class=\"varname\">SINGLESTEP</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u8fd9\u4e2a\u53d8\u91cf\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-s</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SQLSTATE\"><span class=\"term\"><code class=\"varname\">SQLSTATE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0e\u4e0a\u4e00\u4e2aSQL\u67e5\u8be2\u7684\u5931\u8d25\u76f8\u5173\u7684\u9519\u8bef\u4ee3\u7801\uff08\u89c1<a class=\"xref\" href=\"/docs/18/errcodes-appendix.html\" title=\"\u9644\u5f55\u00a0A.\u00a0PostgreSQL\u9519\u8bef\u4ee3\u7801\">\u9644\u5f55\u00a0A</a>\uff09\uff0c\u5982\u679c\u4e0a\u4e00\u4e2a\u67e5\u8be2\u6210\u529f\u5219\u4e3a<code class=\"literal\">00000</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-USER\"><span class=\"term\"><code class=\"varname\">USER</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7528\u6237\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u662f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-VERBOSITY\"><span class=\"term\"><code class=\"varname\">VERBOSITY</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u53d8\u91cf\u53ef\u4ee5\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">default</code>\u3001<code class=\"literal\">verbose</code>\u3001<code class=\"literal\">terse</code>\u6216\u8005<code class=\"literal\">sqlstate</code>\u6765\u63a7\u5236\u9519\u8bef\u62a5\u544a\u7684\u8be6\u7ec6\u7a0b\u5ea6\uff08\u53e6\u89c1<code class=\"command\">\\errverbose</code>\uff0c\u5728\u60f3\u5f97\u5230\u521a\u9047\u5230\u7684\u9519\u8bef\u7684\u8be6\u7ec6\u4fe1\u606f\u65f6\u4f7f\u7528\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-VERSION\"><span class=\"term\"><code class=\"varname\">VERSION</code><br/></span><span class=\"term\"><code class=\"varname\">VERSION_NAME</code><br/></span><span class=\"term\"><code class=\"varname\">VERSION_NUM</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e9b\u53d8\u91cf\u5728\u7a0b\u5e8f\u542f\u52a8\u65f6\u88ab\u8bbe\u7f6e\u4ee5\u53cd\u6620<span class=\"application\">psql</span>\u7684\u7248\u672c\uff0c\u5206\u522b\u662f\u4e00\u4e2a\u8be6\u7ec6\u7684\u5b57\u7b26\u4e32\u3001\u4e00\u4e2a\u77ed\u5b57\u7b26\u4e32\uff08\u4f8b\u5982<code class=\"literal\">9.6.2</code>\u3001<code class=\"literal\">10.1</code>\u6216\u8005<code class=\"literal\">11beta1</code>\uff09\u4ee5\u53ca\u4e00\u4e2a\u6570\u5b57\uff08\u4f8b\u5982<code class=\"literal\">90602</code>\u6216\u8005<code class=\"literal\">100001</code>\uff09\u3002\u5b83\u4eec\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-WATCH-INTERVAL\"><span class=\"term\"><code class=\"varname\">WATCH_INTERVAL</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6b64\u53d8\u91cf\u8bbe\u7f6e<code class=\"command\">\\watch</code>\u5728\u4e24\u6b21\u6267\u884c\u67e5\u8be2\u4e4b\u95f4\u7b49\u5f85\u7684\u9ed8\u8ba4\u95f4\u9694\uff0c\u5355\u4f4d\u4e3a\u79d2\u3002\u9ed8\u8ba4\u503c\u4e3a 2 \u79d2\u3002\u82e5\u5728\u547d\u4ee4\u4e2d\u6307\u5b9a\u4e86\u95f4\u9694\uff0c\u5219\u4f1a\u8986\u76d6\u6b64\u53d8\u91cf\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-INTERPOLATION\">\n<h4 lang=\"zh\">SQL \u63d2\u503c</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u53d8\u91cf\u7684\u4e00\u4e2a\u5173\u952e\u7279\u6027\u662f\u53ef\u4ee5\u628a\u5b83\u4eec\u66ff\u6362\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u63d2\u503c</span>\u201d</span>\uff09\u5230\u5e38\u89c4<acronym class=\"acronym\">SQL</acronym>\u8bed\u53e5\u4e2d\uff0c\u4e5f\u53ef\u4ee5\u628a\u5b83\u4eec\u66ff\u6362\u5230\u5143\u547d\u4ee4\u7684\u53c2\u6570\u4e2d\u3002\u6b64\u5916\uff0c<span class=\"application\">psql</span>\u8fd8\u63d0\u4f9b\u4e86\u529f\u80fd\u6765\u786e\u4fdd\u88ab\u7528\u4f5c SQL \u5b57\u9762\u91cf\u548c\u6807\u8bc6\u7b26\u7684\u53d8\u91cf\u503c\u4f1a\u88ab\u6b63\u786e\u5730\u52a0\u5f15\u53f7\u3002\u4e0d\u52a0\u5f15\u53f7\u5730\u63d2\u503c\u4e00\u4e2a\u503c\u7684\u8bed\u6cd5\u662f\u5728\u53d8\u91cf\u540d\u524d\u9762\u52a0\u4e0a\u4e00\u4e2a\u5192\u53f7\uff08<code class=\"literal\">:</code>\uff09\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo 'my_table'</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM :foo;</code></strong>\n</pre>\n<p lang=\"zh\">\u5c06\u67e5\u8be2\u8868<code class=\"literal\">my_table</code>\u3002\u6ce8\u610f\u8fd9\u53ef\u80fd\u4f1a\u4e0d\u5b89\u5168\uff1a\u8be5\u53d8\u91cf\u7684\u503c\u4f1a\u88ab\u6309\u5b57\u9762\u62f7\u8d1d\uff0c\u56e0\u6b64\u5b83\u53ef\u80fd\u5305\u542b\u4e0d\u5e73\u8861\u7684\u5f15\u53f7\u751a\u81f3\u53cd\u659c\u7ebf\u547d\u4ee4\u3002\u5fc5\u987b\u786e\u4fdd\u628a\u5b83\u653e\u5728\u90a3\u91cc\u662f\u6709\u610f\u4e49\u7684\u3002</p>\n<p lang=\"zh\">\u5f53\u4e00\u4e2a\u503c\u8981\u7528\u4f5c SQL \u5b57\u9762\u91cf\u6216\u6807\u8bc6\u7b26\u65f6\uff0c\u6700\u5b89\u5168\u7684\u505a\u6cd5\u662f\u4e3a\u5b83\u52a0\u4e0a\u5f15\u53f7\u3002\u8981\u5c06\u53d8\u91cf\u503c\u4f5c\u4e3a SQL \u5b57\u9762\u91cf\u52a0\u5f15\u53f7\uff0c\u5e94\u5199\u4e00\u4e2a\u5192\u53f7\uff0c\u540e\u9762\u8ddf\u7528\u5355\u5f15\u53f7\u62ec\u8d77\u6765\u7684\u53d8\u91cf\u540d\u3002\u8981\u5c06\u53d8\u91cf\u503c\u4f5c\u4e3a SQL \u6807\u8bc6\u7b26\u52a0\u5f15\u53f7\uff0c\u5219\u5728\u5192\u53f7\u540e\u9762\u7528\u53cc\u5f15\u53f7\u62ec\u8d77\u53d8\u91cf\u540d\u3002\u8fd9\u4e9b\u5199\u6cd5\u80fd\u6b63\u786e\u5904\u7406\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165\u7684\u5f15\u53f7\u548c\u5176\u4ed6\u7279\u6b8a\u5b57\u7b26\u3002\u524d\u9762\u7684\u793a\u4f8b\u53ef\u7528\u4ee5\u4e0b\u66f4\u5b89\u5168\u7684\u5199\u6cd5\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo 'my_table'</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM :\"foo\";</code></strong>\n</pre>\n<p lang=\"zh\">\u5728\u52a0\u5f15\u53f7\u7684<acronym class=\"acronym\">SQL</acronym>\u5b57\u9762\u91cf\u548c\u6807\u8bc6\u7b26\u5185\u90e8\uff0c\u4e0d\u4f1a\u6267\u884c\u53d8\u91cf\u63d2\u503c\u3002\u56e0\u6b64\uff0c<code class=\"literal\">':foo'</code>\u8fd9\u6837\u7684\u5199\u6cd5\u4e0d\u80fd\u6839\u636e\u53d8\u91cf\u503c\u751f\u6210\u52a0\u5f15\u53f7\u7684\u5b57\u9762\u91cf\uff08\u5373\u4f7f\u80fd\u591f\u751f\u6548\uff0c\u4e5f\u4e0d\u5b89\u5168\uff0c\u56e0\u4e3a\u5b83\u65e0\u6cd5\u6b63\u786e\u5904\u7406\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165\u7684\u5f15\u53f7\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8fd9\u79cd\u673a\u5236\u7684\u4e00\u4e2a\u793a\u4f8b\u662f\u628a\u4e00\u4e2a\u6587\u4ef6\u7684\u5185\u5bb9\u62f7\u8d1d\u5230\u4e00\u4e2a\u8868\u5217\u4e2d\u3002\u9996\u5148\u628a\u8be5\u6587\u4ef6\u8f7d\u5165\u5230\u4e00\u4e2a\u53d8\u91cf\uff0c\u7136\u540e\u628a\u8be5\u53d8\u91cf\u7684\u503c\u4f5c\u4e3a\u4e00\u4e2a\u52a0\u5f15\u53f7\u7684\u5b57\u7b26\u4e32\u8fdb\u884c\u63d2\u503c\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set content `cat my_file.txt`</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>INSERT INTO my_table VALUES (:'content');</code></strong>\n</pre>\n<p lang=\"zh\">\uff08\u6ce8\u610f\u5982\u679c<code class=\"filename\">my_file.txt</code>\u5305\u542b NUL \u5b57\u8282\uff0c\u8fd9\u6837\u4e5f\u4e0d\u884c\u3002<span class=\"application\">psql</span>\u4e0d\u652f\u6301\u5728\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165 NUL \u5b57\u8282\uff09\u3002</p>\n<p lang=\"zh\">\u56e0\u4e3a\u5192\u53f7\u53ef\u4ee5\u5408\u6cd5\u5730\u51fa\u73b0\u5728 SQL \u547d\u4ee4\u4e2d\uff0c\u770b\u4f3c\u63d2\u503c\u7684\u5199\u6cd5\uff08\u5373<code class=\"literal\">:name</code>\u3001<code class=\"literal\">:'name'</code>\u6216\u8005<code class=\"literal\">:\"name\"</code>\uff09\u4e0d\u4f1a\u88ab\u66ff\u6362\uff0c\u9664\u975e\u6240\u6307\u7684\u53d8\u91cf\u5f53\u524d\u5df2\u8bbe\u7f6e\u3002\u5728\u4efb\u4f55\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u7528\u4e00\u4e2a\u53cd\u659c\u7ebf\u5bf9\u5192\u53f7\u8fdb\u884c\u8f6c\u4e49\u4ee5\u907f\u514d\u5b83\u88ab\u66ff\u6362\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">:{?<em class=\"replaceable\"><code>name</code></em>}</code>\u7279\u6b8a\u8bed\u6cd5\u4f1a\u6839\u636e\u8be5\u53d8\u91cf\u662f\u5426\u5b58\u5728\u8fd4\u56de TRUE \u6216 FALSE\uff0c\u56e0\u6b64\u603b\u662f\u4f1a\u88ab\u66ff\u6362\uff0c\u9664\u975e\u5192\u53f7\u88ab\u53cd\u659c\u7ebf\u8f6c\u4e49\u3002</p>\n<p lang=\"zh\">\u53d8\u91cf\u7684\u5192\u53f7\u8bed\u6cd5\u5bf9\u5d4c\u5165\u5f0f\u67e5\u8be2\u8bed\u8a00\uff08\u4f8b\u5982<span class=\"application\">ECPG</span>\uff09\u6765\u8bf4\u662f\u6807\u51c6\u7684<acronym class=\"acronym\">SQL</acronym>\u3002\u7528\u4e8e\u6570\u7ec4\u5207\u7247\u548c\u7c7b\u578b\u8f6c\u6362\u7684\u5192\u53f7\u8bed\u6cd5\u662f<span class=\"productname\">PostgreSQL</span>\u6269\u5c55\uff0c\u5b83\u6709\u65f6\u53ef\u80fd\u4f1a\u4e0e\u6807\u51c6\u7528\u6cd5\u51b2\u7a81\u3002\u628a\u4e00\u4e2a\u53d8\u91cf\u503c\u8f6c\u4e49\u6210 SQL \u5b57\u9762\u91cf\u6216\u8005\u6807\u8bc6\u7b26\u7684\u5192\u53f7\u52a0\u5f15\u53f7\u8bed\u6cd5\u662f\u4e00\u79cd<span class=\"application\">psql</span>\u6269\u5c55\u3002</p>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-PROMPTING\">\n<h4 lang=\"zh\">\u63d0\u793a\u7b26</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u53d1\u51fa\u7684\u63d0\u793a\u7b26\u53ef\u4ee5\u6309\u4f60\u7684\u559c\u597d\u8fdb\u884c\u5b9a\u5236\u3002<code class=\"varname\">PROMPT1</code>\u3001<code class=\"varname\">PROMPT2</code> \u548c <code class=\"varname\">PROMPT3</code> \u8fd9\u4e09\u4e2a\u53d8\u91cf\u5305\u542b\u63cf\u8ff0\u63d0\u793a\u7b26\u5916\u89c2\u7684\u5b57\u7b26\u4e32\u548c\u7279\u6b8a\u8f6c\u4e49\u5e8f\u5217\u3002\u63d0\u793a\u7b26 1 \u662f <span class=\"application\">psql</span> \u8bf7\u6c42\u65b0\u547d\u4ee4\u65f6\u53d1\u51fa\u7684\u5e38\u89c4\u63d0\u793a\u7b26\u3002\u63d0\u793a\u7b26 2 \u4f1a\u5728\u5f55\u5165\u547d\u4ee4\u671f\u95f4\u8fd8\u9700\u8981\u66f4\u591a\u8f93\u5165\u65f6\u53d1\u51fa\uff0c\u4f8b\u5982\u547d\u4ee4\u5c1a\u672a\u4ee5\u5206\u53f7\u7ed3\u675f\uff0c\u6216\u8005\u5f15\u53f7\u5c1a\u672a\u95ed\u5408\u65f6\u3002\u5728\u6267\u884c <acronym class=\"acronym\">SQL</acronym> <code class=\"command\">COPY FROM STDIN</code> \u547d\u4ee4\u5e76\u9700\u8981\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4e00\u884c\u503c\u65f6\uff0c\u4f1a\u53d1\u51fa\u63d0\u793a\u7b26 3\u3002</p>\n<p lang=\"zh\">\u9009\u4e2d\u7684\u63d0\u793a\u7b26\u53d8\u91cf\u503c\u4f1a\u6309\u5b57\u9762\u8f93\u51fa\uff0c\u9664\u975e\u9047\u5230\u767e\u5206\u53f7\uff08<code class=\"literal\">%</code>\uff09\u3002\u6839\u636e\u4e0b\u4e00\u4e2a\u5b57\u7b26\u7684\u4e0d\u540c\uff0c\u4f1a\u66ff\u6362\u6210\u67d0\u4e9b\u5176\u4ed6\u6587\u672c\u3002\u5df2\u5b9a\u4e49\u7684\u66ff\u6362\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-PROMPTING-M-UC\"><span class=\"term\"><code class=\"literal\">%M</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5b8c\u6574\u4e3b\u673a\u540d\uff08\u542b\u57df\u540d\uff09\uff1b\u5982\u679c\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\uff0c\u5219\u4e3a<code class=\"literal\">[local]</code>\uff1b\u5982\u679c Unix \u57df\u5957\u63a5\u5b57\u4e0d\u5728\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u9ed8\u8ba4\u4f4d\u7f6e\uff0c\u5219\u4e3a<code class=\"literal\">[local:<em class=\"replaceable\"><code>/dir/name</code></em>]</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-M-LC\"><span class=\"term\"><code class=\"literal\">%m</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\uff0c\u5728\u7b2c\u4e00\u4e2a\u70b9\u53f7\u5904\u622a\u65ad\uff1b\u5982\u679c\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\uff0c\u5219\u4e3a<code class=\"literal\">[local]</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-GT\"><span class=\"term\"><code class=\"literal\">%&gt;</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u76d1\u542c\u7684\u7aef\u53e3\u53f7\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-N\"><span class=\"term\"><code class=\"literal\">%n</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u4f1a\u8bdd\u7528\u6237\u540d\u3002\uff08\u5728\u6570\u636e\u5e93\u4f1a\u8bdd\u671f\u95f4\uff0c<code class=\"command\">SET SESSION AUTHORIZATION</code>\u547d\u4ee4\u53ef\u80fd\u6539\u53d8\u8be5\u503c\u7684\u6269\u5c55\u7ed3\u679c\u3002\uff09</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-S\"><span class=\"term\"><code class=\"literal\">%s</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u670d\u52a1\u540d\u79f0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-SLASH\"><span class=\"term\"><code class=\"literal\">%/</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-TILDE\"><span class=\"term\"><code class=\"literal\">%~</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7c7b\u4f3c <code class=\"literal\">%/</code>\uff0c\u4f46\u5982\u679c\u8be5\u6570\u636e\u5e93\u662f\u4f60\u7684\u9ed8\u8ba4\u6570\u636e\u5e93\uff0c\u5219\u8f93\u51fa <code class=\"literal\">~</code>\uff08\u6ce2\u6d6a\u53f7\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-NUMBERSIGN\"><span class=\"term\"><code class=\"literal\">%#</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u4f1a\u8bdd\u7528\u6237\u662f\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\uff0c\u5219\u4e3a<code class=\"literal\">#</code>\uff0c\u5426\u5219\u4e3a<code class=\"literal\">&gt;</code>\u3002\uff08\u5728\u6570\u636e\u5e93\u4f1a\u8bdd\u671f\u95f4\uff0c<code class=\"command\">SET SESSION AUTHORIZATION</code>\u547d\u4ee4\u53ef\u80fd\u6539\u53d8\u8be5\u503c\u7684\u6269\u5c55\u7ed3\u679c\u3002\uff09</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-P\"><span class=\"term\"><code class=\"literal\">%p</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u6240\u8fde\u63a5\u540e\u7aef\u7684\u8fdb\u7a0b ID\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-P-UC\"><span class=\"term\"><code class=\"literal\">%P</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7ba1\u9053\u72b6\u6001\uff1a\u4e0d\u5728\u7ba1\u9053\u4e2d\u65f6\u4e3a <code class=\"literal\">off</code>\uff0c\u5728\u8fdb\u884c\u4e2d\u7684\u7ba1\u9053\u4e2d\u65f6\u4e3a <code class=\"literal\">on</code>\uff0c\u5728\u5df2\u4e2d\u6b62\u7684\u7ba1\u9053\u4e2d\u65f6\u4e3a <code class=\"literal\">abort</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-R\"><span class=\"term\"><code class=\"literal\">%R</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5728\u63d0\u793a\u7b26 1 \u4e2d\uff0c\u901a\u5e38\u663e\u793a =\uff1b\u4f46\u5982\u679c\u4f1a\u8bdd\u5904\u4e8e\u6761\u4ef6\u5757\u4e2d\u672a\u6fc0\u6d3b\u7684\u5206\u652f\uff0c\u5219\u663e\u793a @\uff1b\u5982\u679c\u5904\u4e8e\u5355\u884c\u6a21\u5f0f\uff0c\u5219\u663e\u793a ^\uff1b\u5982\u679c\u4f1a\u8bdd\u5df2\u65ad\u5f00\u6570\u636e\u5e93\u8fde\u63a5\uff08\u4f8b\u5982 \\connect \u5931\u8d25\u65f6\uff09\uff0c\u5219\u663e\u793a !\u3002\u5728\u63d0\u793a\u7b26 2 \u4e2d\uff0c%R \u4f1a\u66ff\u6362\u4e3a\u8868\u793a psql \u7b49\u5f85\u66f4\u591a\u8f93\u5165\u539f\u56e0\u7684\u5b57\u7b26\uff1a\u547d\u4ee4\u5c1a\u672a\u7ed3\u675f\u65f6\u4e3a -\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684 /* ... */ \u6ce8\u91ca\u65f6\u4e3a *\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u5e26\u5f15\u53f7\u5b57\u7b26\u4e32\u65f6\u4e3a\u5355\u5f15\u53f7\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u5e26\u5f15\u53f7\u6807\u8bc6\u7b26\u65f6\u4e3a\u53cc\u5f15\u53f7\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u7f8e\u5143\u5f15\u7528\u5b57\u7b26\u4e32\u65f6\u4e3a\u7f8e\u5143\u7b26\u53f7\uff1b\u5b58\u5728\u672a\u5339\u914d\u7684\u5de6\u62ec\u53f7\u65f6\u4e3a (\u3002\u5728\u63d0\u793a\u7b26 3 \u4e2d\uff0c%R \u4e0d\u4ea7\u751f\u4efb\u4f55\u5185\u5bb9\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-X\"><span class=\"term\"><code class=\"literal\">%x</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u72b6\u6001\uff1a\u5982\u679c\u5f53\u524d\u4e0d\u5728\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff1b\u5982\u679c\u5904\u4e8e\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a <code class=\"literal\">*</code>\uff1b\u5982\u679c\u5904\u4e8e\u5931\u8d25\u7684\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a <code class=\"literal\">!</code>\uff1b\u5982\u679c\u4e8b\u52a1\u72b6\u6001\u4e0d\u786e\u5b9a\uff08\u4f8b\u5982\u56e0\u4e3a\u5f53\u524d\u6ca1\u6709\u8fde\u63a5\uff09\uff0c\u5219\u4e3a <code class=\"literal\">?</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-L\"><span class=\"term\"><code class=\"literal\">%l</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8bed\u53e5\u4e2d\u7684\u884c\u53f7\uff0c\u4ece <code class=\"literal\">1</code> \u5f00\u59cb\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-DIGITS\"><span class=\"term\"><code class=\"literal\">%</code><em class=\"replaceable\"><code>digits</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u66ff\u6362\u4e3a\u6307\u5b9a\u516b\u8fdb\u5236\u4ee3\u7801\u5bf9\u5e94\u7684\u5b57\u7b26\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-NAME\"><span class=\"term\"><code class=\"literal\">%:</code><em class=\"replaceable\"><code>name</code></em><code class=\"literal\">:</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><span class=\"application\">psql</span> \u53d8\u91cf <em class=\"replaceable\"><code>name</code></em> \u7684\u503c\u3002\u8be6\u89c1\u4e0a\u9762\u7684<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-COMMAND\"><span class=\"term\"><code class=\"literal\">%`</code><em class=\"replaceable\"><code>command</code></em><code class=\"literal\">`</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><em class=\"replaceable\"><code>command</code></em> \u7684\u8f93\u51fa\uff0c\u7c7b\u4f3c\u666e\u901a\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u53cd\u5f15\u53f7</span>\u201d</span>\u66ff\u6362\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-SQUARE-BRACKETS\"><span class=\"term\"><code class=\"literal\">%[</code> ... <code class=\"literal\">%]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u63d0\u793a\u7b26\u4e2d\u53ef\u4ee5\u5305\u542b\u7ec8\u7aef\u63a7\u5236\u5b57\u7b26\uff0c\u4f8b\u5982\u6539\u53d8\u63d0\u793a\u6587\u672c\u7684\u989c\u8272\u3001\u80cc\u666f\u6216\u6837\u5f0f\uff0c\u6216\u8005\u6539\u53d8\u7ec8\u7aef\u7a97\u53e3\u6807\u9898\u3002\u4e3a\u4e86\u8ba9 <span class=\"application\">Readline</span> \u7684\u884c\u7f16\u8f91\u529f\u80fd\u6b63\u5e38\u5de5\u4f5c\uff0c\u8fd9\u4e9b\u4e0d\u53ef\u6253\u5370\u7684\u63a7\u5236\u5b57\u7b26\u5fc5\u987b\u7528 <code class=\"literal\">%[</code> \u548c <code class=\"literal\">%]</code> \u5305\u56f4\u8d77\u6765\uff0c\u4ee5\u6807\u8bb0\u4e3a\u4e0d\u53ef\u89c1\u5b57\u7b26\u3002\u63d0\u793a\u7b26\u4e2d\u53ef\u4ee5\u51fa\u73b0\u591a\u7ec4\u8fd9\u6837\u7684\u6807\u8bb0\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; \\set PROMPT1 '%[%033[1;33;40m%]%n@%/%R%[%033[0m%]%# '\n</pre>\n<p lang=\"zh\">\u5176\u6548\u679c\u662f\u5728\u517c\u5bb9 VT100 \u4e14\u652f\u6301\u989c\u8272\u7684\u7ec8\u7aef\u4e0a\uff0c\u751f\u6210\u4e00\u4e2a\u7c97\u4f53\uff08<code class=\"literal\">1;</code>\uff09\u7684\u9ed1\u5e95\u9ec4\u5b57\u63d0\u793a\u7b26\uff08<code class=\"literal\">33;40</code>\uff09\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-W\"><span class=\"term\"><code class=\"literal\">%w</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0e\u6700\u8fd1\u4e00\u6b21\u8f93\u51fa\u7684 <code class=\"varname\">PROMPT1</code> \u5177\u6709\u76f8\u540c\u5bbd\u5ea6\u7684\u7a7a\u767d\u3002\u8fd9\u53ef\u7528\u4f5c <code class=\"varname\">PROMPT2</code> \u7684\u8bbe\u7f6e\uff0c\u4f7f\u591a\u884c\u8bed\u53e5\u4e0e\u7b2c\u4e00\u884c\u5bf9\u9f50\uff0c\u4f46\u4e0d\u663e\u793a\u53ef\u89c1\u7684\u4e8c\u7ea7\u63d0\u793a\u7b26\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8981\u5728\u63d0\u793a\u7b26\u4e2d\u63d2\u5165\u767e\u5206\u53f7\uff0c\u8bf7\u5199 %%\u3002\u63d0\u793a\u7b26 1 \u548c 2 \u7684\u9ed8\u8ba4\u503c\u4e3a '%/%R%x%# '\uff0c\u63d0\u793a\u7b26 3 \u7684\u9ed8\u8ba4\u503c\u4e3a '&gt;&gt; '\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">tcsh</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-READLINE\">\n<h4 lang=\"zh\">\u547d\u4ee4\u884c\u7f16\u8f91</h4>\n<p lang=\"zh\">\u5982\u679c\u53ef\u7528\uff0c<span class=\"application\">psql</span> \u4f1a\u4f7f\u7528<span class=\"application\">Readline</span>\u6216<span class=\"application\">libedit</span>\u5e93\uff0c\u4ee5\u4fbf\u8fdb\u884c\u4fbf\u6377\u7684\u884c\u7f16\u8f91\u548c\u5386\u53f2\u68c0\u7d22\u3002\u5f53<span class=\"application\">psql</span>\u9000\u51fa\u65f6\uff0c\u547d\u4ee4\u5386\u53f2\u4f1a\u81ea\u52a8\u4fdd\u5b58\uff1b\u5f53<span class=\"application\">psql</span>\u542f\u52a8\u65f6\uff0c\u53c8\u4f1a\u91cd\u65b0\u8f7d\u5165\u3002\u8f93\u5165\u4e0a\u7bad\u5934\u6216 control-P \u53ef\u4ee5\u53d6\u56de\u4e4b\u524d\u7684\u884c\u3002</p>\n<p lang=\"zh\">\u5728\u8bb8\u591a\uff08\u7edd\u975e\u5168\u90e8\uff09\u4e0a\u4e0b\u6587\u4e2d\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528 TAB \u8865\u5168\u90e8\u5206\u8f93\u5165\u7684\u5173\u952e\u5b57\u548c SQL \u5bf9\u8c61\u540d\u3002\u4f8b\u5982\uff0c\u5728\u547d\u4ee4\u5f00\u5934\u8f93\u5165<code class=\"literal\">ins</code>\u5e76\u6309\u4e0b TAB \u952e\uff0c\u4f1a\u8865\u5168\u4e3a<code class=\"literal\">insert into</code> \u3002\u7136\u540e\u8f93\u5165\u8868\u540d\u6216\u6a21\u5f0f\u540d\u7684\u51e0\u4e2a\u5b57\u7b26\uff0c\u518d\u6309\u4e0b<code class=\"literal\">TAB</code>\u952e\uff0c\u5c31\u4f1a\u8865\u5168\u5c1a\u672a\u8f93\u5b8c\u7684\u540d\u79f0\uff1b\u5982\u679c\u6709\u591a\u4e2a\u5019\u9009\u9879\uff0c\u5219\u4f1a\u7ed9\u51fa\u53ef\u80fd\u7684\u8865\u5168\u83dc\u5355\u3002\uff08\u5177\u4f53\u53d6\u51b3\u4e8e\u6240\u4f7f\u7528\u7684\u5e93\uff0c\u53ef\u80fd\u9700\u8981\u6309\u591a\u6b21<code class=\"literal\">TAB</code>\u952e\u624d\u80fd\u770b\u5230\u83dc\u5355\u3002\uff09</p>\n<p lang=\"zh\">\u5bf9 SQL \u5bf9\u8c61\u540d\u8fdb\u884c TAB \u8865\u5168\u65f6\uff0c\u9700\u8981\u5411\u670d\u52a1\u5668\u53d1\u9001\u67e5\u8be2\u6765\u67e5\u627e\u53ef\u80fd\u7684\u5339\u914d\u9879\u3002\u5728\u67d0\u4e9b\u4e0a\u4e0b\u6587\u4e2d\uff0c\u8fd9\u53ef\u80fd\u4f1a\u5e72\u6270\u5176\u4ed6\u64cd\u4f5c\u3002\u4f8b\u5982\uff0c\u5728<code class=\"command\">BEGIN</code>\u4e4b\u540e\uff0c\u5982\u679c\u4e2d\u95f4\u53d1\u51fa\u4e86\u4e00\u6b21 TAB \u8865\u5168\u67e5\u8be2\uff0c\u90a3\u4e48\u518d\u53d1\u51fa<code class=\"command\">SET TRANSACTION ISOLATION LEVEL</code>\u5c31\u4e3a\u65f6\u5df2\u665a\u4e86\u3002\u5982\u679c\u6839\u672c\u4e0d\u60f3\u4f7f\u7528 TAB \u8865\u5168\uff0c\u53ef\u4ee5\u628a\u4e0b\u9762\u7684\u5185\u5bb9\u653e\u5230\u4e3b\u76ee\u5f55\u4e2d\u540d\u4e3a<code class=\"filename\">.inputrc</code>\u7684\u6587\u4ef6\u91cc\uff0c\u4ece\u800c\u6c38\u4e45\u5173\u95ed\u5b83\uff1a</p>\n<pre class=\"programlisting\">$if psql\nset disable-completion on\n$endif\n</pre>\n<p lang=\"zh\">\uff08\u8fd9\u4e0d\u662f<span class=\"application\">psql</span>\u800c\u662f\u4e00\u4e2a<span class=\"application\">Readline</span>\u529f\u80fd\u3002\u9605\u8bfb\u5176\u6587\u6863\u4ee5\u83b7\u53d6\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\u3002\uff09</p>\n<p lang=\"zh\"><code class=\"option\">-n</code>\uff08<code class=\"option\">--no-readline</code>\uff09\u547d\u4ee4\u884c\u9009\u9879\u4e5f\u53ef\u7528\u4e8e\u5728\u5355\u6b21\u8fd0\u884c<span class=\"application\">psql</span>\u65f6\u7981\u7528 <span class=\"application\">Readline</span>\u3002\u8fd9\u4f1a\u963b\u6b62TAB \u8865\u5168\u3001\u547d\u4ee4\u884c\u5386\u53f2\u7684\u4f7f\u7528\u6216\u8bb0\u5f55\uff0c\u4ee5\u53ca\u591a\u884c\u547d\u4ee4\u7684\u7f16\u8f91\u3002\u5f53\u4f60\u9700\u8981\u590d\u5236\u7c98\u8d34\u5305\u542b <code class=\"literal\">TAB</code> \u5b57\u7b26\u7684\u6587\u672c\u65f6\uff0c\u5b83\u5c24\u5176\u6709\u7528\u3002</p>\n</div>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PSQL-ENVIRONMENT\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-ENVIRONMENT-COLUMNS\"><span class=\"term\"><code class=\"envar\">COLUMNS</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c<code class=\"literal\">\\pset columns</code>\u4e3a\u96f6\uff0c\u8fd9\u4e2a\u73af\u5883\u53d8\u91cf\u63a7\u5236\u7528\u4e8e<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u5bbd\u5ea6\u4ee5\u53ca\u7528\u6765\u786e\u5b9a\u8f83\u5bbd\u7684\u8f93\u51fa\u662f\u5426\u9700\u8981\u5206\u9875\u5668\uff0c\u6216\u8005\u662f\u5426\u5e94\u5207\u6362\u5230\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e2d\u7684\u5782\u76f4\u683c\u5f0f\u7684\u5bbd\u5ea6\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PGDATABASE\"><span class=\"term\"><code class=\"envar\">PGDATABASE</code><br/></span><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\uff08\u89c1<a class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a032.15\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PG-COLOR\"><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PSQL-EDITOR\"><span class=\"term\"><code class=\"envar\">PSQL_EDITOR</code><br/></span><span class=\"term\"><code class=\"envar\">EDITOR</code><br/></span><span class=\"term\"><code class=\"envar\">VISUAL</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"command\">\\e</code>\u3001<code class=\"command\">\\ef</code>\u4ee5\u53ca<code class=\"command\">\\ev</code>\u547d\u4ee4\u6240\u4f7f\u7528\u7684\u7f16\u8f91\u5668\u3002\u4f1a\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u68c0\u67e5\u8fd9\u4e9b\u53d8\u91cf\uff0c\u7b2c\u4e00\u4e2a\u88ab\u8bbe\u7f6e\u7684\u5c06\u88ab\u4f7f\u7528\u3002\u5982\u679c\u90fd\u6ca1\u6709\u88ab\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u662f\u4f7f\u7528Unix\u7cfb\u7edf\u4e0a\u7684<code class=\"filename\">vi</code>\u6216\u8005Windows\u7cfb\u7edf\u4e0a\u7684<code class=\"filename\">notepad.exe</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PSQL-EDITOR-LINENUMBER-ARG\"><span class=\"term\"><code class=\"envar\">PSQL_EDITOR_LINENUMBER_ARG</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5f53 <code class=\"command\">\\e</code>\u3001<code class=\"command\">\\ef</code> \u6216 <code class=\"command\">\\ev</code> \u5e26\u6709\u884c\u53f7\u53c2\u6570\u4f7f\u7528\u65f6\uff0c\u6b64\u53d8\u91cf\u6307\u5b9a\u5c06\u8d77\u59cb\u884c\u53f7\u4f20\u7ed9\u7528\u6237\u7f16\u8f91\u5668\u65f6\u6240\u7528\u7684\u547d\u4ee4\u884c\u53c2\u6570\u3002\u5bf9\u4e8e <span class=\"productname\">Emacs</span> \u6216 <span class=\"productname\">vi</span> \u4e4b\u7c7b\u7684\u7f16\u8f91\u5668\uff0c\u8fd9\u4e2a\u53c2\u6570\u662f\u4e00\u4e2a\u52a0\u53f7\u3002\u5982\u679c\u9009\u9879\u540d\u548c\u884c\u53f7\u4e4b\u95f4\u9700\u8981\u7a7a\u683c\uff0c\u8bf7\u5728\u53d8\u91cf\u503c\u4e2d\u5305\u542b\u672b\u5c3e\u7a7a\u683c\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">PSQL_EDITOR_LINENUMBER_ARG='+'\nPSQL_EDITOR_LINENUMBER_ARG='--line '\n</pre>\n<p lang=\"zh\">\u5728 Unix \u7cfb\u7edf\u4e0a\u9ed8\u8ba4\u662f<code class=\"literal\">+</code>\uff08\u5bf9\u5e94\u4e8e\u9ed8\u8ba4\u7f16\u8f91\u5668<code class=\"filename\">vi</code>\uff0c\u4e14\u5bf9\u5f88\u591a\u5176\u4ed6\u5e38\u89c1\u7f16\u8f91\u5668\u53ef\u7528\uff09\u3002\u5728 Windows \u7cfb\u7edf\u4e0a\u6ca1\u6709\u9ed8\u8ba4\u503c\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PSQL-HISTORY\"><span class=\"term\"><code class=\"envar\">PSQL_HISTORY</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u547d\u4ee4\u5386\u53f2\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08<code class=\"literal\">~</code>\uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PAGER\"><span class=\"term\"><code class=\"envar\">PSQL_PAGER</code><br/></span><span class=\"term\"><code class=\"envar\">PAGER</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u67e5\u8be2\u7ed3\u679c\u65e0\u6cd5\u5728\u5c4f\u5e55\u4e0a\u663e\u793a\u5b8c\u6574\uff0c\u5b83\u4eec\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6b64\u547d\u4ee4\u3002\u5178\u578b\u7684\u503c\u662f<code class=\"literal\">more</code>\u6216<code class=\"literal\">less</code>\u3002\u53ef\u4ee5\u901a\u8fc7\u5c06<code class=\"envar\">PSQL_PAGER</code>\u6216<code class=\"envar\">PAGER</code>\u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u6216\u901a\u8fc7\u8c03\u6574<code class=\"command\">\\pset</code>\u547d\u4ee4\u7684\u4e0e\u5206\u9875\u76f8\u5173\u7684\u9009\u9879\u6765\u7981\u7528\u5206\u9875\u5668\u3002\u8fd9\u4e9b\u53d8\u91cf\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u8fdb\u884c\u68c0\u67e5\uff1b\u4f7f\u7528\u6309\u8be5\u987a\u5e8f\u627e\u5230\u7684\u7b2c\u4e00\u4e2a\u5df2\u8bbe\u7f6e\u7684\u53d8\u91cf\u3002\u5982\u679c\u5b83\u4eec\u90fd\u6ca1\u6709\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5728\u5927\u591a\u6570\u5e73\u53f0\u4e0a\u4f7f\u7528<code class=\"literal\">more</code>\uff0c\u4f46\u5728Cygwin\u4e0a\u4f7f\u7528<code class=\"literal\">less</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PSQL-WATCH-PAGER\"><span class=\"term\"><code class=\"envar\">PSQL_WATCH_PAGER</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528 \\watch \u547d\u4ee4\u53cd\u590d\u6267\u884c\u67e5\u8be2\u65f6\uff0c\u9ed8\u8ba4\u4e0d\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\u3002\u5728 Unix \u7cfb\u7edf\u4e0a\uff0c\u53ef\u4ee5\u5c06 PSQL_WATCH_PAGER \u8bbe\u4e3a\u5206\u9875\u7a0b\u5e8f\u547d\u4ee4\u6765\u6539\u53d8\u6b64\u884c\u4e3a\u3002pspg \u5206\u9875\u7a0b\u5e8f\uff08\u4e0d\u5c5e\u4e8e PostgreSQL\uff0c\u4f46\u8bb8\u591a\u5f00\u6e90\u8f6f\u4ef6\u53d1\u884c\u7248\u90fd\u63d0\u4f9b\u5b83\uff09\u4ee5 --stream \u9009\u9879\u542f\u52a8\u65f6\uff0c\u53ef\u4ee5\u663e\u793a \\watch \u7684\u8f93\u51fa\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PSQLRC\"><span class=\"term\"><code class=\"envar\">PSQLRC</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7528\u6237\u7684<code class=\"filename\">.psqlrc</code>\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08<code class=\"literal\">~</code>\uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-SHELL\"><span class=\"term\"><code class=\"envar\">SHELL</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u88ab<code class=\"command\">\\!</code>\u547d\u4ee4\u6267\u884c\u7684\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-TMPDIR\"><span class=\"term\"><code class=\"envar\">TMPDIR</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b58\u50a8\u4e34\u65f6\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u662f<code class=\"filename\">/tmp</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6 <span class=\"productname\">PostgreSQL</span> \u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528 <span class=\"application\">libpq</span> \u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a032.15\u00a0\u8282</a>\uff09\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.21.10\">\n<h2 lang=\"zh\">\u6587\u4ef6</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-FILES-PSQLRC\" lang=\"zh\"><span class=\"term\"><code class=\"filename\">psqlrc</code> \u548c <code class=\"filename\">~/.psqlrc</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u6ca1\u6709<code class=\"option\">-X</code>\u9009\u9879\uff0c\u5728\u8fde\u63a5\u5230\u6570\u636e\u5e93\u540e\u4f46\u5728\u63a5\u6536\u6b63\u5e38\u7684\u547d\u4ee4\u4e4b\u524d\uff0c<span class=\"application\">psql</span>\u4f1a\u5c1d\u8bd5\u4f9d\u6b21\u4ece\u7cfb\u7edf\u7ea7\u7684\u542f\u52a8\u6587\u4ef6\uff08<code class=\"filename\">psqlrc</code>\uff09\u548c\u7528\u6237\u7684\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\uff08<code class=\"filename\">~/.psqlrc</code>\uff09\u4e2d\u8bfb\u53d6\u5e76\u4e14\u6267\u884c\u547d\u4ee4\u3002\u8fd9\u4e9b\u6587\u4ef6\u53ef\u4ee5\u88ab\u7528\u6765\u8bbe\u7f6e\u5ba2\u6237\u7aef\u6216\u8005\u670d\u52a1\u5668\uff0c\u901a\u5e38\u662f\u4e00\u4e9b<code class=\"command\">\\set</code>\u548c<code class=\"command\">SET</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u7cfb\u7edf\u8303\u56f4\u7684\u542f\u52a8\u6587\u4ef6\u540d\u4e3a <code class=\"filename\">psqlrc</code>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4f1a\u5728\u5b89\u88c5\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u7cfb\u7edf\u914d\u7f6e</span>\u201d</span>\u76ee\u5f55\u4e2d\u67e5\u627e\u5b83\uff0c\u6700\u53ef\u9760\u7684\u8bc6\u522b\u65b9\u5f0f\u662f\u8fd0\u884c <code class=\"literal\">pg_config --sysconfdir</code>\u3002\u901a\u5e38\u8fd9\u4e2a\u76ee\u5f55\u662f\u76f8\u5bf9\u4e8e\u5305\u542b <span class=\"productname\">PostgreSQL</span> \u53ef\u6267\u884c\u6587\u4ef6\u7684\u76ee\u5f55\u7684 <code class=\"filename\">../etc/</code>\u3002\u4e5f\u53ef\u4ee5\u901a\u8fc7 <code class=\"envar\">PGSYSCONFDIR</code> \u73af\u5883\u53d8\u91cf\u663e\u5f0f\u6307\u5b9a\u67e5\u627e\u76ee\u5f55\u3002</p>\n<p lang=\"zh\">\u7528\u6237\u7684\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\u540d\u4e3a<code class=\"filename\">.psqlrc</code>\uff0c\u5e76\u4e14\u5728\u8c03\u7528\u7528\u6237\u7684\u4e3b\u76ee\u5f55\u4e2d\u5bfb\u627e\u3002\u5728Windows\u4e0a\uff0c\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\u7684\u540d\u79f0\u6539\u4e3a<code class=\"filename\">%APPDATA%\\postgresql\\psqlrc.conf</code>\u3002\u5728\u4efb\u4f55\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e<code class=\"envar\">PSQLRC</code>\u73af\u5883\u53d8\u91cf\u6765\u8986\u76d6\u6b64\u9ed8\u8ba4\u6587\u4ef6\u8def\u5f84\u3002</p>\n<p lang=\"zh\">\u7cfb\u7edf\u8303\u56f4\u7684\u542f\u52a8\u6587\u4ef6\u548c\u7528\u6237\u4e2a\u4eba\u7684\u542f\u52a8\u6587\u4ef6\u90fd\u53ef\u4ee5\u901a\u8fc7\u5728\u6587\u4ef6\u540d\u540e\u9644\u52a0\u8fde\u5b57\u7b26\u548c<span class=\"productname\">PostgreSQL</span>\u7684\u5927\u7248\u672c\u6216\u5c0f\u7248\u672c\u6807\u8bc6\u7b26\u6765\u4f7f\u5176\u4e0e<span class=\"application\">psql</span>\u7248\u672c\u76f8\u5173\uff0c\u4f8b\u5982<code class=\"filename\">~/.psqlrc-18</code>\u6216<code class=\"filename\">~/.psqlrc-18.6</code>\u3002\u6700\u5177\u4f53\u7248\u672c\u5339\u914d\u7684\u6587\u4ef6\u5c06\u4f18\u5148\u8bfb\u53d6\uff0c\u800c\u4e0d\u662f\u975e\u7279\u5b9a\u7248\u672c\u7684\u6587\u4ef6\u3002\u8fd9\u4e9b\u7248\u672c\u540e\u7f00\u662f\u5728\u786e\u5b9a\u6587\u4ef6\u8def\u5f84\u540e\u6dfb\u52a0\u7684\uff0c\u5982\u4e0a\u6240\u8ff0\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-FILES-PSQL-HISTORY\"><span class=\"term\"><code class=\"filename\">.psql_history</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u547d\u4ee4\u884c\u5386\u53f2\u88ab\u5b58\u50a8\u5728\u6587\u4ef6<code class=\"filename\">~/.psql_history</code>\u4e2d\uff0c\u5728 Windows \u4e0a\u5219\u5b58\u50a8\u5728\u6587\u4ef6<code class=\"filename\">%APPDATA%\\postgresql\\psql_history</code>\u4e2d\u3002</p>\n<p lang=\"zh\">\u5386\u53f2\u6587\u4ef6\u7684\u4f4d\u7f6e\u53ef\u4ee5\u901a\u8fc7<code class=\"varname\">HISTFILE</code> <span class=\"application\">psql</span>\u53d8\u91cf\u6216\u8005<code class=\"envar\">PSQL_HISTORY</code>\u73af\u5883\u53d8\u91cf\u663e\u5f0f\u8bbe\u7f6e\u3002</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.21.11\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">psql</span>\u6700\u9002\u5408\u4e0e\u76f8\u540c\u6216\u8f83\u65e7\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\u914d\u5408\u4f7f\u7528\u3002\u5982\u679c\u670d\u52a1\u5668\u7684\u7248\u672c\u6bd4<span class=\"application\">psql</span>\u672c\u8eab\u66f4\u65b0\uff0c\u53cd\u659c\u7ebf\u547d\u4ee4\u7279\u522b\u5bb9\u6613\u5931\u8d25\u3002\u7136\u800c\uff0c<code class=\"literal\">\\d</code>\u7cfb\u5217\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u5e94\u8be5\u53ef\u4ee5\u5728\u6700\u4f4e\u81f3 9.2 \u7248\u672c\u7684\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\uff0c\u4f46\u4e0d\u4e00\u5b9a\u9002\u7528\u4e8e\u6bd4<span class=\"application\">psql</span>\u672c\u8eab\u66f4\u65b0\u7684\u670d\u52a1\u5668\u3002\u8fd0\u884cSQL\u547d\u4ee4\u548c\u663e\u793a\u67e5\u8be2\u7ed3\u679c\u7684\u4e00\u822c\u529f\u80fd\u4e5f\u5e94\u8be5\u53ef\u4ee5\u5728\u66f4\u65b0\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\uff0c\u4f46\u4e0d\u80fd\u4fdd\u8bc1\u5728\u6240\u6709\u60c5\u51b5\u4e0b\u90fd\u80fd\u5b9e\u73b0\u3002</p>\n<p>\u5982\u679c\u4f60\u60f3\u7528<span class=\"application\">psql</span>\u8fde\u63a5\u5230\u591a\u4e2a\u5177\u6709\u4e0d\u540c\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\uff0c\u63a8\u8350\u4f7f\u7528\u6700\u65b0\u7248\u672c\u7684<span class=\"application\">psql</span>\u3002\u6216\u8005\uff0c\u4f60\u53ef\u4ee5\u4e3a\u6bcf\u4e00\u4e2a\u5927\u7248\u672c\u4fdd\u7559\u4e00\u4efd<span class=\"application\">psql</span>\u62f7\u8d1d\uff0c\u5e76\u4e14\u9488\u5bf9\u76f8\u5e94\u7684\u670d\u52a1\u5668\u4f7f\u7528\u5339\u914d\u7684\u7248\u672c\u3002\u4f46\u5b9e\u9645\u4e0a\uff0c\u8fd9\u79cd\u989d\u5916\u7684\u9ebb\u70e6\u662f\u4e0d\u5fc5\u8981\u7684\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5728 <span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\uff0c<code class=\"option\">-c</code> \u9009\u9879\u610f\u5473\u7740 <code class=\"option\">-X</code>\uff08<code class=\"option\">--no-psqlrc</code>\uff09\uff1b\u73b0\u5728\u5df2\u7ecf\u4e0d\u662f\u8fd9\u6837\u4e86\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5728<span class=\"productname\">PostgreSQL</span> 8.4 \u4e4b\u524d\uff0c<span class=\"application\">psql</span>\u5141\u8bb8\u4e00\u4e2a\u5355\u5b57\u6bcd\u53cd\u659c\u7ebf\u547d\u4ee4\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u76f4\u63a5\u5199\u5728\u8be5\u547d\u4ee4\u540e\u9762\uff0c\u4e2d\u95f4\u4e0d\u9700\u8981\u7a7a\u767d\u3002\u73b0\u5728\u5219\u8981\u6c42\u7528\u7a7a\u767d\u5206\u9694\u3002</p>\n</li>\n</ul>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.21.12\">\n<h2 lang=\"zh\">\u7ed9 Windows \u7528\u6237\u7684\u6ce8\u89e3</h2>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u662f\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u63a7\u5236\u53f0\u5e94\u7528</span>\u201d</span>\u3002\u7531\u4e8e Windows \u7684\u63a7\u5236\u53f0\u7a97\u53e3\u4f7f\u7528\u7684\u662f\u4e00\u79cd\u548c\u7cfb\u7edf\u4e2d\u5176\u4ed6\u5e94\u7528\u4e0d\u540c\u7684\u7f16\u7801\uff0c\u5728<span class=\"application\">psql</span>\u4e2d\u4f7f\u7528 8 \u4f4d\u5b57\u7b26\u65f6\u8981\u7279\u522b\u6ce8\u610f\u3002\u5982\u679c<span class=\"application\">psql</span>\u68c0\u6d4b\u5230\u4e00\u4e2a\u6709\u95ee\u9898\u7684\u63a7\u5236\u53f0\u4ee3\u7801\u9875\uff0c\u5b83\u5c06\u4f1a\u5728\u542f\u52a8\u65f6\u8b66\u544a\u4f60\u3002\u8981\u66f4\u6539\u63a7\u5236\u53f0\u4ee3\u7801\u9875\uff0c\u6709\u4e24\u4ef6\u4e8b\u662f\u5fc5\u8981\u7684\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u8f93\u5165<strong class=\"userinput\"><code>cmd.exe /c chcp 1252</code></strong>\u53ef\u4ee5\u8bbe\u7f6e\u4ee3\u7801\u9875\uff081252 \u662f\u9002\u7528\u4e8e\u5fb7\u8bed\u7684\u4e00\u4e2a\u4ee3\u7801\u9875\uff0c\u8bf7\u5728\u8fd9\u91cc\u66ff\u6362\u6210\u4f60\u7684\u503c\uff09\u3002\u5982\u679c\u6b63\u5728\u4f7f\u7528 Cygwin\uff0c\u53ef\u4ee5\u628a\u8fd9\u4e2a\u547d\u4ee4\u653e\u5728<code class=\"filename\">/etc/profile</code>\u4e2d\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u628a\u63a7\u5236\u53f0\u5b57\u4f53\u8bbe\u7f6e\u4e3a<code class=\"literal\">Lucida Console</code>\uff0c\u56e0\u4e3a\u6805\u683c\u5b57\u4f53\u65e0\u6cd5\u4e0e ANSI \u4ee3\u7801\u9875\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</li>\n</ul>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PSQL-EXAMPLES\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u7b2c\u4e00\u4e2a\u793a\u4f8b\u5c55\u793a\u4e86\u5982\u4f55\u628a\u4e00\u6761\u547d\u4ee4\u5206\u6563\u5230\u591a\u884c\u8f93\u5165\u4e2d\u3002\u6ce8\u610f\u63d0\u793a\u7b26\u7684\u53d8\u5316\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>CREATE TABLE my_table (</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code> first integer not null default 0,</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code> second text)</code></strong>\ntestdb-&gt; <strong class=\"userinput\"><code>;</code></strong>\nCREATE TABLE\n</pre>\n<p lang=\"zh\">\u73b0\u5728\u518d\u6765\u770b\u4e00\u4e0b\u8fd9\u4e2a\u8868\u7684\u5b9a\u4e49\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\d my_table</code></strong>\n              Table \"public.my_table\"\n Column |  Type   | Collation | Nullable | Default\n--------+---------+-----------+----------+---------\n first  | integer |           | not null | 0\n second | text    |           |          |\n</pre>\n<p lang=\"zh\">\u73b0\u5728\u6211\u4eec\u628a\u63d0\u793a\u7b26\u6539\u6210\u66f4\u6709\u8da3\u7684\u5f62\u5f0f\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set PROMPT1 '%n@%m %~%R%# '</code></strong>\npeter@localhost testdb=&gt;\n</pre>\n<p lang=\"zh\">\u5047\u8bbe\u4f60\u5df2\u7ecf\u5411\u8868\u4e2d\u586b\u5165\u6570\u636e\uff0c\u5e76\u60f3\u770b\u4e00\u770b\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; SELECT * FROM my_table;\n first | second\n-------+--------\n     1 | one\n     2 | two\n     3 | three\n     4 | four\n(4 rows)\n</pre>\n<p lang=\"zh\">\u4f60\u53ef\u4ee5\u4f7f\u7528 <code class=\"command\">\\pset</code> \u547d\u4ee4\u4ee5\u4e0d\u540c\u65b9\u5f0f\u663e\u793a\u8868\u683c\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 2</code></strong>\nBorder style is 2.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\n+-------+--------+\n| first | second |\n+-------+--------+\n|     1 | one    |\n|     2 | two    |\n|     3 | three  |\n|     4 | four   |\n+-------+--------+\n(4 rows)\n\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 0</code></strong>\nBorder style is 0.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\nfirst second\n----- ------\n    1 one\n    2 two\n    3 three\n    4 four\n(4 rows)\n\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 1</code></strong>\nBorder style is 1.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset format csv</code></strong>\nOutput format is csv.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset tuples_only</code></strong>\nTuples only is on.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT second, first FROM my_table;</code></strong>\none,1\ntwo,2\nthree,3\nfour,4\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset format unaligned</code></strong>\nOutput format is unaligned.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset fieldsep '\\t'</code></strong>\nField separator is \"    \".\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT second, first FROM my_table;</code></strong>\none     1\ntwo     2\nthree   3\nfour    4\n</pre>\n<p lang=\"zh\">\u6216\u8005\u4f7f\u7528\u77ed\u547d\u4ee4\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\a \\t \\x</code></strong>\nOutput format is aligned.\nTuples only is off.\nExpanded display is on.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\n-[ RECORD 1 ]-\nfirst  | 1\nsecond | one\n-[ RECORD 2 ]-\nfirst  | 2\nsecond | two\n-[ RECORD 3 ]-\nfirst  | 3\nsecond | three\n-[ RECORD 4 ]-\nfirst  | 4\nsecond | four\n</pre>\n<p lang=\"zh\">\u6b64\u5916\uff0c\u53ef\u4ee5\u4f7f\u7528<code class=\"literal\">\\g</code>\u4e3a\u4e00\u4e2a\u67e5\u8be2\u8bbe\u7f6e\u8fd9\u4e9b\u8f93\u51fa\u683c\u5f0f\u9009\u9879\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table</code></strong>\npeter@localhost testdb-&gt; <strong class=\"userinput\"><code>\\g (format=aligned tuples_only=off expanded=on)</code></strong>\n-[ RECORD 1 ]-\nfirst  | 1\nsecond | one\n-[ RECORD 2 ]-\nfirst  | 2\nsecond | two\n-[ RECORD 3 ]-\nfirst  | 3\nsecond | three\n-[ RECORD 4 ]-\nfirst  | 4\nsecond | four\n</pre>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4e00\u4e2a\u4f7f\u7528 <code class=\"command\">\\df</code> \u547d\u4ee4\u53ea\u67e5\u627e\u540d\u79f0\u5339\u914d <code class=\"literal\">int*pl</code> \u4e14\u7b2c\u4e8c\u4e2a\u53c2\u6570\u7c7b\u578b\u4e3a <code class=\"type\">bigint</code> \u7684\u51fd\u6570\u7684\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\df int*pl * bigint</code></strong>\n                          List of functions\n   Schema   |  Name   | Result data type | Argument data types | Type\n------------+---------+------------------+---------------------+------\n pg_catalog | int28pl | bigint           | smallint, bigint    | func\n pg_catalog | int48pl | bigint           | integer, bigint     | func\n pg_catalog | int8pl  | bigint           | bigint, bigint      | func\n(3 rows)\n</pre>\n<p lang=\"zh\">\u8fd9\u91cc\uff0c<code class=\"literal\">+</code> \u9009\u9879\u7528\u4e8e\u663e\u793a\u5176\u4e2d\u4e00\u4e2a\u51fd\u6570\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u800c <code class=\"literal\">x</code> \u7528\u4e8e\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u7ed3\u679c\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\df+x int*pl integer bigint</code></strong>\nList of functions\n-[ RECORD 1 ]-------+-----------------------------\nSchema              | pg_catalog\nName                | int48pl\nResult data type    | bigint\nArgument data types | integer, bigint\nType                | func\nVolatility          | immutable\nParallel            | safe\nOwner               | postgres\nSecurity            | invoker\nLeakproof?          | no\nAccess privileges   |\nLanguage            | internal\nInternal name       | int48pl\nDescription         | implementation of + operator\n</pre>\n<p lang=\"zh\">\u5728\u9002\u5408\u7684\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u4f7f\u7528 <code class=\"command\">\\crosstabview</code> \u547d\u4ee4\u5c06\u67e5\u8be2\u7ed3\u679c\u663e\u793a\u4e3a\u4ea4\u53c9\u8868\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>SELECT first, second, first &gt; 2 AS gt2 FROM my_table;</code></strong>\n first | second | gt2\n-------+--------+-----\n     1 | one    | f\n     2 | two    | f\n     3 | three  | t\n     4 | four   | t\n(4 rows)\n\ntestdb=&gt; <strong class=\"userinput\"><code>\\crosstabview first second</code></strong>\n first | one | two | three | four\n-------+-----+-----+-------+------\n     1 | f   |     |       |\n     2 |     | f   |       |\n     3 |     |     | t     |\n     4 |     |     |       | t\n(4 rows)\n</pre>\n<p lang=\"zh\">\u7b2c\u4e8c\u4e2a\u793a\u4f8b\u5c55\u793a\u4e86\u4e00\u4e2a\u4e58\u6cd5\u8868\uff0c\u5176\u4e2d\u884c\u6309\u6570\u5b57\u5012\u5e8f\u6392\u5217\uff0c\u800c\u5217\u6309\u72ec\u7acb\u7684\u5347\u5e8f\u6570\u5b57\u6392\u5217\u3002</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>SELECT t1.first as \"A\", t2.first+100 AS \"B\", t1.first*(t2.first+100) as \"AxB\",</code></strong>\ntestdb-&gt; <strong class=\"userinput\"><code>row_number() over(order by t2.first) AS ord</code></strong>\ntestdb-&gt; <strong class=\"userinput\"><code>FROM my_table t1 CROSS JOIN my_table t2 ORDER BY 1 DESC</code></strong>\ntestdb-&gt; <strong class=\"userinput\"><code>\\crosstabview \"A\" \"B\" \"AxB\" ord</code></strong>\n A | 101 | 102 | 103 | 104\n---+-----+-----+-----+-----\n 4 | 404 | 408 | 412 | 416\n 3 | 303 | 306 | 309 | 312\n 2 | 202 | 204 | 206 | 208\n 1 | 101 | 102 | 103 | 104\n(4 rows)\n</pre>\n</div>\n</div></div>", "manual_path": "app-psql.html", "localization": {"status": "complete", "sources": [{"url": "/docs/18/app-psql.html", "method": "same-major semantic node", "sha256": "4ff5633229e0afa7feecc2750a7187d2d45a7eef0ca8febc73e4e5c15ac7fa6d", "language": "zh", "matched_nodes": ["#APP-PSQL/div[10]/div[1]/ul[0]/li[0]", "#APP-PSQL/div[10]/div[1]/ul[0]/li[1]", "#APP-PSQL/div[10]/div[1]/ul[0]/li[2]", "#APP-PSQL/div[10]/h2[0]", "#APP-PSQL/div[11]/div[2]/ul[0]/li[0]", "#APP-PSQL/div[11]/div[2]/ul[0]/li[1]", "#APP-PSQL/div[11]/h2[0]", "#APP-PSQL/div[11]/p[1]", "#APP-PSQL/div[12]/p[11]", "#APP-PSQL/div[12]/p[13]", "#APP-PSQL/div[12]/p[15]", "#APP-PSQL/div[12]/p[17]", "#APP-PSQL/div[12]/p[19]", "#APP-PSQL/div[12]/p[1]", "#APP-PSQL/div[12]/p[21]", "#APP-PSQL/div[12]/p[3]", "#APP-PSQL/div[12]/p[5]", "#APP-PSQL/div[12]/p[7]", "#APP-PSQL/div[12]/p[9]", "#APP-PSQL/div[2]/p[1]", "#APP-PSQL/div[3]/h2[0]", "#APP-PSQL/div[4]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[11]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[13]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[15]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]/p[2]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[19]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[21]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[23]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[25]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[25]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[27]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[29]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[31]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[35]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[37]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[39]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[3]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[41]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]/div[1]/h3[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]/div[1]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[45]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[47]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[49]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[51]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[53]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[55]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[55]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[57]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[57]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[59]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[5]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[61]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[63]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[65]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[67]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[67]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[69]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[3]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[5]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[6]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[7]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[9]", "#APP-PSQL/div[6]/h2[0]", "#APP-PSQL/div[6]/p[1]", "#APP-PSQL/div[7]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[1]/p[1]", "#APP-PSQL/div[7]/div[1]/p[2]", "#APP-PSQL/div[7]/div[1]/p[5]", "#APP-PSQL/div[7]/div[1]/p[6]", "#APP-PSQL/div[7]/div[1]/p[7]", "#APP-PSQL/div[7]/div[2]/h3[0]", "#APP-PSQL/div[7]/div[2]/p[1]", "#APP-PSQL/div[7]/div[2]/p[3]", "#APP-PSQL/div[7]/div[2]/p[4]", "#APP-PSQL/div[7]/div[2]/p[5]", "#APP-PSQL/div[7]/div[2]/p[6]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[101]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[103]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[105]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[105]/div[4]/p[1]/a[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[105]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[105]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[105]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[105]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[107]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[107]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[107]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[109]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[109]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[109]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[109]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[111]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[113]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[115]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[115]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[115]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[115]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[117]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[119]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[119]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[119]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[119]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[119]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[11]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[11]/div[1]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[11]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[121]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[121]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[123]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[125]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[127]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[127]/p[0]/a[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[127]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[127]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[127]/p[5]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[131]/div[2]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[131]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[131]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[133]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[135]/div[2]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[135]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[135]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[137]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[137]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[137]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[137]/p[5]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[137]/p[6]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[139]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[13]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[13]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[141]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[143]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[145]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[145]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[145]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[147]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[149]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[151]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[151]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[151]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[151]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[153]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[155]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[155]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[157]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[159]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[159]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[15]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[15]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[15]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[15]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[15]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[17]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[17]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[17]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[17]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[21]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[23]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[23]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[29]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[31]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[31]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[37]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[41]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[43]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[43]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[43]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dt[30]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dt[32]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dt[34]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dt[6]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[5]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/p[4]/a[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[163]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[165]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[167]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[169]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[171]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[173]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[173]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[173]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[173]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[173]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[175]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[177]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[177]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[179]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[179]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[179]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[17]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[17]/div[5]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[17]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[17]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[181]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[181]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[181]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[181]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[181]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[181]/p[5]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[183]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[185]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[187]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[189]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[189]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[191]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[191]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[193]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[195]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[197]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[199]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[201]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[201]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[203]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[203]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[205]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[207]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[207]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[207]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[207]/p[5]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[21]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[21]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[21]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[23]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[23]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[23]/p[0]/a[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[23]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[23]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[23]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[25]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[29]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[31]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[37]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[3]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[3]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[3]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[41]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[43]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[45]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[45]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[45]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[47]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[49]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[49]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[51]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[53]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[55]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[57]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[57]/div[1]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[57]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[59]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[5]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[5]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[61]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[63]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[65]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[67]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[69]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[71]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[73]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[75]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[77]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[79]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[7]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[7]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[7]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[7]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[7]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[81]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[83]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[83]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[85]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[85]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[85]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[87]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[87]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[89]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[89]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[91]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[93]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[95]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[97]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[99]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[104]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[130]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[132]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[134]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[138]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[140]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[150]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[152]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[162]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[166]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[192]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[6]", "#APP-PSQL/div[7]/div[3]/div[12]/p[2]", "#APP-PSQL/div[7]/div[3]/div[12]/p[3]", "#APP-PSQL/div[7]/div[3]/div[12]/p[4]", "#APP-PSQL/div[7]/div[3]/div[12]/p[6]", "#APP-PSQL/div[7]/div[3]/div[12]/p[7]", "#APP-PSQL/div[7]/div[3]/h3[0]", "#APP-PSQL/div[7]/div[3]/p[10]", "#APP-PSQL/div[7]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/p[2]", "#APP-PSQL/div[7]/div[3]/p[3]", "#APP-PSQL/div[7]/div[3]/p[4]", "#APP-PSQL/div[7]/div[3]/p[4]/a[2]", "#APP-PSQL/div[7]/div[3]/p[5]", "#APP-PSQL/div[7]/div[3]/p[7]", "#APP-PSQL/div[7]/div[3]/p[8]", "#APP-PSQL/div[7]/div[3]/p[9]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[15]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[17]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/div[2]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[21]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[21]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[23]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[23]/p[2]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[41]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[43]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[45]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[47]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[47]/p[0]/a[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[49]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[53]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[55]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[57]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[59]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[61]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[63]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[65]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[67]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[69]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[71]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[73]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[75]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[77]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[4]/div[1]/div[8]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/p[10]", "#APP-PSQL/div[7]/div[4]/div[1]/p[11]", "#APP-PSQL/div[7]/div[4]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/p[2]", "#APP-PSQL/div[7]/div[4]/div[1]/p[4]", "#APP-PSQL/div[7]/div[4]/div[1]/p[6]", "#APP-PSQL/div[7]/div[4]/div[1]/p[7]", "#APP-PSQL/div[7]/div[4]/div[1]/p[9]", "#APP-PSQL/div[7]/div[4]/div[2]/p[10]", "#APP-PSQL/div[7]/div[4]/div[2]/p[11]", "#APP-PSQL/div[7]/div[4]/div[2]/p[12]", "#APP-PSQL/div[7]/div[4]/div[2]/p[1]", "#APP-PSQL/div[7]/div[4]/div[2]/p[3]", "#APP-PSQL/div[7]/div[4]/div[2]/p[4]", "#APP-PSQL/div[7]/div[4]/div[2]/p[6]", "#APP-PSQL/div[7]/div[4]/div[2]/p[7]", "#APP-PSQL/div[7]/div[4]/div[2]/p[9]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[15]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[17]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[23]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[25]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[29]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[31]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[33]/p[0]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[33]/p[2]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[4]/div[3]/div[5]/p[1]", "#APP-PSQL/div[7]/div[4]/div[3]/p[1]", "#APP-PSQL/div[7]/div[4]/div[3]/p[2]", "#APP-PSQL/div[7]/div[4]/div[4]/h4[0]", "#APP-PSQL/div[7]/div[4]/div[4]/p[3]", "#APP-PSQL/div[7]/div[4]/div[4]/p[4]", "#APP-PSQL/div[7]/div[4]/div[4]/p[5]", "#APP-PSQL/div[7]/div[4]/div[4]/p[7]", "#APP-PSQL/div[7]/div[4]/div[4]/p[8]", "#APP-PSQL/div[7]/div[4]/h3[0]", "#APP-PSQL/div[7]/h2[0]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[11]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[13]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[17]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[19]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[1]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[21]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[3]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[5]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[7]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]/p[0]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]/p[2]", "#APP-PSQL/div[8]/p[2]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[0]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[1]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[2]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[3]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[3]/p[0]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[3]/p[1]", "#APP-PSQL/div[9]/div[1]/dl[0]/dt[0]", "#APP-PSQL/div[9]/h2[0]"]}, {"url": "/docs/18/indexes-index-only-scans.html", "method": "same-major semantic node", "sha256": "3433104d8b02c78dc0b08de1ab2d9f46c731577dfb71cd7805a9ee87bb0c2c0a", "language": "zh", "matched_nodes": ["#INDEXES-INDEX-ONLY-SCANS/p[25]/span[2]"]}], "language": "zh", "original_text": {"/versions/18/description/0": "psql \u2014 PostgreSQL interactive terminal", "/versions/18/facts/0/label": "Documented executable", "/versions/18/facts/1/label": "Executable version", "/versions/18/facts/2/label": "Reference inventory", "/versions/18/facts/2/value": "Client applications", "/versions/18/facts/3/label": "Option definition groups", "/versions/18/tables/0/title": "Documented options", "/versions/18/tables/1/title": "Environment variables", "/versions/18/related/0/label": "psql meta-commands", "/versions/18/related/1/label": "libpq connection parameters", "/versions/18/tables/0/rows/0/summary": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all .", "/versions/18/tables/0/rows/1/summary": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned .", "/versions/18/tables/0/rows/2/summary": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors .", "/versions/18/tables/0/rows/3/summary": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence.", "/versions/18/tables/0/rows/4/summary": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv .", "/versions/18/tables/0/rows/5/summary": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "/versions/18/tables/0/rows/6/summary": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries .", "/versions/18/tables/0/rows/7/summary": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on .", "/versions/18/tables/0/rows/8/summary": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i .", "/versions/18/tables/0/rows/9/summary": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f .", "/versions/18/tables/0/columns/0/label": "Option and arguments", "/versions/18/tables/0/columns/1/label": "Description", "/versions/18/tables/0/rows/10/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket.", "/versions/18/tables/0/rows/11/summary": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command.", "/versions/18/tables/0/rows/12/summary": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list .", "/versions/18/tables/0/rows/13/summary": "Write all query output into file filename , in addition to the normal output destination.", "/versions/18/tables/0/rows/14/summary": "Do not use Readline for line editing and do not use the command history (see the section called \u201cCommand-Line Editing\u201d below).", "/versions/18/tables/0/rows/15/summary": "Put all query output into file filename . This is equivalent to the command \\o .", "/versions/18/tables/0/rows/16/summary": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432.", "/versions/18/tables/0/rows/17/summary": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex .", "/versions/18/tables/0/rows/18/summary": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on .", "/versions/18/tables/0/rows/19/summary": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep .", "/versions/18/tables/0/rows/20/summary": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts.", "/versions/18/tables/0/rows/21/summary": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does.", "/versions/18/tables/0/rows/22/summary": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only .", "/versions/18/tables/0/rows/23/summary": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details.", "/versions/18/tables/0/rows/24/summary": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)", "/versions/18/tables/0/rows/25/summary": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later.", "/versions/18/tables/0/rows/26/summary": "Print the psql version and exit.", "/versions/18/tables/0/rows/27/summary": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/18/tables/0/rows/28/summary": "Force psql to prompt for a password before connecting to a database, even if the password will not be used.", "/versions/18/tables/0/rows/29/summary": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded .", "/versions/18/tables/0/rows/30/summary": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file).", "/versions/18/tables/0/rows/31/summary": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero .", "/versions/18/tables/0/rows/32/summary": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero .", "/versions/18/tables/0/rows/33/summary": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied.", "/versions/18/tables/0/rows/34/summary": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables.", "/versions/18/tables/1/columns/0/label": "Variable", "/versions/18/tables/1/columns/1/label": "Meaning", "/versions/18/tables/1/rows/0/description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode.", "/versions/18/tables/1/rows/1/description": "Default connection parameters (see Section 32.15 ).", "/versions/18/tables/1/rows/2/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .", "/versions/18/tables/1/rows/3/description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems.", "/versions/18/tables/1/rows/4/description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems.", "/versions/18/tables/1/rows/5/description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed.", "/versions/18/tables/1/rows/6/description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If neither of them is set, the default is to use more on most platforms, but less on Cygwin.", "/versions/18/tables/1/rows/7/description": "When a query is executed repeatedly with the \\watch command, a pager is not used by default. This behavior can be changed by setting PSQL_WATCH_PAGER to a pager command, on Unix systems. The pspg pager (not part of PostgreSQL but available in many open source software distributions) can display the output of \\watch if started with the option --stream .", "/versions/18/tables/1/rows/8/description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed.", "/versions/18/tables/1/rows/9/description": "Command executed by the \\! command.", "/versions/18/tables/1/rows/10/description": "Directory for storing temporary files. The default is /tmp ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "d18bbfb49a4cc89a98678a6903511d5b896ca4f873a401899f6b203300909100"}, "comparison_data": {"options": [{"names": ["-a", "--echo-all"], "signature": "-a --echo-all", "description": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all ."}, {"names": ["-A", "--no-align"], "signature": "-A --no-align", "description": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned ."}, {"names": ["-b", "--echo-errors"], "signature": "-b --echo-errors", "description": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors ."}, {"names": ["-c command", "--command= command"], "signature": "-c command --command= command", "description": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. command must be either a command string that is completely parsable by the server (i.e., it contains no psql -specific features), or a single backslash command. Thus you cannot mix SQL and psql meta-commands within a -c option. To achieve that, you could use repeated -c options or pipe the string into psql , for example: psql -c '\\x' -c 'SELECT * FROM foo;' or echo '\\x \\\\ SELECT * FROM foo;' | psql ( \\\\ is the separator meta-command.) Each SQL command string passed to -c is sent to the server as a single request. Because of this, the server executes it as a single transaction even if the string contains multiple SQL commands, unless there are explicit BEGIN / COMMIT commands included in the string to divide it into multiple transactions. (See Section 54.2.2.1 for more details about how the server handles multi-query strings.) If having several commands executed in one transaction is not desired, use repeated -c commands or feed multiple commands to psql 's standard input, either using echo as illustrated above, or via a shell here-document, for example: psql <<EOF \\x SELECT * FROM foo; EOF"}, {"names": ["--csv"], "signature": "--csv", "description": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv ."}, {"names": ["-d dbname", "--dbname= dbname"], "signature": "-d dbname --dbname= dbname", "description": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--echo-queries"], "signature": "-e --echo-queries", "description": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries ."}, {"names": ["-E", "--echo-hidden"], "signature": "-E --echo-hidden", "description": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on ."}, {"names": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i . If filename is - (hyphen), then standard input is read until an EOF indication or \\q meta-command. This can be used to intersperse interactive input with input from files. Note however that Readline is not used in this case (much as if -n had been specified). Using this option is subtly different from writing psql < filename . In general, both will do what you expect, but using -f enables some nice features such as error messages with line numbers. There is also a slight chance that using this option will reduce the start-up overhead. On the other hand, the variant using the shell's input redirection is (in theory) guaranteed to yield exactly the same output you would have received had you entered everything by hand."}, {"names": ["-F separator", "--field-separator= separator"], "signature": "-F separator --field-separator= separator", "description": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f ."}, {"names": ["-h hostname", "--host= hostname"], "signature": "-h hostname --host= hostname", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket."}, {"names": ["-H", "--html"], "signature": "-H --html", "description": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command."}, {"names": ["-l", "--list"], "signature": "-l --list", "description": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list . When this option is used, psql will connect to the database postgres , unless a different database is named on the command line (option -d or non-option argument, possibly via a service entry, but not via an environment variable)."}, {"names": ["-L filename", "--log-file= filename"], "signature": "-L filename --log-file= filename", "description": "Write all query output into file filename , in addition to the normal output destination."}, {"names": ["-n", "--no-readline"], "signature": "-n --no-readline", "description": "Do not use Readline for line editing and do not use the command history (see the section called \u201cCommand-Line Editing\u201d below)."}, {"names": ["-o filename", "--output= filename"], "signature": "-o filename --output= filename", "description": "Put all query output into file filename . This is equivalent to the command \\o ."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432."}, {"names": ["-P assignment", "--pset= assignment"], "signature": "-P assignment --pset= assignment", "description": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex ."}, {"names": ["-q", "--quiet"], "signature": "-q --quiet", "description": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on ."}, {"names": ["-R separator", "--record-separator= separator"], "signature": "-R separator --record-separator= separator", "description": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep ."}, {"names": ["-s", "--single-step"], "signature": "-s --single-step", "description": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts."}, {"names": ["-S", "--single-line"], "signature": "-S --single-line", "description": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does. Note This mode is provided for those who insist on it, but you are not necessarily encouraged to use it. In particular, if you mix SQL and meta-commands on a line the order of execution might not always be clear to the inexperienced user."}, {"names": ["-t", "--tuples-only"], "signature": "-t --tuples-only", "description": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only ."}, {"names": ["-T table_options", "--table-attr= table_options"], "signature": "-T table_options --table-attr= table_options", "description": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)"}, {"names": ["-v assignment", "--set= assignment", "--variable= assignment"], "signature": "-v assignment --set= assignment --variable= assignment", "description": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the psql version and exit."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Force psql to prompt for a password before connecting to a database, even if the password will not be used. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, psql will prompt for a password in any case. However, psql will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-x", "--expanded"], "signature": "-x --expanded", "description": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded ."}, {"names": ["-X", "--no-psqlrc"], "signature": "-X --no-psqlrc", "description": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file)."}, {"names": ["-z", "--field-separator-zero"], "signature": "-z --field-separator-zero", "description": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero ."}, {"names": ["-0", "--record-separator-zero"], "signature": "-0 --record-separator-zero", "description": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero ."}, {"names": ["-1", "--single-transaction"], "signature": "-1 --single-transaction", "description": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied. If the commands themselves contain BEGIN , COMMIT , or ROLLBACK , this option will not have the desired effects. Also, if an individual command cannot be executed inside a transaction block, specifying this option will cause the whole transaction to fail."}, {"names": ["-?", "--help[= topic ]"], "signature": "-? --help[= topic ]", "description": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables."}], "synopsis": ["psql [ option ...] [ dbname [ username ]]"], "environment": [{"name": "COLUMNS", "description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode."}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters (see Section 32.15 )."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems."}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems."}, {"name": "PSQL_HISTORY", "description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed."}, {"name": "PSQL_PAGER PAGER", "description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If neither of them is set, the default is to use more on most platforms, but less on Cygwin."}, {"name": "PSQL_WATCH_PAGER", "description": "When a query is executed repeatedly with the \\watch command, a pager is not used by default. This behavior can be changed by setting PSQL_WATCH_PAGER to a pager command, on Unix systems. The pspg pager (not part of PostgreSQL but available in many open source software distributions) can display the output of \\watch if started with the option --stream ."}, {"name": "PSQLRC", "description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed."}, {"name": "SHELL", "description": "Command executed by the \\! command."}, {"name": "TMPDIR", "description": "Directory for storing temporary files. The default is /tmp ."}]}, "comparison_hash": "7e52d8ca2dae4caec99412af17f0657a086f7413f9904aa5e55efb826f752e8b", "manual_language": "zh"}, "19": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "psql"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "19beta4"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "35"}], "tables": [{"key": "options", "rows": [{"summary": "\u5728\u8bfb\u5165\u65f6\u5c06\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u884c\u8bfb\u53d6\uff09\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a all \u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-ECHO-ALL", "text": "-a --echo-all"}}, {"summary": "\u5207\u6362\u5230\u975e\u5bf9\u9f50\u8f93\u51fa\u6a21\u5f0f\uff08\u9ed8\u8ba4\u8f93\u51fa\u6a21\u5f0f\u662f aligned \uff09\u3002\u8fd9\u7b49\u6548\u4e8e \\pset format unaligned \u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-NO-ALIGN", "text": "-A --no-align"}}, {"summary": "\u628a\u5931\u8d25\u7684 SQL \u547d\u4ee4\u6253\u5370\u5230\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a errors \u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-ECHO-ERRORS", "text": "-b --echo-errors"}}, {"summary": "\u6307\u5b9a psql \u6267\u884c\u4e00\u4e2a\u7ed9\u5b9a\u7684\u547d\u4ee4\u5b57\u7b26\u4e32 command \u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u591a\u6b21\u5e76\u4e14\u4ee5\u4efb\u4f55\u987a\u5e8f\u4e0e -f \u9009\u9879\u7ec4\u5408\u5728\u4e00\u8d77\u3002\u5f53 -c \u6216\u8005 -f \u88ab\u6307\u5b9a\u65f6\uff0c psql \u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709 -c \u548c -f \u9009\u9879\u540e\u7ec8\u6b62\u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-COMMAND", "text": "-c command --command= command"}}, {"summary": "\u5207\u6362\u5230 CSV \uff08\u9017\u53f7\u5206\u9694\u503c\uff09\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u76f8\u5f53\u4e8e \\pset format csv \u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-CSV", "text": "--csv"}}, {"summary": "\u6307\u5b9a\u8981\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002\u8fd9\u7b49\u6548\u4e8e\u6307\u5b9a dbname \u4e3a\u547d\u4ee4\u884c\u4e0a\u7684\u7b2c\u4e00\u4e2a\u975e\u9009\u9879\u53c2\u6570\u3002 dbname \u53ef\u4ee5\u662f \u8fde\u63a5\u5b57\u7b26\u4e32 \u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u5c06\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-DBNAME", "text": "-d dbname --dbname= dbname"}}, {"summary": "\u4e5f\u628a\u53d1\u9001\u5230\u670d\u52a1\u5668\u7684\u6240\u6709 SQL \u547d\u4ee4\u590d\u5236\u5230\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a queries \u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-ECHO-QUERIES", "text": "-e --echo-queries"}}, {"summary": "\u56de\u663e \\d \u4ee5\u53ca\u5176\u4ed6\u53cd\u659c\u7ebf\u547d\u4ee4\u751f\u6210\u7684\u5b9e\u9645\u67e5\u8be2\u3002\u53ef\u4ee5\u7528\u5b83\u6765\u5b66\u4e60 psql \u7684\u5185\u90e8\u64cd\u4f5c\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO_HIDDEN \u8bbe\u7f6e\u4e3a on \u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-ECHO-HIDDEN", "text": "-E --echo-hidden"}}, {"summary": "\u4ece\u6587\u4ef6 filename \u800c\u4e0d\u662f\u6807\u51c6\u8f93\u5165\u4e2d\u8bfb\u53d6\u547d\u4ee4\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u6307\u5b9a\uff0c\u4e5f\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u4e0e -c \u9009\u9879\u7ec4\u5408\u4f7f\u7528\u3002\u5f53\u6307\u5b9a\u4e86 -c \u6216 -f \u65f6\uff0c psql \u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709 -c \u548c -f \u9009\u9879\u540e\u7ec8\u6b62\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u7b49\u4ef7\u4e8e\u5143\u547d\u4ee4 \\i \u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-FILE", "text": "-f filename --file= filename"}}, {"summary": "\u4f7f\u7528 separator \u4f5c\u4e3a\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e \\pset fieldsep \u6216\u8005 \\f \u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR", "text": "-F separator --field-separator= separator"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-FIELD-HOST", "text": "-h hostname --host= hostname"}}, {"summary": "\u5207\u6362\u5230 HTML \u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e \\pset format html \u6216\u8005 \\H \u547d\u4ee4\u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-HTML", "text": "-H --html"}}, {"summary": "\u5217\u51fa\u6240\u6709\u53ef\u7528\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u9000\u51fa\u3002\u5176\u4ed6\u975e\u8fde\u63a5\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002\u8fd9\u4e0e\u5143\u547d\u4ee4 \\list \u7c7b\u4f3c\u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-LIST", "text": "-l --list"}}, {"summary": "\u9664\u4e86\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u5199\u5230\u666e\u901a\u8f93\u51fa\u76ee\u6807\u4e4b\u5916\uff0c\u8fd8\u5199\u5230\u6587\u4ef6 filename \u4e2d\u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-LOG-FILE", "text": "-L filename --log-file= filename"}}, {"summary": "\u4e0d\u8981\u4f7f\u7528 Readline \u8fdb\u884c\u884c\u7f16\u8f91\uff0c\u4e5f\u4e0d\u8981\u4f7f\u7528\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\uff08\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684 \u201c\u547d\u4ee4\u884c\u7f16\u8f91\u201d\u4e00\u8282 \uff09\u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-NO-READLINE", "text": "-n --no-readline"}}, {"summary": "\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u653e\u5230\u6587\u4ef6 filename \u4e2d\u3002\u8fd9\u7b49\u6548\u4e8e\u547d\u4ee4 \\o \u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-OUTPUT", "text": "-o filename --output= filename"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u7684\u6587\u4ef6\u540d\u540e\u7f00\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u7684\u503c\uff1b\u672a\u8bbe\u7f6e\u65f6\uff0c\u4f7f\u7528\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u7aef\u53e3\uff0c\u901a\u5e38\u4e3a 5432\u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-PORT", "text": "-p port --port= port"}}, {"summary": "\u4ee5 \\pset \u7684\u5f62\u5f0f\u6307\u5b9a\u6253\u5370\u9009\u9879\u3002\u6ce8\u610f\uff0c\u8fd9\u91cc\u4f60\u5fc5\u987b\u7528\u4e00\u4e2a\u7b49\u53f7\u800c\u4e0d\u662f\u7a7a\u683c\u6765\u5206\u9694\u540d\u79f0\u548c\u503c\u3002\u4f8b\u5982\uff0c\u8981\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a LaTeX \uff0c\u5e94\u8be5\u5199\u6210 -P format=latex \u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-PSET", "text": "-P assignment --pset= assignment"}}, {"summary": "\u6307\u5b9a psql \u5e94\u8be5\u5b89\u9759\u5730\u5de5\u4f5c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4f1a\u6253\u5370\u51fa\u6b22\u8fce\u6d88\u606f\u548c\u5404\u79cd\u63d0\u793a\u4fe1\u606f\u3002\u5982\u679c\u4f7f\u7528\u4e86\u8fd9\u4e2a\u9009\u9879\uff0c\u4ee5\u4e0a\u90a3\u4e9b\u5c31\u90fd\u4e0d\u4f1a\u8f93\u51fa\u3002\u5728\u4f7f\u7528 -c \u9009\u9879\u65f6\uff0c\u914d\u5408\u8fd9\u4e2a\u9009\u9879\u5f88\u6709\u7528\u3002\u8fd9\u7b49\u6548\u4e8e\u8bbe\u7f6e\u53d8\u91cf QUIET \u4e3a on \u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-QUIET", "text": "-q --quiet"}}, {"summary": "\u628a separator \u7528\u4f5c\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e \\pset recordsep \u547d\u4ee4\u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR", "text": "-R separator --record-separator= separator"}}, {"summary": "\u8fd0\u884c\u5728\u5355\u6b65\u6a21\u5f0f\u4e2d\u3002\u8fd9\u610f\u5473\u7740\u5728\u6bcf\u4e2a\u547d\u4ee4\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u4e4b\u524d\u90fd\u4f1a\u63d0\u793a\u7528\u6237\uff0c\u5e76\u5141\u8bb8\u53d6\u6d88\u6267\u884c\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u8c03\u8bd5\u811a\u672c\u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-SINGLE-STEP", "text": "-s --single-step"}}, {"summary": "\u8fd0\u884c\u5728\u5355\u884c\u6a21\u5f0f\u4e2d\uff0c\u5176\u4e2d\u6362\u884c\u7b26\u4f1a\u7ec8\u6b62\u4e00\u4e2a SQL \u547d\u4ee4\uff0c\u5c31\u50cf\u5206\u53f7\u7684\u4f5c\u7528\u4e00\u6837\u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-SINGLE-LINE", "text": "-S --single-line"}}, {"summary": "\u5173\u95ed\u6253\u5370\u5217\u540d\u548c\u7ed3\u679c\u884c\u8ba1\u6570\u9875\u811a\u7b49\u3002\u8fd9\u7b49\u6548\u4e8e \\t \u6216\u8005 \\pset tuples_only \u547d\u4ee4\u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-TUPLES-ONLY", "text": "-t --tuples-only"}}, {"summary": "\u6307\u5b9a\u8981\u653e\u5728 HTML table \u6807\u7b7e\u5185\u7684\u9009\u9879\u3002\u8be6\u89c1 \\pset tableattr \u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-TABLE-ATTR", "text": "-T table_options --table-attr= table_options"}}, {"summary": "\u4f5c\u4e3a\u7528\u6237 username \u800c\u4e0d\u662f\u9ed8\u8ba4\u7528\u6237\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff08\u5f53\u7136\uff0c\u4f60\u5fc5\u987b\u5177\u6709\u8fd9\u6837\u505a\u7684\u6743\u9650\uff09\u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-USERNAME", "text": "-U username --username= username"}}, {"summary": "\u6267\u884c\u4e00\u6b21\u53d8\u91cf\u8d4b\u503c\uff0c\u548c \\set \u5143\u547d\u4ee4\u76f8\u4f3c\u3002\u6ce8\u610f\u4f60\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u7528\u7b49\u53f7\u5206\u9694\u540d\u5b57\u548c\u503c\uff08\u5982\u679c\u6709\uff09\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u7684\u8bbe\u7f6e\uff0c\u53bb\u6389\u7b49\u53f7\u5c31\u884c\u3002\u8981\u628a\u4e00\u4e2a\u53d8\u91cf\u8bbe\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u4f7f\u7528\u7b49\u53f7\u4f46\u662f\u53bb\u6389\u503c\u3002\u8fd9\u4e9b\u8d4b\u503c\u5728\u547d\u4ee4\u884c\u5904\u7406\u671f\u95f4\u88ab\u5b8c\u6210\uff0c\u56e0\u6b64\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u7684\u53d8\u91cf\u5c06\u5728\u7a0d\u540e\u88ab\u8986\u76d6\u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-VARIABLE", "text": "-v assignment --set= assignment --variable= assignment"}}, {"summary": "\u6253\u5370 psql \u7248\u672c\u5e76\u4e14\u9000\u51fa\u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-VERSION", "text": "-V --version"}}, {"summary": "\u6c38\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982 .pgpass \u6587\u4ef6\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u8fd9\u4e2a\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4efb\u52a1\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u65f6\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-NO-PASSWORD", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 psql \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\uff0c\u5373\u4f7f\u8be5\u5bc6\u7801\u5b9e\u9645\u4e0a\u4e0d\u4f1a\u88ab\u4f7f\u7528\u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-PASSWORD", "text": "-W --password"}}, {"summary": "\u6253\u5f00\u6269\u5c55\u8868\u683c\u5f0f\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e \\x \u6216\u8005 \\pset expanded \u547d\u4ee4\u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-EXPANDED", "text": "-x --expanded"}}, {"summary": "\u4e0d\u8bfb\u53d6\u542f\u52a8\u6587\u4ef6\uff08\u65e2\u4e0d\u8bfb\u53d6\u7cfb\u7edf\u8303\u56f4\u7684 psqlrc \u6587\u4ef6\uff0c\u4e5f\u4e0d\u8bfb\u53d6\u7528\u6237\u7684 ~/.psqlrc \u6587\u4ef6\uff09\u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-NO-PSQLRC", "text": "-X --no-psqlrc"}}, {"summary": "\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u8fd9\u7b49\u6548\u4e8e \\pset fieldsep_zero \u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR-ZERO", "text": "-z --field-separator-zero"}}, {"summary": "\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u4f8b\u5982\uff0c\u8fd9\u6709\u52a9\u4e8e\u4e0e xargs -0 \u914d\u5408\u4f7f\u7528\u3002\u8fd9\u7b49\u6548\u4e8e \\pset recordsep_zero \u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR-ZERO", "text": "-0 --record-separator-zero"}}, {"summary": "\u8fd9\u4e2a\u9009\u9879\u53ea\u80fd\u4e0e\u4e00\u4e2a\u6216\u591a\u4e2a -c \u548c/\u6216 -f \u9009\u9879\u7ed3\u5408\u4f7f\u7528\u3002\u5b83\u4f1a\u5bfc\u81f4 psql \u5728\u7b2c\u4e00\u4e2a\u8fd9\u6837\u7684\u9009\u9879\u4e4b\u524d\u53d1\u51fa\u4e00\u4e2a BEGIN \u547d\u4ee4\uff0c\u5e76\u5728\u6700\u540e\u4e00\u4e2a\u9009\u9879\u4e4b\u540e\u53d1\u51fa\u4e00\u4e2a COMMIT \u547d\u4ee4\uff0c\u4ece\u800c\u5c06\u6240\u6709\u547d\u4ee4\u5305\u88c5\u6210\u4e00\u4e2a\u5355\u72ec\u7684\u4e8b\u52a1\u3002\u5982\u679c\u4efb\u4f55\u547d\u4ee4\u5931\u8d25\u4e14\u53d8\u91cf ON_ERROR_STOP \u88ab\u8bbe\u7f6e\uff0c\u5219\u4f1a\u6539\u4e3a\u53d1\u9001\u4e00\u4e2a ROLLBACK \u547d\u4ee4\u3002\u8fd9\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-SINGLE-TRANSACTION", "text": "-1 --single-transaction"}}, {"summary": "\u663e\u793a\u6709\u5173 psql \u7684\u5e2e\u52a9\u5e76\u4e14\u9000\u51fa\u3002\u53ef\u9009\u7684 topic \u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a options \uff09\u9009\u62e9\u8981\u89e3\u91ca psql \u7684\u54ea\u4e00\u90e8\u5206\uff1a commands \u63cf\u8ff0 psql \u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b options \u63cf\u8ff0\u53ef\u4ee5\u88ab\u4f20\u9012\u7ed9 psql \u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c variables \u5219\u663e\u793a\u6709\u5173 psql \u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002", "signature": {"url": "/docs/19/app-psql.html#APP-PSQL-OPTION-HELP", "text": "-? --help[= topic ]"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "COLUMNS", "description": "\u5982\u679c \\pset columns \u4e3a\u96f6\uff0c\u8fd9\u4e2a\u73af\u5883\u53d8\u91cf\u63a7\u5236\u7528\u4e8e wrapped \u683c\u5f0f\u7684\u5bbd\u5ea6\u4ee5\u53ca\u7528\u6765\u786e\u5b9a\u8f83\u5bbd\u7684\u8f93\u51fa\u662f\u5426\u9700\u8981\u5206\u9875\u5668\uff0c\u6216\u8005\u662f\u5426\u5e94\u5207\u6362\u5230\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e2d\u7684\u5782\u76f4\u683c\u5f0f\u7684\u5bbd\u5ea6\u3002"}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\uff08\u89c1 \u7b2c 32.15 \u8282 \uff09\u3002"}, {"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "\\e \u3001 \\ef \u4ee5\u53ca \\ev \u547d\u4ee4\u6240\u4f7f\u7528\u7684\u7f16\u8f91\u5668\u3002\u4f1a\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u68c0\u67e5\u8fd9\u4e9b\u53d8\u91cf\uff0c\u7b2c\u4e00\u4e2a\u88ab\u8bbe\u7f6e\u7684\u5c06\u88ab\u4f7f\u7528\u3002\u5982\u679c\u90fd\u6ca1\u6709\u88ab\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u662f\u4f7f\u7528Unix\u7cfb\u7edf\u4e0a\u7684 vi \u6216\u8005Windows\u7cfb\u7edf\u4e0a\u7684 notepad.exe \u3002"}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "\u5f53 \\e \u3001 \\ef \u6216 \\ev \u5e26\u6709\u884c\u53f7\u53c2\u6570\u4f7f\u7528\u65f6\uff0c\u6b64\u53d8\u91cf\u6307\u5b9a\u5c06\u8d77\u59cb\u884c\u53f7\u4f20\u7ed9\u7528\u6237\u7f16\u8f91\u5668\u65f6\u6240\u7528\u7684\u547d\u4ee4\u884c\u53c2\u6570\u3002\u5bf9\u4e8e Emacs \u6216 vi \u4e4b\u7c7b\u7684\u7f16\u8f91\u5668\uff0c\u8fd9\u4e2a\u53c2\u6570\u662f\u4e00\u4e2a\u52a0\u53f7\u3002\u5982\u679c\u9009\u9879\u540d\u548c\u884c\u53f7\u4e4b\u95f4\u9700\u8981\u7a7a\u683c\uff0c\u8bf7\u5728\u53d8\u91cf\u503c\u4e2d\u5305\u542b\u672b\u5c3e\u7a7a\u683c\u3002\u4f8b\u5982\uff1a PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' \u5728 Unix \u7cfb\u7edf\u4e0a\u9ed8\u8ba4\u662f + \uff08\u5bf9\u5e94\u4e8e\u9ed8\u8ba4\u7f16\u8f91\u5668 vi \uff0c\u4e14\u5bf9\u5f88\u591a\u5176\u4ed6\u5e38\u89c1\u7f16\u8f91\u5668\u53ef\u7528\uff09\u3002\u5728 Windows \u7cfb\u7edf\u4e0a\u6ca1\u6709\u9ed8\u8ba4\u503c\u3002"}, {"name": "PSQL_HISTORY", "description": "\u547d\u4ee4\u5386\u53f2\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08 ~ \uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002"}, {"name": "PSQL_PAGER PAGER", "description": "\u5982\u679c\u67e5\u8be2\u7ed3\u679c\u65e0\u6cd5\u5728\u5c4f\u5e55\u4e0a\u663e\u793a\u5b8c\u6574\uff0c\u5b83\u4eec\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6b64\u547d\u4ee4\u3002\u5178\u578b\u7684\u503c\u662f more \u6216 less \u3002\u53ef\u4ee5\u901a\u8fc7\u5c06 PSQL_PAGER \u6216 PAGER \u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u6216\u901a\u8fc7\u8c03\u6574 \\pset \u547d\u4ee4\u7684\u4e0e\u5206\u9875\u76f8\u5173\u7684\u9009\u9879\u6765\u7981\u7528\u5206\u9875\u5668\u3002\u8fd9\u4e9b\u53d8\u91cf\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u8fdb\u884c\u68c0\u67e5\uff1b\u4f7f\u7528\u6309\u8be5\u987a\u5e8f\u627e\u5230\u7684\u7b2c\u4e00\u4e2a\u5df2\u8bbe\u7f6e\u7684\u53d8\u91cf\u3002\u5982\u679c\u5b83\u4eec\u90fd\u6ca1\u6709\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5728\u5927\u591a\u6570\u5e73\u53f0\u4e0a\u4f7f\u7528 more \uff0c\u4f46\u5728Cygwin\u4e0a\u4f7f\u7528 less \u3002"}, {"name": "PSQL_WATCH_PAGER", "description": "\u4f7f\u7528 \\watch \u547d\u4ee4\u53cd\u590d\u6267\u884c\u67e5\u8be2\u65f6\uff0c\u9ed8\u8ba4\u4e0d\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\u3002\u5728 Unix \u7cfb\u7edf\u4e0a\uff0c\u53ef\u4ee5\u5c06 PSQL_WATCH_PAGER \u8bbe\u4e3a\u5206\u9875\u7a0b\u5e8f\u547d\u4ee4\u6765\u6539\u53d8\u6b64\u884c\u4e3a\u3002pspg \u5206\u9875\u7a0b\u5e8f\uff08\u4e0d\u5c5e\u4e8e PostgreSQL\uff0c\u4f46\u8bb8\u591a\u5f00\u6e90\u8f6f\u4ef6\u53d1\u884c\u7248\u90fd\u63d0\u4f9b\u5b83\uff09\u4ee5 --stream \u9009\u9879\u542f\u52a8\u65f6\uff0c\u53ef\u4ee5\u663e\u793a \\watch \u7684\u8f93\u51fa\u3002"}, {"name": "PSQLRC", "description": "\u7528\u6237\u7684 .psqlrc \u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08 ~ \uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002"}, {"name": "SHELL", "description": "\u88ab \\! \u547d\u4ee4\u6267\u884c\u7684\u547d\u4ee4\u3002"}, {"name": "TMPDIR", "description": "\u5b58\u50a8\u4e34\u65f6\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u662f /tmp \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-a", "--echo-all"], "summary": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all .", "signature": "-a --echo-all", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-ECHO-ALL", "description": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all ."}, {"names": ["-A", "--no-align"], "summary": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned .", "signature": "-A --no-align", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-NO-ALIGN", "description": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned ."}, {"names": ["-b", "--echo-errors"], "summary": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors .", "signature": "-b --echo-errors", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-ECHO-ERRORS", "description": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors ."}, {"names": ["-c command", "--command= command"], "summary": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence.", "signature": "-c command --command= command", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-COMMAND", "description": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. command must be either a command string that is completely parsable by the server (i.e., it contains no psql -specific features), or a single backslash command. Thus you cannot mix SQL and psql meta-commands within a -c option. To achieve that, you could use repeated -c options or pipe the string into psql , for example: psql -c '\\x' -c 'SELECT * FROM foo;' or echo '\\x \\\\ SELECT * FROM foo;' | psql ( \\\\ is the separator meta-command.) Each SQL command string passed to -c is sent to the server as a single request. Because of this, the server executes it as a single transaction even if the string contains multiple SQL commands, unless there are explicit BEGIN / COMMIT commands included in the string to divide it into multiple transactions. (See Section 54.2.2.1 for more details about how the server handles multi-query strings.) If having several commands executed in one transaction is not desired, use repeated -c commands or feed multiple commands to psql 's standard input, either using echo as illustrated above, or via a shell here-document, for example: psql <<EOF \\x SELECT * FROM foo; EOF"}, {"names": ["--csv"], "summary": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv .", "signature": "--csv", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-CSV", "description": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv ."}, {"names": ["-d dbname", "--dbname= dbname"], "summary": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "signature": "-d dbname --dbname= dbname", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-DBNAME", "description": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--echo-queries"], "summary": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries .", "signature": "-e --echo-queries", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-ECHO-QUERIES", "description": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries ."}, {"names": ["-E", "--echo-hidden"], "summary": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on .", "signature": "-E --echo-hidden", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-ECHO-HIDDEN", "description": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on ."}, {"names": ["-f filename", "--file= filename"], "summary": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i .", "signature": "-f filename --file= filename", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-FILE", "description": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i . If filename is - (hyphen), then standard input is read until an EOF indication or \\q meta-command. This can be used to intersperse interactive input with input from files. Note however that Readline is not used in this case (much as if -n had been specified). Using this option is subtly different from writing psql < filename . In general, both will do what you expect, but using -f enables some nice features such as error messages with line numbers. There is also a slight chance that using this option will reduce the start-up overhead. On the other hand, the variant using the shell's input redirection is (in theory) guaranteed to yield exactly the same output you would have received had you entered everything by hand."}, {"names": ["-F separator", "--field-separator= separator"], "summary": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f .", "signature": "-F separator --field-separator= separator", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR", "description": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f ."}, {"names": ["-h hostname", "--host= hostname"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket.", "signature": "-h hostname --host= hostname", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-FIELD-HOST", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket."}, {"names": ["-H", "--html"], "summary": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command.", "signature": "-H --html", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-HTML", "description": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command."}, {"names": ["-l", "--list"], "summary": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list .", "signature": "-l --list", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-LIST", "description": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list . When this option is used, psql will connect to the database postgres , unless a different database is named on the command line (option -d or non-option argument, possibly via a service entry, but not via an environment variable)."}, {"names": ["-L filename", "--log-file= filename"], "summary": "Write all query output into file filename , in addition to the normal output destination.", "signature": "-L filename --log-file= filename", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-LOG-FILE", "description": "Write all query output into file filename , in addition to the normal output destination."}, {"names": ["-n", "--no-readline"], "summary": "Do not use Readline for line editing and do not use the command history (see the section called \u201cCommand-Line Editing\u201d below).", "signature": "-n --no-readline", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-NO-READLINE", "description": "Do not use Readline for line editing and do not use the command history (see the section called \u201cCommand-Line Editing\u201d below)."}, {"names": ["-o filename", "--output= filename"], "summary": "Put all query output into file filename . This is equivalent to the command \\o .", "signature": "-o filename --output= filename", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-OUTPUT", "description": "Put all query output into file filename . This is equivalent to the command \\o ."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432.", "signature": "-p port --port= port", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-PORT", "description": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432."}, {"names": ["-P assignment", "--pset= assignment"], "summary": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex .", "signature": "-P assignment --pset= assignment", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-PSET", "description": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex ."}, {"names": ["-q", "--quiet"], "summary": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on .", "signature": "-q --quiet", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-QUIET", "description": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on ."}, {"names": ["-R separator", "--record-separator= separator"], "summary": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep .", "signature": "-R separator --record-separator= separator", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR", "description": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep ."}, {"names": ["-s", "--single-step"], "summary": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts.", "signature": "-s --single-step", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-SINGLE-STEP", "description": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts."}, {"names": ["-S", "--single-line"], "summary": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does.", "signature": "-S --single-line", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-SINGLE-LINE", "description": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does. Note This mode is provided for those who insist on it, but you are not necessarily encouraged to use it. In particular, if you mix SQL and meta-commands on a line the order of execution might not always be clear to the inexperienced user."}, {"names": ["-t", "--tuples-only"], "summary": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only .", "signature": "-t --tuples-only", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-TUPLES-ONLY", "description": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only ."}, {"names": ["-T table_options", "--table-attr= table_options"], "summary": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details.", "signature": "-T table_options --table-attr= table_options", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-TABLE-ATTR", "description": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details."}, {"names": ["-U username", "--username= username"], "summary": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)", "signature": "-U username --username= username", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-USERNAME", "description": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)"}, {"names": ["-v assignment", "--set= assignment", "--variable= assignment"], "summary": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later.", "signature": "-v assignment --set= assignment --variable= assignment", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-VARIABLE", "description": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later."}, {"names": ["-V", "--version"], "summary": "Print the psql version and exit.", "signature": "-V --version", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-VERSION", "description": "Print the psql version and exit."}, {"names": ["-w", "--no-password"], "summary": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-NO-PASSWORD", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-W", "--password"], "summary": "Force psql to prompt for a password before connecting to a database, even if the password will not be used.", "signature": "-W --password", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-PASSWORD", "description": "Force psql to prompt for a password before connecting to a database, even if the password will not be used. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, psql will prompt for a password in any case. However, psql will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-x", "--expanded"], "summary": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded .", "signature": "-x --expanded", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-EXPANDED", "description": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded ."}, {"names": ["-X", "--no-psqlrc"], "summary": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file).", "signature": "-X --no-psqlrc", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-NO-PSQLRC", "description": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file)."}, {"names": ["-z", "--field-separator-zero"], "summary": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero .", "signature": "-z --field-separator-zero", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR-ZERO", "description": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero ."}, {"names": ["-0", "--record-separator-zero"], "summary": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero .", "signature": "-0 --record-separator-zero", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR-ZERO", "description": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero ."}, {"names": ["-1", "--single-transaction"], "summary": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied.", "signature": "-1 --single-transaction", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-SINGLE-TRANSACTION", "description": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied. If the commands themselves contain BEGIN , COMMIT , or ROLLBACK , this option will not have the desired effects. Also, if an individual command cannot be executed inside a transaction block, specifying this option will cause the whole transaction to fail."}, {"names": ["-?", "--help[= topic ]"], "summary": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables.", "signature": "-? --help[= topic ]", "source_url": "/docs/19/app-psql.html#APP-PSQL-OPTION-HELP", "description": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables."}], "related": [{"url": "/wiki/psql/?v=19", "label": "psql \u5143\u547d\u4ee4"}, {"url": "/wiki/conn/?v=19", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v19beta4/postgresql-19beta4.tar.bz2", "label": "19beta4", "major": "19", "channel": "preview", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/19/postgresql-19-A4.pdf", "bytes": 16064841, "pages": 3052, "sha256": "4dd099e4125c591128fc5f3ebd02178dc24781f9e5ae629f96d67c4c8547427b", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/19/postgresql-19-US.pdf", "bytes": 15974616, "pages": 3225, "sha256": "61971fa857f0956d47341a0388fa6af9ae10acf691d4b2fc009007d384b0342b", "built_at": "2026-09-26"}}, "tree": "19", "index": "index.html", "major": "19", "pages": 1155, "release": "19beta4", "source_url": "https://ftp.postgresql.org/pub/source/v19beta4/postgresql-19beta4.tar.bz2", "svg_assets": 5, "source_mode": "en SGML built with pinned official archive", "source_sha256": "83157ee9c599d03b2f7a3d73ef3a56ec24e0e79cc2b3501a64d1364f56398c86"}, "revision": "1bbbbf4133d426f0e4304010688d2984c30fb67df0cc3a61b3e37eb3f6f37833", "evidence_kind": "English manual and source declarations", "source_sha256": "83157ee9c599d03b2f7a3d73ef3a56ec24e0e79cc2b3501a64d1364f56398c86"}, "sources": [{"url": "https://pg.center/docs/19/app-psql.html", "file": "app-psql.html", "label": "19beta4 English manual \u00b7 app-psql.html", "anchor": "", "sha256": "312975c12d6e4d62aeebcb5e98e7ca795c6d07ecb743b4bc64403dc42bc2a6e9", "language": "en", "original_url": "/docs/19/app-psql.html"}, {"url": "https://pg.center/docs/19/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "c827f460db781b39da305303c88e73729a419cd2b2b9dedb126d8ad5cbf02c95", "language": "en", "original_url": "/docs/19/reference-client.html"}], "sections": [], "synopsis": ["psql [ option ...] [ dbname [ username ]]"], "signature": "psql [ option ...] [ dbname [ username ]]", "description": ["psql \u2014 PostgreSQL \u7684\u4ea4\u4e92\u5f0f\u7ec8\u7aef"], "environment": [{"name": "COLUMNS", "description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode."}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters (see Section 32.15 )."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems."}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems."}, {"name": "PSQL_HISTORY", "description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed."}, {"name": "PSQL_PAGER PAGER", "description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If neither of them is set, the default is to use more on most platforms, but less on Cygwin."}, {"name": "PSQL_WATCH_PAGER", "description": "When a query is executed repeatedly with the \\watch command, a pager is not used by default. This behavior can be changed by setting PSQL_WATCH_PAGER to a pager command, on Unix systems. The pspg pager (not part of PostgreSQL but available in many open source software distributions) can display the output of \\watch if started with the option --stream ."}, {"name": "PSQLRC", "description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed."}, {"name": "SHELL", "description": "Command executed by the \\! command."}, {"name": "TMPDIR", "description": "Directory for storing temporary files. The default is /tmp ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PSQL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></h2>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u2014 <span class=\"productname\">PostgreSQL</span>\u7684\u4ea4\u4e92\u5f0f\u7ec8\u7aef</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.21.4.1\"><code class=\"command\">psql</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em> [<em class=\"replaceable\"><code>username</code></em>]]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.21.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u662f<span class=\"productname\">PostgreSQL</span>\u7684\u4e00\u4e2a\u57fa\u4e8e\u7ec8\u7aef\u7684\u524d\u7aef\u3002\u5b83\u4f7f\u4f60\u80fd\u591f\u4ea4\u4e92\u5f0f\u5730\u8f93\u5165\u67e5\u8be2\uff0c\u5c06\u5176\u53d1\u9001\u7ed9<span class=\"productname\">PostgreSQL</span>\uff0c\u5e76\u67e5\u770b\u67e5\u8be2\u7ed3\u679c\u3002\u4e5f\u53ef\u4ee5\u4ece\u6587\u4ef6\u6216\u547d\u4ee4\u884c\u53c2\u6570\u63d0\u4f9b\u8f93\u5165\u3002\u6b64\u5916\uff0c<span class=\"application\">psql</span>\u8fd8\u63d0\u4f9b\u4e86\u82e5\u5e72\u5143\u547d\u4ee4\u548c\u591a\u79cd\u7c7b\u4f3c shell \u7684\u7279\u6027\uff0c\u4ee5\u4fbf\u4e8e\u7f16\u5199\u811a\u672c\u548c\u81ea\u52a8\u5316\u6267\u884c\u5404\u79cd\u4efb\u52a1\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-PSQL-3\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-OPTION-ECHO-ALL\"><span class=\"term\"><code class=\"option\">-a</code><br/></span><span class=\"term\"><code class=\"option\">--echo-all</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8bfb\u5165\u65f6\u5c06\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u884c\u8bfb\u53d6\uff09\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a <code class=\"literal\">all</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-NO-ALIGN\"><span class=\"term\"><code class=\"option\">-A</code><br/></span><span class=\"term\"><code class=\"option\">--no-align</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230\u975e\u5bf9\u9f50\u8f93\u51fa\u6a21\u5f0f\uff08\u9ed8\u8ba4\u8f93\u51fa\u6a21\u5f0f\u662f<code class=\"literal\">aligned</code>\uff09\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset format unaligned</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-ECHO-ERRORS\"><span class=\"term\"><code class=\"option\">-b</code><br/></span><span class=\"term\"><code class=\"option\">--echo-errors</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u5931\u8d25\u7684 SQL \u547d\u4ee4\u6253\u5370\u5230\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">errors</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-COMMAND\"><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>command</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--command=<em class=\"replaceable\"><code>command</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a<span class=\"application\">psql</span>\u6267\u884c\u4e00\u4e2a\u7ed9\u5b9a\u7684\u547d\u4ee4\u5b57\u7b26\u4e32<em class=\"replaceable\"><code>command</code></em>\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u591a\u6b21\u5e76\u4e14\u4ee5\u4efb\u4f55\u987a\u5e8f\u4e0e<code class=\"option\">-f</code>\u9009\u9879\u7ec4\u5408\u5728\u4e00\u8d77\u3002\u5f53<code class=\"option\">-c</code>\u6216\u8005<code class=\"option\">-f</code>\u88ab\u6307\u5b9a\u65f6\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709<code class=\"option\">-c</code>\u548c<code class=\"option\">-f</code>\u9009\u9879\u540e\u7ec8\u6b62\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>command</code></em>\u5fc5\u987b\u662f\u4e00\u4e2a\u670d\u52a1\u5668\u5b8c\u5168\u53ef\u89e3\u6790\u7684\u547d\u4ee4\u5b57\u7b26\u4e32\uff08\u5373\u4e0d\u5305\u542b<span class=\"application\">psql</span>\u4e13\u6709\u7684\u7279\u6027\uff09\u6216\u8005\u5355\u4e2a\u53cd\u659c\u7ebf\u547d\u4ee4\u3002\u56e0\u6b64\u4e0d\u80fd\u5728\u4e00\u4e2a<code class=\"option\">-c</code>\u9009\u9879\u4e2d\u6df7\u5408<acronym class=\"acronym\">SQL</acronym>\u548c<span class=\"application\">psql</span>\u5143\u547d\u4ee4\u3002\u8981\u90a3\u6837\u505a\uff0c\u53ef\u4ee5\u4f7f\u7528\u591a\u4e2a<code class=\"option\">-c</code>\u9009\u9879\u6216\u8005\u628a\u5b57\u7b26\u4e32\u7528\u7ba1\u9053\u8f93\u9001\u5230<span class=\"application\">psql</span>\u4e2d\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">psql -c '\\x' -c 'SELECT * FROM foo;'\n</pre>\n<p lang=\"zh\">\u6216\u8005</p>\n<pre class=\"programlisting\">echo '\\x \\\\ SELECT * FROM foo;' | psql\n</pre>\n<p lang=\"zh\">\uff08<code class=\"literal\">\\\\</code>\u662f\u5206\u9694\u7b26\u5143\u547d\u4ee4\uff09\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u5b57\u7b26\u4e32\u4f20\u9012\u7ed9<code class=\"option\">-c</code>\u90fd\u4f5c\u4e3a\u4e00\u4e2a\u5355\u72ec\u7684\u8bf7\u6c42\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u56e0\u6b64\uff0c\u5373\u4f7f\u5b57\u7b26\u4e32\u5305\u542b\u591a\u4e2a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\uff0c\u670d\u52a1\u5668\u4e5f\u4f1a\u5c06\u5176\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff0c\u9664\u975e\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u660e\u786e\u7684<code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code>\u547d\u4ee4\u5c06\u5176\u5206\u6210\u591a\u4e2a\u4e8b\u52a1\u3002\uff08\u6709\u5173\u670d\u52a1\u5668\u5982\u4f55\u5904\u7406\u591a\u67e5\u8be2\u5b57\u7b26\u4e32\u7684\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/19/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT\" title=\"54.2.2.1.\u00a0\u4e00\u4e2a\u7b80\u5355\u67e5\u8be2\u4e2d\u7684\u591a\u6761\u8bed\u53e5\">\u7b2c\u00a054.2.2.1\u00a0\u8282</a>\u3002\uff09</p>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u5e0c\u671b\u5728\u4e00\u4e2a\u4e8b\u52a1\u4e2d\u6267\u884c\u591a\u4e2a\u547d\u4ee4\uff0c\u53ef\u4ee5\u4f7f\u7528\u91cd\u590d\u7684<code class=\"option\">-c</code>\u547d\u4ee4\uff0c\u6216\u5c06\u591a\u4e2a\u547d\u4ee4\u8f93\u5165\u5230<span class=\"application\">psql</span>\u7684\u6807\u51c6\u8f93\u5165\uff0c\u53ef\u4ee5\u50cf\u4e0a\u9762\u793a\u4f8b\u4e2d\u4f7f\u7528<span class=\"application\">echo</span>\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7shell\u7684here-document\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">psql &lt;&lt;EOF\n\\x\nSELECT * FROM foo;\nEOF\n</pre>\n</dd>\n<dt id=\"APP-PSQL-OPTION-CSV\"><span class=\"term\"><code class=\"option\">--csv</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230<acronym class=\"acronym\">CSV</acronym>\uff08\u9017\u53f7\u5206\u9694\u503c\uff09\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u76f8\u5f53\u4e8e<code class=\"command\">\\pset format csv</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-DBNAME\"><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>dbname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>dbname</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002\u8fd9\u7b49\u6548\u4e8e\u6307\u5b9a<em class=\"replaceable\"><code>dbname</code></em>\u4e3a\u547d\u4ee4\u884c\u4e0a\u7684\u7b2c\u4e00\u4e2a\u975e\u9009\u9879\u53c2\u6570\u3002<em class=\"replaceable\"><code>dbname</code></em> \u53ef\u4ee5\u662f<a class=\"link\" href=\"/docs/19/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u5c06\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-ECHO-QUERIES\"><span class=\"term\"><code class=\"option\">-e</code><br/></span><span class=\"term\"><code class=\"option\">--echo-queries</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e5f\u628a\u53d1\u9001\u5230\u670d\u52a1\u5668\u7684\u6240\u6709 SQL \u547d\u4ee4\u590d\u5236\u5230\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">queries</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-ECHO-HIDDEN\"><span class=\"term\"><code class=\"option\">-E</code><br/></span><span class=\"term\"><code class=\"option\">--echo-hidden</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u56de\u663e<code class=\"command\">\\d</code>\u4ee5\u53ca\u5176\u4ed6\u53cd\u659c\u7ebf\u547d\u4ee4\u751f\u6210\u7684\u5b9e\u9645\u67e5\u8be2\u3002\u53ef\u4ee5\u7528\u5b83\u6765\u5b66\u4e60<span class=\"application\">psql</span>\u7684\u5185\u90e8\u64cd\u4f5c\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO_HIDDEN</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-FILE\"><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u800c\u4e0d\u662f\u6807\u51c6\u8f93\u5165\u4e2d\u8bfb\u53d6\u547d\u4ee4\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u6307\u5b9a\uff0c\u4e5f\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u4e0e<code class=\"option\">-c</code>\u9009\u9879\u7ec4\u5408\u4f7f\u7528\u3002\u5f53\u6307\u5b9a\u4e86<code class=\"option\">-c</code>\u6216<code class=\"option\">-f</code>\u65f6\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709<code class=\"option\">-c</code>\u548c<code class=\"option\">-f</code>\u9009\u9879\u540e\u7ec8\u6b62\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u7b49\u4ef7\u4e8e\u5143\u547d\u4ee4<code class=\"command\">\\i</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c<em class=\"replaceable\"><code>filename</code></em>\u662f<code class=\"literal\">-</code>\uff08\u8fde\u5b57\u7b26\uff09\uff0c\u5219\u4f1a\u8bfb\u53d6\u6807\u51c6\u8f93\u5165\uff0c\u76f4\u5230\u9047\u5230 <acronym class=\"acronym\">EOF</acronym> \u6307\u793a\u6216<code class=\"command\">\\q</code>\u5143\u547d\u4ee4\u3002\u8fd9\u53ef\u7528\u4e8e\u5c06\u4ea4\u4e92\u5f0f\u8f93\u5165\u4e0e\u6587\u4ef6\u8f93\u5165\u4ea4\u9519\u4f7f\u7528\u3002\u4e0d\u8fc7\u8bf7\u6ce8\u610f\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\u4e0d\u4f1a\u4f7f\u7528 <span class=\"application\">Readline</span>\uff08\u5f88\u50cf\u6307\u5b9a\u4e86<code class=\"option\">-n</code>\u65f6\u7684\u60c5\u51b5\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u4e0e\u5199\u6210<code class=\"literal\">psql &lt; <em class=\"replaceable\"><code>filename</code></em></code>\u6709\u7ec6\u5fae\u5dee\u522b\u3002\u901a\u5e38\u4e24\u79cd\u5f62\u5f0f\u90fd\u4f1a\u5f97\u5230\u4f60\u671f\u671b\u7684\u7ed3\u679c\uff0c\u4f46\u4f7f\u7528<code class=\"literal\">-f</code>\u53ef\u4ee5\u542f\u7528\u4e00\u4e9b\u6709\u7528\u7684\u7279\u6027\uff0c\u4f8b\u5982\u5e26\u884c\u53f7\u7684\u9519\u8bef\u6d88\u606f\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u4e5f\u8fd8\u6709\u4e00\u70b9\u673a\u4f1a\u964d\u4f4e\u542f\u52a8\u5f00\u9500\u3002\u53e6\u4e00\u65b9\u9762\uff0c\u4f7f\u7528 shell \u8f93\u5165\u91cd\u5b9a\u5411\u7684\u5f62\u5f0f\u5728\u7406\u8bba\u4e0a\u80fd\u4fdd\u8bc1\u5f97\u5230\u4e0e\u4f60\u624b\u5de5\u9010\u884c\u8f93\u5165\u65f6\u5b8c\u5168\u76f8\u540c\u7684\u8f93\u51fa\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-FIELD-SEPARATOR\"><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>separator</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--field-separator=<em class=\"replaceable\"><code>separator</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f7f\u7528<em class=\"replaceable\"><code>separator</code></em>\u4f5c\u4e3a\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset fieldsep</code>\u6216\u8005<code class=\"command\">\\f</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-FIELD-HOST\"><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>hostname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>hostname</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-HTML\"><span class=\"term\"><code class=\"option\">-H</code><br/></span><span class=\"term\"><code class=\"option\">--html</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230<acronym class=\"acronym\">HTML</acronym>\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset format html</code>\u6216\u8005<code class=\"command\">\\H</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-LIST\"><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--list</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u6240\u6709\u53ef\u7528\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u9000\u51fa\u3002\u5176\u4ed6\u975e\u8fde\u63a5\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002\u8fd9\u4e0e\u5143\u547d\u4ee4<code class=\"command\">\\list</code>\u7c7b\u4f3c\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8be5\u9009\u9879\u65f6\uff0c<span class=\"application\">psql</span>\u5c06\u8fde\u63a5\u5230\u6570\u636e\u5e93<code class=\"literal\">postgres</code>\uff0c\u9664\u975e\u547d\u4ee4\u884c\u4e0a\u6307\u5b9a\u4e86\u5176\u4ed6\u6570\u636e\u5e93\uff08\u901a\u8fc7<code class=\"option\">-d</code>\u9009\u9879\u6216\u975e\u9009\u9879\u53c2\u6570\uff0c\u4e5f\u53ef\u80fd\u901a\u8fc7\u670d\u52a1\u9879\uff0c\u4f46\u4e0d\u80fd\u901a\u8fc7\u73af\u5883\u53d8\u91cf\uff09\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-LOG-FILE\"><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--log-file=<em class=\"replaceable\"><code>filename</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9664\u4e86\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u5199\u5230\u666e\u901a\u8f93\u51fa\u76ee\u6807\u4e4b\u5916\uff0c\u8fd8\u5199\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-NO-READLINE\"><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-readline</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8981\u4f7f\u7528<span class=\"application\">Readline</span>\u8fdb\u884c\u884c\u7f16\u8f91\uff0c\u4e5f\u4e0d\u8981\u4f7f\u7528\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\uff08\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/19/app-psql.html#APP-PSQL-READLINE\" title=\"\u547d\u4ee4\u884c\u7f16\u8f91\">\u201c\u547d\u4ee4\u884c\u7f16\u8f91\u201d\u4e00\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-OUTPUT\"><span class=\"term\"><code class=\"option\">-o <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--output=<em class=\"replaceable\"><code>filename</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u653e\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u3002\u8fd9\u7b49\u6548\u4e8e\u547d\u4ee4<code class=\"command\">\\o</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-PORT\"><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u7684\u6587\u4ef6\u540d\u540e\u7f00\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u7684\u503c\uff1b\u672a\u8bbe\u7f6e\u65f6\uff0c\u4f7f\u7528\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u7aef\u53e3\uff0c\u901a\u5e38\u4e3a 5432\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-PSET\"><span class=\"term\"><code class=\"option\">-P <em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--pset=<em class=\"replaceable\"><code>assignment</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ee5<code class=\"command\">\\pset</code>\u7684\u5f62\u5f0f\u6307\u5b9a\u6253\u5370\u9009\u9879\u3002\u6ce8\u610f\uff0c\u8fd9\u91cc\u4f60\u5fc5\u987b\u7528\u4e00\u4e2a\u7b49\u53f7\u800c\u4e0d\u662f\u7a7a\u683c\u6765\u5206\u9694\u540d\u79f0\u548c\u503c\u3002\u4f8b\u5982\uff0c\u8981\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a<span class=\"application\">LaTeX</span>\uff0c\u5e94\u8be5\u5199\u6210<code class=\"literal\">-P format=latex</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-QUIET\"><span class=\"term\"><code class=\"option\">-q</code><br/></span><span class=\"term\"><code class=\"option\">--quiet</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a<span class=\"application\">psql</span>\u5e94\u8be5\u5b89\u9759\u5730\u5de5\u4f5c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4f1a\u6253\u5370\u51fa\u6b22\u8fce\u6d88\u606f\u548c\u5404\u79cd\u63d0\u793a\u4fe1\u606f\u3002\u5982\u679c\u4f7f\u7528\u4e86\u8fd9\u4e2a\u9009\u9879\uff0c\u4ee5\u4e0a\u90a3\u4e9b\u5c31\u90fd\u4e0d\u4f1a\u8f93\u51fa\u3002\u5728\u4f7f\u7528<code class=\"option\">-c</code>\u9009\u9879\u65f6\uff0c\u914d\u5408\u8fd9\u4e2a\u9009\u9879\u5f88\u6709\u7528\u3002\u8fd9\u7b49\u6548\u4e8e\u8bbe\u7f6e\u53d8\u91cf<code class=\"varname\">QUIET</code>\u4e3a<code class=\"literal\">on</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-RECORD-SEPARATOR\"><span class=\"term\"><code class=\"option\">-R <em class=\"replaceable\"><code>separator</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--record-separator=<em class=\"replaceable\"><code>separator</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a<em class=\"replaceable\"><code>separator</code></em>\u7528\u4f5c\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset recordsep</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-SINGLE-STEP\"><span class=\"term\"><code class=\"option\">-s</code><br/></span><span class=\"term\"><code class=\"option\">--single-step</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5728\u5355\u6b65\u6a21\u5f0f\u4e2d\u3002\u8fd9\u610f\u5473\u7740\u5728\u6bcf\u4e2a\u547d\u4ee4\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u4e4b\u524d\u90fd\u4f1a\u63d0\u793a\u7528\u6237\uff0c\u5e76\u5141\u8bb8\u53d6\u6d88\u6267\u884c\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u8c03\u8bd5\u811a\u672c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-SINGLE-LINE\"><span class=\"term\"><code class=\"option\">-S</code><br/></span><span class=\"term\"><code class=\"option\">--single-line</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd0\u884c\u5728\u5355\u884c\u6a21\u5f0f\u4e2d\uff0c\u5176\u4e2d\u6362\u884c\u7b26\u4f1a\u7ec8\u6b62\u4e00\u4e2a SQL \u547d\u4ee4\uff0c\u5c31\u50cf\u5206\u53f7\u7684\u4f5c\u7528\u4e00\u6837\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u79cd\u6a21\u5f0f\u662f\u4e3a\u575a\u6301\u4f7f\u7528\u5b83\u7684\u7528\u6237\u63d0\u4f9b\u7684\uff0c\u4f46\u5e76\u4e0d\u4e00\u5b9a\u503c\u5f97\u63a8\u8350\u3002\u7279\u522b\u662f\uff0c\u5982\u679c\u5728\u4e00\u884c\u4e2d\u6df7\u5408\u4e86<acronym class=\"acronym\">SQL</acronym>\u548c\u5143\u547d\u4ee4\uff0c\u5bf9\u4e8e\u6ca1\u6709\u7ecf\u9a8c\u7684\u7528\u6237\u6765\u8bf4\uff0c\u5b83\u4eec\u7684\u6267\u884c\u987a\u5e8f\u672a\u5fc5\u603b\u662f\u6e05\u695a\u7684\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-OPTION-TUPLES-ONLY\"><span class=\"term\"><code class=\"option\">-t</code><br/></span><span class=\"term\"><code class=\"option\">--tuples-only</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5173\u95ed\u6253\u5370\u5217\u540d\u548c\u7ed3\u679c\u884c\u8ba1\u6570\u9875\u811a\u7b49\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\t</code>\u6216\u8005<code class=\"command\">\\pset tuples_only</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-TABLE-ATTR\"><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>table_options</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--table-attr=<em class=\"replaceable\"><code>table_options</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u653e\u5728<acronym class=\"acronym\">HTML</acronym> <code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u9009\u9879\u3002\u8be6\u89c1<code class=\"command\">\\pset tableattr</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-USERNAME\"><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f5c\u4e3a\u7528\u6237<em class=\"replaceable\"><code>username</code></em>\u800c\u4e0d\u662f\u9ed8\u8ba4\u7528\u6237\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff08\u5f53\u7136\uff0c\u4f60\u5fc5\u987b\u5177\u6709\u8fd9\u6837\u505a\u7684\u6743\u9650\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-VARIABLE\"><span class=\"term\"><code class=\"option\">-v <em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--set=<em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--variable=<em class=\"replaceable\"><code>assignment</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6267\u884c\u4e00\u6b21\u53d8\u91cf\u8d4b\u503c\uff0c\u548c<code class=\"command\">\\set</code>\u5143\u547d\u4ee4\u76f8\u4f3c\u3002\u6ce8\u610f\u4f60\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u7528\u7b49\u53f7\u5206\u9694\u540d\u5b57\u548c\u503c\uff08\u5982\u679c\u6709\uff09\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u7684\u8bbe\u7f6e\uff0c\u53bb\u6389\u7b49\u53f7\u5c31\u884c\u3002\u8981\u628a\u4e00\u4e2a\u53d8\u91cf\u8bbe\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u4f7f\u7528\u7b49\u53f7\u4f46\u662f\u53bb\u6389\u503c\u3002\u8fd9\u4e9b\u8d4b\u503c\u5728\u547d\u4ee4\u884c\u5904\u7406\u671f\u95f4\u88ab\u5b8c\u6210\uff0c\u56e0\u6b64\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u7684\u53d8\u91cf\u5c06\u5728\u7a0d\u540e\u88ab\u8986\u76d6\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-VERSION\"><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">psql</span>\u7248\u672c\u5e76\u4e14\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-NO-PASSWORD\"><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6c38\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u8fd9\u4e2a\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4efb\u52a1\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u65f6\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u6574\u4e2a\u4f1a\u8bdd\u671f\u95f4\u90fd\u4f1a\u4fdd\u6301\u751f\u6548\uff0c\u56e0\u6b64\u5b83\u4e0d\u4ec5\u5f71\u54cd\u521d\u59cb\u8fde\u63a5\u5c1d\u8bd5\uff0c\u4e5f\u4f1a\u5f71\u54cd\u5143\u547d\u4ee4<code class=\"command\">\\connect</code>\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-PASSWORD\"><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236<span class=\"application\">psql</span>\u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\uff0c\u5373\u4f7f\u8be5\u5bc6\u7801\u5b9e\u9645\u4e0a\u4e0d\u4f1a\u88ab\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff0c\u5219<span class=\"application\">psql</span>\u65e0\u8bba\u5982\u4f55\u90fd\u4f1a\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">psql</span>\u9700\u8981\u5148\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\uff0c\u624d\u80fd\u77e5\u9053\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u663e\u5f0f\u6307\u5b9a<code class=\"option\">-W</code>\u503c\u5f97\u7528\u6765\u907f\u514d\u8fd9\u6b21\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u6574\u4e2a\u4f1a\u8bdd\u671f\u95f4\u90fd\u4f1a\u4fdd\u6301\u751f\u6548\uff0c\u56e0\u6b64\u5b83\u4e0d\u4ec5\u5f71\u54cd\u521d\u59cb\u8fde\u63a5\u5c1d\u8bd5\uff0c\u4e5f\u4f1a\u5f71\u54cd\u5143\u547d\u4ee4<code class=\"command\">\\connect</code>\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-EXPANDED\"><span class=\"term\"><code class=\"option\">-x</code><br/></span><span class=\"term\"><code class=\"option\">--expanded</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5f00\u6269\u5c55\u8868\u683c\u5f0f\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\x</code>\u6216\u8005<code class=\"command\">\\pset expanded</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-NO-PSQLRC\"><span class=\"term\"><code class=\"option\">-X</code><br/></span><span class=\"term\"><code class=\"option\">--no-psqlrc</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8bfb\u53d6\u542f\u52a8\u6587\u4ef6\uff08\u65e2\u4e0d\u8bfb\u53d6\u7cfb\u7edf\u8303\u56f4\u7684<code class=\"filename\">psqlrc</code>\u6587\u4ef6\uff0c\u4e5f\u4e0d\u8bfb\u53d6\u7528\u6237\u7684<code class=\"filename\">~/.psqlrc</code>\u6587\u4ef6\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-FIELD-SEPARATOR-ZERO\"><span class=\"term\"><code class=\"option\">-z</code><br/></span><span class=\"term\"><code class=\"option\">--field-separator-zero</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset fieldsep_zero</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-RECORD-SEPARATOR-ZERO\"><span class=\"term\"><code class=\"option\">-0</code><br/></span><span class=\"term\"><code class=\"option\">--record-separator-zero</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u4f8b\u5982\uff0c\u8fd9\u6709\u52a9\u4e8e\u4e0e<code class=\"literal\">xargs -0</code>\u914d\u5408\u4f7f\u7528\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset recordsep_zero</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-SINGLE-TRANSACTION\"><span class=\"term\"><code class=\"option\">-1</code><br/></span><span class=\"term\"><code class=\"option\">--single-transaction</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u9009\u9879\u53ea\u80fd\u4e0e\u4e00\u4e2a\u6216\u591a\u4e2a<code class=\"option\">-c</code>\u548c/\u6216<code class=\"option\">-f</code>\u9009\u9879\u7ed3\u5408\u4f7f\u7528\u3002\u5b83\u4f1a\u5bfc\u81f4<span class=\"application\">psql</span>\u5728\u7b2c\u4e00\u4e2a\u8fd9\u6837\u7684\u9009\u9879\u4e4b\u524d\u53d1\u51fa\u4e00\u4e2a<code class=\"command\">BEGIN</code>\u547d\u4ee4\uff0c\u5e76\u5728\u6700\u540e\u4e00\u4e2a\u9009\u9879\u4e4b\u540e\u53d1\u51fa\u4e00\u4e2a<code class=\"command\">COMMIT</code>\u547d\u4ee4\uff0c\u4ece\u800c\u5c06\u6240\u6709\u547d\u4ee4\u5305\u88c5\u6210\u4e00\u4e2a\u5355\u72ec\u7684\u4e8b\u52a1\u3002\u5982\u679c\u4efb\u4f55\u547d\u4ee4\u5931\u8d25\u4e14\u53d8\u91cf<code class=\"varname\">ON_ERROR_STOP</code>\u88ab\u8bbe\u7f6e\uff0c\u5219\u4f1a\u6539\u4e3a\u53d1\u9001\u4e00\u4e2a<code class=\"command\">ROLLBACK</code>\u547d\u4ee4\u3002\u8fd9\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u547d\u4ee4\u672c\u8eab\u5305\u542b<code class=\"command\">BEGIN</code>\u3001<code class=\"command\">COMMIT</code>\u6216<code class=\"command\">ROLLBACK</code>\uff0c\u8fd9\u4e2a\u9009\u9879\u5c31\u4e0d\u4f1a\u4ea7\u751f\u671f\u671b\u7684\u6548\u679c\u3002\u53e6\u5916\uff0c\u5982\u679c\u67d0\u4e2a\u5355\u72ec\u547d\u4ee4\u4e0d\u80fd\u5728\u4e8b\u52a1\u5757\u4e2d\u6267\u884c\uff0c\u6307\u5b9a\u8fd9\u4e2a\u9009\u9879\u5c06\u5bfc\u81f4\u6574\u4e2a\u4e8b\u52a1\u5931\u8d25\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-HELP\"><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help[=<em class=\"replaceable\"><code>topic</code></em>]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u6709\u5173<span class=\"application\">psql</span>\u7684\u5e2e\u52a9\u5e76\u4e14\u9000\u51fa\u3002\u53ef\u9009\u7684<em class=\"replaceable\"><code>topic</code></em>\u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a<code class=\"literal\">options</code>\uff09\u9009\u62e9\u8981\u89e3\u91ca<span class=\"application\">psql</span>\u7684\u54ea\u4e00\u90e8\u5206\uff1a<code class=\"literal\">commands</code>\u63cf\u8ff0<span class=\"application\">psql</span>\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b<code class=\"literal\">options</code>\u63cf\u8ff0\u53ef\u4ee5\u88ab\u4f20\u9012\u7ed9<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c<code class=\"literal\">variables</code>\u5219\u663e\u793a\u6709\u5173<span class=\"application\">psql</span>\u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.21.7\">\n<h2 lang=\"zh\">\u9000\u51fa\u72b6\u6001</h2>\n<p lang=\"zh\">\u5982\u679c<span class=\"application\">psql</span>\u6b63\u5e38\u7ed3\u675f\uff0c\u5b83\u4f1a\u5411 shell \u8fd4\u56de 0\uff1b\u5982\u679c\u5b83\u81ea\u8eab\u53d1\u751f\u81f4\u547d\u9519\u8bef\uff08\u4f8b\u5982\u5185\u5b58\u8017\u5c3d\u3001\u627e\u4e0d\u5230\u6587\u4ef6\uff09\uff0c\u5219\u8fd4\u56de 1\uff1b\u5982\u679c\u5230\u670d\u52a1\u5668\u7684\u8fde\u63a5\u53d1\u751f\u6545\u969c\u4e14\u8be5\u4f1a\u8bdd\u4e0d\u662f\u4ea4\u4e92\u5f0f\u7684\uff0c\u5219\u8fd4\u56de 2\uff1b\u5982\u679c\u811a\u672c\u4e2d\u53d1\u751f\u9519\u8bef\u4e14\u53d8\u91cf<code class=\"varname\">ON_ERROR_STOP</code>\u5df2\u8bbe\u7f6e\uff0c\u5219\u8fd4\u56de 3\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.21.8\">\n<h2 lang=\"zh\">\u7528\u6cd5</h2>\n<div class=\"refsect2\" id=\"R2-APP-PSQL-CONNECTING\">\n<h3 lang=\"zh\">\u8fde\u63a5\u5230\u6570\u636e\u5e93</h3>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u662f\u5e38\u89c4\u7684 <span class=\"productname\">PostgreSQL</span> \u5ba2\u6237\u7aef\u5e94\u7528\u7a0b\u5e8f\u3002\u8981\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff0c\u4f60\u9700\u8981\u77e5\u9053\u76ee\u6807\u6570\u636e\u5e93\u540d\u79f0\u3001\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u548c\u7aef\u53e3\u53f7\uff0c\u4ee5\u53ca\u8981\u4ee5\u54ea\u4e2a\u6570\u636e\u5e93\u7528\u6237\u540d\u8fde\u63a5\u3002<span class=\"application\">psql</span> \u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u9009\u9879 <code class=\"option\">-d</code>\u3001<code class=\"option\">-h</code>\u3001<code class=\"option\">-p</code> \u548c <code class=\"option\">-U</code> \u5206\u522b\u6307\u5b9a\u8fd9\u4e9b\u53c2\u6570\u3002\u5982\u679c\u9047\u5230\u4e00\u4e2a\u4e0d\u5c5e\u4e8e\u4efb\u4f55\u9009\u9879\u7684\u53c2\u6570\uff0c\u5b83\u5c06\u88ab\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u540d\uff08\u5982\u679c\u6570\u636e\u5e93\u540d\u5df2\u7ecf\u7ed9\u51fa\uff0c\u5219\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u7528\u6237\u540d\uff09\u3002\u5e76\u975e\u6240\u6709\u8fd9\u4e9b\u9009\u9879\u90fd\u662f\u5fc5\u9700\u7684\uff1b\u5b83\u4eec\u90fd\u6709\u6709\u7528\u7684\u9ed8\u8ba4\u503c\u3002\u5982\u679c\u7701\u7565\u4e3b\u673a\u540d\uff0c<span class=\"application\">psql</span> \u5728 Unix \u4e0a\u5c06\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u5230\u672c\u5730\u4e3b\u673a\u4e0a\u7684\u670d\u52a1\u5668\uff0c\u5728 Windows \u4e0a\u5219\u901a\u8fc7 TCP/IP \u8fde\u63a5\u5230 <code class=\"literal\">localhost</code>\u3002\u9ed8\u8ba4\u7aef\u53e3\u53f7\u5728\u7f16\u8bd1\u65f6\u786e\u5b9a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u670d\u52a1\u5668\u4f7f\u7528\u76f8\u540c\u7684\u9ed8\u8ba4\u503c\uff0c\u56e0\u6b64\u5728\u5927\u591a\u6570\u60c5\u51b5\u4e0b\u4e0d\u5fc5\u6307\u5b9a\u7aef\u53e3\u3002\u9ed8\u8ba4\u6570\u636e\u5e93\u7528\u6237\u540d\u662f\u4f60\u7684\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\u3002\u6570\u636e\u5e93\u7528\u6237\u540d\u786e\u5b9a\u540e\uff0c\u5b83\u4e5f\u4f1a\u88ab\u7528\u4f5c\u9ed8\u8ba4\u6570\u636e\u5e93\u540d\u3002\u8bf7\u6ce8\u610f\uff0c\u4f60\u4e0d\u80fd\u968f\u610f\u4ee5\u4efb\u610f\u6570\u636e\u5e93\u7528\u6237\u540d\u8fde\u63a5\u5230\u4efb\u610f\u6570\u636e\u5e93\u3002\u6570\u636e\u5e93\u7ba1\u7406\u5458\u5e94\u5f53\u5df2\u7ecf\u544a\u77e5\u4f60\u62e5\u6709\u7684\u8bbf\u95ee\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5f53\u9ed8\u8ba4\u503c\u4e0d\u5b8c\u5168\u5408\u9002\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7\u628a\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGDATABASE</code>\u3001<code class=\"envar\">PGHOST</code>\u3001<code class=\"envar\">PGPORT</code>\u548c<code class=\"envar\">PGUSER</code>\u8bbe\u7f6e\u4e3a\u9002\u5f53\u7684\u503c\u6765\u5c11\u6572\u4e00\u4e9b\u952e\u76d8\uff08\u989d\u5916\u7684\u73af\u5883\u53d8\u91cf\u89c1<a class=\"xref\" href=\"/docs/19/libpq-envars.html\" title=\"32.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a032.15\u00a0\u8282</a>\uff09\u3002\u53e6\u5916\uff0c\u51c6\u5907\u4e00\u4e2a<code class=\"filename\">~/.pgpass</code>\u6587\u4ef6\u4e5f\u5f88\u65b9\u4fbf\uff0c\u8fd9\u6837\u5c31\u4e0d\u5fc5\u7ecf\u5e38\u624b\u5de5\u8f93\u5165\u5bc6\u7801\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/19/libpq-pgpass.html\" title=\"32.16.\u00a0\u5bc6\u7801\u6587\u4ef6\">\u7b2c\u00a032.16\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u53e6\u4e00\u79cd\u6307\u5b9a\u8fde\u63a5\u53c2\u6570\u7684\u65b9\u6cd5\u662f\u4f7f\u7528 conninfo \u5b57\u7b26\u4e32\u6216 URI \u6765\u4ee3\u66ff\u6570\u636e\u5e93\u540d\u3002\u6b64\u673a\u5236\u5141\u8bb8\u5bf9\u8fde\u63a5\u8fdb\u884c\u975e\u5e38\u5e7f\u6cdb\u7684\u63a7\u5236\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">$ <strong class=\"userinput\"><code>psql \"service=myservice sslmode=require\"</code></strong>\n$ <strong class=\"userinput\"><code>psql postgresql://dbmaster:5433/mydb?sslmode=require</code></strong>\n</pre>\n<p lang=\"zh\">\u7528\u8fd9\u79cd\u65b9\u5f0f\uff0c\u4f60\u4e5f\u53ef\u4ee5\u628a<acronym class=\"acronym\">LDAP</acronym>\u7528\u4e8e<a class=\"xref\" href=\"/docs/19/libpq-ldap.html\" title=\"32.18.\u00a0\u8fde\u63a5\u53c2\u6570\u7684 LDAP \u67e5\u627e\">\u7b2c\u00a032.18\u00a0\u8282</a>\u4e2d\u63cf\u8ff0\u7684\u8fde\u63a5\u53c2\u6570\u67e5\u627e\u3002\u53ef\u7528\u8fde\u63a5\u9009\u9879\u7684\u66f4\u591a\u4fe1\u606f\u8bf7\u89c1<a class=\"xref\" href=\"/docs/19/libpq-connect.html#LIBPQ-PARAMKEYWORDS\" title=\"32.1.2.\u00a0\u53c2\u6570\u5173\u952e\u8bcd\">\u7b2c\u00a032.1.2\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7531\u4e8e\u4efb\u4f55\u539f\u56e0\uff08\u4f8b\u5982\u6743\u9650\u4e0d\u8db3\u3001\u670d\u52a1\u5668\u6ca1\u6709\u5728\u76ee\u6807\u4e3b\u673a\u4e0a\u8fd0\u884c\u7b49\uff09\u5bfc\u81f4\u8fde\u63a5\u65e0\u6cd5\u5efa\u7acb\uff0c<span class=\"application\">psql</span>\u5c06\u8fd4\u56de\u4e00\u4e2a\u9519\u8bef\u5e76\u4e14\u7ec8\u6b62\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6807\u51c6\u8f93\u5165\u548c\u6807\u51c6\u8f93\u51fa\u90fd\u662f\u7ec8\u7aef\uff0c\u90a3\u4e48<span class=\"application\">psql</span>\u4f1a\u628a\u5ba2\u6237\u7aef\u7f16\u7801\u8bbe\u7f6e\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">auto</span>\u201d</span>\uff0c\u4ece\u533a\u57df\u8bbe\u7f6e\u4e2d\u68c0\u6d4b\u5408\u9002\u7684\u5ba2\u6237\u7aef\u7f16\u7801\uff08\u5728 Unix \u7cfb\u7edf\u4e0a\u662f<code class=\"envar\">LC_CTYPE</code>\u73af\u5883\u53d8\u91cf\uff09\u3002\u5982\u679c\u7ed3\u679c\u4e0d\u7b26\u5408\u9884\u671f\uff0c\u53ef\u4ee5\u4f7f\u7528\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGCLIENTENCODING</code>\u8986\u76d6\u5ba2\u6237\u7aef\u7f16\u7801\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"R2-APP-PSQL-4\">\n<h3 lang=\"zh\">\u8f93\u5165 SQL \u547d\u4ee4</h3>\n<p lang=\"zh\">\u5728\u6b63\u5e38\u64cd\u4f5c\u65f6\uff0c<span class=\"application\">psql</span>\u4f1a\u63d0\u4f9b\u4e00\u4e2a\u63d0\u793a\u7b26\uff0c\u8be5\u63d0\u793a\u7b26\u662f<span class=\"application\">psql</span>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u540d\u79f0\u540e\u9762\u8ddf\u4e0a\u5b57\u7b26\u4e32<code class=\"literal\">=&gt;</code>\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">$ <strong class=\"userinput\"><code>psql testdb</code></strong>\npsql (19beta4)\nType \"help\" for help.\n\ntestdb=&gt;\n</pre>\n<p lang=\"zh\">\u5728\u63d0\u793a\u7b26\u4e0b\uff0c\u7528\u6237\u53ef\u4ee5\u8f93\u5165<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u3002\u901a\u5e38\uff0c\u5f53\u9047\u5230\u8868\u793a\u547d\u4ee4\u7ed3\u675f\u7684\u5206\u53f7\u65f6\uff0c\u8f93\u5165\u7684\u5185\u5bb9\u5c31\u4f1a\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u3002\u884c\u7ed3\u675f\u5e76\u4e0d\u4f1a\u7ec8\u6b62\u4e00\u6761\u547d\u4ee4\uff0c\u56e0\u6b64\u4e3a\u4e86\u63d0\u9ad8\u6e05\u6670\u5ea6\uff0c\u547d\u4ee4\u53ef\u4ee5\u5206\u5e03\u5728\u591a\u884c\u4e0a\u3002\u5982\u679c\u547d\u4ee4\u88ab\u53d1\u9001\u5e76\u6210\u529f\u6267\u884c\uff0c\u5176\u7ed3\u679c\u5c31\u4f1a\u663e\u793a\u5728\u5c4f\u5e55\u4e0a\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u53d7\u4fe1\u4efb\u7684\u7528\u6237\u80fd\u591f\u8bbf\u95ee\u5c1a\u672a\u91c7\u7528<a class=\"link\" href=\"/docs/19/ddl-schemas.html#DDL-SCHEMAS-PATTERNS\" title=\"5.11.6.\u00a0\u4f7f\u7528\u65b9\u5f0f\">\u6a21\u5f0f\u7684\u5b89\u5168\u4f7f\u7528\u65b9\u5f0f</a>\u7684\u6570\u636e\u5e93\uff0c\u8bf7\u5728\u4f1a\u8bdd\u5f00\u59cb\u65f6\u4ece<code class=\"varname\">search_path</code>\u4e2d\u79fb\u9664\u6240\u6709\u516c\u4f17\u53ef\u5199\u7684\u6a21\u5f0f\u3002\u53ef\u4ee5\u5728\u8fde\u63a5\u5b57\u7b26\u4e32\u4e2d\u52a0\u5165<code class=\"literal\">options=-csearch_path=</code>\uff0c\u6216\u8005\u5728\u6267\u884c\u5176\u4ed6 SQL \u547d\u4ee4\u4e4b\u524d\u53d1\u51fa<code class=\"literal\">SELECT pg_catalog.set_config('search_path', '', false)</code>\u3002\u8fd9\u79cd\u8003\u8651\u5e76\u975e<span class=\"application\">psql</span>\u7279\u6709\uff1b\u5b83\u9002\u7528\u4e8e\u4efb\u4f55\u6267\u884c\u4efb\u610f SQL \u547d\u4ee4\u7684\u63a5\u53e3\u3002</p>\n<p lang=\"zh\">\u6bcf\u5f53\u6267\u884c\u547d\u4ee4\u65f6\uff0c<span class=\"application\">psql</span>\u4e5f\u4f1a\u8f6e\u8be2\u7531<a class=\"link\" href=\"/docs/19/sql-listen.html\" title=\"LISTEN\"><code class=\"command\">LISTEN</code></a>\u548c<a class=\"link\" href=\"/docs/19/sql-notify.html\" title=\"NOTIFY\"><code class=\"command\">NOTIFY</code></a>\u751f\u6210\u7684\u5f02\u6b65\u901a\u77e5\u4e8b\u4ef6\u3002</p>\n<p lang=\"zh\">\u867d\u7136 C \u98ce\u683c\u7684\u5757\u6ce8\u91ca\u4f1a\u88ab\u4f20\u7ed9\u670d\u52a1\u5668\u5904\u7406\u5e76\u79fb\u9664\uff0c\u4f46 SQL \u6807\u51c6\u6ce8\u91ca\u4f1a\u7531<span class=\"application\">psql</span>\u81ea\u884c\u79fb\u9664\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"APP-PSQL-META-COMMANDS\">\n<h3 lang=\"zh\">\u5143\u547d\u4ee4</h3>\n<p lang=\"zh\">\u4f60\u8f93\u5165\u5230<span class=\"application\">psql</span>\u4e2d\u7684\u4efb\u4f55\u4ee5\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u5f00\u59cb\u7684\u4e1c\u897f\u90fd\u662f\u4e00\u4e2a<span class=\"application\">psql</span>\u5143\u547d\u4ee4\uff0c\u5b83\u4eec\u7531<span class=\"application\">psql</span>\u81ea\u884c\u5904\u7406\u3002\u8fd9\u4e9b\u547d\u4ee4\u8ba9<span class=\"application\">psql</span>\u5bf9\u7ba1\u7406\u548c\u7f16\u5199\u811a\u672c\u66f4\u6709\u7528\u3002\u5143\u547d\u4ee4\u5e38\u5e38\u88ab\u79f0\u4f5c\u659c\u7ebf\u6216\u8005\u53cd\u659c\u7ebf\u547d\u4ee4\u3002</p>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u547d\u4ee4\u7684\u683c\u5f0f\u662f\u7528\u53cd\u659c\u7ebf\u540e\u9762\u76f4\u63a5\u8ddf\u4e0a\u4e00\u4e2a\u547d\u4ee4\u52a8\u8bcd\uff0c\u7136\u540e\u662f\u4e00\u4e9b\u53c2\u6570\u3002\u53c2\u6570\u4e0e\u547d\u4ee4\u52a8\u8bcd\u548c\u5176\u4ed6\u53c2\u6570\u4e4b\u95f4\u7528\u4efb\u610f\u591a\u4e2a\u7a7a\u767d\u5b57\u7b26\u5206\u9694\u5f00\u3002</p>\n<p lang=\"zh\">\u8981\u5728\u53c2\u6570\u4e2d\u5305\u542b\u7a7a\u767d\uff0c\u53ef\u4ee5\u7528\u5355\u5f15\u53f7\u5c06\u5b83\u62ec\u8d77\u6765\u3002\u8981\u5728\u53c2\u6570\u4e2d\u5305\u542b\u4e00\u4e2a\u5355\u5f15\u53f7\uff0c\u53ef\u4ee5\u5728\u5355\u5f15\u53f7\u6587\u672c\u5185\u5199\u4e24\u4e2a\u5355\u5f15\u53f7\u3002\u5355\u5f15\u53f7\u4e2d\u7684\u5185\u5bb9\u8fd8\u4f1a\u63a5\u53d7\u7c7b\u4f3c C \u8bed\u8a00\u7684\u66ff\u6362\uff1a<code class=\"literal\">\\n</code>\uff08\u6362\u884c\uff09\u3001<code class=\"literal\">\\t</code>\uff08\u5236\u8868\u7b26\uff09\u3001<code class=\"literal\">\\b</code>\uff08\u9000\u683c\uff09\u3001<code class=\"literal\">\\r</code>\uff08\u56de\u8f66\uff09\u3001<code class=\"literal\">\\f</code>\uff08\u6362\u9875\uff09\u3001<code class=\"literal\">\\</code><em class=\"replaceable\"><code>digits</code></em>\uff08\u516b\u8fdb\u5236\uff09\u4ee5\u53ca<code class=\"literal\">\\x</code><em class=\"replaceable\"><code>digits</code></em>\uff08\u5341\u516d\u8fdb\u5236\uff09\u3002\u5728\u5355\u5f15\u53f7\u6587\u672c\u5185\uff0c\u53cd\u659c\u7ebf\u51fa\u73b0\u5728\u4efb\u4f55\u5176\u4ed6\u5b57\u7b26\u524d\u9762\u65f6\uff0c\u53ea\u662f\u5bf9\u8be5\u5355\u4e2a\u5b57\u7b26\u8fdb\u884c\u8f6c\u4e49\uff0c\u4e0d\u8bba\u5b83\u662f\u4ec0\u4e48\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u53c2\u6570\u4e2d\u51fa\u73b0\u4e00\u4e2a\u672a\u52a0\u5f15\u53f7\u7684\u5192\u53f7\uff08<code class=\"literal\">:</code>\uff09\uff0c\u540e\u9762\u7d27\u8ddf\u4e00\u4e2a<span class=\"application\">psql</span>\u53d8\u91cf\u540d\uff0c\u5b83\u5c31\u4f1a\u88ab\u8be5\u53d8\u91cf\u7684\u503c\u66ff\u6362\uff0c\u5982\u4e0b\u9762<a class=\"xref\" href=\"/docs/19/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL \u63d2\u503c\">SQL \u63d2\u503c</a>\u6240\u8ff0\u3002\u5176\u4e2d\u4ecb\u7ecd\u7684<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u548c<code class=\"literal\">:\"<em class=\"replaceable\"><code>variable_name</code></em>\"</code>\u5f62\u5f0f\u4e5f\u540c\u6837\u9002\u7528\u3002<code class=\"literal\">:{?<em class=\"replaceable\"><code>variable_name</code></em>}</code>\u8bed\u6cd5\u5141\u8bb8\u6d4b\u8bd5\u53d8\u91cf\u662f\u5426\u5df2\u5b9a\u4e49\uff1b\u5b83\u4f1a\u88ab TRUE \u6216 FALSE \u66ff\u6362\u3002\u7528\u53cd\u659c\u7ebf\u8f6c\u4e49\u8be5\u5192\u53f7\u53ef\u4ee5\u9632\u6b62\u66ff\u6362\u53d1\u751f\u3002</p>\n<p lang=\"zh\">\u5728\u53c2\u6570\u4e2d\uff0c\u7528\u53cd\u5f15\u53f7\uff08<code class=\"literal\">`</code>\uff09\u5305\u56f4\u7684\u6587\u672c\u4f1a\u88ab\u89c6\u4e3a\u4f20\u7ed9 shell \u7684\u547d\u4ee4\u884c\u3002\u8be5\u547d\u4ee4\u7684\u8f93\u51fa\uff08\u53bb\u6389\u672b\u5c3e\u7684\u6362\u884c\u7b26\uff09\u4f1a\u66ff\u6362\u53cd\u5f15\u53f7\u4e2d\u7684\u6587\u672c\u3002\u5728\u53cd\u5f15\u53f7\u5305\u56f4\u7684\u6587\u672c\u5185\u90e8\uff0c\u4e0d\u4f1a\u8fdb\u884c\u7279\u6b8a\u7684\u5f15\u53f7\u5904\u7406\u6216\u5176\u4ed6\u5904\u7406\uff0c\u4f46\u51fa\u73b0<code class=\"literal\">:<em class=\"replaceable\"><code>variable_name</code></em></code>\u65f6\uff0c\u5982\u679c<em class=\"replaceable\"><code>variable_name</code></em>\u662f<span class=\"application\">psql</span>\u53d8\u91cf\u540d\uff0c\u5c31\u4f1a\u88ab\u66ff\u6362\u4e3a\u8be5\u53d8\u91cf\u7684\u503c\u3002\u6b64\u5916\uff0c<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u4e5f\u4f1a\u88ab\u66ff\u6362\u4e3a\u8be5\u53d8\u91cf\u7684\u503c\uff0c\u5e76\u4f1a\u9002\u5f53\u5730\u52a0\u4e0a\u5f15\u53f7\uff0c\u4f7f\u5176\u6210\u4e3a\u5355\u4e2a shell \u547d\u4ee4\u53c2\u6570\u3002\uff08\u540e\u4e00\u79cd\u5f62\u5f0f\u51e0\u4e4e\u603b\u662f\u66f4\u53ef\u53d6\uff0c\u9664\u975e\u4f60\u975e\u5e38\u786e\u5b9a\u53d8\u91cf\u4e2d\u5305\u542b\u4ec0\u4e48\u3002\uff09\u7531\u4e8e\u65e0\u6cd5\u4fdd\u8bc1\u5728\u6240\u6709\u5e73\u53f0\u4e0a\u90fd\u80fd\u5bf9\u56de\u8f66\u548c\u6362\u884c\u5b57\u7b26\u5b89\u5168\u5730\u52a0\u5f15\u53f7\uff0c\u5f53\u53d8\u91cf\u503c\u4e2d\u51fa\u73b0\u8fd9\u7c7b\u5b57\u7b26\u65f6\uff0c<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u5f62\u5f0f\u4f1a\u6253\u5370\u9519\u8bef\u6d88\u606f\uff0c\u5e76\u4e14\u4e0d\u4f1a\u66ff\u6362\u53d8\u91cf\u503c\u3002</p>\n<p lang=\"zh\">\u4e00\u4e9b\u547d\u4ee4\u63a5\u53d7 SQL \u6807\u8bc6\u7b26\uff08\u4f8b\u5982\u8868\u540d\uff09\u4f5c\u4e3a\u53c2\u6570\u3002\u8fd9\u4e9b\u53c2\u6570\u9075\u5faa SQL \u8bed\u6cd5\u89c4\u5219\uff1a\u672a\u52a0\u5f15\u53f7\u7684\u5b57\u6bcd\u4f1a\u5f3a\u5236\u8f6c\u6362\u4e3a\u5c0f\u5199\uff0c\u800c\u53cc\u5f15\u53f7\uff08\"\uff09\u4f1a\u4fdd\u62a4\u5b57\u6bcd\u4e0d\u88ab\u8f6c\u6362\u5927\u5c0f\u5199\uff0c\u5e76\u5141\u8bb8\u6807\u8bc6\u7b26\u5305\u542b\u7a7a\u767d\u5b57\u7b26\u3002\u5728\u53cc\u5f15\u53f7\u5185\u90e8\uff0c\u8fde\u7eed\u4e24\u4e2a\u53cc\u5f15\u53f7\u4f1a\u5728\u6700\u7ec8\u540d\u79f0\u4e2d\u53d8\u4e3a\u4e00\u4e2a\u53cc\u5f15\u53f7\u3002\u4f8b\u5982\uff0cFOO\"BAR\"BAZ \u4f1a\u88ab\u89e3\u91ca\u4e3a fooBARbaz\uff0c\u800c \"A weird\"\" name\" \u4f1a\u53d8\u4e3a A weird\" name\u3002</p>\n<p lang=\"zh\">\u53c2\u6570\u89e3\u6790\u4f1a\u5728\u884c\u5c3e\u6216\u9047\u5230\u53e6\u4e00\u4e2a\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u65f6\u505c\u6b62\u3002\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u4f1a\u88ab\u89c6\u4e3a\u65b0\u5143\u547d\u4ee4\u7684\u5f00\u59cb\u3002\u7279\u6b8a\u5e8f\u5217<code class=\"literal\">\\\\</code>\uff08\u4e24\u4e2a\u53cd\u659c\u7ebf\uff09\u8868\u793a\u53c2\u6570\u7ed3\u675f\uff0c\u5e76\u7ee7\u7eed\u89e3\u6790<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\uff08\u5982\u679c\u8fd8\u6709\uff09\u3002\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u548c<span class=\"application\">psql</span>\u547d\u4ee4\u53ef\u4ee5\u81ea\u7531\u5730\u6df7\u5408\u5728\u540c\u4e00\u884c\u4e2d\u3002\u4f46\u65e0\u8bba\u5982\u4f55\uff0c\u5143\u547d\u4ee4\u7684\u53c2\u6570\u90fd\u4e0d\u80fd\u5ef6\u7eed\u5230\u4e0b\u4e00\u884c\u3002</p>\n<p lang=\"zh\">\u8bb8\u591a\u5143\u547d\u4ee4\u4f5c\u7528\u4e8e<em class=\"firstterm\">\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a</em>\u3002\u8fd9\u53ea\u662f\u4e00\u4e2a\u4fdd\u5b58\u5df2\u8f93\u5165\u4f46\u5c1a\u672a\u53d1\u9001\u5230\u670d\u52a1\u5668\u6267\u884c\u7684 SQL \u547d\u4ee4\u6587\u672c\u7684\u7f13\u51b2\u533a\u3002\u5176\u4e2d\u65e2\u5305\u62ec\u5148\u524d\u8f93\u5165\u7684\u884c\uff0c\u4e5f\u5305\u62ec\u540c\u4e00\u884c\u4e0a\u4f4d\u4e8e\u5143\u547d\u4ee4\u4e4b\u524d\u7684\u6587\u672c\u3002</p>\n<p lang=\"zh\">\u8bb8\u591a\u5143\u547d\u4ee4\u8fd8\u5141\u8bb8\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code> \u4f5c\u4e3a\u9009\u9879\u3002\u8fd9\u4f1a\u4f7f\u7ed3\u679c\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\uff0c\u5c31\u50cf\u4f7f\u7528\u4e86 <code class=\"command\">\\x</code> \u6216 <code class=\"command\">\\pset expanded</code> \u4e00\u6837\u3002</p>\n<p lang=\"zh\">\u5b9a\u4e49\u4e86\u4ee5\u4e0b\u5143\u547d\u4ee4\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-META-COMMAND-A\"><span class=\"term\"><code class=\"literal\">\\a</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u5f53\u524d\u8868\u683c\u8f93\u51fa\u683c\u5f0f\u662f\u975e\u5bf9\u9f50\uff0c\u5219\u5207\u6362\u4e3a\u5bf9\u9f50\uff1b\u5426\u5219\u5207\u6362\u4e3a\u975e\u5bf9\u9f50\u3002\u4fdd\u7559\u6b64\u547d\u4ee4\u662f\u4e3a\u4e86\u5411\u540e\u517c\u5bb9\u3002\u66f4\u901a\u7528\u7684\u89e3\u51b3\u65b9\u6848\u8bf7\u53c2\u89c1<code class=\"command\">\\pset</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-BIND\"><span class=\"term\"><code class=\"literal\">\\bind</code> [ <em class=\"replaceable\"><code>parameter</code></em> ] ...</span> </dt>\n<dd>\n<p lang=\"zh\">\u4e3a\u4e0b\u4e00\u6b21\u67e5\u8be2\u6267\u884c\u8bbe\u7f6e\u67e5\u8be2\u53c2\u6570\uff0c\u5e76\u5c06\u6307\u5b9a\u53c2\u6570\u4f20\u7ed9\u4efb\u610f\u53c2\u6570\u5360\u4f4d\u7b26\uff08<code class=\"literal\">$1</code> \u7b49\uff09\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">INSERT INTO tbl1 VALUES ($1, $2) \\bind 'first value' 'second value' \\g\n</pre>\n<p lang=\"zh\">\u8fd9\u5bf9\u9664 <code class=\"literal\">\\g</code> \u4e4b\u5916\u7684\u67e5\u8be2\u6267\u884c\u547d\u4ee4\u4e5f\u6709\u6548\uff0c\u4f8b\u5982 <code class=\"literal\">\\gx</code> \u548c <code class=\"literal\">\\gset</code>\u3002</p>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4f1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/19/protocol-overview.html#PROTOCOL-QUERY-CONCEPTS\" title=\"54.1.2.\u00a0\u6269\u5c55\u67e5\u8be2\u6982\u8ff0\">\u7b2c\u00a054.1.2\u00a0\u8282</a>\uff09\uff0c\u4e0d\u540c\u4e8e<span class=\"application\">psql</span>\u901a\u5e38\u4f7f\u7528\u7684\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002\u56e0\u6b64\uff0c\u53ef\u4ee5\u7528\u5b83\u5728<span class=\"application\">psql</span>\u4e2d\u6d4b\u8bd5\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002\uff08\u5373\u4f7f\u67e5\u8be2\u6ca1\u6709\u53c2\u6570\uff0c\u800c\u4e14\u6b64\u547d\u4ee4\u6307\u5b9a\u4e86\u96f6\u4e2a\u53c2\u6570\uff0c\u4e5f\u4f1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002\uff09\u6b64\u547d\u4ee4\u53ea\u5f71\u54cd\u4e0b\u4e00\u6761\u88ab\u6267\u884c\u7684\u67e5\u8be2\uff1b\u4e4b\u540e\u7684\u6240\u6709\u67e5\u8be2\u9ed8\u8ba4\u4ecd\u4f1a\u4f7f\u7528\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-BIND-NAMED\"><span class=\"term\"><code class=\"literal\">\\bind_named</code> <em class=\"replaceable\"><code>statement_name</code></em> [ <em class=\"replaceable\"><code>parameter</code></em> ] ...</span> </dt>\n<dd>\n<p lang=\"zh\"><code class=\"literal\">\\bind_named</code> \u7b49\u540c\u4e8e <code class=\"literal\">\\bind</code>\uff0c\u4e0d\u540c\u4e4b\u5904\u5728\u4e8e\u5b83\u628a\u73b0\u6709\u9884\u5907\u8bed\u53e5\u7684\u540d\u79f0\u4f5c\u4e3a\u7b2c\u4e00\u4e2a\u53c2\u6570\u3002\u7a7a\u5b57\u7b26\u4e32\u8868\u793a\u672a\u547d\u540d\u7684\u9884\u5907\u8bed\u53e5\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">INSERT INTO tbls1 VALUES ($1, $2) \\parse stmt1\n\\bind_named stmt1 'first value' 'second value' \\g\n</pre>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4f1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/19/protocol-overview.html#PROTOCOL-QUERY-CONCEPTS\" title=\"54.1.2.\u00a0\u6269\u5c55\u67e5\u8be2\u6982\u8ff0\">\u7b2c\u00a054.1.2\u00a0\u8282</a>\uff09\uff0c\u4e0d\u540c\u4e8e<span class=\"application\">psql</span>\u901a\u5e38\u4f7f\u7528\u7684\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002\u56e0\u6b64\uff0c\u53ef\u4ee5\u7528\u5b83\u5728<span class=\"application\">psql</span>\u4e2d\u6d4b\u8bd5\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-C-LC\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\c</code> \u6216 <code class=\"literal\">\\connect [ -reuse-previous=<em class=\"replaceable\"><code>on|off</code></em> ] [ <em class=\"replaceable\"><code>dbname</code></em> [ <em class=\"replaceable\"><code>username</code></em> ] [ <em class=\"replaceable\"><code>host</code></em> ] [ <em class=\"replaceable\"><code>port</code></em> ] | <em class=\"replaceable\"><code>conninfo</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5efa\u7acb\u5230<span class=\"productname\">PostgreSQL</span>\u670d\u52a1\u5668\u7684\u65b0\u8fde\u63a5\u3002\u53ef\u4ee5\u4f7f\u7528\u4f4d\u7f6e\u8bed\u6cd5\uff08\u6570\u636e\u5e93\u540d\u79f0\u3001\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\u4e2d\u7684\u4e00\u4e2a\u6216\u591a\u4e2a\uff09\u6307\u5b9a\u8981\u4f7f\u7528\u7684\u8fde\u63a5\u53c2\u6570\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528<em class=\"replaceable\"><code>conninfo</code></em>\u8fde\u63a5\u5b57\u7b26\u4e32\uff0c\u8be6\u89c1<a class=\"xref\" href=\"/docs/19/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u7b2c\u00a032.1.1\u00a0\u8282</a>\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa\u53c2\u6570\uff0c\u5219\u4f7f\u7528\u4e0e\u4e4b\u524d\u76f8\u540c\u7684\u53c2\u6570\u5efa\u7acb\u65b0\u8fde\u63a5\u3002</p>\n<p lang=\"zh\">\u5c06<em class=\"replaceable\"><code>dbname</code></em>\u3001<em class=\"replaceable\"><code>username</code></em>\u3001<em class=\"replaceable\"><code>host</code></em>\u6216 <em class=\"replaceable\"><code>port</code></em>\u4e2d\u7684\u4efb\u610f\u4e00\u4e2a\u6307\u5b9a\u4e3a <code class=\"literal\">-</code>\uff0c\u7b49\u540c\u4e8e\u7701\u7565\u8be5\u53c2\u6570\u3002</p>\n<p lang=\"zh\">\u65b0\u8fde\u63a5\u53ef\u4ee5\u91cd\u7528\u524d\u4e00\u4e2a\u8fde\u63a5\u7684\u8fde\u63a5\u53c2\u6570\uff1b\u4e0d\u4ec5\u5305\u62ec\u6570\u636e\u5e93\u540d\u79f0\u3001\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\uff0c\u8fd8\u5305\u62ec\u5176\u4ed6\u8bbe\u7f6e\uff0c\u5982<em class=\"replaceable\"><code>sslmode</code></em>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53c2\u6570\u5728\u4f4d\u7f6e\u8bed\u6cd5\u4e2d\u88ab\u91cd\u7528\uff0c\u4f46\u5728\u7ed9\u5b9a<em class=\"replaceable\"><code>conninfo</code></em>\u5b57\u7b26\u4e32\u65f6\u4e0d\u4f1a\u88ab\u91cd\u7528\u3002\u4f20\u9012<code class=\"literal\">-reuse-previous=on</code>\u6216<code class=\"literal\">-reuse-previous=off</code>\u4f5c\u4e3a\u7b2c\u4e00\u4e2a\u53c2\u6570\u5c06\u8986\u76d6\u8be5\u9ed8\u8ba4\u8bbe\u7f6e\u3002\u5982\u679c\u53c2\u6570\u88ab\u91cd\u7528\uff0c\u5219\u4efb\u4f55\u672a\u660e\u786e\u6307\u5b9a\u4e3a\u4f4d\u7f6e\u53c2\u6570\u6216\u5728<em class=\"replaceable\"><code>conninfo</code></em>\u5b57\u7b26\u4e32\u4e2d\u7684\u53c2\u6570\u5c06\u4ece\u73b0\u6709\u8fde\u63a5\u7684\u53c2\u6570\u4e2d\u83b7\u53d6\u3002\u4e00\u4e2a\u4f8b\u5916\u662f\uff0c\u5982\u679c\u4f7f\u7528\u4f4d\u7f6e\u8bed\u6cd5\u66f4\u6539<em class=\"replaceable\"><code>host</code></em>\u8bbe\u7f6e\uff0c\u4f7f\u5176\u4e0d\u540c\u4e8e\u5148\u524d\u7684\u503c\uff0c\u5219\u73b0\u6709\u8fde\u63a5\u53c2\u6570\u4e2d\u5b58\u5728\u7684\u4efb\u4f55<em class=\"replaceable\"><code>hostaddr</code></em>\u8bbe\u7f6e\u5c06\u88ab\u5220\u9664\u3002\u6b64\u5916\uff0c\u4ec5\u5f53\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\u8bbe\u7f6e\u672a\u66f4\u6539\u65f6\uff0c\u624d\u4f1a\u91cd\u7528\u73b0\u6709\u8fde\u63a5\u4f7f\u7528\u7684\u4efb\u4f55\u5bc6\u7801\u3002\u5f53\u547d\u4ee4\u65e2\u4e0d\u6307\u5b9a\u4e5f\u4e0d\u91cd\u7528\u7279\u5b9a\u53c2\u6570\u65f6\uff0c\u5c06\u4f7f\u7528<span class=\"application\">libpq</span>\u7684\u9ed8\u8ba4\u503c\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u65b0\u8fde\u63a5\u6210\u529f\u5efa\u7acb\uff0c\u5219\u5173\u95ed\u5148\u524d\u7684\u8fde\u63a5\u3002\u5982\u679c\u8fde\u63a5\u5c1d\u8bd5\u5931\u8d25\uff08\u7528\u6237\u540d\u9519\u8bef\uff0c\u8bbf\u95ee\u88ab\u62d2\u7edd\u7b49\uff09\uff0c\u4e14<span class=\"application\">psql</span>\u5904\u4e8e\u4ea4\u4e92\u6a21\u5f0f\uff0c\u5219\u4fdd\u7559\u5148\u524d\u7684\u8fde\u63a5\u3002\u4f46\u5728\u6267\u884c\u975e\u4ea4\u4e92\u811a\u672c\u65f6\uff0c\u65e7\u8fde\u63a5\u5c06\u88ab\u5173\u95ed\u5e76\u62a5\u544a\u9519\u8bef\u3002\u8fd9\u53ef\u80fd\u4f1a\u6216\u53ef\u80fd\u4e0d\u4f1a\u7ec8\u6b62\u811a\u672c\uff1b\u5982\u679c\u6ca1\u6709\u7ec8\u6b62\uff0c\u76f4\u5230\u6210\u529f\u6267\u884c\u53e6\u4e00\u4e2a<code class=\"literal\">\\connect</code>\u547d\u4ee4\u4e4b\u524d\uff0c\u6240\u6709\u8bbf\u95ee\u6570\u636e\u5e93\u7684\u547d\u4ee4\u90fd\u5c06\u5931\u8d25\u3002\u91c7\u7528\u8fd9\u79cd\u533a\u522b\uff0c\u4e00\u65b9\u9762\u662f\u4e3a\u4e86\u65b9\u4fbf\u7528\u6237\u5e94\u5bf9\u8f93\u5165\u7b14\u8bef\uff0c\u53e6\u4e00\u65b9\u9762\u662f\u4e3a\u4e86\u9632\u6b62\u811a\u672c\u610f\u5916\u64cd\u4f5c\u9519\u8bef\u7684\u6570\u636e\u5e93\u3002\u8bf7\u6ce8\u610f\uff0c\u6bcf\u5f53<code class=\"literal\">\\connect</code>\u547d\u4ee4\u5c1d\u8bd5\u91cd\u65b0\u4f7f\u7528\u53c2\u6570\u65f6\uff0c\u91cd\u65b0\u4f7f\u7528\u7684\u503c\u662f\u6700\u540e\u4e00\u4e2a\u6210\u529f\u8fde\u63a5\u7684\u503c\uff0c\u800c\u4e0d\u662f\u968f\u540e\u7684\u4efb\u4f55\u5931\u8d25\u5c1d\u8bd5\u7684\u503c\u3002\u4f46\u662f\uff0c\u5728\u975e\u4ea4\u4e92<code class=\"literal\">\\connect</code>\u5931\u8d25\u7684\u60c5\u51b5\u4e0b\uff0c\u4e0d\u5141\u8bb8\u7a0d\u540e\u91cd\u65b0\u4f7f\u7528\u53c2\u6570\uff0c\u56e0\u4e3a\u811a\u672c\u53ef\u80fd\u671f\u671b\u4ece\u5931\u8d25\u7684<code class=\"literal\">\\connect</code>\u4e2d\u91cd\u65b0\u4f7f\u7528\u503c\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">=&gt; \\c mydb myuser host.dom 6432\n=&gt; \\c service=foo\n=&gt; \\c \"host=localhost port=5432 dbname=mydb connect_timeout=10 sslmode=disable\"\n=&gt; \\c -reuse-previous=on sslmode=require    -- changes only sslmode\n=&gt; \\c postgresql://tom@localhost/mydb?application_name=myapp\n</pre>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-C-UC\"><span class=\"term\"><code class=\"literal\">\\C [ <em class=\"replaceable\"><code>title</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u4f5c\u4e3a\u67e5\u8be2\u7ed3\u679c\u6253\u5370\u7684\u8868\u7684\u6807\u9898\uff0c\u6216\u53d6\u6d88\u6b64\u7c7b\u6807\u9898\u3002\u8be5\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset title <em class=\"replaceable\"><code>title</code></em></code>\u3002\uff08\u6b64\u547d\u4ee4\u7684\u540d\u79f0\u6e90\u81ea<span class=\"quote\">\u201c<span class=\"quote\">caption</span>\u201d</span>\uff0c\u56e0\u4e3a\u5b83\u8fc7\u53bb\u53ea\u7528\u4e8e\u8bbe\u7f6e<acronym class=\"acronym\">HTML</acronym>\u8868\u7684\u6807\u9898\u3002\uff09</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-CD\"><span class=\"term\"><code class=\"literal\">\\cd [ <em class=\"replaceable\"><code>directory</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u66f4\u6539\u4e3a <em class=\"replaceable\"><code>directory</code></em>\u3002\u5982\u679c\u6ca1\u6709\u53c2\u6570\uff0c\u5219\u5207\u6362\u5230\u5f53\u524d\u7528\u6237\u7684\u4e3b\u76ee\u5f55\u3002\u5173\u4e8e\u5982\u4f55\u786e\u5b9a\u4e3b\u76ee\u5f55\uff0c\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/19/libpq-pgpass.html\" title=\"32.16.\u00a0\u5bc6\u7801\u6587\u4ef6\">\u7b2c\u00a032.16\u00a0\u8282</a>\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8981\u6253\u5370\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\uff0c\u8bf7\u4f7f\u7528<code class=\"literal\">\\! pwd</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-CLOSE-PREPARED\"><span class=\"term\"><code class=\"literal\">\\close_prepared</code> <em class=\"replaceable\"><code>prepared_statement_name</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u5173\u95ed\u6307\u5b9a\u7684\u9884\u5907\u8bed\u53e5\u3002\u7a7a\u5b57\u7b26\u4e32\u8868\u793a\u672a\u547d\u540d\u7684\u9884\u5907\u8bed\u53e5\u3002\u5982\u679c\u4e0d\u5b58\u5728\u8be5\u540d\u79f0\u7684\u9884\u5907\u8bed\u53e5\uff0c\u5219\u4e0d\u6267\u884c\u4efb\u4f55\u64cd\u4f5c\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">SELECT $1 \\parse stmt1\n\\close_prepared stmt1\n</pre>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4f1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\uff0c\u4e0d\u540c\u4e8e<span class=\"application\">psql</span>\u901a\u5e38\u4f7f\u7528\u7684\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002\u56e0\u6b64\uff0c\u53ef\u4ee5\u7528\u5b83\u5728<span class=\"application\">psql</span>\u4e2d\u6d4b\u8bd5\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-CONNINFO\"><span class=\"term\"><code class=\"literal\">\\conninfo</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8f93\u51fa\u5f53\u524d\u6570\u636e\u5e93\u8fde\u63a5\u7684\u4fe1\u606f\uff1b\u5982\u679c\u6b63\u5728\u4f7f\u7528 SSL\uff0c\u4e5f\u5305\u62ec\u4e0e SSL \u76f8\u5173\u7684\u4fe1\u606f\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c<code class=\"structfield\">Client User</code> \u5b57\u6bb5\u663e\u793a\u7684\u662f\u8fde\u63a5\u5efa\u7acb\u65f6\u7684\u7528\u6237\uff0c\u800c <code class=\"structfield\">Superuser</code> \u5b57\u6bb5\u8868\u793a\u5f53\u524d\u7528\u6237\uff08\u5728\u5f53\u524d\u6267\u884c\u4e0a\u4e0b\u6587\u4e2d\uff09\u662f\u5426\u5177\u6709\u8d85\u7ea7\u7528\u6237\u6743\u9650\u3002\u8fd9\u4e24\u4e2a\u7528\u6237\u901a\u5e38\u76f8\u540c\uff0c\u4f46\u4e5f\u53ef\u80fd\u4e0d\u540c\uff0c\u4f8b\u5982\u5f53\u524d\u7528\u6237\u66fe\u901a\u8fc7 <code class=\"command\">SET ROLE</code> \u547d\u4ee4\u88ab\u66f4\u6539\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMANDS-COPY\"><span class=\"term\"><code class=\"literal\">\\copy { <em class=\"replaceable\"><code>table</code></em> [ ( <em class=\"replaceable\"><code>column_list</code></em> ) ] } <code class=\"literal\">from</code> { <em class=\"replaceable\"><code>'filename'</code></em> | program <em class=\"replaceable\"><code>'command'</code></em> | stdin | pstdin } [ [ with ] ( <em class=\"replaceable\"><code>option</code></em> [, ...] ) ] [ where <em class=\"replaceable\"><code>condition</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\copy { <em class=\"replaceable\"><code>table</code></em> [ ( <em class=\"replaceable\"><code>column_list</code></em> ) ] | ( <em class=\"replaceable\"><code>query</code></em> ) } <code class=\"literal\">to</code> { <em class=\"replaceable\"><code>'filename'</code></em> | program <em class=\"replaceable\"><code>'command'</code></em> | stdout | pstdout } [ [ with ] ( <em class=\"replaceable\"><code>option</code></em> [, ...] ) ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6267\u884c\u524d\u7aef\uff08\u5ba2\u6237\u7aef\uff09\u590d\u5236\u3002\u8be5\u64cd\u4f5c\u4f1a\u8fd0\u884c\u4e00\u4e2a<acronym class=\"acronym\">SQL</acronym> <a class=\"link\" href=\"/docs/19/sql-copy.html\" title=\"COPY\"><code class=\"command\">COPY</code></a>\u547d\u4ee4\uff0c\u4f46\u5e76\u4e0d\u662f\u7531\u670d\u52a1\u5668\u8bfb\u53d6\u6216\u5199\u5165\u6307\u5b9a\u6587\u4ef6\uff0c\u800c\u662f\u7531<span class=\"application\">psql</span>\u8bfb\u53d6\u6216\u5199\u5165\u6587\u4ef6\uff0c\u5e76\u5728\u670d\u52a1\u5668\u4e0e\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e4b\u95f4\u8f6c\u9001\u6570\u636e\u3002\u8fd9\u610f\u5473\u7740\u6587\u4ef6\u53ef\u8bbf\u95ee\u6027\u548c\u6743\u9650\u53d6\u51b3\u4e8e\u672c\u5730\u7528\u6237\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\uff0c\u4e5f\u4e0d\u9700\u8981 SQL \u8d85\u7ea7\u7528\u6237\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5f53\u6307\u5b9a<code class=\"literal\">program</code>\u65f6\uff0c<em class=\"replaceable\"><code>command</code></em> \u7531<span class=\"application\">psql</span>\u6267\u884c\uff0c\u4f20\u7ed9<em class=\"replaceable\"><code>command</code></em>\u7684\u6570\u636e\u6216\u4ece\u5176\u4e2d\u8bfb\u51fa\u7684\u6570\u636e\u90fd\u4f1a\u5728\u670d\u52a1\u5668\u4e0e\u5ba2\u6237\u7aef\u4e4b\u95f4\u8f6c\u9001\u3002\u518d\u6b21\u5f3a\u8c03\uff0c\u6267\u884c\u6743\u9650\u5c5e\u4e8e\u672c\u5730\u7528\u6237\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\uff0c\u4e5f\u4e0d\u9700\u8981 SQL \u8d85\u7ea7\u7528\u6237\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e \\copy ... from stdin\uff0c\u4ece\u53d1\u51fa\u547d\u4ee4\u7684\u540c\u4e00\u8f93\u5165\u6e90\u8bfb\u53d6\u6570\u636e\u884c\uff0c\u76f4\u5230\u8bfb\u53d6\u5230\u4ec5\u542b \\. \u7684\u4e00\u884c\u6216\u8f93\u5165\u6d41\u5230\u8fbe EOF\u3002\u8fd9\u9002\u5408\u5728 SQL \u811a\u672c\u4e2d\u5185\u8054\u586b\u5145\u8868\u3002\u5bf9\u4e8e \\copy ... to stdout\uff0c\u8f93\u51fa\u53d1\u5f80\u4e0e psql \u547d\u4ee4\u8f93\u51fa\u76f8\u540c\u7684\u4f4d\u7f6e\uff0c\u4e14\u4e0d\u6253\u5370 COPY count \u547d\u4ee4\u72b6\u6001\uff0c\u4ee5\u514d\u4e0e\u6570\u636e\u884c\u6df7\u6dc6\u3002\u82e5\u8981\u59cb\u7ec8\u8bfb\u5199 psql \u7684\u6807\u51c6\u8f93\u5165\u6216\u8f93\u51fa\uff0c\u800c\u4e0d\u53d7\u5f53\u524d\u547d\u4ee4\u6765\u6e90\u6216 \\o \u9009\u9879\u5f71\u54cd\uff0c\u8bf7\u4f7f\u7528 from pstdin \u6216 to pstdout\u3002</p>\n<p lang=\"zh\">\u8be5\u547d\u4ee4\u7684\u8bed\u6cd5\u4e0e<acronym class=\"acronym\">SQL</acronym> <a class=\"link\" href=\"/docs/19/sql-copy.html\" title=\"COPY\"><code class=\"command\">COPY</code></a>\u547d\u4ee4\u7c7b\u4f3c\u3002\u9664\u6570\u636e\u6e90\u6216\u76ee\u6807\u4e4b\u5916\uff0c\u5176\u4ed6\u6240\u6709\u9009\u9879\u90fd\u4e0e<code class=\"command\">COPY</code>\u547d\u4ee4\u4e2d\u7684\u6307\u5b9a\u76f8\u540c\u3002\u56e0\u6b64\uff0c\u7279\u6b8a\u7684\u89e3\u6790\u89c4\u5219\u9002\u7528\u4e8e<code class=\"command\">\\copy</code>\u5143\u547d\u4ee4\u3002\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u5269\u4f59\u884c\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\copy</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u6267\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u53e6\u4e00\u79cd\u83b7\u5f97\u4e0e<code class=\"literal\">\\copy ... to</code>\u76f8\u540c\u7ed3\u679c\u7684\u65b9\u6cd5\u662f\u4f7f\u7528<acronym class=\"acronym\">SQL</acronym> <code class=\"literal\">COPY ... TO STDOUT</code>\u547d\u4ee4\uff0c\u5e76\u4ee5<code class=\"literal\">\\g <em class=\"replaceable\"><code>filename</code></em></code> \u6216<code class=\"literal\">\\g |<em class=\"replaceable\"><code>program</code></em></code>\u7ed3\u675f\u3002\u4e0e<code class=\"literal\">\\copy</code>\u4e0d\u540c\uff0c\u8fd9\u79cd\u65b9\u6cd5\u5141\u8bb8\u547d\u4ee4\u8de8\u8d8a\u591a\u884c\uff1b\u6b64\u5916\uff0c\u53ef\u4ee5\u4f7f\u7528\u53d8\u91cf\u63d2\u503c\u548c\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</div>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8fd9\u4e9b\u64cd\u4f5c\u4e0d\u5982\u4ee5\u6587\u4ef6\u6216\u7a0b\u5e8f\u4f5c\u4e3a\u6570\u636e\u6e90\u6216\u76ee\u6807\u7684 <acronym class=\"acronym\">SQL</acronym> <code class=\"command\">COPY</code> \u547d\u4ee4\u9ad8\u6548\uff0c\u56e0\u4e3a\u6240\u6709\u6570\u636e\u90fd\u5fc5\u987b\u901a\u8fc7\u5ba2\u6237\u7aef/\u670d\u52a1\u5668\u8fde\u63a5\u4f20\u8f93\u3002\u5bf9\u4e8e\u5927\u91cf\u6570\u636e\uff0c\u4f7f\u7528 <acronym class=\"acronym\">SQL</acronym> \u547d\u4ee4\u53ef\u80fd\u66f4\u5408\u9002\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-COPYRIGHT\"><span class=\"term\"><code class=\"literal\">\\copyright</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"productname\">PostgreSQL</span>\u7684\u7248\u6743\u548c\u5206\u53d1\u6761\u6b3e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMANDS-CROSSTABVIEW\"><span class=\"term\"><code class=\"literal\">\\crosstabview [ <em class=\"replaceable\"><code>colV</code></em> [ <em class=\"replaceable\"><code>colH</code></em> [ <em class=\"replaceable\"><code>colD</code></em> [ <em class=\"replaceable\"><code>sortcolH</code></em> ] ] ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6267\u884c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\uff08\u4e0e<code class=\"literal\">\\g</code>\u7c7b\u4f3c\uff09\uff0c\u5e76\u4ee5\u4ea4\u53c9\u8868\u7f51\u683c\u663e\u793a\u7ed3\u679c\u3002\u67e5\u8be2\u5fc5\u987b\u8fd4\u56de\u81f3\u5c11\u4e09\u5217\u3002\u7531<em class=\"replaceable\"><code>colV</code></em>\u6807\u8bc6\u7684\u8f93\u51fa\u5217\u6210\u4e3a\u7eb5\u5411\u8868\u5934\uff0c\u7531<em class=\"replaceable\"><code>colH</code></em>\u6807\u8bc6\u7684\u8f93\u51fa\u5217\u6210\u4e3a\u6a2a\u5411\u8868\u5934\u3002<em class=\"replaceable\"><code>colD</code></em>\u6807\u8bc6\u8981\u5728\u7f51\u683c\u4e2d\u663e\u793a\u7684\u8f93\u51fa\u5217\u3002<em class=\"replaceable\"><code>sortcolH</code></em>\u6807\u8bc6\u6a2a\u5411\u8868\u5934\u7684\u53ef\u9009\u6392\u5e8f\u5217\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a\u5217\u6307\u5b9a\u9879\u53ef\u4ee5\u662f\u4ece 1 \u5f00\u59cb\u7684\u5217\u53f7\uff0c\u4e5f\u53ef\u4ee5\u662f\u5217\u540d\uff1b\u5217\u540d\u9075\u5faa\u5e38\u89c4 SQL \u5927\u5c0f\u5199\u6298\u53e0\u548c\u5f15\u53f7\u89c4\u5219\u3002\u7701\u7565\u65f6\uff0ccolV \u9ed8\u8ba4\u4e3a\u7b2c 1 \u5217\uff0ccolH \u9ed8\u8ba4\u4e3a\u7b2c 2 \u5217\u3002colH \u5fc5\u987b\u4e0e colV \u4e0d\u540c\u3002\u82e5\u4e0d\u6307\u5b9a colD\uff0c\u67e5\u8be2\u7ed3\u679c\u5fc5\u987b\u6070\u6709\u4e09\u5217\uff0c\u65e2\u975e colV \u4e5f\u975e colH \u7684\u90a3\u4e00\u5217\u4f5c\u4e3a colD\u3002</p>\n<p lang=\"zh\">\u7eb5\u5411\u8868\u5934\u663e\u793a\u4e3a\u6700\u5de6\u5217\uff0c\u5305\u542b<em class=\"replaceable\"><code>colV</code></em>\u5217\u4e2d\u7684\u503c\uff0c\u5176\u987a\u5e8f\u4e0e\u67e5\u8be2\u7ed3\u679c\u4e2d\u76f8\u540c\uff0c\u4f46\u4f1a\u79fb\u9664\u91cd\u590d\u503c\u3002</p>\n<p lang=\"zh\">\u6a2a\u5411\u8868\u5934\u663e\u793a\u4e3a\u7b2c\u4e00\u884c\uff0c\u5305\u542b<em class=\"replaceable\"><code>colH</code></em>\u5217\u4e2d\u7684\u503c\uff0c\u5e76\u79fb\u9664\u91cd\u590d\u503c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4eec\u6309\u67e5\u8be2\u7ed3\u679c\u4e2d\u7684\u76f8\u540c\u987a\u5e8f\u663e\u793a\u3002\u4f46\u5982\u679c\u7ed9\u51fa\u4e86\u53ef\u9009\u7684<em class=\"replaceable\"><code>sortcolH</code></em>\u53c2\u6570\uff0c\u5b83\u6240\u6807\u8bc6\u7684\u5217\u7684\u503c\u5fc5\u987b\u662f\u6574\u6570\uff0c\u800c<em class=\"replaceable\"><code>colH</code></em>\u4e2d\u7684\u503c\u4f1a\u6309\u7167\u5bf9\u5e94\u7684<em class=\"replaceable\"><code>sortcolH</code></em>\u503c\u6392\u5e8f\u540e\u663e\u793a\u5728\u6a2a\u5411\u8868\u5934\u4e2d\u3002</p>\n<p lang=\"zh\">\u4ea4\u53c9\u8868\u4e2d\uff0c\u5bf9\u4e8e colH \u7684\u6bcf\u4e2a\u4e0d\u540c\u503c x \u548c colV \u7684\u6bcf\u4e2a\u4e0d\u540c\u503c y\uff0c\u4ea4\u70b9 (x,y) \u7684\u5355\u5143\u683c\u4fdd\u5b58\u67e5\u8be2\u7ed3\u679c\u4e2d colH=x \u4e14 colV=y \u90a3\u4e00\u884c\u7684 colD \u503c\u3002\u6ca1\u6709\u5339\u914d\u884c\u65f6\u5355\u5143\u683c\u4e3a\u7a7a\uff1b\u5b58\u5728\u591a\u884c\u65f6\u4f1a\u62a5\u9519\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-D\"><span class=\"term\"><code class=\"literal\">\\d[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5bf9\u4e8e\u6bcf\u4e2a\u4e0e<em class=\"replaceable\"><code>pattern</code></em>\u5339\u914d\u7684\u5173\u7cfb\uff08\u8868\u3001\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u7d22\u5f15\u3001\u5e8f\u5217\u6216\u5916\u90e8\u8868\uff09\u6216\u590d\u5408\u7c7b\u578b\uff0c\u663e\u793a\u6240\u6709\u5217\u3001\u5b83\u4eec\u7684\u7c7b\u578b\u3001\u8868\u7a7a\u95f4\uff08\u5982\u679c\u4e0d\u662f\u9ed8\u8ba4\u7684\uff09\u4ee5\u53ca\u4efb\u4f55\u7279\u6b8a\u5c5e\u6027\uff0c\u5982<code class=\"literal\">NOT NULL</code>\u6216\u9ed8\u8ba4\u503c\u3002\u8fd8\u663e\u793a\u76f8\u5173\u5bf9\u8c61\uff0c\u4f8b\u5982\u7d22\u5f15\u3001\u7ea6\u675f\u3001\u89c4\u5219\u3001\u89e6\u53d1\u5668\u548c\u53d1\u5e03\u3002\u5bf9\u4e8e\u5916\u90e8\u8868\uff0c\u8fd8\u663e\u793a\u5173\u8054\u7684\u5916\u90e8\u670d\u52a1\u5668\u3002\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u5339\u914d\u6a21\u5f0f</span>\u201d</span>\u7684\u5b9a\u4e49\u5728\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"\u6a21\u5f0f\">\u6a21\u5f0f</a>\u4e2d\u3002\uff09</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u67d0\u4e9b\u7c7b\u578b\u7684\u5173\u7cfb\uff0c<code class=\"literal\">\\d</code>\u663e\u793a\u6bcf\u5217\u7684\u9644\u52a0\u4fe1\u606f\uff1a\u5e8f\u5217\u7684\u5217\u503c\uff0c\u7d22\u5f15\u7684\u7d22\u5f15\u8868\u8fbe\u5f0f\uff0c\u5916\u90e8\u8868\u7684\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u547d\u4ee4\u5f62\u5f0f<code class=\"literal\">\\d+</code>\u4e0e\u524d\u8005\u76f8\u540c\uff0c\u4f46\u4f1a\u663e\u793a\u66f4\u591a\u4fe1\u606f\uff0c\u4f8b\u5982\uff1a\u8868\u5217\u5173\u8054\u7684\u6ce8\u91ca\u3001\u8868\u662f\u5426\u5305\u542b OID\u3001\u5f53\u5173\u7cfb\u4e3a\u89c6\u56fe\u65f6\u7684\u89c6\u56fe\u5b9a\u4e49\u3001\u975e\u9ed8\u8ba4\u7684<a class=\"link\" href=\"/docs/19/sql-altertable.html#SQL-ALTERTABLE-REPLICA-IDENTITY\">\u590d\u5236\u6807\u8bc6</a>\u8bbe\u7f6e\uff0c\u4ee5\u53ca\u5f53\u5173\u7cfb\u5177\u6709\u8bbf\u95ee\u65b9\u6cd5\u65f6\u7684<a class=\"link\" href=\"/docs/19/sql-create-access-method.html\" title=\"CREATE ACCESS METHOD\">\u8bbf\u95ee\u65b9\u6cd5</a>\u540d\u79f0\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u4e00\u4e2a\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u4ee5\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528<code class=\"command\">\\d</code>\u800c\u6ca1\u6709<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\uff0c\u5b83\u7b49\u540c\u4e8e<code class=\"command\">\\dtvmsE</code>\uff0c\u5b83\u5c06\u663e\u793a\u6240\u6709\u53ef\u89c1\u7684\u8868\u3001\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u7684\u5217\u8868\u3002\u8fd9\u7eaf\u7cb9\u662f\u4e00\u79cd\u4fbf\u5229\u63aa\u65bd\u3002</p>\n<p lang=\"zh\">\u4e0e\u8bb8\u591a\u5176\u4ed6\u547d\u4ee4\u4e00\u6837\uff0c\u5728\u547d\u4ee4\u540d\u540e\u6dfb\u52a0 x \u4f1a\u4f7f\u7528\u6269\u5c55\u663e\u793a\u6a21\u5f0f\u3002\u4f46\u8fd9\u4ec5\u9002\u7528\u4e8e\u4e0d\u5e26 pattern \u53c2\u6570\u7684 \\d\uff0c\u4e14 x \u4e0d\u80fd\u7d27\u8ddf \\d\uff08\u56e0\u4e3a \\dx \u662f\u53e6\u4e00\u4e2a\u547d\u4ee4\uff09\uff0c\u53ea\u80fd\u4f4d\u4e8e S \u6216 + \u4fee\u9970\u7b26\u4e4b\u540e\u3002\u4f8b\u5982\uff0c\\d+x \u7b49\u4ef7\u4e8e \\dtvmsE+x\uff0c\u5c06\u4ee5\u6269\u5c55\u6a21\u5f0f\u5217\u51fa\u6240\u6709\u5173\u7cfb\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DA-LC\"><span class=\"term\"><code class=\"literal\">\\da[Sx] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u805a\u5408\u51fd\u6570\uff0c\u4ee5\u53ca\u5b83\u4eec\u7684\u8fd4\u56de\u7c7b\u578b\u548c\u6240\u4f5c\u7528\u7684\u6570\u636e\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u805a\u5408\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DA-UC\"><span class=\"term\"><code class=\"literal\">\\dA[x+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8bbf\u95ee\u65b9\u6cd5\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bbf\u95ee\u65b9\u6cd5\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u8bbf\u95ee\u65b9\u6cd5\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u7684\u5904\u7406\u5668\u51fd\u6570\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DAC\"><span class=\"term\"><code class=\"literal\">\\dAc[x+] [<a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>input-type-pattern</code></em></a>]]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u64cd\u4f5c\u7b26\u7c7b\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/19/xindex.html#XINDEX-OPCLASS\" title=\"36.16.1.\u00a0\u7d22\u5f15\u65b9\u6cd5\u548c\u64cd\u4f5c\u7b26\u7c7b\">\u7b2c\u00a036.16.1\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u7c7b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>input-type-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8f93\u5165\u7c7b\u578b\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u7c7b\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u7c7b\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u548c\u6240\u6709\u8005\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DAF\"><span class=\"term\"><code class=\"literal\">\\dAf[x+] [<a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>input-type-pattern</code></em></a>]]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u64cd\u4f5c\u7b26\u65cf\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/19/xindex.html#XINDEX-OPFAMILY\" title=\"36.16.5.\u00a0\u64cd\u4f5c\u7b26\u7c7b\u548c\u64cd\u4f5c\u7b26\u65cf\">\u7b2c\u00a036.16.5\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>input-type-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8f93\u5165\u7c7b\u578b\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u65cf\u90fd\u4f1a\u8fde\u540c\u5176\u6240\u6709\u8005\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DAO\"><span class=\"term\"><code class=\"literal\">\\dAo[x+] [<a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>operator-family-pattern</code></em></a>]]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u4e0e\u64cd\u4f5c\u7b26\u65cf\u5173\u8054\u7684\u64cd\u4f5c\u7b26\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/19/xindex.html#XINDEX-STRATEGIES\" title=\"36.16.2.\u00a0\u7d22\u5f15\u65b9\u6cd5\u7b56\u7565\">\u7b2c\u00a036.16.2\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u6240\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u6210\u5458\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>operator-family-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u8be5\u6a21\u5f0f\u5339\u914d\u7684\u64cd\u4f5c\u7b26\u65cf\u6210\u5458\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u90fd\u4f1a\u8fde\u540c\u5176\u6392\u5e8f\u64cd\u4f5c\u7b26\u65cf\uff08\u5982\u679c\u5b83\u662f\u6392\u5e8f\u64cd\u4f5c\u7b26\uff09\u4ee5\u53ca\u5176\u5e95\u5c42\u51fd\u6570\u662f\u5426\u9632\u6f0f\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DAP\"><span class=\"term\"><code class=\"literal\">\\dAp[x+] [<a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>operator-family-pattern</code></em></a>]]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u4e0e\u64cd\u4f5c\u7b26\u65cf\u5173\u8054\u7684\u652f\u6301\u51fd\u6570\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/19/xindex.html#XINDEX-SUPPORT\" title=\"36.16.3.\u00a0\u7d22\u5f15\u65b9\u6cd5\u652f\u6301\u4f8b\u7a0b\">\u7b2c\u00a036.16.3\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u6240\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u51fd\u6570\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>operator-family-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u8be5\u6a21\u5f0f\u5339\u914d\u7684\u64cd\u4f5c\u7b26\u65cf\u51fd\u6570\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u51fd\u6570\u4f1a\u4ee5\u8be6\u7ec6\u5f62\u5f0f\u663e\u793a\uff0c\u5e76\u5e26\u6709\u5176\u5b9e\u9645\u53c2\u6570\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DB\"><span class=\"term\"><code class=\"literal\">\\db[x+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8868\u7a7a\u95f4\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8868\u7a7a\u95f4\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u8868\u7a7a\u95f4\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u9009\u9879\u3001\u78c1\u76d8\u5927\u5c0f\u3001\u6743\u9650\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DC-LC\"><span class=\"term\"><code class=\"literal\">\\dc[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5b57\u7b26\u96c6\u7f16\u7801\u4e4b\u95f4\u7684\u8f6c\u6362\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8f6c\u6362\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DCONFIG\"><span class=\"term\"><code class=\"literal\">\\dconfig[x+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u670d\u52a1\u5668\u914d\u7f6e\u53c2\u6570\u53ca\u5176\u503c\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u53c2\u6570\u3002\u4e0d\u5e26 <em class=\"replaceable\"><code>pattern</code></em> \u65f6\uff0c\u53ea\u5217\u51fa\u88ab\u8bbe\u7f6e\u4e3a\u975e\u9ed8\u8ba4\u503c\u7684\u53c2\u6570\u3002\uff08\u4f7f\u7528 <code class=\"literal\">\\dconfig *</code> \u53ef\u67e5\u770b\u6240\u6709\u53c2\u6570\u3002\uff09\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u53c2\u6570\u90fd\u4f1a\u8fde\u540c\u5176\u6570\u636e\u7c7b\u578b\u3001\u8be5\u53c2\u6570\u53ef\u8bbe\u7f6e\u7684\u4e0a\u4e0b\u6587\u4ee5\u53ca\u8bbf\u95ee\u6743\u9650\uff08\u5982\u679c\u5df2\u6388\u4e88\u975e\u9ed8\u8ba4\u8bbf\u95ee\u6743\u9650\uff09\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DC-UC\"><span class=\"term\"><code class=\"literal\">\\dC[x+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u7c7b\u578b\u8f6c\u6362\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u5176\u6e90\u7c7b\u578b\u6216\u76ee\u6807\u7c7b\u578b\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u7c7b\u578b\u8f6c\u6362\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u7c7b\u578b\u8f6c\u6362\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5176\u5e95\u5c42\u51fd\u6570\u662f\u5426\u9632\u6f0f\uff0c\u4ee5\u53ca\u8be5\u7c7b\u578b\u8f6c\u6362\u7684\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DD-LC\"><span class=\"term\"><code class=\"literal\">\\dd[Sx] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u663e\u793a<code class=\"literal\">constraint</code>\u3001<code class=\"literal\">operator class</code>\u3001<code class=\"literal\">operator family</code>\u3001<code class=\"literal\">rule</code>\u548c <code class=\"literal\">trigger</code>\u7c7b\u578b\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002\u5176\u4ed6\u6ce8\u91ca\u53ef\u901a\u8fc7\u5bf9\u5e94\u5bf9\u8c61\u7c7b\u578b\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u67e5\u770b\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">\\dd</code> \u663e\u793a\u4e0e <em class=\"replaceable\"><code>pattern</code></em> \u5339\u914d\u7684\u5bf9\u8c61\u63cf\u8ff0\uff1b\u5982\u679c\u6ca1\u6709\u7ed9\u51fa\u53c2\u6570\uff0c\u5219\u663e\u793a\u76f8\u5e94\u7c7b\u578b\u7684\u53ef\u89c1\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002\u4f46\u65e0\u8bba\u54ea\u79cd\u60c5\u51b5\uff0c\u53ea\u5217\u51fa\u90a3\u4e9b\u5df2\u6709\u63cf\u8ff0\u7684\u5bf9\u8c61\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528 <a class=\"link\" href=\"/docs/19/sql-comment.html\" title=\"COMMENT\"><code class=\"command\">COMMENT</code></a> <acronym class=\"acronym\">SQL</acronym> \u547d\u4ee4\u521b\u5efa\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DD-UC\"><span class=\"term\"><code class=\"literal\">\\dD[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u57df\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u57df\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u6743\u9650\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DDP\"><span class=\"term\"><code class=\"literal\">\\ddp[x] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u9ed8\u8ba4\u8bbf\u95ee\u6743\u9650\u8bbe\u7f6e\u3002\u5bf9\u4e8e\u6bcf\u4e2a\u9ed8\u8ba4\u6743\u9650\u8bbe\u7f6e\u5df2\u504f\u79bb\u5185\u7f6e\u9ed8\u8ba4\u503c\u7684\u89d2\u8272\uff08\u4ee5\u53ca\u9002\u7528\u65f6\u7684\u6a21\u5f0f\uff09\uff0c\u90fd\u4f1a\u663e\u793a\u4e00\u6761\u8bb0\u5f55\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u89d2\u8272\u540d\u6216\u6a21\u5f0f\u540d\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bb0\u5f55\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002</p>\n<p lang=\"zh\"><a class=\"link\" href=\"/docs/19/sql-alterdefaultprivileges.html\" title=\"ALTER DEFAULT PRIVILEGES\"><code class=\"command\">ALTER DEFAULT PRIVILEGES</code></a>\u547d\u4ee4\u7528\u4e8e\u8bbe\u7f6e\u9ed8\u8ba4\u8bbf\u95ee\u6743\u9650\u3002\u6743\u9650\u663e\u793a\u7684\u542b\u4e49\u5728<a class=\"xref\" href=\"/docs/19/ddl-priv.html\" title=\"5.9.\u00a0\u6743\u9650\">\u7b2c\u00a05.9\u00a0\u8282</a>\u4e2d\u6709\u89e3\u91ca\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DE\"><span class=\"term\"><code class=\"literal\">\\dE[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\di[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dm[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\ds[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dt[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dv[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd9\u7ec4\u547d\u4ee4\u4e2d\uff0c\u5b57\u6bcd <code class=\"literal\">E</code>\u3001<code class=\"literal\">i</code>\u3001<code class=\"literal\">m</code>\u3001<code class=\"literal\">s</code>\u3001<code class=\"literal\">t</code> \u548c <code class=\"literal\">v</code> \u5206\u522b\u8868\u793a\u5916\u90e8\u8868\u3001\u7d22\u5f15\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u3001\u8868\u548c\u89c6\u56fe\u3002\u4f60\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u6307\u5b9a\u5176\u4e2d\u4efb\u610f\u4e00\u4e2a\u6216\u591a\u4e2a\u5b57\u6bcd\uff0c\u4ee5\u83b7\u53d6\u8fd9\u4e9b\u7c7b\u578b\u5bf9\u8c61\u7684\u5217\u8868\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dti</code> \u4f1a\u5217\u51fa\u8868\u548c\u7d22\u5f15\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u6301\u4e45\u6027\u72b6\u6001\uff08\u6c38\u4e45\u3001\u4e34\u65f6\u6216\u4e0d\u8bb0\u5f55 WAL\uff09\u3001\u78c1\u76d8\u4e0a\u7684\u7269\u7406\u5927\u5c0f\u4ee5\u53ca\u76f8\u5173\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u4e00\u8d77\u5217\u51fa\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u5bf9\u8c61\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DES\"><span class=\"term\"><code class=\"literal\">\\des[x+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u670d\u52a1\u5668\uff08\u52a9\u8bb0\u7b26\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external servers</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u670d\u52a1\u5668\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u670d\u52a1\u5668\u7684\u5b8c\u6574\u63cf\u8ff0\uff0c\u5305\u62ec\u670d\u52a1\u5668\u7684\u8bbf\u95ee\u6743\u9650\u3001\u7c7b\u578b\u3001\u7248\u672c\u3001\u9009\u9879\u548c\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DET\"><span class=\"term\"><code class=\"literal\">\\det[x+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u8868\uff08\u52a9\u8bb0\u7b26\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external tables</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u8868\u540d\u6216\u6a21\u5f0f\u540d\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6761\u76ee\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u8fd8\u4f1a\u663e\u793a\u901a\u7528\u9009\u9879\u4ee5\u53ca\u5916\u90e8\u8868\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DEU\"><span class=\"term\"><code class=\"literal\">\\deu[x+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u7528\u6237\u6620\u5c04\uff08\u52a9\u8bb0\u7b26\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external users</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u7528\u6237\u540d\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6620\u5c04\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u6620\u5c04\u7684\u9644\u52a0\u4fe1\u606f\u3002</p>\n<div class=\"caution\">\n<h3 class=\"title\" lang=\"zh\">\u5c0f\u5fc3</h3>\n<p lang=\"zh\"><code class=\"literal\">\\deu+</code>\u53ef\u80fd\u8fd8\u4f1a\u663e\u793a\u8fdc\u7a0b\u7528\u6237\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u56e0\u6b64\u5e94\u6ce8\u610f\u4e0d\u8981\u6cc4\u9732\u5b83\u4eec\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DEW\"><span class=\"term\"><code class=\"literal\">\\dew[x+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\uff08\u52a9\u8bb0\u7b26\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external wrappers</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u8fd8\u4f1a\u663e\u793a\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u7684\u8bbf\u95ee\u6743\u9650\u3001\u9009\u9879\u548c\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DF-LC\"><span class=\"term\"><code class=\"literal\">\\df[anptwSx+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> [ <em class=\"replaceable\"><code>arg_pattern</code></em> ... ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u51fd\u6570\uff0c\u4ee5\u53ca\u5b83\u4eec\u7684\u7ed3\u679c\u6570\u636e\u7c7b\u578b\u3001\u53c2\u6570\u6570\u636e\u7c7b\u578b\u548c\u51fd\u6570\u7c7b\u578b\uff0c\u51fd\u6570\u7c7b\u578b\u5206\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">agg</span>\u201d</span>\uff08\u805a\u5408\uff09\u3001<span class=\"quote\">\u201c<span class=\"quote\">normal</span>\u201d</span>\u3001<span class=\"quote\">\u201c<span class=\"quote\">procedure</span>\u201d</span>\u3001<span class=\"quote\">\u201c<span class=\"quote\">trigger</span>\u201d</span>\u6216<span class=\"quote\">\u201c<span class=\"quote\">window</span>\u201d</span>\u3002\u8981\u53ea\u663e\u793a\u7279\u5b9a\u7c7b\u578b\u7684\u51fd\u6570\uff0c\u8bf7\u5728\u547d\u4ee4\u540e\u6dfb\u52a0\u76f8\u5e94\u7684\u5b57\u6bcd <code class=\"literal\">a</code>\u3001<code class=\"literal\">n</code>\u3001<code class=\"literal\">p</code>\u3001<code class=\"literal\">t</code> \u6216 <code class=\"literal\">w</code>\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u51fd\u6570\u3002\u4efb\u4f55\u9644\u52a0\u53c2\u6570\u90fd\u662f\u7c7b\u578b\u540d\u6a21\u5f0f\uff0c\u5206\u522b\u4e0e\u51fd\u6570\u7b2c\u4e00\u3001\u7b2c\u4e8c\u7b49\u53c2\u6570\u7684\u7c7b\u578b\u540d\u5339\u914d\u3002\uff08\u5339\u914d\u5230\u7684\u51fd\u6570\u53ef\u4ee5\u6bd4\u4f60\u6307\u5b9a\u7684\u53c2\u6570\u66f4\u591a\uff1b\u82e5\u8981\u9632\u6b62\u8fd9\u79cd\u60c5\u51b5\uff0c\u53ef\u5c06\u8fde\u5b57\u7b26 <code class=\"literal\">-</code> \u5199\u6210\u6700\u540e\u4e00\u4e2a <em class=\"replaceable\"><code>arg_pattern</code></em>\u3002\uff09\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u51fd\u6570\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u6613\u53d8\u6027\u3001\u5e76\u884c\u5b89\u5168\u6027\u3001\u6240\u6709\u8005\u3001\u5b89\u5168\u5206\u7c7b\u3001\u662f\u5426\u9632\u6f0f\u3001\u8bbf\u95ee\u6743\u9650\u3001\u8bed\u8a00\u3001\u5185\u90e8\u540d\u79f0\uff08\u4ec5\u9002\u7528\u4e8e C \u548c internal \u51fd\u6570\uff09\u4ee5\u53ca\u63cf\u8ff0\u3002\u7279\u5b9a\u51fd\u6570\u7684\u6e90\u4ee3\u7801\u53ef\u901a\u8fc7 <code class=\"literal\">\\sf</code> \u67e5\u770b\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DF-UC\"><span class=\"term\"><code class=\"literal\">\\dF[x+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u914d\u7f6e\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u914d\u7f6e\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u914d\u7f6e\u7684\u5b8c\u6574\u63cf\u8ff0\uff0c\u5305\u62ec\u5e95\u5c42\u5168\u6587\u68c0\u7d22\u89e3\u6790\u5668\u4ee5\u53ca\u6bcf\u79cd\u89e3\u6790\u5668\u8bcd\u5143\u7c7b\u578b\u5bf9\u5e94\u7684\u8bcd\u5178\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DFD\"><span class=\"term\"><code class=\"literal\">\\dFd[x+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u8bcd\u5178\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bcd\u5178\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u6240\u9009\u8bcd\u5178\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5e95\u5c42\u5168\u6587\u68c0\u7d22\u6a21\u677f\u548c\u9009\u9879\u503c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DFP\"><span class=\"term\"><code class=\"literal\">\\dFp[x+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u89e3\u6790\u5668\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u89e3\u6790\u5668\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u89e3\u6790\u5668\u7684\u5b8c\u6574\u63cf\u8ff0\uff0c\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u548c\u53ef\u8bc6\u522b\u7684\u8bcd\u5143\u7c7b\u578b\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DFT\"><span class=\"term\"><code class=\"literal\">\\dFt[x+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u6a21\u677f\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6a21\u677f\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u6a21\u677f\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u540d\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DG\"><span class=\"term\"><code class=\"literal\">\\dg[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u5e93\u89d2\u8272\u3002\uff08\u7531\u4e8e<span class=\"quote\">\u201c<span class=\"quote\">\u7528\u6237</span>\u201d</span>\u548c<span class=\"quote\">\u201c<span class=\"quote\">\u7ec4</span>\u201d</span>\u7684\u6982\u5ff5\u5df2\u7ecf\u7edf\u4e00\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">\u89d2\u8272</span>\u201d</span>\uff0c\u6b64\u547d\u4ee4\u73b0\u5728\u7b49\u540c\u4e8e <code class=\"literal\">\\du</code>\u3002\uff09\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u89d2\u8272\uff1b\u63d0\u4f9b <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u89d2\u8272\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u89d2\u8272\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u89d2\u8272\u7684\u9644\u52a0\u4fe1\u606f\uff1b\u76ee\u524d\u8fd9\u4f1a\u589e\u52a0\u6bcf\u4e2a\u89d2\u8272\u7684\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DL-LC\"><span class=\"term\"><code class=\"literal\">\\dl[x+]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u662f <code class=\"command\">\\lo_list</code> \u7684\u522b\u540d\uff0c\u540e\u8005\u4f1a\u663e\u793a\u5927\u5bf9\u8c61\u5217\u8868\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u5217\u51fa\u6bcf\u4e2a\u5927\u5bf9\u8c61\u7684\u76f8\u5173\u6743\u9650\uff08\u5982\u679c\u6709\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DL-UC\"><span class=\"term\"><code class=\"literal\">\\dL[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8fc7\u7a0b\u8bed\u8a00\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bed\u8a00\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u8bed\u8a00\uff1b\u63d0\u4f9b <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u79cd\u8bed\u8a00\u90fd\u4f1a\u8fde\u540c\u5176\u8c03\u7528\u5904\u7406\u5668\u3001\u9a8c\u8bc1\u5668\u3001\u8bbf\u95ee\u6743\u9650\u4ee5\u53ca\u5b83\u662f\u5426\u4e3a\u7cfb\u7edf\u5bf9\u8c61\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DN\"><span class=\"term\"><code class=\"literal\">\\dn[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6a21\u5f0f\uff08\u547d\u540d\u7a7a\u95f4\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6a21\u5f0f\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u6743\u9650\u548c\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DO-LC\"><span class=\"term\"><code class=\"literal\">\\do[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> [ <em class=\"replaceable\"><code>arg_pattern</code></em> [ <em class=\"replaceable\"><code>arg_pattern</code></em> ] ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u64cd\u4f5c\u7b26\u53ca\u5176\u64cd\u4f5c\u6570\u7c7b\u578b\u548c\u7ed3\u679c\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u64cd\u4f5c\u7b26\u3002\u5982\u679c\u6307\u5b9a\u4e86\u4e00\u4e2a <em class=\"replaceable\"><code>arg_pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u5176\u53f3\u53c2\u6570\u7c7b\u578b\u540d\u79f0\u4e0e\u8be5\u6a21\u5f0f\u5339\u914d\u7684\u524d\u7f00\u64cd\u4f5c\u7b26\u3002\u5982\u679c\u6307\u5b9a\u4e86\u4e24\u4e2a <em class=\"replaceable\"><code>arg_pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u53c2\u6570\u7c7b\u578b\u540d\u79f0\u4e0e\u8fd9\u4e9b\u6a21\u5f0f\u5339\u914d\u7684\u4e8c\u5143\u64cd\u4f5c\u7b26\u3002\uff08\u5bf9\u4e8e\u4e00\u5143\u64cd\u4f5c\u7b26\u672a\u4f7f\u7528\u7684\u53c2\u6570\uff0c\u4e5f\u53ef\u4ee5\u5199\u6210 <code class=\"literal\">-</code>\u3002\uff09\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u540d\u4ee5\u53ca\u5b83\u662f\u5426\u9632\u6f0f\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DO-UC\"><span class=\"term\"><code class=\"literal\">\\dO[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6392\u5e8f\u89c4\u5219\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6392\u5e8f\u89c4\u5219\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u6392\u5e8f\u89c4\u5219\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u4e00\u8d77\u5217\u51fa\u3002\u8bf7\u6ce8\u610f\uff0c\u53ea\u4f1a\u663e\u793a\u4e0e\u5f53\u524d\u6570\u636e\u5e93\u7f16\u7801\u517c\u5bb9\u7684\u6392\u5e8f\u89c4\u5219\uff0c\u56e0\u6b64\u5728\u540c\u4e00\u5b89\u88c5\u4e2d\u7684\u4e0d\u540c\u6570\u636e\u5e93\u91cc\u7ed3\u679c\u53ef\u80fd\u4e0d\u540c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DP-LC\"><span class=\"term\"><code class=\"literal\">\\dp[Sx] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u53ca\u5176\u76f8\u5173\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002</p>\n<p lang=\"zh\"><a class=\"link\" href=\"/docs/19/sql-grant.html\" title=\"GRANT\"><code class=\"command\">GRANT</code></a>\u548c <a class=\"link\" href=\"/docs/19/sql-revoke.html\" title=\"REVOKE\"><code class=\"command\">REVOKE</code></a> \u547d\u4ee4\u7528\u4e8e\u8bbe\u7f6e\u8bbf\u95ee\u6743\u9650\u3002\u6743\u9650\u663e\u793a\u7684\u542b\u4e49\u5728<a class=\"xref\" href=\"/docs/19/ddl-priv.html\" title=\"5.9.\u00a0\u6743\u9650\">\u7b2c\u00a05.9\u00a0\u8282</a>\u4e2d\u6709\u89e3\u91ca\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DP-UC\"><span class=\"term\"><code class=\"literal\">\\dP[itnx+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5206\u533a\u5173\u7cfb\u3002\u5982\u679c<em class=\"replaceable\"><code>pattern</code></em>\u88ab\u6307\u5b9a\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6761\u76ee\u3002\u4fee\u9970\u7b26<code class=\"literal\">t</code>\uff08\u8868\uff09\u548c<code class=\"literal\">i</code>\uff08\u7d22\u5f15\uff09\u53ef\u4ee5\u9644\u52a0\u5230\u547d\u4ee4\uff0c\u8fc7\u6ee4\u8981\u5217\u51fa\u7684\u5173\u7cfb\u7c7b\u578b\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5217\u51fa\u5206\u533a\u8868\u548c\u7d22\u5f15\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528\u4fee\u9970\u7b26<code class=\"literal\">n</code>\uff08<span class=\"quote\">\u201c<span class=\"quote\">nested</span>\u201d</span>\uff09\uff0c\u6216\u6307\u5b9a\u4e86\u6a21\u5f0f\uff0c\u5219\u5c06\u5305\u62ec\u975e\u6839\u5206\u533a\u5173\u7cfb\uff0c\u5e76\u663e\u793a\u4e00\u5217\uff0c\u7ed9\u51fa\u6bcf\u4e2a\u5206\u533a\u5173\u7cfb\u7684\u7236\u7ea7\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u5173\u7cfb\u5206\u533a\u5927\u5c0f\u7684\u603b\u548c\u4ee5\u53ca\u5173\u7cfb\u63cf\u8ff0\u3002\u5982\u679c <code class=\"literal\">n</code> \u4e0e <code class=\"literal\">+</code> \u7ec4\u5408\u4f7f\u7528\uff0c\u5219\u4f1a\u663e\u793a\u4e24\u4e2a\u5927\u5c0f\uff1a\u4e00\u4e2a\u5305\u62ec\u76f4\u63a5\u9644\u52a0\u7684\u53f6\u5206\u533a\u7684\u603b\u5927\u5c0f\uff0c\u53e6\u4e00\u4e2a\u663e\u793a\u5305\u62ec\u95f4\u63a5\u9644\u52a0\u5b50\u5206\u533a\u5728\u5185\u7684\u6240\u6709\u5206\u533a\u603b\u5927\u5c0f\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DRDS\"><span class=\"term\"><code class=\"literal\">\\drds[x] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>role-pattern</code></em></a> [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>database-pattern</code></em></a> ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5df2\u5b9a\u4e49\u7684\u914d\u7f6e\u8bbe\u7f6e\u3002\u8fd9\u4e9b\u8bbe\u7f6e\u53ef\u4ee5\u7279\u5b9a\u4e8e\u89d2\u8272\u3001\u7279\u5b9a\u4e8e\u6570\u636e\u5e93\uff0c\u6216\u540c\u65f6\u7279\u5b9a\u4e8e\u4e24\u8005\u3002<em class=\"replaceable\"><code>role-pattern</code></em>\u548c<em class=\"replaceable\"><code>database-pattern</code></em>\u5206\u522b\u7528\u4e8e\u9009\u62e9\u8981\u5217\u51fa\u7684\u89d2\u8272\u548c\u6570\u636e\u5e93\u3002\u7701\u7565\u67d0\u4e2a\u6a21\u5f0f\u53c2\u6570\u6216\u5c06\u5176\u6307\u5b9a\u4e3a<code class=\"literal\">*</code>\u65f6\uff0c\u4e0d\u4f1a\u6309\u8be5\u53c2\u6570\u7b5b\u9009\uff0c\u8fd8\u4f1a\u5206\u522b\u5305\u542b\u4e0d\u7279\u5b9a\u4e8e\u89d2\u8272\u6216\u4e0d\u7279\u5b9a\u4e8e\u6570\u636e\u5e93\u7684\u8bbe\u7f6e\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0<code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002</p>\n<p lang=\"zh\"><a class=\"link\" href=\"/docs/19/sql-alterrole.html\" title=\"ALTER ROLE\"><code class=\"command\">ALTER ROLE</code></a>\u548c <a class=\"link\" href=\"/docs/19/sql-alterdatabase.html\" title=\"ALTER DATABASE\"><code class=\"command\">ALTER DATABASE</code></a> \u547d\u4ee4\u7528\u4e8e\u5b9a\u4e49\u6bcf\u4e2a\u89d2\u8272\u548c\u6bcf\u4e2a\u6570\u636e\u5e93\u7684\u914d\u7f6e\u8bbe\u7f6e\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DRG\"><span class=\"term\"><code class=\"literal\">\\drg[Sx] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u6bcf\u4e2a\u88ab\u6388\u4e88\u89d2\u8272\u6210\u5458\u8eab\u4efd\u7684\u4fe1\u606f\uff0c\u5305\u62ec\u88ab\u6388\u4e88\u7684\u9009\u9879\uff08<code class=\"literal\">ADMIN</code>\u3001<code class=\"literal\">INHERIT</code> \u548c/\u6216 <code class=\"literal\">SET</code>\uff09\u4ee5\u53ca\u6388\u4e88\u8005\u3002\u5173\u4e8e\u89d2\u8272\u6210\u5458\u8eab\u4efd\uff0c\u53c2\u89c1 <a class=\"link\" href=\"/docs/19/sql-grant.html\" title=\"GRANT\"><code class=\"command\">GRANT</code></a> \u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u6388\u4e88\u7528\u6237\u521b\u5efa\u89d2\u8272\u7684\u6210\u5458\u8eab\u4efd\uff1b\u63d0\u4f9b <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u89d2\u8272\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u6388\u4e88\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u89d2\u8272\u7684\u6210\u5458\u8eab\u4efd\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DRP\"><span class=\"term\"><code class=\"literal\">\\dRp[x+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u903b\u8f91\u590d\u5236\u53d1\u5e03\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u53d1\u5e03\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u8fd8\u4f1a\u663e\u793a\u4e0e\u6bcf\u4e2a\u53d1\u5e03\u5173\u8054\u7684\u8868\u3001\u6392\u9664\u8868\u548c\u6a21\u5f0f\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DRS\"><span class=\"term\"><code class=\"literal\">\\dRs[x+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u903b\u8f91\u590d\u5236\u8ba2\u9605\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8ba2\u9605\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u8ba2\u9605\u7684\u5176\u4ed6\u5c5e\u6027\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DT\"><span class=\"term\"><code class=\"literal\">\\dT[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u7c7b\u578b\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u7c7b\u578b\u90fd\u4f1a\u8fde\u540c\u5176\u5185\u90e8\u540d\u79f0\u3001\u5927\u5c0f\u548c\u76f8\u5173\u6743\u9650\u4e00\u8d77\u5217\u51fa\uff1b\u5bf9\u4e8e <code class=\"type\">enum</code> \u7c7b\u578b\uff0c\u8fd8\u4f1a\u663e\u793a\u5176\u5141\u8bb8\u503c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DU\"><span class=\"term\"><code class=\"literal\">\\du[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u5e93\u89d2\u8272\u3002\uff08\u7531\u4e8e<span class=\"quote\">\u201c<span class=\"quote\">\u7528\u6237</span>\u201d</span>\u548c<span class=\"quote\">\u201c<span class=\"quote\">\u7ec4</span>\u201d</span>\u7684\u6982\u5ff5\u5df2\u7ecf\u7edf\u4e00\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">\u89d2\u8272</span>\u201d</span>\uff0c\u6b64\u547d\u4ee4\u73b0\u5728\u7b49\u540c\u4e8e <code class=\"literal\">\\dg</code>\u3002\uff09\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u89d2\u8272\uff1b\u63d0\u4f9b <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u89d2\u8272\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u89d2\u8272\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u89d2\u8272\u7684\u9644\u52a0\u4fe1\u606f\uff1b\u76ee\u524d\u8fd9\u4f1a\u589e\u52a0\u6bcf\u4e2a\u89d2\u8272\u7684\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DX-LC\"><span class=\"term\"><code class=\"literal\">\\dx[x+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5df2\u5b89\u88c5\u7684\u6269\u5c55\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6269\u5c55\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u5217\u51fa\u5c5e\u4e8e\u6bcf\u4e2a\u5339\u914d\u6269\u5c55\u7684\u5168\u90e8\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DX-UC\"><span class=\"term\"><code class=\"literal\">\\dX[x+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u6269\u5c55\u7edf\u8ba1\u4fe1\u606f\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6269\u5c55\u7edf\u8ba1\u4fe1\u606f\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n<p lang=\"zh\">\u6bcf\u79cd\u6269\u5c55\u7edf\u8ba1\u7684\u72b6\u6001\u663e\u793a\u5728\u4ee5\u7edf\u8ba1\u79cd\u7c7b\u547d\u540d\u7684\u5217\u4e2d\uff0c\u4f8b\u5982 Ndistinct\u3002defined \u8868\u793a\u521b\u5efa\u7edf\u8ba1\u65f6\u8bf7\u6c42\u4e86\u8be5\u7edf\u8ba1\uff0cNULL \u8868\u793a\u672a\u8bf7\u6c42\u3002\u82e5\u8981\u5224\u65ad ANALYZE \u662f\u5426\u8fd0\u884c\u8fc7\u3001\u7edf\u8ba1\u662f\u5426\u53ef\u4f9b\u89c4\u5212\u5668\u4f7f\u7528\uff0c\u53ef\u67e5\u8be2 pg_stats_ext\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DY\"><span class=\"term\"><code class=\"literal\">\\dy[x+] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u4e8b\u4ef6\u89e6\u53d1\u5668\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u4e8b\u4ef6\u89e6\u53d1\u5668\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-EDIT\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\e</code> \u6216 <code class=\"literal\">\\edit</code> <code class=\"literal\">[ <span class=\"optional\"><em class=\"replaceable\"><code>filename</code></em></span> ] [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5219\u7f16\u8f91\u8be5\u6587\u4ef6\uff1b\u7f16\u8f91\u5668\u9000\u51fa\u540e\uff0c\u6587\u4ef6\u5185\u5bb9\u5c06\u88ab\u590d\u5236\u5230\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5219\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u590d\u5236\u5230\u4e34\u65f6\u6587\u4ef6\u4e2d\uff0c\u7136\u540e\u4ee5\u76f8\u540c\u65b9\u5f0f\u8fdb\u884c\u7f16\u8f91\u3002\u6216\u8005\uff0c\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u5c06\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u590d\u5236\u5230\u4e34\u65f6\u6587\u4ef6\u4e2d\uff0c\u5e76\u4ee5\u76f8\u540c\u65b9\u5f0f\u8fdb\u884c\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7f16\u8f91\u6587\u4ef6\u6216\u4e0a\u4e00\u4e2a\u67e5\u8be2\u540e\u5728\u672a\u4fee\u6539\u6587\u4ef6\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5219\u67e5\u8be2\u7f13\u51b2\u533a\u5c06\u88ab\u6e05\u9664\u3002\u5426\u5219\uff0c\u67e5\u8be2\u7f13\u51b2\u533a\u7684\u65b0\u5185\u5bb9\u5c06\u6839\u636e<span class=\"application\">psql</span>\u7684\u6b63\u5e38\u89c4\u5219\u91cd\u65b0\u89e3\u6790\uff0c\u5c06\u6574\u4e2a\u7f13\u51b2\u533a\u89c6\u4e3a\u5355\u884c\u3002\u4efb\u4f55\u5b8c\u6574\u7684\u67e5\u8be2\u5c06\u7acb\u5373\u6267\u884c\uff1b\u4e5f\u5c31\u662f\u8bf4\uff0c\u5982\u679c\u67e5\u8be2\u7f13\u51b2\u533a\u5305\u542b\u5206\u53f7\u6216\u4ee5\u5206\u53f7\u7ed3\u5c3e\uff0c\u5219\u6267\u884c\u5e76\u4ece\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u5220\u9664\u5230\u8be5\u70b9\u7684\u6240\u6709\u5185\u5bb9\u3002\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u5269\u4f59\u7684\u5185\u5bb9\u5c06\u91cd\u65b0\u663e\u793a\u3002\u8f93\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u8f93\u5165<code class=\"literal\">\\r</code>\u901a\u8fc7\u6e05\u9664\u67e5\u8be2\u7f13\u51b2\u533a\u6765\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u5c06\u7f13\u51b2\u533a\u89c6\u4e3a\u5355\u884c\u4e3b\u8981\u5f71\u54cd\u5143\u547d\u4ee4\uff1a\u5728\u5143\u547d\u4ee4\u540e\u7684\u7f13\u51b2\u533a\u5c06\u88ab\u89c6\u4e3a\u5143\u547d\u4ee4\u7684\u53c2\u6570\uff0c\u5373\u4f7f\u5b83\u8de8\u8d8a\u591a\u884c\u3002\uff08\u56e0\u6b64\uff0c\u4e0d\u80fd\u7528\u8fd9\u79cd\u65b9\u5f0f\u521b\u5efa\u4f7f\u7528\u5143\u547d\u4ee4\u7684\u811a\u672c\u3002\u8bf7\u4f7f\u7528<code class=\"command\">\\i</code>\u3002\uff09</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u5c06\u5149\u6807\u5b9a\u4f4d\u5728\u6587\u4ef6\u6216\u67e5\u8be2\u7f13\u51b2\u533a\u7684\u6307\u5b9a\u884c\u4e0a\u3002\u8bf7\u6ce8\u610f\uff0c\u5982\u679c\u53ea\u7ed9\u51fa\u4e00\u4e2a\u5168\u662f\u6570\u5b57\u7684\u53c2\u6570\uff0c<span class=\"application\">psql</span>\u4f1a\u5047\u5b9a\u5b83\u662f\u4e00\u4e2a\u884c\u53f7\uff0c\u800c\u4e0d\u662f\u6587\u4ef6\u540d\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5173\u4e8e\u5982\u4f55\u914d\u7f6e\u548c\u81ea\u5b9a\u4e49\u7f16\u8f91\u5668\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/19/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"\u73af\u5883\">\u73af\u5883</a>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-ECHO\"><span class=\"term\"><code class=\"literal\">\\echo <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6c42\u503c\u540e\u7684\u53c2\u6570\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff0c\u7528\u7a7a\u683c\u5206\u9694\uff0c\u5e76\u5728\u672b\u5c3e\u52a0\u4e0a\u6362\u884c\u7b26\u3002\u8fd9\u5bf9\u4e8e\u5728\u811a\u672c\u8f93\u51fa\u4e2d\u7a7f\u63d2\u4fe1\u606f\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>\\echo `date`</code></strong>\nTue Oct 26 21:40:57 CEST 1999\n</pre>\n<p lang=\"zh\">\u5982\u679c\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f\u672a\u52a0\u5f15\u53f7\u7684<code class=\"literal\">-n</code>\uff0c\u5219\u4e0d\u4f1a\u5199\u5165\u5c3e\u968f\u7684\u6362\u884c\u7b26\uff08\u4e5f\u4e0d\u4f1a\u5199\u5165\u7b2c\u4e00\u4e2a\u53c2\u6570\uff09\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528<code class=\"command\">\\o</code>\u547d\u4ee4\u91cd\u5b9a\u5411\u67e5\u8be2\u8f93\u51fa\uff0c\u53ef\u80fd\u4f1a\u60f3\u7528<code class=\"command\">\\qecho</code>\u4ee3\u66ff\u8fd9\u4e2a\u547d\u4ee4\u3002\u53e6\u8bf7\u53c2\u9605<code class=\"command\">\\warn</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-EF\"><span class=\"term\"><code class=\"literal\">\\ef [ <span class=\"optional\"><em class=\"replaceable\"><code>function_description</code></em> [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</span> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u7f16\u8f91\u6307\u5b9a\u51fd\u6570\u6216\u8fc7\u7a0b\u7684\u5b9a\u4e49\uff0c\u5f62\u5f0f\u4e3a<code class=\"command\">CREATE OR REPLACE FUNCTION</code>\u6216 <code class=\"command\">CREATE OR REPLACE PROCEDURE</code>\u547d\u4ee4\u3002\u7f16\u8f91\u65b9\u5f0f\u4e0e<code class=\"literal\">\\edit</code>\u76f8\u540c\u3002\u5982\u679c\u5728\u4e0d\u4fdd\u5b58\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5219\u8be5\u8bed\u53e5\u4f1a\u88ab\u4e22\u5f03\u3002\u5982\u679c\u4fdd\u5b58\u5e76\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5e76\u5728\u5176\u4e2d\u6dfb\u52a0\u4e86\u5206\u53f7\uff0c\u5219\u66f4\u65b0\u540e\u7684\u547d\u4ee4\u4f1a\u7acb\u5373\u6267\u884c\u3002\u5426\u5219\u5b83\u4f1a\u91cd\u65b0\u663e\u793a\uff1b\u952e\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u7528<code class=\"literal\">\\r</code>\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u76ee\u6807\u51fd\u6570\u53ef\u4ec5\u7528\u540d\u79f0\u6307\u5b9a\uff0c\u4e5f\u53ef\u7528\u540d\u79f0\u548c\u53c2\u6570\u6307\u5b9a\uff0c\u4f8b\u5982 foo(integer, text)\u3002\u82e5\u6709\u591a\u4e2a\u540c\u540d\u51fd\u6570\uff0c\u5219\u5fc5\u987b\u63d0\u4f9b\u53c2\u6570\u7c7b\u578b\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u51fd\u6570\uff0c\u5219\u4f1a\u5448\u73b0\u4e00\u4e2a\u7a7a\u7684<code class=\"command\">CREATE FUNCTION</code>\u6a21\u677f\u4f9b\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u5c06\u5149\u6807\u5b9a\u4f4d\u5728\u51fd\u6570\u4f53\u7684\u6307\u5b9a\u884c\u4e0a\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u51fd\u6570\u4f53\u901a\u5e38\u4e0d\u4f1a\u4ece\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u5f00\u59cb\u3002\uff09</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\ef</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5173\u4e8e\u5982\u4f55\u914d\u7f6e\u548c\u81ea\u5b9a\u4e49\u7f16\u8f91\u5668\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/19/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"\u73af\u5883\">\u73af\u5883</a>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-ENCODING\"><span class=\"term\"><code class=\"literal\">\\encoding [ <em class=\"replaceable\"><code>encoding</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5ba2\u6237\u7aef\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u6ca1\u6709\u53c2\u6570\u65f6\uff0c\u6b64\u547d\u4ee4\u663e\u793a\u5f53\u524d\u7f16\u7801\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-ERRVERBOSE\"><span class=\"term\"><code class=\"literal\">\\errverbose</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ee5\u6700\u5927\u7684\u8be6\u7ec6\u7a0b\u5ea6\u91cd\u590d\u6700\u8fd1\u7684\u670d\u52a1\u5668\u9519\u8bef\u6d88\u606f\uff0c\u5c31\u597d\u50cf<code class=\"varname\">VERBOSITY</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">verbose</code>\uff0c<code class=\"varname\">SHOW_CONTEXT</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">always</code>\u4e00\u6837\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-EV\"><span class=\"term\"><code class=\"literal\">\\ev [ <span class=\"optional\"><em class=\"replaceable\"><code>view_name</code></em> [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</span> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u7f16\u8f91\u6307\u5b9a\u89c6\u56fe\u7684\u5b9a\u4e49\uff0c\u5f62\u5f0f\u4e3a<code class=\"command\">CREATE OR REPLACE VIEW</code>\u547d\u4ee4\u3002\u7f16\u8f91\u65b9\u5f0f\u4e0e<code class=\"literal\">\\edit</code>\u76f8\u540c\u3002\u5982\u679c\u5728\u4e0d\u4fdd\u5b58\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5219\u8be5\u8bed\u53e5\u4f1a\u88ab\u4e22\u5f03\u3002\u5982\u679c\u4fdd\u5b58\u5e76\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5e76\u5728\u5176\u4e2d\u6dfb\u52a0\u4e86\u5206\u53f7\uff0c\u5219\u66f4\u65b0\u540e\u7684\u547d\u4ee4\u4f1a\u7acb\u5373\u6267\u884c\uff1b\u5426\u5219\u5c06\u91cd\u65b0\u663e\u793a\uff1b\u8f93\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u7528<code class=\"literal\">\\r</code>\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u89c6\u56fe\uff0c\u5219\u4f1a\u5448\u73b0\u4e00\u4e2a\u7a7a\u7684<code class=\"command\">CREATE VIEW</code>\u6a21\u677f\u4f9b\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u5c06\u5149\u6807\u5b9a\u4f4d\u5728\u89c6\u56fe\u5b9a\u4e49\u7684\u6307\u5b9a\u884c\u4e0a\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\ev</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-F\"><span class=\"term\"><code class=\"literal\">\\f [ <em class=\"replaceable\"><code>string</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u67e5\u8be2\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u9ed8\u8ba4\u503c\u662f\u7ad6\u7ebf\uff08<code class=\"literal\">|</code>\uff09\u3002\u5b83\u7b49\u540c\u4e8e<code class=\"command\">\\pset fieldsep</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-G\"><span class=\"term\"><code class=\"literal\">\\g [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\g [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u6267\u884c\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728<code class=\"literal\">\\g</code>\u540e\u9762\u51fa\u73b0\u62ec\u53f7\uff0c\u5219\u62ec\u53f7\u4e2d\u662f\u7528\u7a7a\u683c\u5206\u9694\u7684<em class=\"replaceable\"><code>option</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em>\u683c\u5f0f\u9009\u9879\u5b50\u53e5\u5217\u8868\u3002\u8fd9\u4e9b\u5b50\u53e5\u7684\u89e3\u91ca\u65b9\u5f0f\u4e0e<code class=\"literal\">\\pset</code> <em class=\"replaceable\"><code>option</code></em> <em class=\"replaceable\"><code>value</code></em>\u547d\u4ee4\u76f8\u540c\uff0c\u4f46\u4ec5\u5728\u6b64\u67e5\u8be2\u6267\u884c\u671f\u95f4\u751f\u6548\u3002\u5728\u6b64\u5217\u8868\u4e2d\uff0c<code class=\"literal\">=</code>\u7b26\u53f7\u5468\u56f4\u4e0d\u5141\u8bb8\u6709\u7a7a\u683c\uff0c\u4f46\u9009\u9879\u5b50\u53e5\u4e4b\u95f4\u5fc5\u987b\u6709\u7a7a\u683c\u3002\u5982\u679c<code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em>\u88ab\u7701\u7565\uff0c\u5219\u6307\u5b9a\u7684<em class=\"replaceable\"><code>option</code></em>\u4f1a\u6309\u4ee5\u4e0b\u547d\u4ee4\u7684\u65b9\u5f0f\u66f4\u6539\uff1a<code class=\"literal\">\\pset</code> <em class=\"replaceable\"><code>option</code></em>\uff0c\u5176\u4e2d\u4e0d\u663e\u5f0f\u6307\u5b9a<em class=\"replaceable\"><code>value</code></em>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7ed9\u51fa\u4e86<em class=\"replaceable\"><code>filename</code></em>\u6216<code class=\"literal\">|</code><em class=\"replaceable\"><code>command</code></em>\u53c2\u6570\uff0c\u67e5\u8be2\u8f93\u51fa\u5c31\u4f1a\u5199\u5165\u6307\u5b9a\u6587\u4ef6\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6307\u5b9a\u7684 shell \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u7167\u5e38\u663e\u793a\u3002\u53ea\u6709\u5f53\u67e5\u8be2\u6210\u529f\u8fd4\u56de\u96f6\u4e2a\u6216\u591a\u4e2a\u5143\u7ec4\u65f6\uff0c\u624d\u4f1a\u5411\u6587\u4ef6\u6216\u547d\u4ee4\u5199\u5165\uff1b\u5982\u679c\u67e5\u8be2\u5931\u8d25\uff0c\u6216\u6267\u884c\u7684\u662f\u4e0d\u8fd4\u56de\u6570\u636e\u7684 SQL \u547d\u4ee4\uff0c\u5219\u4e0d\u4f1a\u5199\u5165\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u5c06\u88ab\u91cd\u65b0\u6267\u884c\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u6ca1\u6709\u4efb\u4f55\u53c2\u6570\u7684<code class=\"literal\">\\g</code>\u57fa\u672c\u4e0a\u7b49\u540c\u4e8e\u4e00\u4e2a\u5206\u53f7\u3002\u5e26\u6709\u53c2\u6570\u7684<code class=\"literal\">\\g</code>\u63d0\u4f9b\u4e86\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u4e00\u6b21\u6027</span>\u201d</span>\u66ff\u4ee3<code class=\"command\">\\o</code>\u547d\u4ee4\u7684\u9009\u62e9\uff0c\u5e76\u4e14\u8fd8\u5141\u8bb8\u4e00\u6b21\u6027\u8c03\u6574\u901a\u5e38\u7531<code class=\"literal\">\\pset</code>\u8bbe\u7f6e\u7684\u8f93\u51fa\u683c\u5f0f\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u5f53\u6700\u540e\u4e00\u4e2a\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\u65f6\uff0c\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u90fd\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u65e2\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\uff0c\u4e5f\u4e0d\u8fdb\u884c\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u90e8\u5206\u4f1a\u76f4\u63a5\u6309\u5b57\u9762\u4f20\u7ed9 shell\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-GDESC\"><span class=\"term\"><code class=\"literal\">\\gdesc</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u663e\u793a\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u67e5\u8be2\u7ed3\u679c\u7684\u63cf\u8ff0\uff08\u5373\u5217\u540d\u548c\u6570\u636e\u7c7b\u578b\uff09\u3002\u67e5\u8be2\u5e76\u4e0d\u4f1a\u5b9e\u9645\u6267\u884c\uff1b\u4e0d\u8fc7\uff0c\u5982\u679c\u5176\u4e2d\u5b58\u5728\u8bed\u6cd5\u9519\u8bef\uff0c\u4f1a\u6309\u901a\u5e38\u7684\u65b9\u5f0f\u62a5\u544a\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6539\u4e3a\u63cf\u8ff0\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-GETENV\"><span class=\"term\"><code class=\"literal\">\\getenv <em class=\"replaceable\"><code>psql_var</code></em> <em class=\"replaceable\"><code>env_var</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u83b7\u53d6\u73af\u5883\u53d8\u91cf<em class=\"replaceable\"><code>env_var</code></em>\u7684\u503c\uff0c\u5e76\u5c06\u5176\u8d4b\u7ed9<span class=\"application\">psql</span>\u53d8\u91cf<em class=\"replaceable\"><code>psql_var</code></em>\u3002\u5982\u679c<em class=\"replaceable\"><code>env_var</code></em>\u5728<span class=\"application\">psql</span>\u8fdb\u7a0b\u7684\u73af\u5883\u4e2d\u672a\u5b9a\u4e49\uff0c<em class=\"replaceable\"><code>psql_var</code></em>\u4e0d\u4f1a\u88ab\u6539\u53d8\u3002\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>\\getenv home HOME</code></strong>\n=&gt; <strong class=\"userinput\"><code>\\echo :home</code></strong>\n/home/postgres\n</pre>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-GEXEC\"><span class=\"term\"><code class=\"literal\">\\gexec</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u7136\u540e\u5c06\u67e5\u8be2\u8f93\u51fa\u7684\u6bcf\u884c\u6bcf\u5217\u89c6\u4e3a\u8981\u6267\u884c\u7684SQL\u8bed\u53e5\u3002\u4f8b\u5982\uff0c\u8981\u5728<code class=\"structname\">my_table</code>\u7684\u6bcf\u4e00\u5217\u4e0a\u521b\u5efa\u7d22\u5f15\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT format('CREATE INDEX ON my_table (%I)', attname)</code></strong>\n-&gt; <strong class=\"userinput\"><code>FROM pg_attribute</code></strong>\n-&gt; <strong class=\"userinput\"><code>WHERE attrelid = 'my_table'::regclass AND attnum &gt; 0</code></strong>\n-&gt; <strong class=\"userinput\"><code>ORDER BY attnum</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gexec</code></strong>\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\n</pre>\n<p lang=\"zh\">\u751f\u6210\u7684\u67e5\u8be2\u6309\u8fd4\u56de\u884c\u7684\u987a\u5e8f\u6267\u884c\uff1b\u540c\u4e00\u884c\u6709\u591a\u5217\u65f6\u4ece\u5de6\u5230\u53f3\u6267\u884c\uff0c\u5ffd\u7565 NULL \u5b57\u6bb5\u3002\u67e5\u8be2\u539f\u6837\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u56e0\u6b64\u4e0d\u80fd\u662f psql \u5143\u547d\u4ee4\uff0c\u4e5f\u4e0d\u80fd\u5305\u542b psql \u53d8\u91cf\u5f15\u7528\u3002\u9664\u975e\u8bbe\u7f6e ON_ERROR_STOP\uff0c\u67d0\u6761\u67e5\u8be2\u5931\u8d25\u540e\u4ecd\u7ee7\u7eed\u6267\u884c\u5176\u4f59\u67e5\u8be2\u3002\u6bcf\u6761\u67e5\u8be2\u5747\u9075\u5faa ECHO \u8bbe\u7f6e\uff08\u4f7f\u7528 \\gexec \u65f6\uff0c\u901a\u5e38\u5efa\u8bae\u5c06 ECHO \u8bbe\u4e3a all \u6216 queries\uff09\uff0c\u67e5\u8be2\u65e5\u5fd7\u3001\u5355\u6b65\u6a21\u5f0f\u3001\u8ba1\u65f6\u7b49\u6267\u884c\u529f\u80fd\u4e5f\u5206\u522b\u5e94\u7528\u4e8e\u6bcf\u6761\u751f\u6210\u7684\u67e5\u8be2\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-GSET\"><span class=\"term\"><code class=\"literal\">\\gset [ <em class=\"replaceable\"><code>prefix</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u5e76\u5c06\u67e5\u8be2\u8f93\u51fa\u5b58\u5165 <span class=\"application\">psql</span> \u53d8\u91cf\uff08\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/19/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\uff09\u3002\u8981\u6267\u884c\u7684\u67e5\u8be2\u5fc5\u987b\u6070\u597d\u8fd4\u56de\u4e00\u884c\u3002\u8be5\u884c\u7684\u6bcf\u4e00\u5217\u5206\u522b\u5b58\u5165\u4e00\u4e2a\u53d8\u91cf\uff0c\u53d8\u91cf\u540d\u4e0e\u5217\u540d\u76f8\u540c\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT 'hello' AS var1, 10 AS var2</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gset</code></strong>\n=&gt; <strong class=\"userinput\"><code>\\echo :var1 :var2</code></strong>\nhello 10\n</pre>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>prefix</code></em>\uff0c\u5219\u4f1a\u5c06\u8be5\u5b57\u7b26\u4e32\u52a0\u5230\u67e5\u8be2\u7684\u5217\u540d\u524d\u9762\uff0c\u4ee5\u6784\u6210\u8981\u4f7f\u7528\u7684\u53d8\u91cf\u540d\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT 'hello' AS var1, 10 AS var2</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gset result_</code></strong>\n=&gt; <strong class=\"userinput\"><code>\\echo :result_var1 :result_var2</code></strong>\nhello 10\n</pre>\n<p lang=\"zh\">\u5982\u679c\u67d0\u4e00\u5217\u7684\u7ed3\u679c\u4e3a NULL\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u5bf9\u5e94\u7684\u53d8\u91cf\uff0c\u800c\u4e0d\u662f\u8bbe\u7f6e\u5b83\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u67e5\u8be2\u5931\u8d25\u6216\u6ca1\u6709\u6070\u597d\u8fd4\u56de\u4e00\u884c\uff0c\u5219\u4e0d\u4f1a\u66f4\u6539\u4efb\u4f55\u53d8\u91cf\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-GX\"><span class=\"term\"><code class=\"literal\">\\gx [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\gx [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\\gx \u4e0e \\g \u7b49\u4ef7\uff0c\u4f46\u4f1a\u5f3a\u5236\u6b64\u67e5\u8be2\u4f7f\u7528\u6269\u5c55\u8f93\u51fa\u6a21\u5f0f\uff0c\u76f8\u5f53\u4e8e\u5728 \\pset \u9009\u9879\u5217\u8868\u4e2d\u6307\u5b9a expanded=on\u3002\u53e6\u89c1 \\x\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-HELP\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\h</code>\u6216<code class=\"literal\">\\help</code> <code class=\"literal\">[ <em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u7ed9\u51fa\u6307\u5b9a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u7684\u8bed\u6cd5\u5e2e\u52a9\u3002\u5982\u679c\u672a\u6307\u5b9a<em class=\"replaceable\"><code>command</code></em>\uff0c\u5219<span class=\"application\">psql</span>\u5c06\u5217\u51fa\u6240\u6709\u53ef\u7528\u8bed\u6cd5\u5e2e\u52a9\u7684\u547d\u4ee4\u3002\u5982\u679c<em class=\"replaceable\"><code>command</code></em>\u662f\u661f\u53f7\uff08<code class=\"literal\">*</code>\uff09\uff0c\u5219\u663e\u793a\u6240\u6709<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u7684\u8bed\u6cd5\u5e2e\u52a9\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\help</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u4e3a\u4e86\u7b80\u5316\u8f93\u5165\uff0c\u7531\u591a\u4e2a\u5355\u8bcd\u7ec4\u6210\u7684\u547d\u4ee4\u4e0d\u9700\u8981\u52a0\u5f15\u53f7\u3002\u56e0\u6b64\uff0c\u53ef\u4ee5\u76f4\u63a5\u8f93\u5165<strong class=\"userinput\"><code>\\help alter table</code></strong>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-HTML\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\H</code> \u6216 <code class=\"literal\">\\html</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5f00<acronym class=\"acronym\">HTML</acronym>\u67e5\u8be2\u8f93\u51fa\u683c\u5f0f\u3002\u5982\u679c<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u5df2\u7ecf\u6253\u5f00\uff0c\u5219\u5207\u6362\u56de\u9ed8\u8ba4\u7684\u5bf9\u9f50\u6587\u672c\u683c\u5f0f\u3002\u6b64\u547d\u4ee4\u662f\u4e3a\u517c\u5bb9\u6027\u548c\u4fbf\u5229\u6027\u800c\u4fdd\u7559\u7684\uff1b\u8bbe\u7f6e\u5176\u4ed6\u8f93\u51fa\u9009\u9879\u7684\u65b9\u6cd5\u89c1<code class=\"command\">\\pset</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-INCLUDE\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\i</code> \u6216 <code class=\"literal\">\\include</code> <em class=\"replaceable\"><code>filename</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u8bfb\u53d6\u8f93\u5165\uff0c\u5e76\u50cf\u5728\u952e\u76d8\u4e0a\u8f93\u5165\u4e00\u6837\u6267\u884c\u5b83\u3002</p>\n<p lang=\"zh\">\u5982\u679c<em class=\"replaceable\"><code>filename</code></em>\u662f<code class=\"literal\">-</code>\uff08\u8fde\u5b57\u7b26\uff09\uff0c\u5219\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\uff0c\u76f4\u5230\u9047\u5230 EOF \u6307\u793a\u6216<code class=\"command\">\\q</code>\u5143\u547d\u4ee4\u3002\u8fd9\u53ef\u7528\u4e8e\u5c06\u4ea4\u4e92\u5f0f\u8f93\u5165\u4e0e\u6587\u4ef6\u8f93\u5165\u4ea4\u9519\u4f7f\u7528\u3002\u8bf7\u6ce8\u610f\uff0c\u53ea\u6709\u5728\u6700\u5916\u5c42\u542f\u7528\u4e86 Readline\uff0c\u6b64\u5904\u624d\u4f1a\u4f7f\u7528 Readline \u529f\u80fd\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5982\u679c\u60f3\u5728\u5c4f\u5e55\u4e0a\u770b\u5230\u88ab\u8bfb\u5165\u7684\u5404\u884c\uff0c\u8bf7\u5c06\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">all</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"PSQL-METACOMMAND-IF\"><span class=\"term\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\elif</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\else</code><br/></span><span class=\"term\"><code class=\"literal\">\\endif</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u7ec4\u547d\u4ee4\u5b9e\u73b0\u4e86\u53ef\u5d4c\u5957\u7684\u6761\u4ef6\u5757\u3002\u6761\u4ef6\u5757\u5fc5\u987b\u4ee5<code class=\"command\">\\if</code>\u5f00\u59cb\uff0c\u5e76\u4ee5<code class=\"command\">\\endif</code>\u7ed3\u675f\u3002\u5728\u4e24\u8005\u4e4b\u95f4\u53ef\u4ee5\u6709\u4efb\u610f\u6570\u91cf\u7684<code class=\"command\">\\elif</code>\u5b50\u53e5\uff0c\u540e\u9762\u53ef\u4ee5\u9009\u62e9\u6027\u5730\u8ddf\u7740\u4e00\u4e2a<code class=\"command\">\\else</code>\u5b50\u53e5\u3002\u5728\u5f62\u6210\u6761\u4ef6\u5757\u7684\u547d\u4ee4\u4e4b\u95f4\u901a\u5e38\u4f1a\u51fa\u73b0\u666e\u901a\u67e5\u8be2\u548c\u5176\u4ed6\u7c7b\u578b\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\\if \u548c \\elif \u8bfb\u53d6\u53c2\u6570\u5e76\u5c06\u5176\u4f5c\u4e3a\u5e03\u5c14\u8868\u8fbe\u5f0f\u6c42\u503c\u3002\u7ed3\u679c\u4e3a\u771f\u65f6\u7ee7\u7eed\u6b63\u5e38\u5904\u7406\uff0c\u5426\u5219\u8df3\u8fc7\u540e\u7eed\u884c\uff0c\u76f4\u5230\u9047\u5230\u5339\u914d\u7684 \\elif\u3001\\else \u6216 \\endif\u3002\u67d0\u4e2a \\if \u6216 \\elif \u6761\u4ef6\u6210\u7acb\u540e\uff0c\u540c\u4e00\u5757\u4e2d\u540e\u7eed \\elif \u7684\u53c2\u6570\u4e0d\u518d\u6c42\u503c\uff0c\u76f4\u63a5\u89c6\u4e3a\u5047\u3002\u53ea\u6709\u4e4b\u524d\u5339\u914d\u7684 \\if \u548c \\elif \u5747\u672a\u6210\u7acb\uff0c\u624d\u5904\u7406 \\else \u540e\u7684\u884c\u3002</p>\n<p lang=\"zh\">\u4e0e\u5176\u4ed6\u53cd\u659c\u6760\u547d\u4ee4\u53c2\u6570\u4e00\u6837\uff0c\\if \u6216 \\elif \u7684\u8868\u8fbe\u5f0f\u53c2\u6570\u5148\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u548c\u53cd\u5f15\u53f7\u5c55\u5f00\uff0c\u7136\u540e\u50cf\u5f00\u5173\u9009\u9879\u53d8\u91cf\u4e00\u6837\u6c42\u503c\u3002\u6709\u6548\u503c\u4e3a true\u3001false\u30011\u30010\u3001on\u3001off\u3001yes\u3001no \u7684\u4efb\u610f\u65e0\u6b67\u4e49\u3001\u4e0d\u533a\u5206\u5927\u5c0f\u5199\u7684\u5339\u914d\u3002\u4f8b\u5982 t\u3001T \u548c tR \u90fd\u4f1a\u89c6\u4e3a\u771f\u3002</p>\n<p lang=\"zh\">\u4e0d\u80fd\u6b63\u786e\u6c42\u503c\u4e3a\u771f\u6216\u5047\u7684\u8868\u8fbe\u5f0f\u4f1a\u4ea7\u751f\u8b66\u544a\uff0c\u5e76\u88ab\u89c6\u4e3a\u5047\u3002</p>\n<p lang=\"zh\">\u88ab\u8df3\u8fc7\u7684\u884c\u4f1a\u88ab\u6b63\u5e38\u89e3\u6790\u4ee5\u8bc6\u522b\u67e5\u8be2\u548c\u53cd\u659c\u7ebf\u547d\u4ee4\uff0c\u4f46\u67e5\u8be2\u4e0d\u4f1a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u4e14\u9664\u4e86\u6761\u4ef6\u547d\u4ee4\uff08<code class=\"command\">\\if</code>\u3001<code class=\"command\">\\elif</code>\u3001<code class=\"command\">\\else</code>\u3001<code class=\"command\">\\endif</code>\uff09\u4e4b\u5916\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u4f1a\u88ab\u5ffd\u7565\u3002\u4ec5\u68c0\u67e5\u8df3\u8fc7\u884c\u4e2d\u6761\u4ef6\u547d\u4ee4\u7684\u6709\u6548\u5d4c\u5957\u3002\u8df3\u8fc7\u884c\u4e2d\u7684\u53d8\u91cf\u5f15\u7528\u4e0d\u4f1a\u88ab\u5c55\u5f00\uff0c\u4e5f\u4e0d\u4f1a\u6267\u884c\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<p lang=\"zh\">\u540c\u4e00\u4e2a\u6761\u4ef6\u5757\u7684\u6240\u6709\u53cd\u659c\u7ebf\u547d\u4ee4\u5fc5\u987b\u51fa\u73b0\u5728\u540c\u4e00\u4e2a\u6e90\u6587\u4ef6\u4e2d\u3002\u5982\u679c\u4e3b\u8f93\u5165\u6587\u4ef6\u6216\u901a\u8fc7<code class=\"command\">\\include</code>\u5f15\u5165\u7684\u6587\u4ef6\u5230\u8fbe EOF \u65f6\uff0c\u4ecd\u6709\u672c\u5730<code class=\"command\">\\if</code>\u5757\u672a\u5173\u95ed\uff0c<span class=\"application\">psql</span>\u5c31\u4f1a\u62a5\u9519\u3002</p>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4e00\u4e2a\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">-- check for the existence of two separate records in the database and store\n-- the results in separate psql variables\nSELECT\n    EXISTS (SELECT 1 FROM customer WHERE customer_id = 123) AS is_customer,\n    EXISTS (SELECT 1 FROM employee WHERE employee_id = 456) AS is_employee\n\\gset\n\\if :is_customer\n    SELECT * FROM customer WHERE customer_id = 123;\n\\elif :is_employee\n    \\echo 'is not a customer but is an employee'\n    SELECT * FROM employee WHERE employee_id = 456;\n\\else\n    \\if yes\n        \\echo 'not a customer or employee'\n    \\else\n        \\echo 'this will never print'\n    \\endif\n\\endif\n</pre>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-INCLUDE-RELATIVE\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\ir</code> \u6216 <code class=\"literal\">\\include_relative</code> <em class=\"replaceable\"><code>filename</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"literal\">\\ir</code>\u547d\u4ee4\u4e0e<code class=\"literal\">\\i</code>\u76f8\u4f3c\uff0c\u4f46\u89e3\u6790\u76f8\u5bf9\u6587\u4ef6\u540d\u7684\u65b9\u5f0f\u4e0d\u540c\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\u6267\u884c\u65f6\uff0c\u8fd9\u4e24\u4e2a\u547d\u4ee4\u7684\u884c\u4e3a\u76f8\u540c\u3002\u4e0d\u8fc7\uff0c\u5728\u811a\u672c\u4e2d\u8c03\u7528\u65f6\uff0c<code class=\"literal\">\\ir</code>\u4f1a\u76f8\u5bf9\u4e8e\u811a\u672c\u6240\u5728\u7684\u76ee\u5f55\u6765\u89e3\u91ca\u6587\u4ef6\u540d\uff0c\u800c\u4e0d\u662f\u76f8\u5bf9\u4e8e\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-LIST\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\l[x+]</code>\u6216<code class=\"literal\">\\list[x+] [ <a class=\"link\" href=\"/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"\u6a21\u5f0f\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u670d\u52a1\u5668\u4e2d\u7684\u6570\u636e\u5e93\uff0c\u5e76\u663e\u793a\u5176\u540d\u79f0\u3001\u6240\u6709\u8005\u3001\u5b57\u7b26\u96c6\u7f16\u7801\u548c\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6570\u636e\u5e93\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u8fd8\u4f1a\u663e\u793a\u6570\u636e\u5e93\u5927\u5c0f\u3001\u9ed8\u8ba4\u8868\u7a7a\u95f4\u548c\u63cf\u8ff0\u3002\u5f53\u524d\u7528\u6237\u5bf9\u5176\u62e5\u6709 <code class=\"literal\">CONNECT</code> \u6743\u9650\u7684\u6570\u636e\u5e93\u53ef\u4ee5\u663e\u793a\u5927\u5c0f\u4fe1\u606f\uff1b\u5982\u679c\u5f53\u524d\u7528\u6237\u662f\u8d85\u7ea7\u7528\u6237\u6216\u5177\u6709 <code class=\"literal\">pg_read_all_stats</code> \u89d2\u8272\u7684\u6743\u9650\uff0c\u4e5f\u53ef\u4ee5\u663e\u793a\u5927\u5c0f\u4fe1\u606f\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-LO-EXPORT\"><span class=\"term\"><code class=\"literal\">\\lo_export <em class=\"replaceable\"><code>loid</code></em> <em class=\"replaceable\"><code>filename</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6570\u636e\u5e93\u4e2d\u8bfb\u53d6\u5177\u6709<acronym class=\"acronym\">OID</acronym><em class=\"replaceable\"><code>loid</code></em>\u7684\u5927\u5bf9\u8c61\uff0c\u5e76\u5c06\u5176\u5199\u5165<em class=\"replaceable\"><code>filename</code></em>\u3002\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e0e\u670d\u52a1\u5668\u51fd\u6570 <code class=\"function\">lo_export</code>\u7565\u6709\u4e0d\u540c\uff0c\u540e\u8005\u4f7f\u7528\u8fd0\u884c\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7528\u6237\u7684\u6743\u9650\uff0c\u5e76\u5728\u670d\u52a1\u5668\u7684\u6587\u4ef6\u7cfb\u7edf\u4e0a\u64cd\u4f5c\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u4f7f\u7528 \\lo_list \u67e5\u627e\u5927\u5bf9\u8c61\u7684 OID\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-LO-IMPORT\"><span class=\"term\"><code class=\"literal\">\\lo_import <em class=\"replaceable\"><code>filename</code></em> [ <em class=\"replaceable\"><code>comment</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6587\u4ef6\u5b58\u50a8\u5230\u4e00\u4e2a<span class=\"productname\">PostgreSQL</span>\u5927\u5bf9\u8c61\u4e2d\u3002\u53ef\u9009\u5730\uff0c\u5b83\u5c06\u7ed9\u5b9a\u7684\u6ce8\u91ca\u4e0e\u5bf9\u8c61\u5173\u8054\u8d77\u6765\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">foo=&gt; <strong class=\"userinput\"><code>\\lo_import '/home/peter/pictures/photo.xcf' 'a picture of me'</code></strong>\nlo_import 152801\n</pre>\n<p lang=\"zh\">\u54cd\u5e94\u8868\u660e\u5927\u5bf9\u8c61\u83b7\u5f97\u4e86\u5bf9\u8c61 ID 152801\uff0c\u8fd9\u4e2a ID \u53ef\u4ee5\u7528\u6765\u5728\u5c06\u6765\u8bbf\u95ee\u65b0\u521b\u5efa\u7684\u5927\u5bf9\u8c61\u3002\u4e3a\u4fbf\u4e8e\u9605\u8bfb\uff0c\u5efa\u8bae\u59cb\u7ec8\u4e3a\u6bcf\u4e2a\u5bf9\u8c61\u5173\u8054\u4e00\u6761\u4fbf\u4e8e\u4eba\u9605\u8bfb\u7684\u6ce8\u91ca\u3002\u67e5\u770b OID \u548c\u6ce8\u91ca\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528<code class=\"command\">\\lo_list</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u6b64\u547d\u4ee4\u4e0e\u670d\u52a1\u5668\u7aef\u7684<code class=\"function\">lo_import</code>\u7565\u6709\u4e0d\u540c\uff0c\u56e0\u4e3a\u5b83\u4f5c\u4e3a\u672c\u5730\u7528\u6237\u5728\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e0a\u64cd\u4f5c\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\u7684\u7528\u6237\u548c\u6587\u4ef6\u7cfb\u7edf\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-LO-LIST\"><span class=\"term\"><code class=\"literal\">\\lo_list[x+]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5f53\u524d\u5b58\u50a8\u5728\u6570\u636e\u5e93\u4e2d\u7684\u5168\u90e8 <span class=\"productname\">PostgreSQL</span> \u5927\u5bf9\u8c61\u5217\u8868\uff0c\u4ee5\u53ca\u4e3a\u5b83\u4eec\u63d0\u4f9b\u7684\u4efb\u4f55\u6ce8\u91ca\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u5217\u51fa\u6bcf\u4e2a\u5927\u5bf9\u8c61\u7684\u76f8\u5173\u6743\u9650\uff08\u5982\u679c\u6709\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-LO-UNLINK\"><span class=\"term\"><code class=\"literal\">\\lo_unlink <em class=\"replaceable\"><code>loid</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6570\u636e\u5e93\u4e2d\u5220\u9664<acronym class=\"acronym\">OID</acronym> \u4e3a <em class=\"replaceable\"><code>loid</code></em>\u7684\u5927\u5bf9\u8c61\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u4f7f\u7528 \\lo_list \u67e5\u627e\u5927\u5bf9\u8c61\u7684 OID\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-OUT\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\o</code> \u6216 <code class=\"literal\">\\out [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\o</code> \u6216 <code class=\"literal\">\\out [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u540e\u7eed\u67e5\u8be2\u7ed3\u679c\u4fdd\u5b58\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9 shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002\u5982\u679c\u6ca1\u6709\u6307\u5b9a\u53c2\u6570\uff0c\u67e5\u8be2\u8f93\u51fa\u5c06\u6062\u590d\u4e3a\u6807\u51c6\u8f93\u51fa\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\uff0c\u5219\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u7684\u5185\u5bb9\u53ea\u4f1a\u539f\u6837\u4f20\u9012\u7ed9 shell\u3002</p>\n<p lang=\"zh\"><span class=\"quote\">\u201c<span class=\"quote\">\u67e5\u8be2\u7ed3\u679c</span>\u201d</span>\u5305\u62ec\u4ece\u6570\u636e\u5e93\u670d\u52a1\u5668\u83b7\u53d6\u7684\u6240\u6709\u8868\u683c\u3001\u547d\u4ee4\u54cd\u5e94\u548c\u901a\u77e5\uff0c\u4ee5\u53ca\u67e5\u8be2\u6570\u636e\u5e93\u7684\u5404\u79cd\u53cd\u659c\u6760\u547d\u4ee4\u7684\u8f93\u51fa\uff08\u4f8b\u5982<code class=\"command\">\\d</code>\uff09\uff1b\u4f46\u4e0d\u5305\u62ec\u9519\u8bef\u6d88\u606f\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8981\u5728\u67e5\u8be2\u7ed3\u679c\u4e4b\u95f4\u63d2\u5165\u6587\u672c\u8f93\u51fa\uff0c\u4f7f\u7528<code class=\"command\">\\qecho</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PRINT\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\p</code>\u6216<code class=\"literal\">\\print</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\u3002\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6253\u5370\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PARSE\"><span class=\"term\"><code class=\"literal\">\\parse <em class=\"replaceable\"><code>statement_name</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u57fa\u4e8e\u76ee\u6807\u9884\u5907\u8bed\u53e5\u5bf9\u8c61\u7684\u540d\u79f0\uff0c\u4ece\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u521b\u5efa\u4e00\u4e2a\u9884\u5907\u8bed\u53e5\u3002\u7a7a\u5b57\u7b26\u4e32\u8868\u793a\u672a\u547d\u540d\u7684\u9884\u5907\u8bed\u53e5\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">SELECT $1 \\parse stmt1\n</pre>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4f1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\uff0c\u4e0d\u540c\u4e8e<span class=\"application\">psql</span>\u901a\u5e38\u4f7f\u7528\u7684\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002\u8be5\u547d\u4ee4\u4f1a\u53d1\u51fa\u4e00\u6761<a class=\"xref\" href=\"/docs/19/protocol-message-formats.html#PROTOCOL-MESSAGE-FORMATS-PARSE\">Parse (F)</a>\u6d88\u606f\uff0c\u56e0\u6b64\u53ef\u7528\u4e8e\u5728<span class=\"application\">psql</span>\u4e2d\u6d4b\u8bd5\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002\u6b64\u547d\u4ee4\u53ea\u5f71\u54cd\u4e0b\u4e00\u6761\u88ab\u6267\u884c\u7684\u67e5\u8be2\uff1b\u4e4b\u540e\u7684\u6240\u6709\u67e5\u8be2\u9ed8\u8ba4\u4ecd\u4f1a\u4f7f\u7528\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PASSWORD\"><span class=\"term\"><code class=\"literal\">\\password [ <em class=\"replaceable\"><code>username</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u66f4\u6539\u6307\u5b9a\u7528\u6237\uff08\u9ed8\u8ba4\u4e3a\u5f53\u524d\u7528\u6237\uff09\u7684\u5bc6\u7801\u3002\u6b64\u547d\u4ee4\u63d0\u793a\u8f93\u5165\u65b0\u5bc6\u7801\uff0c\u5bf9\u5176\u8fdb\u884c\u52a0\u5bc6\uff0c\u5e76\u5c06\u5176\u4f5c\u4e3a<code class=\"command\">ALTER ROLE</code>\u547d\u4ee4\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u65b0\u5bc6\u7801\u4e0d\u4f1a\u4ee5\u660e\u6587\u5f62\u5f0f\u51fa\u73b0\u5728\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\u3001\u670d\u52a1\u5668\u65e5\u5fd7\u6216\u5176\u4ed6\u5730\u65b9\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PROMPT\"><span class=\"term\"><code class=\"literal\">\\prompt [ <em class=\"replaceable\"><code>text</code></em> ] <em class=\"replaceable\"><code>name</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u63d0\u793a\u7528\u6237\u63d0\u4f9b\u6587\u672c\uff0c\u5c06\u5176\u8d4b\u503c\u7ed9\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u3002\u53ef\u4ee5\u6307\u5b9a\u4e00\u4e2a\u53ef\u9009\u7684\u63d0\u793a\u5b57\u7b26\u4e32<em class=\"replaceable\"><code>text</code></em>\u3002\uff08\u5bf9\u4e8e\u591a\u4e2a\u5355\u8bcd\u7684\u63d0\u793a\uff0c\u7528\u5355\u5f15\u53f7\u62ec\u8d77\u6587\u672c\u3002\uff09</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"literal\">\\prompt</code> \u4f7f\u7528\u7ec8\u7aef\u8fdb\u884c\u8f93\u5165\u548c\u8f93\u51fa\u3002\u7136\u800c\uff0c\u5982\u679c\u4f7f\u7528\u4e86 <code class=\"option\">-f</code> \u547d\u4ee4\u884c\u5f00\u5173\uff0c<code class=\"literal\">\\prompt</code> \u5c06\u4f7f\u7528\u6807\u51c6\u8f93\u5165\u548c\u6807\u51c6\u8f93\u51fa\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET\"><span class=\"term\"><code class=\"literal\">\\pset [ <em class=\"replaceable\"><code>option</code></em> [ <em class=\"replaceable\"><code>value</code></em> ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u8bbe\u7f6e\u5f71\u54cd\u67e5\u8be2\u7ed3\u679c\u8868\u8f93\u51fa\u7684\u9009\u9879\u3002<em class=\"replaceable\"><code>option</code></em>\u6307\u5b9a\u8981\u8bbe\u7f6e\u54ea\u4e2a\u9009\u9879\u3002<em class=\"replaceable\"><code>value</code></em>\u7684\u542b\u4e49\u53d6\u51b3\u4e8e\u6240\u9009\u7684\u9009\u9879\u3002\u5bf9\u4e8e\u67d0\u4e9b\u9009\u9879\uff0c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\u4f1a\u5207\u6362\u6216\u53d6\u6d88\u8bbe\u7f6e\u8be5\u9009\u9879\uff0c\u5177\u4f53\u89c1\u5404\u9009\u9879\u7684\u8bf4\u660e\u3002\u5982\u679c\u6ca1\u6709\u63d0\u53ca\u8fd9\u7c7b\u884c\u4e3a\uff0c\u90a3\u4e48\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\u53ea\u4f1a\u663e\u793a\u5f53\u524d\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\">\u4e0d\u5e26\u4efb\u4f55\u53c2\u6570\u7684<code class=\"command\">\\pset</code>\u4f1a\u663e\u793a\u6240\u6709\u6253\u5370\u9009\u9879\u7684\u5f53\u524d\u72b6\u6001\u3002</p>\n<p lang=\"zh\">\u53ef\u8c03\u6574\u6253\u5370\u9009\u9879\u6709\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-META-COMMAND-PSET-BORDER\"><span class=\"term\"><code class=\"literal\">border</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><em class=\"replaceable\"><code>value</code></em>\u5fc5\u987b\u662f\u6570\u5b57\u3002\u4e00\u822c\u6765\u8bf4\uff0c\u6570\u5b57\u8d8a\u5927\uff0c\u8868\u683c\u7684\u8fb9\u6846\u548c\u5206\u9694\u7ebf\u5c31\u8d8a\u591a\uff0c\u4f46\u7ec6\u8282\u53d6\u51b3\u4e8e\u5177\u4f53\u683c\u5f0f\u3002\u5728<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u4e2d\uff0c\u5b83\u4f1a\u76f4\u63a5\u8f6c\u6362\u4e3a<code class=\"literal\">border=...</code>\u5c5e\u6027\u3002\u5728\u5927\u591a\u6570\u5176\u4ed6\u683c\u5f0f\u4e2d\uff0c\u53ea\u6709\u503c 0\uff08\u65e0\u8fb9\u6846\uff09\u30011\uff08\u5185\u90e8\u5206\u9694\u7ebf\uff09\u548c 2\uff08\u8868\u683c\u5916\u6846\uff09\u6709\u610f\u4e49\uff0c\u5927\u4e8e 2 \u7684\u503c\u4f1a\u4e0e<code class=\"literal\">border = 2</code>\u4f5c\u76f8\u540c\u5904\u7406\u3002<code class=\"literal\">latex</code>\u548c<code class=\"literal\">latex-longtable</code>\u683c\u5f0f\u8fd8\u5141\u8bb8\u4f7f\u7528\u503c 3\uff0c\u4ee5\u5728\u6570\u636e\u884c\u4e4b\u95f4\u6dfb\u52a0\u5206\u9694\u7ebf\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-COLUMNS\" lang=\"zh\"><em>\u5217</em></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u76ee\u6807\u5bbd\u5ea6\uff0c\u540c\u65f6\u4e5f\u662f\u786e\u5b9a\u8f93\u51fa\u662f\u5426\u8db3\u591f\u5bbd\u4ee5\u9700\u8981\u5206\u9875\u5668\u6216\u5728\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e0b\u5207\u6362\u5230\u5782\u76f4\u663e\u793a\u7684\u5bbd\u5ea6\u9650\u5236\u3002\u96f6\uff08\u9ed8\u8ba4\u503c\uff09\u4f1a\u5bfc\u81f4\u76ee\u6807\u5bbd\u5ea6\u7531\u73af\u5883\u53d8\u91cf<code class=\"envar\">COLUMNS</code>\u63a7\u5236\uff0c\u6216\u8005\u5982\u679c\u672a\u8bbe\u7f6e <code class=\"envar\">COLUMNS</code>\u5219\u7531\u68c0\u6d4b\u5230\u7684\u5c4f\u5e55\u5bbd\u5ea6\u63a7\u5236\u3002\u53e6\u5916\uff0c\u5982\u679c<code class=\"literal\">columns</code>\u4e3a\u96f6\uff0c\u5219<code class=\"literal\">wrapped</code>\u683c\u5f0f\u4ec5\u5f71\u54cd\u5c4f\u5e55\u8f93\u51fa\u3002\u5982\u679c<code class=\"literal\">columns</code>\u4e3a\u975e\u96f6\uff0c\u5219\u6587\u4ef6\u548c\u7ba1\u9053\u8f93\u51fa\u4e5f\u4f1a\u6309\u8be5\u5bbd\u5ea6\u6298\u884c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-CSV-FIELDSEP\"><span class=\"term\"><code class=\"literal\">csv_fieldsep</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728<acronym class=\"acronym\">CSV</acronym>\u8f93\u51fa\u683c\u5f0f\u4e2d\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u5982\u679c\u5206\u9694\u7b26\u5b57\u7b26\u51fa\u73b0\u5728\u5b57\u6bb5\u7684\u503c\u4e2d\uff0c\u5219\u8be5\u5b57\u6bb5\u5c06\u6839\u636e\u6807\u51c6<acronym class=\"acronym\">CSV</acronym>\u89c4\u5219\u5728\u53cc\u5f15\u53f7\u5185\u8f93\u51fa\u3002\u9ed8\u8ba4\u503c\u662f\u9017\u53f7\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-DISPLAY-FALSE\"><span class=\"term\"><code class=\"literal\">display_false</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u66ff\u4ee3\u5047\u503c\u6253\u5370\u7684\u5b57\u7b26\u4e32\u3002\u9ed8\u8ba4\u6253\u5370 <code class=\"literal\">f</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-DISPLAY-TRUE\"><span class=\"term\"><code class=\"literal\">display_true</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u66ff\u4ee3\u771f\u503c\u6253\u5370\u7684\u5b57\u7b26\u4e32\u3002\u9ed8\u8ba4\u6253\u5370 <code class=\"literal\">t</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-EXPANDED\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">expanded</code>\uff08\u6216<code class=\"literal\">x</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff08\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u6269\u5c55\u6a21\u5f0f\uff09\uff0c\u6216\u8005\u662f<code class=\"literal\">auto</code>\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5f00\u542f\u548c\u5173\u95ed\u8bbe\u7f6e\u4e4b\u95f4\u5207\u6362\u3002\u542f\u7528\u6269\u5c55\u6a21\u5f0f\u65f6\uff0c\u67e5\u8be2\u7ed3\u679c\u4ee5\u4e24\u5217\u663e\u793a\uff0c\u5de6\u4fa7\u4e3a\u5217\u540d\uff0c\u53f3\u4fa7\u4e3a\u6570\u636e\u3002\u5982\u679c\u6570\u636e\u5728\u901a\u5e38\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u6a2a\u5411</span>\u201d</span>\u6a21\u5f0f\u4e0b\u65e0\u6cd5\u9002\u5e94\u5c4f\u5e55\uff0c\u8fd9\u79cd\u6a21\u5f0f\u5c31\u5f88\u6709\u7528\u3002\u5728\u81ea\u52a8\u8bbe\u7f6e\u4e0b\uff0c\u5f53\u67e5\u8be2\u8f93\u51fa\u5305\u542b\u591a\u5217\u4e14\u5bbd\u5ea6\u8d85\u8fc7\u5c4f\u5e55\u65f6\uff0c\u4f1a\u4f7f\u7528\u6269\u5c55\u6a21\u5f0f\uff1b\u5426\u5219\u4f7f\u7528\u5e38\u89c4\u6a21\u5f0f\u3002\u81ea\u52a8\u8bbe\u7f6e\u53ea\u5728\u5bf9\u9f50\u548c\u6298\u884c\u683c\u5f0f\u4e2d\u6709\u6548\u3002\u5728\u5176\u4ed6\u683c\u5f0f\u4e2d\uff0c\u5b83\u7684\u884c\u4e3a\u59cb\u7ec8\u4e0e\u5173\u95ed\u6269\u5c55\u6a21\u5f0f\u76f8\u540c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-FIELDSEP\"><span class=\"term\"><code class=\"literal\">fieldsep</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u6837\u53ef\u4ee5\u521b\u5efa\u4f8b\u5982\u5236\u8868\u7b26\u5206\u9694\u7684\u8f93\u51fa\uff0c\u8fd9\u53ef\u80fd\u66f4\u7b26\u5408\u5176\u4ed6\u7a0b\u5e8f\u7684\u9700\u8981\u3002\u8981\u5c06\u5236\u8868\u7b26\u8bbe\u7f6e\u4e3a\u5b57\u6bb5\u5206\u9694\u7b26\uff0c\u8bf7\u8f93\u5165<code class=\"literal\">\\pset fieldsep '\\t'</code>\u3002\u9ed8\u8ba4\u5b57\u6bb5\u5206\u9694\u7b26\u662f<code class=\"literal\">'|'</code>\uff08\u7ad6\u7ebf\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-FIELDSEP-ZERO\"><span class=\"term\"><code class=\"literal\">fieldsep_zero</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u8bbe\u7f6e\u4e3a\u96f6\u5b57\u8282\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-FOOTER\"><span class=\"term\"><code class=\"literal\">footer</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u8868\u683c\u9875\u811a\uff08<code class=\"literal\">(<em class=\"replaceable\"><code>n</code></em> rows)</code>\u8ba1\u6570\uff09\u7684\u663e\u793a\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5207\u6362\u9875\u811a\u663e\u793a\u7684\u5f00\u5173\u72b6\u6001\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-FORMAT\"><span class=\"term\"><code class=\"literal\">format</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a<code class=\"literal\">aligned</code>\u3001<code class=\"literal\">asciidoc</code>\u3001<code class=\"literal\">csv</code>\u3001<code class=\"literal\">html</code>\u3001<code class=\"literal\">latex</code>\u3001<code class=\"literal\">latex-longtable</code>\u3001<code class=\"literal\">troff-ms</code>\u3001<code class=\"literal\">unaligned</code>\u6216<code class=\"literal\">wrapped</code>\u3002\u5141\u8bb8\u4f7f\u7528\u552f\u4e00\u7f29\u5199\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">aligned</code>\u683c\u5f0f\u662f\u6807\u51c6\u7684\u3001\u9002\u5408\u4eba\u9605\u8bfb\u4e14\u6392\u7248\u6574\u9f50\u7684\u6587\u672c\u8f93\u51fa\uff1b\u8fd9\u662f\u9ed8\u8ba4\u683c\u5f0f\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">unaligned</code>\u683c\u5f0f\u5c06\u4e00\u884c\u4e2d\u7684\u6240\u6709\u5217\u5199\u5728\u4e00\u884c\u4e0a\uff0c\u7531\u5f53\u524d\u6d3b\u52a8\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u5206\u9694\u3002\u8fd9\u5bf9\u4e8e\u521b\u5efa\u53ef\u80fd\u88ab\u5176\u4ed6\u7a0b\u5e8f\u8bfb\u53d6\u7684\u8f93\u51fa\u5f88\u6709\u7528\uff0c\u4f8b\u5982\uff0c\u5236\u8868\u7b26\u5206\u9694\u6216\u9017\u53f7\u5206\u9694\u683c\u5f0f\u3002\u7136\u800c\uff0c\u5982\u679c\u5b57\u6bb5\u5206\u9694\u7b26\u5b57\u7b26\u51fa\u73b0\u5728\u5217\u7684\u503c\u4e2d\uff0c\u5219\u4e0d\u4f1a\u88ab\u7279\u6b8a\u5904\u7406\uff1b\u56e0\u6b64\uff0c<acronym class=\"acronym\">CSV</acronym>\u683c\u5f0f\u53ef\u80fd\u66f4\u9002\u5408\u8fd9\u4e9b\u76ee\u7684\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">csv</code>\u683c\u5f0f<a class=\"indexterm\" id=\"id-1.9.4.21.8.4.11.1.81.2.3.1.10.2.4.2\" name=\"id-1.9.4.21.8.4.11.1.81.2.3.1.10.2.4.2\"></a>\u6309\u9017\u53f7\u5206\u9694\u7684\u5217\u503c\u8f93\u51fa\uff0c\u5e76\u5e94\u7528 <a class=\"ulink\" href=\"https://datatracker.ietf.org/doc/html/rfc4180\" target=\"_top\">RFC 4180</a> \u4e2d\u63cf\u8ff0\u7684\u52a0\u5f15\u53f7\u89c4\u5219\u3002\u6b64\u8f93\u51fa\u4e0e\u670d\u52a1\u5668\u7684CSV\u683c\u5f0f\u7684 <code class=\"command\">COPY</code>\u547d\u4ee4\u517c\u5bb9\u3002\u751f\u6210\u5305\u542b\u5217\u540d\u7684\u8868\u5934\u884c\uff0c\u9664\u975e <code class=\"literal\">tuples_only</code>\u53c2\u6570\u8bbe\u7f6e\u4e3a <code class=\"literal\">on</code>\u3002\u4e0d\u6253\u5370\u8868\u683c\u6807\u9898\u548c\u9875\u811a\u3002\u6bcf\u884c\u4ee5\u7cfb\u7edf\u76f8\u5173\u7684\u884c\u7ed3\u675f\u5b57\u7b26\u7ed3\u675f\uff0c\u5bf9\u4e8e\u7c7bUnix\u7cfb\u7edf\u901a\u5e38\u662f\u5355\u4e2a\u6362\u884c\u7b26\uff08<code class=\"literal\">\\n</code>\uff09\uff0c\u5bf9\u4e8eMicrosoft Windows\u5219\u662f\u56de\u8f66\u548c\u6362\u884c\u5e8f\u5217\uff08<code class=\"literal\">\\r\\n</code>\uff09\u3002\u53ef\u4ee5\u7528<code class=\"command\">\\pset csv_fieldsep</code>\u9009\u62e9\u9017\u53f7\u4ee5\u5916\u7684\u5b57\u6bb5\u5206\u9694\u5b57\u7b26\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">wrapped</code>\u683c\u5f0f\u4e0e<code class=\"literal\">aligned</code>\u76f8\u4f3c\uff0c\u4f46\u4f1a\u5c06\u8f83\u5bbd\u7684\u6570\u636e\u503c\u6298\u6210\u591a\u884c\uff0c\u4f7f\u8f93\u51fa\u9002\u5e94\u76ee\u6807\u5217\u5bbd\u3002\u76ee\u6807\u5bbd\u5ea6\u7684\u786e\u5b9a\u65b9\u5f0f\u89c1<code class=\"literal\">columns</code>\u9009\u9879\u7684\u8bf4\u660e\u3002\u8bf7\u6ce8\u610f\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u5c1d\u8bd5\u5bf9\u5217\u6807\u9898\u6298\u884c\uff1b\u56e0\u6b64\uff0c\u5982\u679c\u5217\u6807\u9898\u6240\u9700\u7684\u603b\u5bbd\u5ea6\u8d85\u8fc7\u76ee\u6807\u5bbd\u5ea6\uff0c<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u884c\u4e3a\u5c31\u4e0e<code class=\"literal\">aligned</code>\u76f8\u540c\u3002</p>\n<p lang=\"zh\">asciidoc\u3001html\u3001latex\u3001latex-longtable \u548c troff-ms \u683c\u5f0f\u8f93\u51fa\u7684\u662f\u53ef\u5d4c\u5165\u76f8\u5e94\u6807\u8bb0\u8bed\u8a00\u6587\u6863\u7684\u8868\u683c\uff0c\u5e76\u975e\u5b8c\u6574\u6587\u6863\u3002HTML \u53ef\u80fd\u4e0d\u8981\u6c42\u5b8c\u6574\u5c01\u88c5\uff0c\u4f46 LaTeX \u5fc5\u987b\u6709\u5b8c\u6574\u6587\u6863\u7ed3\u6784\u3002latex \u4f7f\u7528 LaTeX \u7684 tabular \u73af\u5883\uff1blatex-longtable \u9700\u8981 LaTeX \u7684 longtable \u548c booktabs \u5b8f\u5305\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-LINESTYLE\"><span class=\"term\"><code class=\"literal\">linestyle</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u8fb9\u6846\u7ebf\u7ed8\u5236\u6837\u5f0f\u4e3a<code class=\"literal\">ascii</code>\u3001<code class=\"literal\">old-ascii</code>\u6216<code class=\"literal\">unicode</code>\u4e4b\u4e00\u3002\u5141\u8bb8\u4f7f\u7528\u552f\u4e00\u7f29\u5199\u3002\uff08\u8fd9\u610f\u5473\u7740\u4e00\u4e2a\u5b57\u6bcd\u5c31\u8db3\u591f\u4e86\u3002\uff09\u9ed8\u8ba4\u8bbe\u7f6e\u4e3a<code class=\"literal\">ascii</code>\u3002\u6b64\u9009\u9879\u4ec5\u5f71\u54cd<code class=\"literal\">aligned</code>\u548c<code class=\"literal\">wrapped</code>\u8f93\u51fa\u683c\u5f0f\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">ascii</code>\u6837\u5f0f\u4f7f\u7528\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u53f3\u8fb9\u7f18\u7684<code class=\"literal\">+</code>\u7b26\u53f7\u8868\u793a\u3002\u5f53<code class=\"literal\">wrapped</code>\u683c\u5f0f\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u628a\u6570\u636e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u4f1a\u5728\u7b2c\u4e00\u884c\u7684\u53f3\u8fb9\u7f18\u663e\u793a\u4e00\u4e2a\u70b9\uff08<code class=\"literal\">.</code>\uff09\uff0c\u5e76\u5728\u4e0b\u4e00\u884c\u7684\u5de6\u8fb9\u7f18\u518d\u6b21\u663e\u793a\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">old-ascii</code>\u6837\u5f0f\u4f7f\u7528\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\uff0c\u91c7\u7528<span class=\"productname\">PostgreSQL</span> 8.4 \u53ca\u66f4\u65e9\u7248\u672c\u7684\u683c\u5f0f\u6837\u5f0f\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u66ff\u4ee3\u5de6\u4fa7\u5217\u5206\u9694\u7b26\u7684<code class=\"literal\">:</code>\u7b26\u53f7\u8868\u793a\u3002\u5f53\u6570\u636e\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u5219\u7528<code class=\"literal\">;</code>\u7b26\u53f7\u66ff\u4ee3\u5de6\u4fa7\u5217\u5206\u9694\u7b26\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">unicode</code>\u6837\u5f0f\u4f7f\u7528 Unicode \u6846\u7ebf\u7ed8\u5236\u5b57\u7b26\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u53f3\u8fb9\u7f18\u7684\u56de\u8f66\u7b26\u53f7\u8868\u793a\u3002\u5f53\u6570\u636e\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u4f1a\u5728\u7b2c\u4e00\u884c\u7684\u53f3\u8fb9\u7f18\u663e\u793a\u7701\u7565\u53f7\u7b26\u53f7\uff0c\u5e76\u5728\u4e0b\u4e00\u884c\u7684\u5de6\u8fb9\u7f18\u518d\u6b21\u663e\u793a\u3002</p>\n<p lang=\"zh\">\u5f53<code class=\"literal\">border</code>\u8bbe\u7f6e\u5927\u4e8e\u96f6\u65f6\uff0c<code class=\"literal\">linestyle</code>\u9009\u9879\u8fd8\u51b3\u5b9a\u7528\u54ea\u4e9b\u5b57\u7b26\u7ed8\u5236\u8fb9\u6846\u7ebf\u3002\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\u5728\u4efb\u4f55\u73af\u5883\u4e2d\u90fd\u53ef\u7528\uff0c\u4f46\u5728\u652f\u6301 Unicode \u7684\u663e\u793a\u8bbe\u5907\u4e0a\uff0cUnicode \u5b57\u7b26\u66f4\u7f8e\u89c2\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-NULL\"><span class=\"term\"><code class=\"literal\">null</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u7528\u4e8e\u4ee3\u66ff\u7a7a\u503c\u6253\u5370\u7684\u5b57\u7b26\u4e32\u3002\u9ed8\u8ba4\u4e0d\u6253\u5370\u4efb\u4f55\u5185\u5bb9\uff0c\u8fd9\u5f88\u5bb9\u6613\u88ab\u8bef\u8ba4\u4e3a\u7a7a\u5b57\u7b26\u4e32\u3002\u4f8b\u5982\uff0c\u4f60\u53ef\u80fd\u66f4\u559c\u6b22\u4f7f\u7528<code class=\"literal\">\\pset null '(null)'</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-NUMERICLOCALE\"><span class=\"term\"><code class=\"literal\">numericlocale</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u4f7f\u7528\u533a\u57df\u8bbe\u7f6e\u7279\u5b9a\u7684\u5b57\u7b26\u6765\u5206\u9694\u5c0f\u6570\u70b9\u5de6\u4fa7\u7684\u6570\u5b57\u7ec4\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5e38\u89c4\u6570\u5b57\u8f93\u51fa\u548c\u533a\u57df\u8bbe\u7f6e\u7279\u5b9a\u7684\u6570\u5b57\u8f93\u51fa\u4e4b\u95f4\u5207\u6362\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-PAGER\"><span class=\"term\"><code class=\"literal\">pager</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u63a7\u5236\u67e5\u8be2\u7ed3\u679c\u4e0e psql \u5e2e\u52a9\u8f93\u51fa\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\u7684\u65b9\u5f0f\u3002\u5f53 pager \u4e3a off \u65f6\uff0c\u4e0d\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\uff1b\u4e3a on \u65f6\uff0c\u5728\u9002\u5f53\u60c5\u51b5\u4e0b\u4f7f\u7528\uff0c\u5373\u8f93\u51fa\u76ee\u6807\u662f\u7ec8\u7aef\u4e14\u5185\u5bb9\u65e0\u6cd5\u5728\u5c4f\u5e55\u5185\u663e\u793a\u5b8c\u3002\u8bbe\u4e3a always \u65f6\uff0c\u6240\u6709\u7ec8\u7aef\u8f93\u51fa\u5747\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\uff0c\u65e0\u8bba\u662f\u5426\u80fd\u5728\u5c4f\u5e55\u5185\u663e\u793a\u5b8c\u3002\u4e0d\u5e26\u503c\u7684 \\pset pager \u4f1a\u5207\u6362\u5206\u9875\u7684\u5f00\u5173\u72b6\u6001\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u8bbe\u7f6e\u4e86\u73af\u5883\u53d8\u91cf<code class=\"envar\">PSQL_PAGER</code>\u6216<code class=\"envar\">PAGER</code>\uff0c\u9700\u8981\u5206\u9875\u7684\u8f93\u51fa\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6307\u5b9a\u7a0b\u5e8f\u3002\u5426\u5219\uff0c\u4f7f\u7528\u4e0e\u5e73\u53f0\u6709\u5173\u7684\u9ed8\u8ba4\u7a0b\u5e8f\uff08\u5982<code class=\"filename\">more</code>\uff09\u3002</p>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 <code class=\"literal\">\\watch</code> \u547d\u4ee4\u91cd\u590d\u6267\u884c\u67e5\u8be2\u65f6\uff0c\u5728 Unix \u7cfb\u7edf\u4e0a\u4f1a\u6539\u7528\u73af\u5883\u53d8\u91cf <code class=\"envar\">PSQL_WATCH_PAGER</code> \u6765\u67e5\u627e\u5206\u9875\u5668\u7a0b\u5e8f\u3002\u4e4b\u6240\u4ee5\u5355\u72ec\u914d\u7f6e\u5b83\uff0c\u662f\u56e0\u4e3a\u8fd9\u79cd\u7528\u6cd5\u53ef\u80fd\u4f1a\u8ba9\u4f20\u7edf\u5206\u9875\u5668\u65e0\u6cd5\u6b63\u5e38\u5de5\u4f5c\uff1b\u4f46\u5b83\u53ef\u7528\u4e8e\u628a\u8f93\u51fa\u53d1\u9001\u7ed9\u80fd\u591f\u7406\u89e3 <span class=\"application\">psql</span> \u8f93\u51fa\u683c\u5f0f\u7684\u5de5\u5177\uff08\u4f8b\u5982 <code class=\"filename\">pspg --stream</code>\uff09\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-PAGER-MIN-LINES\"><span class=\"term\"><code class=\"literal\">pager_min_lines</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u82e5 pager_min_lines \u5927\u4e8e\u5c4f\u5e55\u9875\u9ad8\uff0c\u53ea\u6709\u8f93\u51fa\u884c\u6570\u8fbe\u5230\u8be5\u503c\u65f6\u624d\u8c03\u7528\u5206\u9875\u7a0b\u5e8f\u3002\u9ed8\u8ba4\u503c\u4e3a 0\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-RECORDSEP\"><span class=\"term\"><code class=\"literal\">recordsep</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u8bb0\u5f55\uff08\u884c\uff09\u5206\u9694\u7b26\u3002\u9ed8\u8ba4\u4e3a\u6362\u884c\u7b26\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-RECORDSEP-ZERO\"><span class=\"term\"><code class=\"literal\">recordsep_zero</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u8bbe\u7f6e\u4e3a\u96f6\u5b57\u8282\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-TABLEATTR\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">tableattr</code>\uff08\u6216<code class=\"literal\">T</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\u5728<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u4e2d\uff0c\u8fd9\u6307\u5b9a\u8981\u653e\u5728<code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u5c5e\u6027\uff0c\u4f8b\u5982<code class=\"literal\">cellpadding</code>\u6216<code class=\"literal\">bgcolor</code>\u3002\u8bf7\u6ce8\u610f\uff0c\u4f60\u53ef\u80fd\u4e0d\u9700\u8981\u5728\u8fd9\u91cc\u6307\u5b9a<code class=\"literal\">border</code>\uff0c\u56e0\u4e3a<code class=\"literal\">\\pset border</code>\u5df2\u7ecf\u8d1f\u8d23\u5904\u7406\u5b83\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u8868\u683c\u5c5e\u6027\u3002</p>\n<p lang=\"zh\">\u5728<code class=\"literal\">latex-longtable</code>\u683c\u5f0f\u4e2d\uff0c\u8fd9\u63a7\u5236\u6bcf\u4e2a\u5305\u542b\u5de6\u5bf9\u9f50\u6570\u636e\u7c7b\u578b\u7684\u5217\u7684\u5bbd\u5ea6\u6bd4\u4f8b\u3002\u5b83\u4ee5\u7a7a\u767d\u5206\u9694\u7684\u503c\u5217\u8868\u6307\u5b9a\uff0c\u4f8b\u5982<code class=\"literal\">'0.2 0.2 0.6'</code>\u3002\u672a\u6307\u5b9a\u7684\u8f93\u51fa\u5217\u4f7f\u7528\u6700\u540e\u6307\u5b9a\u7684\u503c\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-TITLE\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">title</code>\uff08\u6216<code class=\"literal\">C</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u968f\u540e\u6253\u5370\u7684\u6240\u6709\u8868\u683c\u7684\u6807\u9898\u3002\u8fd9\u53ef\u4ee5\u4e3a\u8f93\u51fa\u63d0\u4f9b\u63cf\u8ff0\u6027\u6807\u7b7e\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u6807\u9898\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-TUPLES-ONLY\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">tuples_only</code>\uff08\u6216<code class=\"literal\">t</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u4ec5\u5143\u7ec4\u6a21\u5f0f\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5e38\u89c4\u8f93\u51fa\u548c\u4ec5\u5143\u7ec4\u8f93\u51fa\u4e4b\u95f4\u5207\u6362\u3002\u5e38\u89c4\u8f93\u51fa\u5305\u542b\u5217\u6807\u9898\u3001\u8868\u683c\u6807\u9898\u548c\u5404\u79cd\u9875\u811a\u7b49\u9644\u52a0\u4fe1\u606f\u3002\u5728\u4ec5\u5143\u7ec4\u6a21\u5f0f\u4e0b\uff0c\u53ea\u663e\u793a\u5b9e\u9645\u7684\u8868\u683c\u6570\u636e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-UNICODE-BORDER-LINESTYLE\"><span class=\"term\"><code class=\"literal\">unicode_border_linestyle</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u8fb9\u6846\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-UNICODE-COLUMN-LINESTYLE\"><span class=\"term\"><code class=\"literal\">unicode_column_linestyle</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u5217\u5206\u9694\u7ebf\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-UNICODE-HEADER-LINESTYLE\"><span class=\"term\"><code class=\"literal\">unicode_header_linestyle</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u8868\u5934\u5206\u9694\u7ebf\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-XHEADER-WIDTH\"><span class=\"term\"><code class=\"literal\">xheader_width</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6269\u5c55\u8f93\u51fa\u6807\u9898\u7684\u6700\u5927\u5bbd\u5ea6\u8bbe\u4e3a full\uff08\u9ed8\u8ba4\u503c\uff09\u3001column\u3001page \u6216\u4e00\u4e2a\u6574\u6570\u503c\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">full</code>\uff1a\u6269\u5c55\u8868\u5934\u4e0d\u622a\u65ad\uff0c\u5176\u5bbd\u5ea6\u4e0e\u6700\u5bbd\u7684\u8f93\u51fa\u884c\u76f8\u540c\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">column</code>\uff1a\u5c06\u8868\u5934\u884c\u622a\u65ad\u4e3a\u7b2c\u4e00\u5217\u7684\u5bbd\u5ea6\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">page</code>\uff1a\u5c06\u8868\u5934\u884c\u622a\u65ad\u4e3a\u7ec8\u7aef\u5bbd\u5ea6\u3002</p>\n<p lang=\"zh\">\u6574\u6570\u503c\uff1a\u7cbe\u786e\u6307\u5b9a\u6807\u9898\u884c\u7684\u6700\u5927\u5bbd\u5ea6\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8fd9\u4e9b\u4e0d\u540c\u683c\u5f0f\u7684\u5916\u89c2\u793a\u4f8b\u53ef\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/19/app-psql.html#APP-PSQL-EXAMPLES\" title=\"\u793a\u4f8b\">\u793a\u4f8b</a>\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u6709\u5404\u79cd\u5feb\u6377\u547d\u4ee4\u7528\u4e8e<code class=\"command\">\\pset</code>\u3002\u8bf7\u53c2\u89c1<code class=\"command\">\\a</code>\u3001<code class=\"command\">\\C</code>\u3001<code class=\"command\">\\f</code>\u3001<code class=\"command\">\\H</code>\u3001<code class=\"command\">\\t</code>\u3001<code class=\"command\">\\T</code>\u548c<code class=\"command\">\\x</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-QUIT\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\q</code>\u6216<code class=\"literal\">\\quit</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9000\u51fa<span class=\"application\">psql</span>\u7a0b\u5e8f\u3002\u5728\u811a\u672c\u6587\u4ef6\u4e2d\uff0c\u53ea\u4f1a\u7ec8\u6b62\u8be5\u811a\u672c\u7684\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-QECHO\"><span class=\"term\"><code class=\"literal\">\\qecho <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u547d\u4ee4\u4e0e<code class=\"command\">\\echo</code>\u76f8\u540c\uff0c\u53ea\u662f\u8f93\u51fa\u4f1a\u5199\u5165\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u7684\u67e5\u8be2\u8f93\u51fa\u901a\u9053\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-RESET\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\r</code>\u6216<code class=\"literal\">\\reset</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u91cd\u7f6e\uff08\u6e05\u7a7a\uff09\u67e5\u8be2\u7f13\u51b2\u533a\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-RESTRICT\"><span class=\"term\"><code class=\"literal\">\\restrict <em class=\"replaceable\"><code>restrict_key</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528\u7ed9\u5b9a\u7684\u5bc6\u94a5\u8fdb\u5165<span class=\"quote\">\u201c<span class=\"quote\">\u53d7\u9650</span>\u201d</span>\u6a21\u5f0f\u3002\u5728\u8be5\u6a21\u5f0f\u4e0b\uff0c\u552f\u4e00\u5141\u8bb8\u7684\u5143\u547d\u4ee4\u662f\u7528\u4e8e\u9000\u51fa\u53d7\u9650\u6a21\u5f0f\u7684<code class=\"command\">\\unrestrict</code>\u3002\u5bc6\u94a5\u53ea\u80fd\u5305\u542b\u5b57\u6bcd\u6570\u5b57\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4e3b\u8981\u7528\u4e8e pg_dump\u3001pg_dumpall \u548c pg_restore \u751f\u6210\u7684\u7eaf\u6587\u672c\u8f6c\u50a8\uff0c\u4e5f\u53ef\u80fd\u9002\u7528\u4e8e\u5176\u4ed6\u573a\u666f\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-S\"><span class=\"term\"><code class=\"literal\">\\s [ <em class=\"replaceable\"><code>filename</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u5386\u53f2\u8bb0\u5f55\u5230<em class=\"replaceable\"><code>filename</code></em>\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5386\u53f2\u8bb0\u5f55\u5c06\u88ab\u5199\u5165\u6807\u51c6\u8f93\u51fa\uff08\u5982\u679c\u9002\u7528\uff0c\u5c06\u4f7f\u7528\u5206\u9875\u5668\uff09\u3002\u5982\u679c<span class=\"application\">psql</span>\u5728\u6784\u5efa\u65f6\u6ca1\u6709\u4f7f\u7528<span class=\"application\">Readline</span>\u652f\u6301\uff0c\u5219\u6b64\u547d\u4ee4\u4e0d\u53ef\u7528\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-SET\"><span class=\"term\"><code class=\"literal\">\\set [ <em class=\"replaceable\"><code>name</code></em> [ <em class=\"replaceable\"><code>value</code></em> [ ... ] ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e<span class=\"application\">psql</span>\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u4e3a<em class=\"replaceable\"><code>value</code></em>\uff0c\u5982\u679c\u7ed9\u51fa\u591a\u4e2a\u503c\uff0c\u5219\u8bbe\u7f6e\u4e3a\u6240\u6709\u503c\u7684\u8fde\u63a5\u3002\u5982\u679c\u53ea\u7ed9\u51fa\u4e00\u4e2a\u53c2\u6570\uff0c\u5219\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\u503c\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u8bbe\u7f6e\uff0c\u8bf7\u4f7f\u7528<code class=\"command\">\\unset</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\"><code class=\"command\">\\set</code>\u6ca1\u6709\u4efb\u4f55\u53c2\u6570\u65f6\uff0c\u663e\u793a\u5f53\u524d\u8bbe\u7f6e\u7684\u6240\u6709<span class=\"application\">psql</span>\u53d8\u91cf\u7684\u540d\u79f0\u548c\u503c\u3002</p>\n<p lang=\"zh\">\u6709\u6548\u7684\u53d8\u91cf\u540d\u53ef\u4ee5\u5305\u542b\u5b57\u6bcd\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u3002\u6709\u5173\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/19/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002\u53d8\u91cf\u540d\u533a\u5206\u5927\u5c0f\u5199\u3002</p>\n<p lang=\"zh\">\u67d0\u4e9b\u53d8\u91cf\u662f\u7279\u6b8a\u7684\uff0c\u5b83\u4eec\u63a7\u5236<span class=\"application\">psql</span>\u7684\u884c\u4e3a\u6216\u8005\u81ea\u52a8\u8bbe\u7f6e\u4ee5\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u3002\u8fd9\u4e9b\u53d8\u91cf\u5728\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/19/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u4e2d\u6709\u6587\u6863\u8bb0\u5f55\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u4e0e<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4<a class=\"link\" href=\"/docs/19/sql-set.html\" title=\"SET\"><code class=\"command\">SET</code></a>\u65e0\u5173\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-SETENV\"><span class=\"term\"><code class=\"literal\">\\setenv <em class=\"replaceable\"><code>name</code></em> [ <em class=\"replaceable\"><code>value</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u4e3a<em class=\"replaceable\"><code>value</code></em>\uff0c\u6216\u8005\u5982\u679c\u672a\u63d0\u4f9b<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3002\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\setenv PAGER less</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>\\setenv LESS -imx4F</code></strong>\n</pre>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-SF\"><span class=\"term\"><code class=\"literal\">\\sf[+] <em class=\"replaceable\"><code>function_description</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u663e\u793a\u6307\u5b9a\u51fd\u6570\u6216\u8fc7\u7a0b\u7684\u5b9a\u4e49\uff0c\u4ee5<code class=\"command\">CREATE OR REPLACE FUNCTION</code>\u6216 <code class=\"command\">CREATE OR REPLACE PROCEDURE</code>\u547d\u4ee4\u7684\u5f62\u5f0f\u5448\u73b0\u3002\u5b9a\u4e49\u5c06\u6253\u5370\u5230\u5f53\u524d\u67e5\u8be2\u8f93\u51fa\u901a\u9053\uff0c\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\">\u76ee\u6807\u51fd\u6570\u53ef\u4ec5\u7528\u540d\u79f0\u6307\u5b9a\uff0c\u4e5f\u53ef\u7528\u540d\u79f0\u548c\u53c2\u6570\u6307\u5b9a\uff0c\u4f8b\u5982 foo(integer, text)\u3002\u82e5\u6709\u591a\u4e2a\u540c\u540d\u51fd\u6570\uff0c\u5219\u5fc5\u987b\u63d0\u4f9b\u53c2\u6570\u7c7b\u578b\u3002</p>\n<p lang=\"zh\">\u5728\u547d\u4ee4\u540d\u540e\u6dfb\u52a0 +\uff0c\u4f1a\u4e3a\u8f93\u51fa\u884c\u7f16\u53f7\uff0c\u51fd\u6570\u4f53\u7b2c\u4e00\u884c\u4e3a\u7b2c 1 \u884c\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\sf</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-SV\"><span class=\"term\"><code class=\"literal\">\\sv[+] <em class=\"replaceable\"><code>view_name</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u6307\u5b9a\u89c6\u56fe\u7684\u5b9a\u4e49\uff0c\u5e76\u4ee5<code class=\"command\">CREATE OR REPLACE VIEW</code>\u547d\u4ee4\u7684\u5f62\u5f0f\u663e\u793a\u3002\u5b9a\u4e49\u4f1a\u6253\u5370\u5230\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u7684\u5f53\u524d\u67e5\u8be2\u8f93\u51fa\u901a\u9053\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u547d\u4ee4\u540d\u79f0\u540e\u6dfb\u52a0<code class=\"literal\">+</code>\uff0c\u90a3\u4e48\u8f93\u51fa\u884c\u5c06\u4ece1\u5f00\u59cb\u7f16\u53f7\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\sv</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PIPELINE\"><span class=\"term\"><code class=\"literal\">\\startpipeline</code><br/></span><span class=\"term\"><code class=\"literal\">\\sendpipeline</code><br/></span><span class=\"term\"><code class=\"literal\">\\syncpipeline</code><br/></span><span class=\"term\"><code class=\"literal\">\\endpipeline</code><br/></span><span class=\"term\"><code class=\"literal\">\\flushrequest</code><br/></span><span class=\"term\"><code class=\"literal\">\\flush</code><br/></span><span class=\"term\"><code class=\"literal\">\\getresults [ <em class=\"replaceable\"><code>number_results</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u7ec4\u547d\u4ee4\u5b9e\u73b0 SQL \u8bed\u53e5\u7684\u7ba1\u9053\u5316\u3002\u4e00\u4e2a\u7ba1\u9053\u5fc5\u987b\u4ee5 <code class=\"command\">\\startpipeline</code> \u5f00\u59cb\uff0c\u5e76\u4ee5 <code class=\"command\">\\endpipeline</code> \u7ed3\u675f\u3002\u5176\u95f4\u53ef\u4ee5\u51fa\u73b0\u4efb\u610f\u6570\u91cf\u7684 <code class=\"command\">\\syncpipeline</code> \u547d\u4ee4\uff0c\u5b83\u4f1a\u53d1\u9001\u4e00\u6761<a class=\"link\" href=\"/docs/19/protocol-flow.html#PROTOCOL-FLOW-EXT-QUERY\" title=\"54.2.3.\u00a0\u6269\u5c55\u67e5\u8be2\">\u540c\u6b65\u6d88\u606f</a>\uff0c\u800c\u4e0d\u4f1a\u7ed3\u675f\u5f53\u524d\u7ba1\u9053\uff0c\u4e5f\u4e0d\u4f1a\u5237\u65b0\u53d1\u9001\u7f13\u51b2\u533a\u3002\u5728\u7ba1\u9053\u6a21\u5f0f\u4e0b\uff0c\u8bed\u53e5\u4f1a\u88ab\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u4e0d\u7b49\u5f85\u524d\u9762\u8bed\u53e5\u7684\u7ed3\u679c\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/19/libpq-pipeline-mode.html\" title=\"32.5.\u00a0\u7ba1\u9053\u6a21\u5f0f\">\u7b2c\u00a032.5\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u7ba1\u9053\u8fdb\u884c\u671f\u95f4\u6267\u884c\u7684\u6240\u6709\u67e5\u8be2\u90fd\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002\u4ee5\u5206\u53f7\u7ed3\u675f\u7684\u67e5\u8be2\u4f1a\u88ab\u8ffd\u52a0\u5230\u7ba1\u9053\u4e2d\u3002\u5143\u547d\u4ee4 <code class=\"literal\">\\bind</code>\u3001<code class=\"literal\">\\bind_named</code>\u3001<code class=\"literal\">\\close_prepared</code> \u548c <code class=\"literal\">\\parse</code> \u53ef\u4ee5\u5728\u8fdb\u884c\u4e2d\u7684\u7ba1\u9053\u91cc\u4f7f\u7528\u3002\u7ba1\u9053\u8fdb\u884c\u671f\u95f4\uff0c<code class=\"literal\">\\sendpipeline</code> \u4f1a\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u8ffd\u52a0\u5230\u7ba1\u9053\u4e2d\u3002\u5176\u4ed6\u5143\u547d\u4ee4\uff0c\u5982 <code class=\"literal\">\\g</code>\u3001<code class=\"literal\">\\gx</code> \u6216 <code class=\"literal\">\\gdesc</code>\uff0c\u5219\u4e0d\u5141\u8bb8\u5728\u7ba1\u9053\u6a21\u5f0f\u4e2d\u4f7f\u7528\u3002</p>\n<p lang=\"zh\"><code class=\"command\">\\flushrequest</code> \u4f1a\u5411\u7ba1\u9053\u8ffd\u52a0\u4e00\u6761 flush \u547d\u4ee4\uff0c\u4f7f\u5f97\u53ef\u4ee5\u5728\u4e0d\u53d1\u9001 sync \u6216\u7ed3\u675f\u7ba1\u9053\u7684\u60c5\u51b5\u4e0b\u901a\u8fc7 <code class=\"command\">\\getresults</code> \u8bfb\u53d6\u7ed3\u679c\u3002<code class=\"command\">\\getresults</code> \u4f1a\u81ea\u52a8\u5c06\u5c1a\u672a\u53d1\u9001\u7684\u6570\u636e\u63a8\u9001\u5230\u670d\u52a1\u5668\u3002<code class=\"command\">\\flush</code> \u53ef\u7528\u4e8e\u624b\u52a8\u63a8\u9001\u672a\u53d1\u9001\u7684\u6570\u636e\u3002</p>\n<p lang=\"zh\"><code class=\"command\">\\getresults</code> \u63a5\u53d7\u4e00\u4e2a\u53ef\u9009\u7684 <em class=\"replaceable\"><code>number_results</code></em> \u53c2\u6570\u3002\u5982\u679c\u63d0\u4f9b\uff0c\u5219\u53ea\u8bfb\u53d6\u524d <em class=\"replaceable\"><code>number_results</code></em> \u4e2a\u5f85\u5904\u7406\u7ed3\u679c\u3002\u82e5\u7701\u7565\u8be5\u53c2\u6570\u6216\u5176\u503c\u4e3a <code class=\"literal\">0</code>\uff0c\u5219\u8bfb\u53d6\u6240\u6709\u5f85\u5904\u7406\u7ed3\u679c\u3002</p>\n<p lang=\"zh\">\u5f53\u7ba1\u9053\u6a21\u5f0f\u5904\u4e8e\u6d3b\u52a8\u72b6\u6001\u65f6\uff0c\u53ef\u4f7f\u7528\u4e00\u4e2a\u4e13\u7528\u7684\u63d0\u793a\u7b26\u53d8\u91cf\u6765\u62a5\u544a\u7ba1\u9053\u72b6\u6001\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/19/app-psql.html#APP-PSQL-PROMPTING-P-UC\"><code class=\"literal\">%P</code></a>\u3002</p>\n<p lang=\"zh\"><code class=\"command\">COPY</code> \u5728\u7ba1\u9053\u6a21\u5f0f\u4e2d\u4e0d\u652f\u6301\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\startpipeline\nSELECT * FROM pg_class;\nSELECT 1 \\bind \\sendpipeline\n\\flushrequest\n\\getresults\n\\endpipeline\n</pre>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-T-LC\"><span class=\"term\"><code class=\"literal\">\\t</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u8f93\u51fa\u4e2d\u7684\u5217\u540d\u6807\u9898\u548c\u884c\u6570\u9875\u811a\u7684\u663e\u793a\u72b6\u6001\u3002\u8fd9\u4e2a\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset tuples_only</code>\uff0c\u63d0\u4f9b\u5b83\u662f\u4e3a\u4e86\u4f7f\u7528\u65b9\u4fbf\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-T-UC\"><span class=\"term\"><code class=\"literal\">\\T <em class=\"replaceable\"><code>table_options</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728<acronym class=\"acronym\">HTML</acronym>\u8f93\u51fa\u683c\u5f0f\u4e2d\u653e\u5728<code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u5c5e\u6027\u3002\u8fd9\u4e2a\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset tableattr <em class=\"replaceable\"><code>table_options</code></em></code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-TIMING\"><span class=\"term\"><code class=\"literal\">\\timing [ <em class=\"replaceable\"><code>on</code></em> | <em class=\"replaceable\"><code>off</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5e26\u53c2\u6570\u65f6\uff0c\u5f00\u542f\u6216\u5173\u95ed\u6bcf\u6761 SQL \u8bed\u53e5\u6267\u884c\u8017\u65f6\u7684\u663e\u793a\u3002\u4e0d\u5e26\u53c2\u6570\u65f6\uff0c\u5207\u6362\u663e\u793a\u7684\u5f00\u5173\u72b6\u6001\u3002\u8017\u65f6\u4ee5\u6beb\u79d2\u663e\u793a\uff1b\u8d85\u8fc7 1 \u79d2\u7684\u65f6\u95f4\u95f4\u9694\u8fd8\u4f1a\u4ee5\u5206\u949f:\u79d2\u7684\u683c\u5f0f\u663e\u793a\uff0c\u5fc5\u8981\u65f6\u6dfb\u52a0\u5c0f\u65f6\u548c\u5929\u5b57\u6bb5\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-UNRESTRICT\"><span class=\"term\"><code class=\"literal\">\\unrestrict <em class=\"replaceable\"><code>restrict_key</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u9000\u51fa<span class=\"quote\">\u201c<span class=\"quote\">\u53d7\u9650</span>\u201d</span>\u6a21\u5f0f\uff08\u5373\u6240\u6709\u5176\u4ed6\u5143\u547d\u4ee4\u90fd\u88ab\u963b\u6b62\u7684\u6a21\u5f0f\uff09\uff0c\u524d\u63d0\u662f\u6307\u5b9a\u7684\u5bc6\u94a5\u4e0e\u8fdb\u5165\u53d7\u9650\u6a21\u5f0f\u65f6\u4f20\u7ed9<code class=\"command\">\\restrict</code>\u7684\u5bc6\u94a5\u5339\u914d\u3002</p>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4e3b\u8981\u7528\u4e8e pg_dump\u3001pg_dumpall \u548c pg_restore \u751f\u6210\u7684\u7eaf\u6587\u672c\u8f6c\u50a8\uff0c\u4e5f\u53ef\u80fd\u9002\u7528\u4e8e\u5176\u4ed6\u573a\u666f\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u5269\u4f59\u884c\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\unrestrict</code>\u7684\u53c2\u6570\uff0c\u5e76\u4e14\u4e0d\u4f1a\u6267\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-UNSET\"><span class=\"term\"><code class=\"literal\">\\unset <em class=\"replaceable\"><code>name</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u53d6\u6d88\u8bbe\u7f6e\uff08\u5220\u9664\uff09<span class=\"application\">psql</span>\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u3002</p>\n<p lang=\"zh\">\u5927\u591a\u6570\u63a7\u5236<span class=\"application\">psql</span>\u884c\u4e3a\u7684\u53d8\u91cf\u4e0d\u80fd\u53d6\u6d88\u8bbe\u7f6e\uff1b\u5bf9\u4e8e\u8fd9\u4e9b\u53d8\u91cf\uff0c<code class=\"literal\">\\unset</code>\u547d\u4ee4\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u5176\u8bbe\u7f6e\u4e3a\u9ed8\u8ba4\u503c\u3002\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/19/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-WRITE\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\w</code> \u6216 <code class=\"literal\">\\write</code> <em class=\"replaceable\"><code>filename</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\w</code> \u6216 <code class=\"literal\">\\write</code> <code class=\"literal\">|</code><em class=\"replaceable\"><code>command</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u5199\u5165\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u9012\u7ed9 shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6539\u4e3a\u5199\u5165\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\uff0c\u5219\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u7684\u5185\u5bb9\u53ea\u4f1a\u539f\u6837\u4f20\u9012\u7ed9 shell\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-WARN\"><span class=\"term\"><code class=\"literal\">\\warn <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u547d\u4ee4\u4e0e<code class=\"command\">\\echo</code>\u547d\u4ee4\u76f8\u540c\uff0c\u53ea\u662f\u8f93\u51fa\u5c06\u88ab\u5199\u5165<span class=\"application\">psql</span>\u7684\u6807\u51c6\u9519\u8bef\u901a\u9053\uff0c\u800c\u4e0d\u662f\u6807\u51c6\u8f93\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-WATCH\"><span class=\"term\"><code class=\"literal\">\\watch [ i[nterval]=<em class=\"replaceable\"><code>seconds</code></em> ] [ c[ount]=<em class=\"replaceable\"><code>times</code></em> ] [ m[in_rows]=<em class=\"replaceable\"><code>rows</code></em> ] [ <em class=\"replaceable\"><code>seconds</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u91cd\u590d\u6267\u884c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\uff08\u5982\u540c <code class=\"literal\">\\g</code> \u4e00\u6837\uff09\uff0c\u76f4\u5230\u88ab\u4e2d\u65ad\u3001\u67e5\u8be2\u5931\u8d25\u3001\u8fbe\u5230\u6267\u884c\u6b21\u6570\u4e0a\u9650\uff08\u5982\u679c\u7ed9\u5b9a\uff09\u6216\u67e5\u8be2\u8fd4\u56de\u7684\u884c\u6570\u4f4e\u4e8e\u6700\u5c0f\u8981\u6c42\u3002\u4e24\u6b21\u6267\u884c\u4e4b\u95f4\u7b49\u5f85\u6307\u5b9a\u7684\u79d2\u6570\uff08\u9ed8\u8ba4 2 \u79d2\uff09\u3002\u9ed8\u8ba4\u7b49\u5f85\u65f6\u95f4\u53ef\u901a\u8fc7\u53d8\u91cf<a class=\"xref\" href=\"/docs/19/app-psql.html#APP-PSQL-VARIABLES-WATCH-INTERVAL\"><code class=\"varname\">WATCH_INTERVAL</code></a>\u4fee\u6539\u3002\u4e3a\u4fdd\u6301\u5411\u540e\u517c\u5bb9\uff0c<em class=\"replaceable\"><code>seconds</code></em> \u53ef\u4ee5\u5e26\u6216\u4e0d\u5e26 <code class=\"literal\">interval=</code> \u524d\u7f00\u3002\u6bcf\u6b21\u67e5\u8be2\u7ed3\u679c\u90fd\u4f1a\u5e26\u6709\u4e00\u4e2a\u5934\u90e8\uff0c\u5176\u4e2d\u5305\u542b <code class=\"literal\">\\pset title</code> \u5b57\u7b26\u4e32\uff08\u5982\u679c\u6709\uff09\u3001\u67e5\u8be2\u5f00\u59cb\u65f6\u7684\u65f6\u95f4\u4ee5\u53ca\u5ef6\u8fdf\u95f4\u9694\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-X\"><span class=\"term\"><code class=\"literal\">\\x [ <em class=\"replaceable\"><code>on</code></em> | <em class=\"replaceable\"><code>off</code></em> | <em class=\"replaceable\"><code>auto</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u6216\u5207\u6362\u6269\u5c55\u8868\u683c\u683c\u5f0f\u6a21\u5f0f\u3002\u5b83\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset expanded</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-Z\"><span class=\"term\"><code class=\"literal\">\\z[Sx] [ <a class=\"link\" href=\"https://pg.center/docs/19/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u53ca\u5176\u76f8\u5173\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002</p>\n<p lang=\"zh\">\u8fd9\u662f<code class=\"command\">\\dp</code>\u7684\u522b\u540d\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u663e\u793a\u6743\u9650</span>\u201d</span>\uff09\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-EXCLAMATION-MARK\"><span class=\"term\"><code class=\"literal\">\\! [ <em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u5e26\u53c2\u6570\u65f6\uff0c\u8fdb\u5165\u4e00\u4e2a\u5b50 shell\uff1b\u5b50 shell \u9000\u51fa\u540e\uff0c<span class=\"application\">psql</span>\u6062\u590d\u8fd0\u884c\u3002\u5e26\u53c2\u6570\u65f6\uff0c\u6267\u884c shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\!</code>\u7684\u53c2\u6570\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u5185\u5bb9\u4f1a\u539f\u6837\u4f20\u7ed9 shell\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-QUESTION-MARK\"><span class=\"term\"><code class=\"literal\">\\? [ <em class=\"replaceable\"><code>topic</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5e2e\u52a9\u4fe1\u606f\u3002\u53ef\u9009\u7684<em class=\"replaceable\"><code>topic</code></em>\u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a<code class=\"literal\">commands</code>\uff09\u9009\u62e9\u8981\u89e3\u91ca\u7684<span class=\"application\">psql</span>\u7684\u54ea\u4e2a\u90e8\u5206\uff1a<code class=\"literal\">commands</code>\u63cf\u8ff0<span class=\"application\">psql</span>\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b<code class=\"literal\">options</code>\u63cf\u8ff0\u53ef\u4ee5\u4f20\u9012\u7ed9<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c<code class=\"literal\">variables</code>\u663e\u793a\u5173\u4e8e<span class=\"application\">psql</span>\u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-SEMICOLON\"><span class=\"term\"><code class=\"literal\">\\;</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u53cd\u659c\u7ebf\u5206\u53f7\u4e0d\u50cf\u524d\u9762\u7684\u547d\u4ee4\u90a3\u6837\u662f\u4e00\u4e2a\u5143\u547d\u4ee4\uff1b\u76f8\u53cd\uff0c\u5b83\u53ea\u662f\u5728\u4e0d\u8fdb\u884c\u8fdb\u4e00\u6b65\u5904\u7406\u7684\u60c5\u51b5\u4e0b\u5c06\u4e00\u4e2a\u5206\u53f7\u6dfb\u52a0\u5230\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u3002</p>\n<p lang=\"zh\">\u901a\u5e38\uff0c<span class=\"application\">psql</span>\u4f1a\u5728\u5230\u8fbe\u547d\u4ee4\u7ed3\u675f\u7684\u5206\u53f7\u65f6\u7acb\u5373\u5c06SQL\u547d\u4ee4\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u5373\u4f7f\u5f53\u524d\u884c\u8fd8\u6709\u66f4\u591a\u8f93\u5165\u3002\u56e0\u6b64\uff0c\u4f8b\u5982\u8f93\u5165</p>\n<pre class=\"programlisting\">SELECT 1; SELECT 2; SELECT 3;\n</pre>\n<p lang=\"zh\">\u5c06\u5bfc\u81f4\u4e09\u4e2aSQL\u547d\u4ee4\u5206\u522b\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u6bcf\u4e2a\u547d\u4ee4\u7684\u7ed3\u679c\u5728\u7ee7\u7eed\u4e0b\u4e00\u4e2a\u547d\u4ee4\u4e4b\u524d\u663e\u793a\u3002\u7136\u800c\uff0c\u8f93\u5165\u4e3a<code class=\"literal\">\\;</code>\u7684\u5206\u53f7\u4e0d\u4f1a\u89e6\u53d1\u547d\u4ee4\u5904\u7406\uff0c\u56e0\u6b64\u5b83\u4e4b\u524d\u548c\u4e4b\u540e\u7684\u547d\u4ee4\u5b9e\u9645\u4e0a\u88ab\u5408\u5e76\u5e76\u4f5c\u4e3a\u4e00\u4e2a\u8bf7\u6c42\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u56e0\u6b64\uff0c\u4f8b\u5982</p>\n<pre class=\"programlisting\">SELECT 1\\; SELECT 2\\; SELECT 3;\n</pre>\n<p lang=\"zh\">\u4f1a\u5728\u9047\u5230\u524d\u9762\u6ca1\u6709\u53cd\u659c\u7ebf\u7684\u5206\u53f7\u65f6\uff0c\u5c06\u8fd9\u4e09\u4e2a SQL \u547d\u4ee4\u4f5c\u4e3a\u5355\u4e2a\u8bf7\u6c42\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u670d\u52a1\u5668\u4f1a\u5c06\u6b64\u7c7b\u8bf7\u6c42\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff0c\u9664\u975e\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u663e\u5f0f\u7684<code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code>\u547d\u4ee4\u5c06\u5176\u5206\u6210\u591a\u4e2a\u4e8b\u52a1\u3002\uff08\u6709\u5173\u670d\u52a1\u5668\u5982\u4f55\u5904\u7406\u591a\u67e5\u8be2\u5b57\u7b26\u4e32\u7684\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/19/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT\" title=\"54.2.2.1.\u00a0\u4e00\u4e2a\u7b80\u5355\u67e5\u8be2\u4e2d\u7684\u591a\u6761\u8bed\u53e5\">\u7b2c\u00a054.2.2.1\u00a0\u8282</a>\u3002\uff09</p>\n</dd>\n</dl>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-PATTERNS\">\n<h4 lang=\"zh\">\u6a21\u5f0f</h4>\n<p lang=\"zh\">\u5f88\u591a<code class=\"literal\">\\d</code>\u547d\u4ee4\u90fd\u53ef\u4ee5\u7528\u4e00\u4e2a<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\u6765\u6307\u5b9a\u8981\u88ab\u663e\u793a\u7684\u5bf9\u8c61\u540d\u79f0\u3002\u5728\u6700\u7b80\u5355\u7684\u60c5\u51b5\u4e0b\uff0c\u6a21\u5f0f\u6b63\u597d\u5c31\u662f\u8be5\u5bf9\u8c61\u7684\u51c6\u786e\u540d\u79f0\u3002\u5728\u6a21\u5f0f\u4e2d\u7684\u5b57\u7b26\u901a\u5e38\u4f1a\u88ab\u53d8\u6210\u5c0f\u5199\u5f62\u5f0f\uff08\u5c31\u50cf\u5728 SQL \u540d\u79f0\u4e2d\u90a3\u6837\uff09\uff0c\u4f8b\u5982<code class=\"literal\">\\dt FOO</code>\u5c06\u4f1a\u663e\u793a\u540d\u4e3a<code class=\"literal\">foo</code>\u7684\u8868\u3002\u5c31\u50cf\u5728 SQL \u540d\u79f0\u4e2d\u90a3\u6837\uff0c\u628a\u6a21\u5f0f\u653e\u5728\u53cc\u5f15\u53f7\u4e2d\u53ef\u4ee5\u963b\u6b62\u5b83\u88ab\u8f6c\u6362\u6210\u5c0f\u5199\u5f62\u5f0f\u3002\u5982\u679c\u9700\u8981\u5728\u4e00\u4e2a\u6a21\u5f0f\u4e2d\u5305\u62ec\u4e00\u4e2a\u771f\u6b63\u7684\u53cc\u5f15\u53f7\u5b57\u7b26\uff0c\u5219\u9700\u8981\u5728\u53cc\u5f15\u53f7\u5305\u56f4\u7684\u6587\u672c\u5185\u628a\u5b83\u5199\u6210\u4e24\u4e2a\u76f8\u90bb\u7684\u53cc\u5f15\u53f7\uff0c\u8fd9\u540c\u6837\u662f\u7b26\u5408 SQL \u52a0\u5f15\u53f7\u6807\u8bc6\u7b26\u7684\u89c4\u5219\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dt \"FOO\"\"BAR\"</code>\u5c06\u663e\u793a\u540d\u4e3a<code class=\"literal\">FOO\"BAR</code>\uff08\u4e0d\u662f<code class=\"literal\">foo\"bar</code>\uff09\u7684\u8868\u3002\u548c\u666e\u901a\u7684 SQL \u540d\u79f0\u89c4\u5219\u4e0d\u540c\uff0c\u4f60\u53ef\u4ee5\u53ea\u5728\u6a21\u5f0f\u7684\u4e00\u90e8\u5206\u5468\u56f4\u653e\u4e0a\u53cc\u5f15\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">\\dt FOO\"FOO\"BAR</code>\u5c06\u4f1a\u663e\u793a\u540d\u4e3a<code class=\"literal\">fooFOObar</code>\u7684\u8868\u3002</p>\n<p lang=\"zh\">\u53ea\u8981\u5b8c\u5168\u7701\u7565<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\uff0c<code class=\"literal\">\\d</code>\u547d\u4ee4\u5c31\u4f1a\u663e\u793a\u5f53\u524d\u6a21\u5f0f\u641c\u7d22\u8def\u5f84\u4e2d\u53ef\u89c1\u7684\u5168\u90e8\u5bf9\u8c61 \u2014 \u8fd9\u7b49\u4ef7\u4e8e\u7528<code class=\"literal\">*</code>\u4f5c\u4e3a\u6a21\u5f0f\uff08\u5982\u679c\u4e00\u4e2a\u5bf9\u8c61\u6240\u5728\u7684\u6a21\u5f0f\u4f4d\u4e8e\u641c\u7d22\u8def\u5f84\u4e2d\uff0c\u5e76\u4e14\u5728\u641c\u7d22\u8def\u5f84\u4e2d\u8be5\u6a21\u5f0f\u4e4b\u524d\u6ca1\u6709\u540c\u7c7b\u4e14\u540c\u540d\u7684\u5bf9\u8c61\uff0c\u5219\u8be5\u5bf9\u8c61\u5c31\u662f<em class=\"firstterm\">\u53ef\u89c1</em>\u7684\u3002\u8fd9\u8868\u793a\u53ef\u4ee5\u76f4\u63a5\u7528\u540d\u79f0\u5f15\u7528\u8be5\u5bf9\u8c61\uff0c\u800c\u4e0d\u9700\u8981\u7528\u6a21\u5f0f\u6765\u9650\u5b9a\uff09\u3002\u8981\u67e5\u770b\u6570\u636e\u5e93\u4e2d\u6240\u6709\u5bf9\u8c61\u800c\u4e0d\u8003\u8651\u5176\u53ef\u89c1\u6027\uff0c\u53ef\u4ee5\u628a<code class=\"literal\">*.*</code>\u7528\u4f5c\u6a21\u5f0f\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u653e\u5728\u4e00\u4e2a\u6a21\u5f0f\u4e2d\uff0c<code class=\"literal\">*</code>\u5c06\u5339\u914d\u4efb\u610f\u5b57\u7b26\u5e8f\u5217\uff08\u5305\u62ec\u7a7a\u5e8f\u5217\uff09\uff0c\u800c<code class=\"literal\">?</code>\u4f1a\u5339\u914d\u4efb\u610f\u7684\u5355\u4e2a\u5b57\u7b26\uff08\u8fd9\u79cd\u8bb0\u53f7\u65b9\u6cd5\u5c31\u50cf Unix shell \u7684\u6587\u4ef6\u540d\u6a21\u5f0f\u4e00\u6837\uff09\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dt int*</code>\u4f1a\u663e\u793a\u540d\u79f0\u4ee5<code class=\"literal\">int</code>\u5f00\u59cb\u7684\u8868\u3002\u4f46\u662f\u5982\u679c\u88ab\u653e\u5728\u53cc\u5f15\u53f7\u5185\uff0c<code class=\"literal\">*</code>\u548c<code class=\"literal\">?</code>\u5c31\u4f1a\u5931\u53bb\u8fd9\u4e9b\u7279\u6b8a\u542b\u4e49\u800c\u53d8\u6210\u666e\u901a\u7684\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u5305\u542b\u70b9\u53f7\uff08.\uff09\u7684\u5173\u7cfb\u540d\u6a21\u5f0f\u4f1a\u88ab\u89e3\u91ca\u4e3a\u6a21\u5f0f\u540d\u5339\u914d\u6a21\u5f0f\uff0c\u540e\u63a5\u5bf9\u8c61\u540d\u5339\u914d\u6a21\u5f0f\u3002\u4f8b\u5982\uff0c\\dt foo*.*bar* \u4f1a\u663e\u793a\u6240\u6709\u6a21\u5f0f\u540d\u4ee5 foo \u5f00\u5934\u3001\u8868\u540d\u5305\u542b bar \u7684\u8868\u3002\u6ca1\u6709\u70b9\u53f7\u65f6\uff0c\u53ea\u5339\u914d\u5f53\u524d\u6a21\u5f0f\u641c\u7d22\u8def\u5f84\u4e2d\u53ef\u89c1\u7684\u5bf9\u8c61\u3002\u540c\u6837\uff0c\u53cc\u5f15\u53f7\u5185\u7684\u70b9\u53f7\u4e0d\u5177\u6709\u7279\u6b8a\u542b\u4e49\uff0c\u6309\u5b57\u9762\u5339\u914d\u3002\u5305\u542b\u4e24\u4e2a\u70b9\u53f7\uff08.\uff09\u7684\u5173\u7cfb\u540d\u6a21\u5f0f\u4f1a\u88ab\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u540d\uff0c\u540e\u63a5\u6a21\u5f0f\u540d\u5339\u914d\u6a21\u5f0f\uff0c\u518d\u63a5\u5bf9\u8c61\u540d\u5339\u914d\u6a21\u5f0f\u3002\u6570\u636e\u5e93\u540d\u90e8\u5206\u4e0d\u4f5c\u4e3a\u5339\u914d\u6a21\u5f0f\uff0c\u5fc5\u987b\u4e0e\u5f53\u524d\u8fde\u63a5\u7684\u6570\u636e\u5e93\u540d\u79f0\u76f8\u540c\uff0c\u5426\u5219\u4f1a\u62a5\u9519\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7528\u4e8e\u5339\u914d\u6a21\u5f0f\u540d\u7684\u6a21\u5f0f\u5305\u542b\u4e00\u4e2a\u70b9\uff08<code class=\"literal\">.</code>\uff09\uff0c\u5219\u4f1a\u88ab\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u540d\uff0c\u540e\u63a5\u6a21\u5f0f\u540d\u7684\u5339\u914d\u6a21\u5f0f\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dn mydb.*foo*</code>\u4f1a\u663e\u793a\u540d\u79f0\u4e2d\u5305\u542b<code class=\"literal\">foo</code>\u7684\u6240\u6709\u6a21\u5f0f\u3002\u6570\u636e\u5e93\u540d\u90e8\u5206\u4e0d\u4f1a\u88ab\u5f53\u4f5c\u5339\u914d\u6a21\u5f0f\uff0c\u5fc5\u987b\u4e0e\u5f53\u524d\u8fde\u63a5\u7684\u6570\u636e\u5e93\u540d\u76f8\u540c\uff0c\u5426\u5219\u4f1a\u62a5\u9519\u3002</p>\n<p lang=\"zh\">\u9ad8\u7ea7\u7528\u6237\u53ef\u4ee5\u4f7f\u7528\u5b57\u7b26\u7c7b\u7b49\u6b63\u5219\u8868\u8fbe\u5f0f\u8bb0\u6cd5\uff0c\u5982<code class=\"literal\">[0-9]</code>\u53ef\u4ee5\u5339\u914d\u4efb\u610f\u6570\u5b57\u3002\u6240\u6709\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u90fd\u6309\u7167<a class=\"xref\" href=\"/docs/19/functions-matching.html#POSIX-SYNTAX-DETAILS\" title=\"9.7.3.2.\u00a0POSIX \u6b63\u5219\u8868\u8fbe\u5f0f\u7ec6\u8282\">\u7b2c\u00a09.7.3.2\u00a0\u8282</a>\u6240\u8bf4\u7684\u5de5\u4f5c\uff0c\u4ee5\u4e0b\u5b57\u7b26\u9664\u5916\uff1a<code class=\"literal\">.</code>\u4f1a\u6309\u7167\u4e0a\u9762\u6240\u8bf4\u7684\u4f5c\u4e3a\u4e00\u79cd\u5206\u9694\u7b26\uff0c<code class=\"literal\">*</code>\u4f1a\u88ab\u7ffb\u8bd1\u6210\u6b63\u5219\u8868\u8fbe\u5f0f\u8bb0\u53f7<code class=\"literal\">.*</code>\uff0c<code class=\"literal\">?</code>\u4f1a\u88ab\u7ffb\u8bd1\u6210<code class=\"literal\">.</code>\uff0c\u800c<code class=\"literal\">$</code>\u5219\u6309\u5b57\u9762\u610f\u601d\u5339\u914d\u3002\u6839\u636e\u9700\u8981\uff0c\u53ef\u4ee5\u7528<code class=\"literal\">?</code>\u6a21\u62df<code class=\"literal\">.</code>\uff0c\u7528<code class=\"literal\">(<em class=\"replaceable\"><code>R</code></em>+|)</code>\u6a21\u62df<code class=\"literal\"><em class=\"replaceable\"><code>R</code></em>*</code>\uff0c\u6216\u7528<code class=\"literal\">(<em class=\"replaceable\"><code>R</code></em>|)</code>\u6a21\u62df<code class=\"literal\"><em class=\"replaceable\"><code>R</code></em>?</code>\u3002<code class=\"literal\">$</code>\u4e0d\u9700\u8981\u4f5c\u4e3a\u4e00\u4e2a\u6b63\u5219\u8868\u8fbe\u5f0f\u5b57\u7b26\uff0c\u56e0\u4e3a\u6a21\u5f0f\u5fc5\u987b\u5339\u914d\u6574\u4e2a\u540d\u79f0\uff0c\u800c\u4e0d\u662f\u50cf\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5e38\u89c4\u7528\u6cd5\u90a3\u6837\u89e3\u91ca\uff08\u6362\u53e5\u8bdd\u8bf4\uff0c<code class=\"literal\">$</code>\u4f1a\u88ab\u81ea\u52a8\u5730\u8ffd\u52a0\u5230\u6a21\u5f0f\u4e0a\uff09\u3002\u5982\u679c\u4e0d\u5e0c\u671b\u8be5\u6a21\u5f0f\u7684\u5339\u914d\u4f4d\u7f6e\u88ab\u56fa\u5b9a\uff0c\u53ef\u4ee5\u5728\u5f00\u5934\u6216\u8005\u7ed3\u5c3e\u5199\u4e0a<code class=\"literal\">*</code>\u3002\u6ce8\u610f\u5728\u53cc\u5f15\u53f7\u5185\uff0c\u6240\u6709\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u4f1a\u5931\u53bb\u5176\u7279\u6b8a\u542b\u4e49\u5e76\u4e14\u6309\u7167\u5176\u5b57\u9762\u610f\u601d\u8fdb\u884c\u5339\u914d\u3002\u8fd8\u6709\uff0c\u5728\u64cd\u4f5c\u7b26\u540d\u79f0\u6a21\u5f0f\u4e2d\uff08\u5373\u4f5c\u4e3a<code class=\"literal\">\\do</code>\u7684\u53c2\u6570\uff09\uff0c\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u4e5f\u6309\u7167\u5b57\u9762\u610f\u601d\u8fdb\u884c\u5339\u914d\u3002</p>\n</div>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.21.8.5\">\n<h3 lang=\"zh\">\u9ad8\u7ea7\u7279\u6027</h3>\n<div class=\"refsect3\" id=\"APP-PSQL-VARIABLES\">\n<h4 lang=\"zh\">\u53d8\u91cf</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u63d0\u4f9b\u4e86\u548c\u666e\u901a Unix \u547d\u4ee4 shell \u76f8\u4f3c\u7684\u53d8\u91cf\u66ff\u6362\u7279\u6027\u3002\u53d8\u91cf\u7b80\u5355\u6765\u8bf4\u5c31\u662f\u4e00\u5bf9\u540d\u79f0/\u503c\uff0c\u5176\u4e2d\u503c\u53ef\u4ee5\u662f\u4efb\u610f\u957f\u5ea6\u7684\u4efb\u610f\u5b57\u7b26\u4e32\u3002\u540d\u79f0\u5fc5\u987b\u7531\u5b57\u6bcd\uff08\u5305\u62ec\u975e\u62c9\u4e01\u5b57\u6bcd\uff09\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u6784\u6210\u3002</p>\n<p lang=\"zh\">\u8981\u8bbe\u7f6e\u4e00\u4e2a\u53d8\u91cf\uff0c\u53ef\u4ee5\u4f7f\u7528<span class=\"application\">psql</span>\u7684\u5143\u547d\u4ee4<code class=\"command\">\\set</code>\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo bar</code></strong>\n</pre>\n<p lang=\"zh\">\u4f1a\u5c06<code class=\"literal\">foo</code>\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">bar</code>\u3002\u8981\u68c0\u7d22\u8be5\u53d8\u91cf\u7684\u5185\u5bb9\uff0c\u53ef\u4ee5\u5728\u540d\u79f0\u524d\u653e\u4e00\u4e2a\u5192\u53f7\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\echo :foo</code></strong>\nbar\n</pre>\n<p lang=\"zh\">\u8fd9\u5728\u5e38\u89c4 SQL \u547d\u4ee4\u548c\u5143\u547d\u4ee4\u4e2d\u5747\u6709\u6548\uff0c\u4e0b\u6587\u7684<a class=\"xref\" href=\"/docs/19/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL \u63d2\u503c\">SQL \u63d2\u503c</a>\u4e2d\u6709\u66f4\u591a\u7ec6\u8282\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u8c03\u7528<code class=\"command\">\\set</code>\u65f6\u6ca1\u6709\u7b2c\u4e8c\u4e2a\u53c2\u6570\uff0c\u8be5\u53d8\u91cf\u4f1a\u88ab\u8bbe\u7f6e\u4e3a\u4e00\u4e2a\u7a7a\u5b57\u7b26\u4e32\u503c\u3002\u8981\u53d6\u6d88\u8bbe\u7f6e\uff08\u5373\u5220\u9664\uff09\u4e00\u4e2a\u53d8\u91cf\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4<code class=\"command\">\\unset</code>\u3002\u8981\u663e\u793a\u6240\u6709\u53d8\u91cf\u7684\u503c\uff0c\u5728\u8c03\u7528<code class=\"command\">\\set</code>\u65f6\u4e0d\u5e26\u4efb\u4f55\u53c2\u6570\u5373\u53ef\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\"><code class=\"command\">\\set</code>\u7684\u53c2\u6570\u670d\u4ece\u4e0e\u5176\u4ed6\u547d\u4ee4\u76f8\u540c\u7684\u66ff\u6362\u89c4\u5219\u3002\u56e0\u6b64\u53ef\u4ee5\u6784\u9020\u6709\u8da3\u7684\u5f15\u7528\uff0c\u4f8b\u5982<code class=\"literal\">\\set :foo 'something'</code>\u4ee5\u53ca\u5206\u522b\u5f97\u5230<span class=\"productname\">Perl</span>\u6216\u8005<span class=\"productname\"><acronym class=\"acronym\">PHP</acronym></span>\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u8f6f\u94fe\u63a5</span>\u201d</span>\u6216\u8005<span class=\"quote\">\u201c<span class=\"quote\">\u53ef\u53d8\u53d8\u91cf</span>\u201d</span>\u3002\u4e0d\u5e78\u7684\u662f\uff08\u6216\u8005\u5e78\u8fd0\u7684\u662f\uff1f\uff09\uff0c\u8fd9\u4e9b\u6784\u9020\u51fa\u6765\u7684\u4e1c\u897f\u5e76\u6ca1\u6709\u4ec0\u4e48\u7528\u5904\u3002\u5728\u53e6\u4e00\u65b9\u9762\uff0c<code class=\"literal\">\\set bar :foo</code>\u662f\u4e00\u79cd\u5f88\u597d\u7684\u62f7\u8d1d\u53d8\u91cf\u7684\u65b9\u6cd5\u3002</p>\n</div>\n<p lang=\"zh\">\u6709\u4e00\u4e9b\u53d8\u91cf\u4f1a\u88ab<span class=\"application\">psql</span>\u7279\u6b8a\u5bf9\u5f85\u3002\u5b83\u4eec\u8868\u793a\u7279\u5b9a\u7684\u9009\u9879\u8bbe\u7f6e\uff0c\u8fd0\u884c\u65f6\u8fd9\u7c7b\u9009\u9879\u8bbe\u7f6e\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539\u8be5\u53d8\u91cf\u7684\u503c\u6765\u6539\u53d8\uff0c\u6216\u8005\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u5b83\u4eec\u8868\u793a<span class=\"application\">psql</span>\u7684\u53ef\u66f4\u6539\u7684\u72b6\u6001\u3002\u6309\u7167\u60ef\u4f8b\uff0c\u6240\u6709\u88ab\u7279\u6b8a\u5bf9\u5f85\u7684\u53d8\u91cf\u7684\u540d\u79f0\u7531\u5168\u90e8\u5927\u5199\u5f62\u5f0f\u7684 ASCII \u5b57\u6bcd\uff08\u8fd8\u6709\u53ef\u80fd\u662f\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\uff09\u7ec4\u6210\u3002\u4e3a\u4e86\u786e\u4fdd\u672a\u6765\u6700\u5927\u7684\u517c\u5bb9\u6027\uff0c\u6700\u597d\u907f\u514d\u628a\u8fd9\u7c7b\u53d8\u91cf\u540d\u7528\u4e8e\u81ea\u5df1\u7684\u76ee\u7684\u3002</p>\n<p lang=\"zh\">\u63a7\u5236<span class=\"application\">psql</span>\u884c\u4e3a\u7684\u53d8\u91cf\u901a\u5e38\u4e0d\u80fd\u88ab\u53d6\u6d88\u8bbe\u7f6e\u6216\u8005\u8bbe\u7f6e\u4e3a\u65e0\u6548\u503c\u3002\u5141\u8bb8<code class=\"literal\">\\unset</code>\u547d\u4ee4\uff0c\u4f46\u5b83\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u5b83\u7684\u9ed8\u8ba4\u503c\u3002\u6ca1\u6709\u7b2c\u4e8c\u53c2\u6570\u7684<code class=\"literal\">\\set</code>\u547d\u4ee4\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\uff08\u5bf9\u4e8e\u63a5\u53d7\u8be5\u503c\u7684\u63a7\u5236\u53d8\u91cf\uff09\uff0c\u5bf9\u4e0d\u63a5\u53d7\u8be5\u503c\u7684\u53d8\u91cf\u5219\u4f1a\u62d2\u7edd\u8fd9\u4e2a\u547d\u4ee4\u3002\u6b64\u5916\uff0c\u63a5\u53d7\u503c<code class=\"literal\">on</code>\u548c<code class=\"literal\">off</code>\u7684\u63a7\u5236\u53d8\u91cf\u4e5f\u80fd\u63a5\u53d7\u5176\u4ed6\u5e38\u89c1\u7684\u5e03\u5c14\u503c\u62fc\u5199\u65b9\u5f0f\uff0c\u4f8b\u5982<code class=\"literal\">true</code>\u548c<code class=\"literal\">false</code>\u3002</p>\n<p lang=\"zh\">\u88ab\u7279\u6b8a\u5bf9\u5f85\u7684\u53d8\u91cf\u662f\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-VARIABLES-AUTOCOMMIT\"><span class=\"term\"><code class=\"varname\">AUTOCOMMIT</code> </span> </dt>\n<dd>\n<p lang=\"zh\">\u5728\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\uff08\u9ed8\u8ba4\uff09\u65f6\uff0c\u6bcf\u4e00\u4e2a SQL \u547d\u4ee4\u5728\u6210\u529f\u5b8c\u6210\u65f6\u4f1a\u88ab\u81ea\u52a8\u63d0\u4ea4\u3002\u5728\u8fd9\u79cd\u6a21\u5f0f\u4e2d\u8981\u63a8\u8fdf\u63d0\u4ea4\uff0c\u5fc5\u987b\u8f93\u5165\u4e00\u4e2a<code class=\"command\">BEGIN</code>\u6216\u8005<code class=\"command\">START TRANSACTION</code> SQL \u547d\u4ee4\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">off</code>\u6216\u8005\u88ab\u53d6\u6d88\u8bbe\u7f6e\u65f6\uff0c\u5728\u663e\u5f0f\u53d1\u51fa<code class=\"command\">COMMIT</code>\u6216\u8005<code class=\"command\">END</code>\u4e4b\u524d\uff0cSQL \u547d\u4ee4\u4e0d\u4f1a\u88ab\u63d0\u4ea4\u3002\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u4f1a\u4e3a\u4f60\u53d1\u51fa\u4e00\u4e2a\u9690\u5f0f\u7684<code class=\"command\">BEGIN</code>\uff0c\u8fd9\u4f1a\u53d1\u751f\u5728\u547d\u4ee4\u6267\u884c\u4e4b\u524d\uff0c\u524d\u63d0\u662f\u8be5\u547d\u4ee4\u4e0d\u5728\u4e8b\u52a1\u5757\u4e2d\uff0c\u4e14\u5176\u672c\u8eab\u65e2\u4e0d\u662f<code class=\"command\">BEGIN</code>\u6216\u5176\u4ed6\u4e8b\u52a1\u63a7\u5236\u547d\u4ee4\uff0c\u4e5f\u4e0d\u662f\u65e0\u6cd5\u5728\u4e8b\u52a1\u5757\u4e2d\u6267\u884c\u7684\u547d\u4ee4\uff08\u4f8b\u5982<code class=\"command\">VACUUM</code>\uff09\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u4e2d\uff0c\u5fc5\u987b\u901a\u8fc7<code class=\"command\">ABORT</code>\u6216\u8005<code class=\"command\">ROLLBACK</code>\u663e\u5f0f\u5730\u653e\u5f03\u4efb\u4f55\u5931\u8d25\u7684\u4e8b\u52a1\u3002\u8fd8\u8981\u8bb0\u4f4f\uff0c\u5982\u679c\u9000\u51fa\u4f1a\u8bdd\u65f6\u6ca1\u6709\u63d0\u4ea4\uff0c\u5219\u6240\u6709\u7684\u5de5\u4f5c\u90fd\u4f1a\u4e22\u5931\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u81ea\u52a8\u63d0\u4ea4\u6253\u5f00\u6a21\u5f0f\u662f<span class=\"productname\">PostgreSQL</span>\u7684\u4f20\u7edf\u884c\u4e3a\uff0c\u4f46\u662f\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u66f4\u63a5\u8fd1\u4e8e SQL \u7684\u89c4\u8303\u3002\u5982\u679c\u66f4\u559c\u6b22\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\uff0c\u53ef\u4ee5\u5728\u7cfb\u7edf\u7ea7\u7684<code class=\"filename\">psqlrc</code>\u6587\u4ef6\u6216\u8005\u4e2a\u4eba\u7684<code class=\"filename\">~/.psqlrc</code>\u6587\u4ef6\u4e2d\u8bbe\u7f6e\u5b83\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-COMP-KEYWORD-CASE\"><span class=\"term\"><code class=\"varname\">COMP_KEYWORD_CASE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u786e\u5b9a\u5728\u8865\u5168\u4e00\u4e2a SQL \u5173\u952e\u8bcd\u65f6\u8981\u4f7f\u7528\u7684\u5927\u5c0f\u5199\u5f62\u5f0f\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">lower</code>\u6216\u8005<code class=\"literal\">upper</code>\uff0c\u8865\u5168\u540e\u7684\u8bcd\u5c06\u5206\u522b\u662f\u5c0f\u5199\u6216\u8005\u5927\u5199\u5f62\u5f0f\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">preserve-lower</code>\u6216\u8005<code class=\"literal\">preserve-upper</code>\uff08\u9ed8\u8ba4\uff09\uff0c\u8865\u5168\u540e\u7684\u8bcd\u5c06\u4f1a\u4fdd\u6301\u8be5\u8bcd\u5df2\u8f93\u5165\u90e8\u5206\u7684\u5927\u5c0f\u5199\u5f62\u5f0f\uff0c\u4f46\u662f\u5982\u679c\u88ab\u8865\u5168\u7684\u8bcd\u8fd8\u6ca1\u6709\u88ab\u8f93\u5165\uff0c\u5219\u5b83\u4f1a\u88ab\u5206\u522b\u8865\u5168\u6210\u5c0f\u5199\u6216\u8005\u5927\u5199\u5f62\u5f0f\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-DBNAME\"><span class=\"term\"><code class=\"varname\">DBNAME</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u5df2\u8fde\u63a5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u662f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ECHO\"><span class=\"term\"><code class=\"varname\">ECHO</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">all</code>\uff0c\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u4f1a\u5728\u8bfb\u5165\u65f6\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u8bfb\u53d6\u7684\u884c\uff09\u3002\u8981\u5728\u7a0b\u5e8f\u5f00\u59cb\u65f6\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\uff0c\u53ef\u4ee5\u4f7f\u7528\u5f00\u5173<code class=\"option\">-a</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">queries</code>\uff0c<span class=\"application\">psql</span>\u4f1a\u5728\u53d1\u9001\u6bcf\u4e2a\u67e5\u8be2\u7ed9\u670d\u52a1\u5668\u65f6\u5c06\u5b83\u4eec\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\u3002\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\u7684\u5f00\u5173\u662f<code class=\"option\">-e</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">errors</code>\uff0c\u90a3\u4e48\u53ea\u6709\u5931\u8d25\u7684\u67e5\u8be2\u4f1a\u88ab\u663e\u793a\u5728\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u4e0a\u3002\u8fd9\u79cd\u884c\u4e3a\u7684\u5f00\u5173\u662f<code class=\"option\">-b</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">none</code>\uff08\u9ed8\u8ba4\u503c\uff09\u5219\u4e0d\u4f1a\u663e\u793a\u4efb\u4f55\u67e5\u8be2\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ECHO-HIDDEN\"><span class=\"term\"><code class=\"varname\">ECHO_HIDDEN</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u4e14\u4e00\u4e2a\u53cd\u659c\u7ebf\u547d\u4ee4\u67e5\u8be2\u6570\u636e\u5e93\u65f6\uff0c\u76f8\u5e94\u7684\u67e5\u8be2\u4f1a\u88ab\u5148\u663e\u793a\u3002\u8fd9\u79cd\u7279\u6027\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u5b66\u4e60<span class=\"productname\">PostgreSQL</span>\u7684\u5185\u90e8\u5e76\u4e14\u5728\u81ea\u5df1\u7684\u7a0b\u5e8f\u4e2d\u63d0\u4f9b\u7c7b\u4f3c\u7684\u529f\u80fd\uff08\u8981\u5728\u7a0b\u5e8f\u5f00\u59cb\u65f6\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\uff0c\u53ef\u4ee5\u4f7f\u7528\u5f00\u5173<code class=\"option\">-E</code>\uff09\u3002\u5982\u679c\u628a\u8fd9\u4e2a\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">noexec</code>\uff0c\u5219\u5bf9\u5e94\u7684\u67e5\u8be2\u53ea\u4f1a\u88ab\u663e\u793a\u800c\u5e76\u4e0d\u771f\u6b63\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u6267\u884c\u3002\u9ed8\u8ba4\u503c\u662f<code class=\"literal\">off</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ENCODING\"><span class=\"term\"><code class=\"varname\">ENCODING</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u7684\u5ba2\u6237\u7aef\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u6bcf\u4e00\u6b21\u4f60\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\uff09\u65f6\u4ee5\u53ca\u5f53\u4f60\u7528<code class=\"literal\">\\encoding</code>\u66f4\u6539\u7f16\u7801\u65f6\uff0c\u8fd9\u4e2a\u53d8\u91cf\u90fd\u4f1a\u88ab\u8bbe\u7f6e\uff0c\u4f46\u5b83\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ERROR\"><span class=\"term\"><code class=\"varname\">ERROR</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u4e0a\u4e00\u4e2aSQL\u67e5\u8be2\u5931\u8d25\u5219\u4e3a<code class=\"literal\">true</code>\uff0c\u5982\u679c\u6210\u529f\u5219\u662f<code class=\"literal\">false</code>\u3002\u53e6\u89c1<code class=\"varname\">SQLSTATE</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-FETCH-COUNT\"><span class=\"term\"><code class=\"varname\">FETCH_COUNT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a\u4e00\u4e2a\u5927\u4e8e\u96f6\u7684\u6574\u6570\u503c\uff0c<code class=\"command\">SELECT</code>\u67e5\u8be2\u7684\u7ed3\u679c\u4f1a\u4ee5\u4e00\u7ec4\u4e00\u7ec4\u7684\u65b9\u5f0f\u53d6\u51fa\u5e76\u4e14\u663e\u793a\uff08\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u7684\u90a3\u6837\u628a\u6574\u4e2a\u7ed3\u679c\u96c6\u62ff\u5230\u4ee5\u540e\u518d\u663e\u793a\uff09\uff0c\u6bcf\u7ec4\u5305\u542b\u7684\u884c\u6570\u7b49\u4e8e\u8be5\u6574\u6570\u503c\u3002\u56e0\u6b64\uff0c\u8fd9\u79cd\u65b9\u5f0f\u53ea\u4f1a\u4f7f\u7528\u6709\u9650\u7684\u5185\u5b58\u91cf\uff0c\u800c\u4e0d\u7ba1\u6574\u4e2a\u7ed3\u679c\u96c6\u7684\u5927\u5c0f\u3002\u5728\u542f\u7528\u8fd9\u4e2a\u7279\u6027\u65f6\uff0c\u901a\u5e38\u4f1a\u4f7f\u7528 100 \u5230 1000 \u7684\u8bbe\u7f6e\u3002\u8bb0\u4f4f\u5728\u4f7f\u7528\u8fd9\u79cd\u7279\u6027\u65f6\uff0c\u4e00\u4e2a\u67e5\u8be2\u53ef\u80fd\u4f1a\u5728\u5df2\u7ecf\u663e\u793a\u4e86\u4e00\u4e9b\u884c\u4e4b\u540e\u5931\u8d25\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5c3d\u7ba1\u53ef\u4ee5\u628a\u8fd9\u79cd\u7279\u6027\u7528\u4e8e\u4efb\u4f55\u7684\u8f93\u51fa\u683c\u5f0f\uff0c\u4f46\u662f\u9ed8\u8ba4\u7684<code class=\"literal\">aligned</code>\u683c\u5f0f\u770b\u8d77\u6765\u4f1a\u6bd4\u8f83\u7cdf\u7cd5\uff0c\u56e0\u4e3a\u6bcf\u4e00\u7ec4\u7684<code class=\"varname\">FETCH_COUNT</code>\u884c\u5c06\u88ab\u5355\u72ec\u683c\u5f0f\u5316\uff0c\u8fd9\u5c31\u4f1a\u5bfc\u81f4\u4e0d\u540c\u7684\u884c\u7ec4\u7684\u5217\u5bbd\u4e0d\u540c\u3002\u5176\u4ed6\u7684\u8f93\u51fa\u683c\u5f0f\u4f1a\u66f4\u597d\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HIDE-TABLEAM\"><span class=\"term\"><code class=\"varname\">HIDE_TABLEAM</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6b64\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">true</code>\uff0c\u5219\u4e0d\u663e\u793a\u8868\u7684\u8bbf\u95ee\u65b9\u6cd5\u7684\u8be6\u7ec6\u4fe1\u606f\u3002\u8fd9\u4e3b\u8981\u7528\u4e8e\u56de\u5f52\u6d4b\u8bd5\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HIDE-TOAST-COMPRESSION\"><span class=\"term\"><code class=\"varname\">HIDE_TOAST_COMPRESSION</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">true</code>\uff0c\u4e0d\u663e\u793a\u5217\u538b\u7f29\u65b9\u6cd5\u7684\u7ec6\u8282\u3002\u8fd9\u4e3b\u8981\u7528\u4e8e\u56de\u5f52\u6d4b\u8bd5\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HISTCONTROL\"><span class=\"term\"><code class=\"varname\">HISTCONTROL</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">ignorespace</code>\uff0c\u5219\u4ee5\u4e00\u4e2a\u7a7a\u683c\u5f00\u59cb\u7684\u884c\u4e0d\u4f1a\u88ab\u653e\u5165\u5230\u5386\u53f2\u5217\u8868\u4e2d\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">ignoredups</code>\uff0c\u5219\u4e0e\u4e0a\u4e00\u6761\u5386\u53f2\u8bb0\u5f55\u76f8\u540c\u7684\u884c\u4e0d\u4f1a\u88ab\u653e\u5165\u3002\u503c<code class=\"literal\">ignoreboth</code>\u7ec4\u5408\u4e86\u4e0a\u8ff0\u4e24\u79cd\u503c\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">none</code>\uff08\u9ed8\u8ba4\u503c\uff09\uff0c\u6240\u6709\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e2d\u88ab\u8bfb\u5165\u7684\u884c\u90fd\u4f1a\u4fdd\u5b58\u5728\u5386\u53f2\u5217\u8868\u4e2d\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HISTFILE\"><span class=\"term\"><code class=\"varname\">HISTFILE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8be5\u6587\u4ef6\u540d\u5c06\u88ab\u7528\u4e8e\u5b58\u50a8\u5386\u53f2\u5217\u8868\u3002\u5982\u679c\u672a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff0c\u6587\u4ef6\u540d\u5c06\u4ece<code class=\"envar\">PSQL_HISTORY</code>\u73af\u5883\u53d8\u91cf\u4e2d\u53d6\u5f97\u3002\u5982\u679c\u8be5\u73af\u5883\u53d8\u91cf\u4e5f\u6ca1\u6709\u88ab\u8bbe\u7f6e\uff0c\u5219\u9ed8\u8ba4\u503c\u662f<code class=\"filename\">~/.psql_history</code>\uff0c\u5728Windows\u4e0a\u662f<code class=\"filename\">%APPDATA%\\postgresql\\psql_history</code>\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">\\set HISTFILE ~/.psql_history-:DBNAME\n</pre>\n<p lang=\"zh\">\u653e\u5728<code class=\"filename\">~/.psqlrc</code>\u4e2d\u5c06\u4f1a\u5bfc\u81f4<span class=\"application\">psql</span>\u4e3a\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u7ef4\u62a4\u4e00\u4e2a\u5355\u72ec\u7684\u5386\u53f2\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HISTSIZE\"><span class=\"term\"><code class=\"varname\">HISTSIZE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u547d\u4ee4\u5386\u53f2\u4e2d\u6700\u591a\u4fdd\u5b58\u7684\u547d\u4ee4\u6570\uff08\u9ed8\u8ba4 500\uff09\u3002\u8bbe\u4e3a\u8d1f\u503c\u65f6\uff0c\u4e0d\u8bbe\u4e0a\u9650\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HOST\"><span class=\"term\"><code class=\"varname\">HOST</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e3b\u673a\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u4e5f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-IGNOREEOF\"><span class=\"term\"><code class=\"varname\">IGNOREEOF</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8bbe\u4e3a 1 \u6216\u66f4\u5c0f\u7684\u503c\uff0c\u5411 psql \u4ea4\u4e92\u4f1a\u8bdd\u53d1\u9001 EOF \u5b57\u7b26\uff08\u901a\u5e38\u4e3a Control + D\uff09\u5c31\u4f1a\u7ec8\u6b62\u5e94\u7528\u3002\u5982\u679c\u8bbe\u4e3a\u66f4\u5927\u7684\u6570\u503c\uff0c\u5219\u5fc5\u987b\u8fde\u7eed\u8f93\u5165\u76f8\u5e94\u6b21\u6570\u7684 EOF \u5b57\u7b26\u624d\u4f1a\u7ec8\u6b62\u4ea4\u4e92\u4f1a\u8bdd\u3002\u5982\u679c\u53d8\u91cf\u8bbe\u4e3a\u975e\u6570\u503c\uff0c\u4f1a\u88ab\u89e3\u91ca\u4e3a 10\u3002\u9ed8\u8ba4\u503c\u4e3a 0\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-LASTOID\"><span class=\"term\"><code class=\"varname\">LASTOID</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6700\u8fd1\u4e00\u6b21\u53d7\u5f71\u54cd\u7684 OID \u503c\uff0c\u7531 INSERT \u6216 \\lo_import \u547d\u4ee4\u8fd4\u56de\u3002\u6b64\u53d8\u91cf\u4ec5\u4fdd\u8bc1\u5728\u4e0b\u4e00\u6761 SQL \u547d\u4ee4\u7684\u7ed3\u679c\u663e\u793a\u4e4b\u524d\u6709\u6548\u3002\u4ece\u7248\u672c 12 \u8d77\uff0cPostgreSQL \u670d\u52a1\u5668\u4e0d\u518d\u652f\u6301 OID \u7cfb\u7edf\u5217\uff0c\u56e0\u6b64\u8fde\u63a5\u5230\u8fd9\u4e9b\u670d\u52a1\u5668\u65f6\uff0c\u6267\u884c INSERT \u540e LASTOID \u59cb\u7ec8\u4e3a 0\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-LAST-ERROR-MESSAGE\"><span class=\"term\"><code class=\"varname\">LAST_ERROR_MESSAGE</code><br/></span><span class=\"term\"><code class=\"varname\">LAST_ERROR_SQLSTATE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d<span class=\"application\">psql</span>\u4f1a\u8bdd\u4e2d\u6700\u8fd1\u4e00\u4e2a\u5931\u8d25\u67e5\u8be2\u7684\u4e3b\u9519\u8bef\u6d88\u606f\u548c\u76f8\u5173\u7684SQLSTATE\u4ee3\u7801\uff0c\u5982\u679c\u5728\u5f53\u524d\u4f1a\u8bdd\u4e2d\u6ca1\u6709\u53d1\u751f\u9519\u8bef\uff0c\u5219\u662f\u4e00\u4e2a\u7a7a\u5b57\u7b26\u4e32\u548c<code class=\"literal\">00000</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ON-ERROR-ROLLBACK\"><span class=\"term\"><code class=\"varname\">ON_ERROR_ROLLBACK</code> </span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u65f6\uff0c\u5982\u679c\u4e8b\u52a1\u5757\u4e2d\u7684\u4e00\u4e2a\u8bed\u53e5\u4ea7\u751f\u4e00\u4e2a\u9519\u8bef\uff0c\u8be5\u9519\u8bef\u4f1a\u88ab\u5ffd\u7565\u5e76\u4e14\u8be5\u4e8b\u52a1\u4f1a\u7ee7\u7eed\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">interactive</code>\u65f6\uff0c\u53ea\u5728\u4ea4\u4e92\u5f0f\u4f1a\u8bdd\u4e2d\u5ffd\u7565\u8fd9\u7c7b\u9519\u8bef\uff0c\u800c\u8bfb\u53d6\u811a\u672c\u6587\u4ef6\u65f6\u5219\u4e0d\u4f1a\u5ffd\u7565\u9519\u8bef\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">off</code>\uff08\u9ed8\u8ba4\u503c\uff09\u65f6\uff0c\u4e8b\u52a1\u5757\u4e2d\u4ea7\u751f\u9519\u8bef\u7684\u4e00\u4e2a\u8bed\u53e5\u4f1a\u4e2d\u6b62\u6574\u4e2a\u4e8b\u52a1\u3002\u9519\u8bef\u56de\u6eda\u6a21\u5f0f\u7684\u5de5\u4f5c\u539f\u7406\u662f\u5728\u4e8b\u52a1\u5757\u7684\u6bcf\u4e2a\u547d\u4ee4\u4e4b\u524d\u90fd\u4e3a\u4f60\u53d1\u51fa\u4e00\u4e2a\u9690\u5f0f\u7684<code class=\"command\">SAVEPOINT</code>\uff0c\u7136\u540e\u5728\u8be5\u547d\u4ee4\u5931\u8d25\u65f6\u56de\u6eda\u5230\u8be5\u4fdd\u5b58\u70b9\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ON-ERROR-STOP\"><span class=\"term\"><code class=\"varname\">ON_ERROR_STOP</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u51fa\u9519\u540e\u4ecd\u4f1a\u7ee7\u7eed\u5904\u7406\u547d\u4ee4\u3002\u5c06\u6b64\u53d8\u91cf\u8bbe\u4e3a on \u540e\uff0c\u5904\u7406\u4f1a\u7acb\u5373\u505c\u6b62\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\uff0cpsql \u4f1a\u8fd4\u56de\u547d\u4ee4\u63d0\u793a\u7b26\uff1b\u5426\u5219\uff0cpsql \u4f1a\u9000\u51fa\u5e76\u8fd4\u56de\u9519\u8bef\u7801 3\uff0c\u4ee5\u533a\u522b\u4e8e\u9519\u8bef\u7801 1 \u6240\u8868\u793a\u7684\u81f4\u547d\u9519\u8bef\u3002\u65e0\u8bba\u54ea\u79cd\u60c5\u51b5\uff0c\u5f53\u524d\u6b63\u5728\u8fd0\u884c\u7684\u6240\u6709\u811a\u672c\uff08\u5982\u679c\u5b58\u5728\u9876\u5c42\u811a\u672c\uff0c\u5219\u5305\u62ec\u8be5\u811a\u672c\u53ca\u5176\u8c03\u7528\u7684\u5176\u4ed6\u811a\u672c\uff09\u90fd\u4f1a\u7acb\u5373\u7ec8\u6b62\u3002\u5982\u679c\u9876\u5c42\u547d\u4ee4\u5b57\u7b26\u4e32\u5305\u542b\u591a\u6761 SQL \u547d\u4ee4\uff0c\u5219\u4f1a\u5728\u5f53\u524d\u547d\u4ee4\u5904\u505c\u6b62\u5904\u7406\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-PIPELINE-COMMAND-COUNT\"><span class=\"term\"><code class=\"varname\">PIPELINE_COMMAND_COUNT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6b63\u5728\u8fd0\u884c\u7684\u7ba1\u9053\u4e2d\u6392\u961f\u7684\u547d\u4ee4\u6570\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-PIPELINE-RESULT-COUNT\"><span class=\"term\"><code class=\"varname\">PIPELINE_RESULT_COUNT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6b63\u5728\u8fdb\u884c\u7684\u7ba1\u9053\u4e2d\uff0c\u6709\u591a\u5c11\u6761\u547d\u4ee4\u540e\u9762\u8ddf\u7740 <code class=\"command\">\\flushrequest</code> \u6216 <code class=\"command\">\\syncpipeline</code>\uff0c\u4ece\u800c\u5f3a\u5236\u670d\u52a1\u5668\u53d1\u9001\u7ed3\u679c\u3002\u8fd9\u4e9b\u7ed3\u679c\u53ef\u4ee5\u901a\u8fc7 <code class=\"command\">\\getresults</code> \u53d6\u56de\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-PIPELINE-SYNC-COUNT\"><span class=\"term\"><code class=\"varname\">PIPELINE_SYNC_COUNT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6b63\u5728\u8fd0\u884c\u7684\u7ba1\u9053\u4e2d\u6392\u961f\u7684\u540c\u6b65\u6d88\u606f\u6570\u91cf\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-PORT\"><span class=\"term\"><code class=\"varname\">PORT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u7aef\u53e3\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u4e5f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-PROMPT\"><span class=\"term\"><code class=\"varname\">PROMPT1</code><br/></span><span class=\"term\"><code class=\"varname\">PROMPT2</code><br/></span><span class=\"term\"><code class=\"varname\">PROMPT3</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e9b\u53d8\u91cf\u6307\u5b9a<span class=\"application\">psql</span>\u53d1\u51fa\u7684\u63d0\u793a\u7b26\u7684\u6a21\u6837\u3002\u89c1\u4e0b\u6587\u7684<a class=\"xref\" href=\"/docs/19/app-psql.html#APP-PSQL-PROMPTING\" title=\"\u63d0\u793a\u7b26\">\u63d0\u793a\u7b26</a>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-QUIET\"><span class=\"term\"><code class=\"varname\">QUIET</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u8fd9\u4e2a\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-q</code>\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\u53ef\u80fd\u7528\u5904\u4e0d\u5927\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ROW-COUNT\"><span class=\"term\"><code class=\"varname\">ROW_COUNT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6700\u8fd1\u4e00\u6761 SQL \u67e5\u8be2\u8fd4\u56de\u6216\u5f71\u54cd\u7684\u884c\u6570\uff1b\u5982\u679c\u67e5\u8be2\u5931\u8d25\u6216\u6ca1\u6709\u62a5\u544a\u884c\u6570\uff0c\u5219\u4e3a 0\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SERVER-VERSION-NAME\"><span class=\"term\"><code class=\"varname\">SERVER_VERSION_NAME</code><br/></span><span class=\"term\"><code class=\"varname\">SERVER_VERSION_NUM</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b57\u7b26\u4e32\u5f62\u5f0f\u7684\u670d\u52a1\u5668\u7248\u672c\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">9.6.2</code>\u3001<code class=\"literal\">10.1</code>\u6216\u8005<code class=\"literal\">11beta1</code>\uff0c\u4ee5\u53ca\u6570\u5b57\u5f62\u5f0f\u7684\u670d\u52a1\u5668\u7248\u672c\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">90602</code>\u6216\u8005<code class=\"literal\">100001</code>\u3002\u6bcf\u6b21\u4f60\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\uff09\u65f6\uff0c\u8fd9\u4e9b\u90fd\u4f1a\u88ab\u8bbe\u7f6e\uff0c\u4f46\u53ef\u4ee5\u88ab\u6539\u53d8\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SERVICE\"><span class=\"term\"><code class=\"varname\">SERVICE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u670d\u52a1\u540d\u79f0\uff08\u5982\u679c\u9002\u7528\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SERVICEFILE\"><span class=\"term\"><code class=\"varname\">SERVICEFILE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u670d\u52a1\u6587\u4ef6\u540d\uff08\u5982\u679c\u9002\u7528\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SHELL-ERROR\"><span class=\"term\"><code class=\"varname\">SHELL_ERROR</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6700\u540e\u4e00\u4e2a shell \u547d\u4ee4\u5931\u8d25\uff0c\u5219\u4e3a <code class=\"literal\">true</code>\uff1b\u5982\u679c\u6210\u529f\uff0c\u5219\u4e3a <code class=\"literal\">false</code>\u3002\u8fd9\u9002\u7528\u4e8e\u901a\u8fc7 <code class=\"literal\">\\!</code>\u3001<code class=\"literal\">\\g</code>\u3001<code class=\"literal\">\\o</code>\u3001<code class=\"literal\">\\w</code> \u548c <code class=\"literal\">\\copy</code> \u5143\u547d\u4ee4\u8c03\u7528\u7684 shell \u547d\u4ee4\uff0c\u4e5f\u9002\u7528\u4e8e\u53cd\u5f15\u53f7\uff08<code class=\"literal\">`</code>\uff09\u6269\u5c55\u3002\u8bf7\u6ce8\u610f\uff0c\u5bf9\u4e8e <code class=\"literal\">\\o</code>\uff0c\u8be5\u53d8\u91cf\u4f1a\u5728\u4e0b\u4e00\u4e2a <code class=\"literal\">\\o</code> \u547d\u4ee4\u5173\u95ed\u8f93\u51fa\u7ba1\u9053\u65f6\u66f4\u65b0\u3002\u53e6\u89c1 <code class=\"varname\">SHELL_EXIT_CODE</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SHELL-EXIT-CODE\"><span class=\"term\"><code class=\"varname\">SHELL_EXIT_CODE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u540e\u4e00\u4e2a shell \u547d\u4ee4\u8fd4\u56de\u7684\u9000\u51fa\u72b6\u6001\u30020\u2013127 \u8868\u793a\u7a0b\u5e8f\u9000\u51fa\u7801\uff0c128\u2013255 \u8868\u793a\u56e0\u4fe1\u53f7\u800c\u7ec8\u6b62\uff0c-1 \u8868\u793a\u672a\u80fd\u542f\u52a8\u7a0b\u5e8f\u6216\u672a\u80fd\u53d6\u5f97\u5176\u9000\u51fa\u72b6\u6001\u3002\u8fd9\u9002\u7528\u4e8e\u901a\u8fc7 <code class=\"literal\">\\!</code>\u3001<code class=\"literal\">\\g</code>\u3001<code class=\"literal\">\\o</code>\u3001<code class=\"literal\">\\w</code> \u548c <code class=\"literal\">\\copy</code> \u5143\u547d\u4ee4\u8c03\u7528\u7684 shell \u547d\u4ee4\uff0c\u4e5f\u9002\u7528\u4e8e\u53cd\u5f15\u53f7\uff08<code class=\"literal\">`</code>\uff09\u6269\u5c55\u3002\u8bf7\u6ce8\u610f\uff0c\u5bf9\u4e8e <code class=\"literal\">\\o</code>\uff0c\u8be5\u53d8\u91cf\u4f1a\u5728\u4e0b\u4e00\u4e2a <code class=\"literal\">\\o</code> \u547d\u4ee4\u5173\u95ed\u8f93\u51fa\u7ba1\u9053\u65f6\u66f4\u65b0\u3002\u53e6\u89c1 <code class=\"varname\">SHELL_ERROR</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SHOW-ALL-RESULTS\"><span class=\"term\"><code class=\"varname\">SHOW_ALL_RESULTS</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u6b64\u53d8\u91cf\u88ab\u8bbe\u4e3a <code class=\"literal\">off</code> \u65f6\uff0c\u7ec4\u5408\u67e5\u8be2\uff08<code class=\"literal\">\\;</code>\uff09\u53ea\u663e\u793a\u6700\u540e\u4e00\u4e2a\u7ed3\u679c\uff0c\u800c\u4e0d\u662f\u663e\u793a\u5168\u90e8\u7ed3\u679c\u3002\u9ed8\u8ba4\u503c\u4e3a <code class=\"literal\">on</code>\u3002\u8bbe\u4e3a off \u7684\u884c\u4e3a\u662f\u4e3a\u4e86\u517c\u5bb9\u65e7\u7248\u672c\u7684 <span class=\"application\">psql</span>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SHOW-CONTEXT\"><span class=\"term\"><code class=\"varname\">SHOW_CONTEXT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u53d8\u91cf\u53ef\u4ee5\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">never</code>\u3001<code class=\"literal\">errors</code>\u6216\u8005<code class=\"literal\">always</code>\u6765\u63a7\u5236\u662f\u5426\u5728\u6765\u81ea\u670d\u52a1\u5668\u7684\u6d88\u606f\u4e2d\u663e\u793a<code class=\"literal\">CONTEXT</code>\u5b57\u6bb5\u3002\u9ed8\u8ba4\u662f<code class=\"literal\">errors</code>\uff08\u8868\u793a\u5728\u9519\u8bef\u6d88\u606f\u4e2d\u663e\u793a\u4e0a\u4e0b\u6587\uff0c\u4f46\u5728\u901a\u77e5\u548c\u8b66\u544a\u6d88\u606f\u4e2d\u4e0d\u663e\u793a\uff09\u3002\u5f53<code class=\"varname\">VERBOSITY</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">terse</code>\u6216<code class=\"literal\">sqlstate</code>\u65f6\uff0c\u8fd9\u4e2a\u8bbe\u7f6e\u65e0\u6548\uff08\u53e6\u89c1<code class=\"command\">\\errverbose</code>\uff0c\u5b83\u53ef\u4ee5\u7528\u6765\u5f97\u5230\u521a\u9047\u5230\u7684\u9519\u8bef\u7684\u8be6\u7ec6\u4fe1\u606f\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SINGLELINE\"><span class=\"term\"><code class=\"varname\">SINGLELINE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u8fd9\u4e2a\u53d8\u91cf\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-S</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SINGLESTEP\"><span class=\"term\"><code class=\"varname\">SINGLESTEP</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u8fd9\u4e2a\u53d8\u91cf\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-s</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SQLSTATE\"><span class=\"term\"><code class=\"varname\">SQLSTATE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0e\u4e0a\u4e00\u4e2aSQL\u67e5\u8be2\u7684\u5931\u8d25\u76f8\u5173\u7684\u9519\u8bef\u4ee3\u7801\uff08\u89c1<a class=\"xref\" href=\"/docs/19/errcodes-appendix.html\" title=\"\u9644\u5f55\u00a0A.\u00a0PostgreSQL\u9519\u8bef\u4ee3\u7801\">\u9644\u5f55\u00a0A</a>\uff09\uff0c\u5982\u679c\u4e0a\u4e00\u4e2a\u67e5\u8be2\u6210\u529f\u5219\u4e3a<code class=\"literal\">00000</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-USER\"><span class=\"term\"><code class=\"varname\">USER</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7528\u6237\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u662f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-VERBOSITY\"><span class=\"term\"><code class=\"varname\">VERBOSITY</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u53d8\u91cf\u53ef\u4ee5\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">default</code>\u3001<code class=\"literal\">verbose</code>\u3001<code class=\"literal\">terse</code>\u6216\u8005<code class=\"literal\">sqlstate</code>\u6765\u63a7\u5236\u9519\u8bef\u62a5\u544a\u7684\u8be6\u7ec6\u7a0b\u5ea6\uff08\u53e6\u89c1<code class=\"command\">\\errverbose</code>\uff0c\u5728\u60f3\u5f97\u5230\u521a\u9047\u5230\u7684\u9519\u8bef\u7684\u8be6\u7ec6\u4fe1\u606f\u65f6\u4f7f\u7528\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-VERSION\"><span class=\"term\"><code class=\"varname\">VERSION</code><br/></span><span class=\"term\"><code class=\"varname\">VERSION_NAME</code><br/></span><span class=\"term\"><code class=\"varname\">VERSION_NUM</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e9b\u53d8\u91cf\u5728\u7a0b\u5e8f\u542f\u52a8\u65f6\u88ab\u8bbe\u7f6e\u4ee5\u53cd\u6620<span class=\"application\">psql</span>\u7684\u7248\u672c\uff0c\u5206\u522b\u662f\u4e00\u4e2a\u8be6\u7ec6\u7684\u5b57\u7b26\u4e32\u3001\u4e00\u4e2a\u77ed\u5b57\u7b26\u4e32\uff08\u4f8b\u5982<code class=\"literal\">9.6.2</code>\u3001<code class=\"literal\">10.1</code>\u6216\u8005<code class=\"literal\">11beta1</code>\uff09\u4ee5\u53ca\u4e00\u4e2a\u6570\u5b57\uff08\u4f8b\u5982<code class=\"literal\">90602</code>\u6216\u8005<code class=\"literal\">100001</code>\uff09\u3002\u5b83\u4eec\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-WATCH-INTERVAL\"><span class=\"term\"><code class=\"varname\">WATCH_INTERVAL</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6b64\u53d8\u91cf\u8bbe\u7f6e<code class=\"command\">\\watch</code>\u5728\u4e24\u6b21\u6267\u884c\u67e5\u8be2\u4e4b\u95f4\u7b49\u5f85\u7684\u9ed8\u8ba4\u95f4\u9694\uff0c\u5355\u4f4d\u4e3a\u79d2\u3002\u9ed8\u8ba4\u503c\u4e3a 2 \u79d2\u3002\u82e5\u5728\u547d\u4ee4\u4e2d\u6307\u5b9a\u4e86\u95f4\u9694\uff0c\u5219\u4f1a\u8986\u76d6\u6b64\u53d8\u91cf\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-INTERPOLATION\">\n<h4 lang=\"zh\">SQL \u63d2\u503c</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u53d8\u91cf\u7684\u4e00\u4e2a\u5173\u952e\u7279\u6027\u662f\u53ef\u4ee5\u628a\u5b83\u4eec\u66ff\u6362\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u63d2\u503c</span>\u201d</span>\uff09\u5230\u5e38\u89c4<acronym class=\"acronym\">SQL</acronym>\u8bed\u53e5\u4e2d\uff0c\u4e5f\u53ef\u4ee5\u628a\u5b83\u4eec\u66ff\u6362\u5230\u5143\u547d\u4ee4\u7684\u53c2\u6570\u4e2d\u3002\u6b64\u5916\uff0c<span class=\"application\">psql</span>\u8fd8\u63d0\u4f9b\u4e86\u529f\u80fd\u6765\u786e\u4fdd\u88ab\u7528\u4f5c SQL \u5b57\u9762\u91cf\u548c\u6807\u8bc6\u7b26\u7684\u53d8\u91cf\u503c\u4f1a\u88ab\u6b63\u786e\u5730\u52a0\u5f15\u53f7\u3002\u4e0d\u52a0\u5f15\u53f7\u5730\u63d2\u503c\u4e00\u4e2a\u503c\u7684\u8bed\u6cd5\u662f\u5728\u53d8\u91cf\u540d\u524d\u9762\u52a0\u4e0a\u4e00\u4e2a\u5192\u53f7\uff08<code class=\"literal\">:</code>\uff09\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo 'my_table'</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM :foo;</code></strong>\n</pre>\n<p lang=\"zh\">\u5c06\u67e5\u8be2\u8868<code class=\"structname\">my_table</code>\u3002\u6ce8\u610f\u8fd9\u53ef\u80fd\u4f1a\u4e0d\u5b89\u5168\uff1a\u8be5\u53d8\u91cf\u7684\u503c\u4f1a\u88ab\u6309\u5b57\u9762\u62f7\u8d1d\uff0c\u56e0\u6b64\u5b83\u53ef\u80fd\u5305\u542b\u4e0d\u5e73\u8861\u7684\u5f15\u53f7\u751a\u81f3\u53cd\u659c\u7ebf\u547d\u4ee4\u3002\u5fc5\u987b\u786e\u4fdd\u628a\u5b83\u653e\u5728\u90a3\u91cc\u662f\u6709\u610f\u4e49\u7684\u3002</p>\n<p lang=\"zh\">\u5f53\u4e00\u4e2a\u503c\u8981\u7528\u4f5c SQL \u5b57\u9762\u91cf\u6216\u6807\u8bc6\u7b26\u65f6\uff0c\u6700\u5b89\u5168\u7684\u505a\u6cd5\u662f\u4e3a\u5b83\u52a0\u4e0a\u5f15\u53f7\u3002\u8981\u5c06\u53d8\u91cf\u503c\u4f5c\u4e3a SQL \u5b57\u9762\u91cf\u52a0\u5f15\u53f7\uff0c\u5e94\u5199\u4e00\u4e2a\u5192\u53f7\uff0c\u540e\u9762\u8ddf\u7528\u5355\u5f15\u53f7\u62ec\u8d77\u6765\u7684\u53d8\u91cf\u540d\u3002\u8981\u5c06\u53d8\u91cf\u503c\u4f5c\u4e3a SQL \u6807\u8bc6\u7b26\u52a0\u5f15\u53f7\uff0c\u5219\u5728\u5192\u53f7\u540e\u9762\u7528\u53cc\u5f15\u53f7\u62ec\u8d77\u53d8\u91cf\u540d\u3002\u8fd9\u4e9b\u5199\u6cd5\u80fd\u6b63\u786e\u5904\u7406\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165\u7684\u5f15\u53f7\u548c\u5176\u4ed6\u7279\u6b8a\u5b57\u7b26\u3002\u524d\u9762\u7684\u793a\u4f8b\u53ef\u7528\u4ee5\u4e0b\u66f4\u5b89\u5168\u7684\u5199\u6cd5\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo 'my_table'</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM :\"foo\";</code></strong>\n</pre>\n<p lang=\"zh\">\u5728\u52a0\u5f15\u53f7\u7684<acronym class=\"acronym\">SQL</acronym>\u5b57\u9762\u91cf\u548c\u6807\u8bc6\u7b26\u5185\u90e8\uff0c\u4e0d\u4f1a\u6267\u884c\u53d8\u91cf\u63d2\u503c\u3002\u56e0\u6b64\uff0c<code class=\"literal\">':foo'</code>\u8fd9\u6837\u7684\u5199\u6cd5\u4e0d\u80fd\u6839\u636e\u53d8\u91cf\u503c\u751f\u6210\u52a0\u5f15\u53f7\u7684\u5b57\u9762\u91cf\uff08\u5373\u4f7f\u80fd\u591f\u751f\u6548\uff0c\u4e5f\u4e0d\u5b89\u5168\uff0c\u56e0\u4e3a\u5b83\u65e0\u6cd5\u6b63\u786e\u5904\u7406\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165\u7684\u5f15\u53f7\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8fd9\u79cd\u673a\u5236\u7684\u4e00\u4e2a\u793a\u4f8b\u662f\u628a\u4e00\u4e2a\u6587\u4ef6\u7684\u5185\u5bb9\u62f7\u8d1d\u5230\u4e00\u4e2a\u8868\u5217\u4e2d\u3002\u9996\u5148\u628a\u8be5\u6587\u4ef6\u8f7d\u5165\u5230\u4e00\u4e2a\u53d8\u91cf\uff0c\u7136\u540e\u628a\u8be5\u53d8\u91cf\u7684\u503c\u4f5c\u4e3a\u4e00\u4e2a\u52a0\u5f15\u53f7\u7684\u5b57\u7b26\u4e32\u8fdb\u884c\u63d2\u503c\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set content `cat my_file.txt`</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>INSERT INTO my_table VALUES (:'content');</code></strong>\n</pre>\n<p lang=\"zh\">\uff08\u6ce8\u610f\u5982\u679c<code class=\"filename\">my_file.txt</code>\u5305\u542b NUL \u5b57\u8282\uff0c\u8fd9\u6837\u4e5f\u4e0d\u884c\u3002<span class=\"application\">psql</span>\u4e0d\u652f\u6301\u5728\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165 NUL \u5b57\u8282\uff09\u3002</p>\n<p lang=\"zh\">\u56e0\u4e3a\u5192\u53f7\u53ef\u4ee5\u5408\u6cd5\u5730\u51fa\u73b0\u5728 SQL \u547d\u4ee4\u4e2d\uff0c\u770b\u4f3c\u63d2\u503c\u7684\u5199\u6cd5\uff08\u5373<code class=\"literal\">:name</code>\u3001<code class=\"literal\">:'name'</code>\u6216\u8005<code class=\"literal\">:\"name\"</code>\uff09\u4e0d\u4f1a\u88ab\u66ff\u6362\uff0c\u9664\u975e\u6240\u6307\u7684\u53d8\u91cf\u5f53\u524d\u5df2\u8bbe\u7f6e\u3002\u5728\u4efb\u4f55\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u7528\u4e00\u4e2a\u53cd\u659c\u7ebf\u5bf9\u5192\u53f7\u8fdb\u884c\u8f6c\u4e49\u4ee5\u907f\u514d\u5b83\u88ab\u66ff\u6362\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">:{?<em class=\"replaceable\"><code>name</code></em>}</code>\u7279\u6b8a\u8bed\u6cd5\u4f1a\u6839\u636e\u8be5\u53d8\u91cf\u662f\u5426\u5b58\u5728\u8fd4\u56de TRUE \u6216 FALSE\uff0c\u56e0\u6b64\u603b\u662f\u4f1a\u88ab\u66ff\u6362\uff0c\u9664\u975e\u5192\u53f7\u88ab\u53cd\u659c\u7ebf\u8f6c\u4e49\u3002</p>\n<p lang=\"zh\">\u53d8\u91cf\u7684\u5192\u53f7\u8bed\u6cd5\u5bf9\u5d4c\u5165\u5f0f\u67e5\u8be2\u8bed\u8a00\uff08\u4f8b\u5982<span class=\"application\">ECPG</span>\uff09\u6765\u8bf4\u662f\u6807\u51c6\u7684<acronym class=\"acronym\">SQL</acronym>\u3002\u7528\u4e8e\u6570\u7ec4\u5207\u7247\u548c\u7c7b\u578b\u8f6c\u6362\u7684\u5192\u53f7\u8bed\u6cd5\u662f<span class=\"productname\">PostgreSQL</span>\u6269\u5c55\uff0c\u5b83\u6709\u65f6\u53ef\u80fd\u4f1a\u4e0e\u6807\u51c6\u7528\u6cd5\u51b2\u7a81\u3002\u628a\u4e00\u4e2a\u53d8\u91cf\u503c\u8f6c\u4e49\u6210 SQL \u5b57\u9762\u91cf\u6216\u8005\u6807\u8bc6\u7b26\u7684\u5192\u53f7\u52a0\u5f15\u53f7\u8bed\u6cd5\u662f\u4e00\u79cd<span class=\"application\">psql</span>\u6269\u5c55\u3002</p>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-PROMPTING\">\n<h4 lang=\"zh\">\u63d0\u793a\u7b26</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u53d1\u51fa\u7684\u63d0\u793a\u7b26\u53ef\u4ee5\u6309\u4f60\u7684\u559c\u597d\u8fdb\u884c\u5b9a\u5236\u3002<code class=\"varname\">PROMPT1</code>\u3001<code class=\"varname\">PROMPT2</code> \u548c <code class=\"varname\">PROMPT3</code> \u8fd9\u4e09\u4e2a\u53d8\u91cf\u5305\u542b\u63cf\u8ff0\u63d0\u793a\u7b26\u5916\u89c2\u7684\u5b57\u7b26\u4e32\u548c\u7279\u6b8a\u8f6c\u4e49\u5e8f\u5217\u3002\u63d0\u793a\u7b26 1 \u662f <span class=\"application\">psql</span> \u8bf7\u6c42\u65b0\u547d\u4ee4\u65f6\u53d1\u51fa\u7684\u5e38\u89c4\u63d0\u793a\u7b26\u3002\u63d0\u793a\u7b26 2 \u4f1a\u5728\u5f55\u5165\u547d\u4ee4\u671f\u95f4\u8fd8\u9700\u8981\u66f4\u591a\u8f93\u5165\u65f6\u53d1\u51fa\uff0c\u4f8b\u5982\u547d\u4ee4\u5c1a\u672a\u4ee5\u5206\u53f7\u7ed3\u675f\uff0c\u6216\u8005\u5f15\u53f7\u5c1a\u672a\u95ed\u5408\u65f6\u3002\u5728\u6267\u884c <acronym class=\"acronym\">SQL</acronym> <code class=\"command\">COPY FROM STDIN</code> \u547d\u4ee4\u5e76\u9700\u8981\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4e00\u884c\u503c\u65f6\uff0c\u4f1a\u53d1\u51fa\u63d0\u793a\u7b26 3\u3002</p>\n<p lang=\"zh\">\u9009\u4e2d\u7684\u63d0\u793a\u7b26\u53d8\u91cf\u503c\u4f1a\u6309\u5b57\u9762\u8f93\u51fa\uff0c\u9664\u975e\u9047\u5230\u767e\u5206\u53f7\uff08<code class=\"literal\">%</code>\uff09\u3002\u6839\u636e\u4e0b\u4e00\u4e2a\u5b57\u7b26\u7684\u4e0d\u540c\uff0c\u4f1a\u66ff\u6362\u6210\u67d0\u4e9b\u5176\u4ed6\u6587\u672c\u3002\u5df2\u5b9a\u4e49\u7684\u66ff\u6362\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-PROMPTING-M-UC\"><span class=\"term\"><code class=\"literal\">%M</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5b8c\u6574\u4e3b\u673a\u540d\uff08\u542b\u57df\u540d\uff09\uff1b\u5982\u679c\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\uff0c\u5219\u4e3a<code class=\"literal\">[local]</code>\uff1b\u5982\u679c Unix \u57df\u5957\u63a5\u5b57\u4e0d\u5728\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u9ed8\u8ba4\u4f4d\u7f6e\uff0c\u5219\u4e3a<code class=\"literal\">[local:<em class=\"replaceable\"><code>/dir/name</code></em>]</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-M-LC\"><span class=\"term\"><code class=\"literal\">%m</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\uff0c\u5728\u7b2c\u4e00\u4e2a\u70b9\u53f7\u5904\u622a\u65ad\uff1b\u5982\u679c\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\uff0c\u5219\u4e3a<code class=\"literal\">[local]</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-GT\"><span class=\"term\"><code class=\"literal\">%&gt;</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u76d1\u542c\u7684\u7aef\u53e3\u53f7\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-N\"><span class=\"term\"><code class=\"literal\">%n</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u4f1a\u8bdd\u7528\u6237\u540d\u3002\uff08\u5728\u6570\u636e\u5e93\u4f1a\u8bdd\u671f\u95f4\uff0c<code class=\"command\">SET SESSION AUTHORIZATION</code>\u547d\u4ee4\u53ef\u80fd\u6539\u53d8\u8be5\u503c\u7684\u6269\u5c55\u7ed3\u679c\u3002\uff09</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-S\"><span class=\"term\"><code class=\"literal\">%S</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d<a class=\"xref\" href=\"/docs/19/runtime-config-client.html#GUC-SEARCH-PATH\">search_path</a>\u7684\u503c\uff1b\u5982\u679c\u8fde\u63a5\u5230\u8fd0\u884c <span class=\"productname\">PostgreSQL</span> 17 \u6216\u66f4\u65e9\u7248\u672c\u7684\u670d\u52a1\u5668\uff0c\u5219\u4e3a <code class=\"literal\">?</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-S\"><span class=\"term\"><code class=\"literal\">%s</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u670d\u52a1\u540d\u79f0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-SLASH\"><span class=\"term\"><code class=\"literal\">%/</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-TILDE\"><span class=\"term\"><code class=\"literal\">%~</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7c7b\u4f3c <code class=\"literal\">%/</code>\uff0c\u4f46\u5982\u679c\u8be5\u6570\u636e\u5e93\u662f\u4f60\u7684\u9ed8\u8ba4\u6570\u636e\u5e93\uff0c\u5219\u8f93\u51fa <code class=\"literal\">~</code>\uff08\u6ce2\u6d6a\u53f7\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-NUMBERSIGN\"><span class=\"term\"><code class=\"literal\">%#</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u4f1a\u8bdd\u7528\u6237\u662f\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\uff0c\u5219\u4e3a<code class=\"literal\">#</code>\uff0c\u5426\u5219\u4e3a<code class=\"literal\">&gt;</code>\u3002\uff08\u5728\u6570\u636e\u5e93\u4f1a\u8bdd\u671f\u95f4\uff0c<code class=\"command\">SET SESSION AUTHORIZATION</code>\u547d\u4ee4\u53ef\u80fd\u6539\u53d8\u8be5\u503c\u7684\u6269\u5c55\u7ed3\u679c\u3002\uff09</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-P\"><span class=\"term\"><code class=\"literal\">%p</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u6240\u8fde\u63a5\u540e\u7aef\u7684\u8fdb\u7a0b ID\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-P-UC\"><span class=\"term\"><code class=\"literal\">%P</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7ba1\u9053\u72b6\u6001\uff1a\u4e0d\u5728\u7ba1\u9053\u4e2d\u65f6\u4e3a <code class=\"literal\">off</code>\uff0c\u5728\u8fdb\u884c\u4e2d\u7684\u7ba1\u9053\u4e2d\u65f6\u4e3a <code class=\"literal\">on</code>\uff0c\u5728\u5df2\u4e2d\u6b62\u7684\u7ba1\u9053\u4e2d\u65f6\u4e3a <code class=\"literal\">abort</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-R\"><span class=\"term\"><code class=\"literal\">%R</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5728\u63d0\u793a\u7b26 1 \u4e2d\uff0c\u901a\u5e38\u663e\u793a =\uff1b\u4f46\u5982\u679c\u4f1a\u8bdd\u5904\u4e8e\u6761\u4ef6\u5757\u4e2d\u672a\u6fc0\u6d3b\u7684\u5206\u652f\uff0c\u5219\u663e\u793a @\uff1b\u5982\u679c\u5904\u4e8e\u5355\u884c\u6a21\u5f0f\uff0c\u5219\u663e\u793a ^\uff1b\u5982\u679c\u4f1a\u8bdd\u5df2\u65ad\u5f00\u6570\u636e\u5e93\u8fde\u63a5\uff08\u4f8b\u5982 \\connect \u5931\u8d25\u65f6\uff09\uff0c\u5219\u663e\u793a !\u3002\u5728\u63d0\u793a\u7b26 2 \u4e2d\uff0c%R \u4f1a\u66ff\u6362\u4e3a\u8868\u793a psql \u7b49\u5f85\u66f4\u591a\u8f93\u5165\u539f\u56e0\u7684\u5b57\u7b26\uff1a\u547d\u4ee4\u5c1a\u672a\u7ed3\u675f\u65f6\u4e3a -\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684 /* ... */ \u6ce8\u91ca\u65f6\u4e3a *\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u5e26\u5f15\u53f7\u5b57\u7b26\u4e32\u65f6\u4e3a\u5355\u5f15\u53f7\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u5e26\u5f15\u53f7\u6807\u8bc6\u7b26\u65f6\u4e3a\u53cc\u5f15\u53f7\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u7f8e\u5143\u5f15\u7528\u5b57\u7b26\u4e32\u65f6\u4e3a\u7f8e\u5143\u7b26\u53f7\uff1b\u5b58\u5728\u672a\u5339\u914d\u7684\u5de6\u62ec\u53f7\u65f6\u4e3a (\u3002\u5728\u63d0\u793a\u7b26 3 \u4e2d\uff0c%R \u4e0d\u4ea7\u751f\u4efb\u4f55\u5185\u5bb9\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-I\"><span class=\"term\"><code class=\"literal\">%i</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8868\u793a\u6240\u8fde\u63a5\u7684\u670d\u52a1\u5668\u662f\u5426\u5904\u4e8e\u70ed\u5907\u6a21\u5f0f\u3002\u5982\u679c\u670d\u52a1\u5668\u5f53\u524d\u5904\u4e8e\u70ed\u5907\u72b6\u6001\uff0c\u5e76\u5c06 in_hot_standby \u62a5\u544a\u4e3a on\uff0c\u5219\u663e\u793a standby\uff1b\u5426\u5219\u663e\u793a primary\u3002\u8fde\u63a5\u591a\u4e2a\u670d\u52a1\u5668\u65f6\uff0c\u8fd9\u6709\u52a9\u4e8e\u5feb\u901f\u8bc6\u522b\u6bcf\u4e2a\u8fde\u63a5\u5bf9\u5e94\u7684\u89d2\u8272\u3002\u8fde\u63a5\u5230 PostgreSQL 13 \u6216\u66f4\u65e9\u7248\u672c\u7684\u670d\u52a1\u5668\u65f6\uff0c\u663e\u793a ?\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-X\"><span class=\"term\"><code class=\"literal\">%x</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u72b6\u6001\uff1a\u5982\u679c\u5f53\u524d\u4e0d\u5728\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff1b\u5982\u679c\u5904\u4e8e\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a <code class=\"literal\">*</code>\uff1b\u5982\u679c\u5904\u4e8e\u5931\u8d25\u7684\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a <code class=\"literal\">!</code>\uff1b\u5982\u679c\u4e8b\u52a1\u72b6\u6001\u4e0d\u786e\u5b9a\uff08\u4f8b\u5982\u56e0\u4e3a\u5f53\u524d\u6ca1\u6709\u8fde\u63a5\uff09\uff0c\u5219\u4e3a <code class=\"literal\">?</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-L\"><span class=\"term\"><code class=\"literal\">%l</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8bed\u53e5\u4e2d\u7684\u884c\u53f7\uff0c\u4ece <code class=\"literal\">1</code> \u5f00\u59cb\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-DIGITS\"><span class=\"term\"><code class=\"literal\">%</code><em class=\"replaceable\"><code>digits</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u66ff\u6362\u4e3a\u6307\u5b9a\u516b\u8fdb\u5236\u4ee3\u7801\u5bf9\u5e94\u7684\u5b57\u7b26\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-NAME\"><span class=\"term\"><code class=\"literal\">%:</code><em class=\"replaceable\"><code>name</code></em><code class=\"literal\">:</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><span class=\"application\">psql</span> \u53d8\u91cf <em class=\"replaceable\"><code>name</code></em> \u7684\u503c\u3002\u8be6\u89c1\u4e0a\u9762\u7684<a class=\"xref\" href=\"/docs/19/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-COMMAND\"><span class=\"term\"><code class=\"literal\">%`</code><em class=\"replaceable\"><code>command</code></em><code class=\"literal\">`</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><em class=\"replaceable\"><code>command</code></em> \u7684\u8f93\u51fa\uff0c\u7c7b\u4f3c\u666e\u901a\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u53cd\u5f15\u53f7</span>\u201d</span>\u66ff\u6362\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-SQUARE-BRACKETS\"><span class=\"term\"><code class=\"literal\">%[</code> ... <code class=\"literal\">%]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u63d0\u793a\u7b26\u4e2d\u53ef\u4ee5\u5305\u542b\u7ec8\u7aef\u63a7\u5236\u5b57\u7b26\uff0c\u4f8b\u5982\u6539\u53d8\u63d0\u793a\u6587\u672c\u7684\u989c\u8272\u3001\u80cc\u666f\u6216\u6837\u5f0f\uff0c\u6216\u8005\u6539\u53d8\u7ec8\u7aef\u7a97\u53e3\u6807\u9898\u3002\u4e3a\u4e86\u8ba9 <span class=\"application\">Readline</span> \u7684\u884c\u7f16\u8f91\u529f\u80fd\u6b63\u5e38\u5de5\u4f5c\uff0c\u8fd9\u4e9b\u4e0d\u53ef\u6253\u5370\u7684\u63a7\u5236\u5b57\u7b26\u5fc5\u987b\u7528 <code class=\"literal\">%[</code> \u548c <code class=\"literal\">%]</code> \u5305\u56f4\u8d77\u6765\uff0c\u4ee5\u6807\u8bb0\u4e3a\u4e0d\u53ef\u89c1\u5b57\u7b26\u3002\u63d0\u793a\u7b26\u4e2d\u53ef\u4ee5\u51fa\u73b0\u591a\u7ec4\u8fd9\u6837\u7684\u6807\u8bb0\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; \\set PROMPT1 '%[%033[1;33;40m%]%n@%/%R%[%033[0m%]%# '\n</pre>\n<p lang=\"zh\">\u5176\u6548\u679c\u662f\u5728\u517c\u5bb9 VT100 \u4e14\u652f\u6301\u989c\u8272\u7684\u7ec8\u7aef\u4e0a\uff0c\u751f\u6210\u4e00\u4e2a\u7c97\u4f53\uff08<code class=\"literal\">1;</code>\uff09\u7684\u9ed1\u5e95\u9ec4\u5b57\u63d0\u793a\u7b26\uff08<code class=\"literal\">33;40</code>\uff09\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-W\"><span class=\"term\"><code class=\"literal\">%w</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0e\u6700\u8fd1\u4e00\u6b21\u8f93\u51fa\u7684 <code class=\"varname\">PROMPT1</code> \u5177\u6709\u76f8\u540c\u5bbd\u5ea6\u7684\u7a7a\u767d\u3002\u8fd9\u53ef\u7528\u4f5c <code class=\"varname\">PROMPT2</code> \u7684\u8bbe\u7f6e\uff0c\u4f7f\u591a\u884c\u8bed\u53e5\u4e0e\u7b2c\u4e00\u884c\u5bf9\u9f50\uff0c\u4f46\u4e0d\u663e\u793a\u53ef\u89c1\u7684\u4e8c\u7ea7\u63d0\u793a\u7b26\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8981\u5728\u63d0\u793a\u7b26\u4e2d\u63d2\u5165\u767e\u5206\u53f7\uff0c\u8bf7\u5199 %%\u3002\u63d0\u793a\u7b26 1 \u548c 2 \u7684\u9ed8\u8ba4\u503c\u4e3a '%/%R%x%# '\uff0c\u63d0\u793a\u7b26 3 \u7684\u9ed8\u8ba4\u503c\u4e3a '&gt;&gt; '\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">tcsh</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-READLINE\">\n<h4 lang=\"zh\">\u547d\u4ee4\u884c\u7f16\u8f91</h4>\n<p lang=\"zh\">\u5982\u679c\u53ef\u7528\uff0c<span class=\"application\">psql</span> \u4f1a\u4f7f\u7528<span class=\"application\">Readline</span>\u6216<span class=\"application\">libedit</span>\u5e93\uff0c\u4ee5\u4fbf\u8fdb\u884c\u4fbf\u6377\u7684\u884c\u7f16\u8f91\u548c\u5386\u53f2\u68c0\u7d22\u3002\u5f53<span class=\"application\">psql</span>\u9000\u51fa\u65f6\uff0c\u547d\u4ee4\u5386\u53f2\u4f1a\u81ea\u52a8\u4fdd\u5b58\uff1b\u5f53<span class=\"application\">psql</span>\u542f\u52a8\u65f6\uff0c\u53c8\u4f1a\u91cd\u65b0\u8f7d\u5165\u3002\u8f93\u5165\u4e0a\u7bad\u5934\u6216 control-P \u53ef\u4ee5\u53d6\u56de\u4e4b\u524d\u7684\u884c\u3002</p>\n<p lang=\"zh\">\u5728\u8bb8\u591a\uff08\u7edd\u975e\u5168\u90e8\uff09\u4e0a\u4e0b\u6587\u4e2d\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528 TAB \u8865\u5168\u90e8\u5206\u8f93\u5165\u7684\u5173\u952e\u5b57\u548c SQL \u5bf9\u8c61\u540d\u3002\u4f8b\u5982\uff0c\u5728\u547d\u4ee4\u5f00\u5934\u8f93\u5165<code class=\"literal\">ins</code>\u5e76\u6309\u4e0b TAB \u952e\uff0c\u4f1a\u8865\u5168\u4e3a<code class=\"literal\">insert into</code> \u3002\u7136\u540e\u8f93\u5165\u8868\u540d\u6216\u6a21\u5f0f\u540d\u7684\u51e0\u4e2a\u5b57\u7b26\uff0c\u518d\u6309\u4e0b<code class=\"literal\">TAB</code>\u952e\uff0c\u5c31\u4f1a\u8865\u5168\u5c1a\u672a\u8f93\u5b8c\u7684\u540d\u79f0\uff1b\u5982\u679c\u6709\u591a\u4e2a\u5019\u9009\u9879\uff0c\u5219\u4f1a\u7ed9\u51fa\u53ef\u80fd\u7684\u8865\u5168\u83dc\u5355\u3002\uff08\u5177\u4f53\u53d6\u51b3\u4e8e\u6240\u4f7f\u7528\u7684\u5e93\uff0c\u53ef\u80fd\u9700\u8981\u6309\u591a\u6b21<code class=\"literal\">TAB</code>\u952e\u624d\u80fd\u770b\u5230\u83dc\u5355\u3002\uff09</p>\n<p lang=\"zh\">\u5bf9 SQL \u5bf9\u8c61\u540d\u8fdb\u884c TAB \u8865\u5168\u65f6\uff0c\u9700\u8981\u5411\u670d\u52a1\u5668\u53d1\u9001\u67e5\u8be2\u6765\u67e5\u627e\u53ef\u80fd\u7684\u5339\u914d\u9879\u3002\u5728\u67d0\u4e9b\u4e0a\u4e0b\u6587\u4e2d\uff0c\u8fd9\u53ef\u80fd\u4f1a\u5e72\u6270\u5176\u4ed6\u64cd\u4f5c\u3002\u4f8b\u5982\uff0c\u5728<code class=\"command\">BEGIN</code>\u4e4b\u540e\uff0c\u5982\u679c\u4e2d\u95f4\u53d1\u51fa\u4e86\u4e00\u6b21 TAB \u8865\u5168\u67e5\u8be2\uff0c\u90a3\u4e48\u518d\u53d1\u51fa<code class=\"command\">SET TRANSACTION ISOLATION LEVEL</code>\u5c31\u4e3a\u65f6\u5df2\u665a\u4e86\u3002\u5982\u679c\u6839\u672c\u4e0d\u60f3\u4f7f\u7528 TAB \u8865\u5168\uff0c\u53ef\u4ee5\u628a\u4e0b\u9762\u7684\u5185\u5bb9\u653e\u5230\u4e3b\u76ee\u5f55\u4e2d\u540d\u4e3a<code class=\"filename\">.inputrc</code>\u7684\u6587\u4ef6\u91cc\uff0c\u4ece\u800c\u6c38\u4e45\u5173\u95ed\u5b83\uff1a</p>\n<pre class=\"programlisting\">$if psql\nset disable-completion on\n$endif\n</pre>\n<p lang=\"zh\">\uff08\u8fd9\u4e0d\u662f<span class=\"application\">psql</span>\u800c\u662f\u4e00\u4e2a<span class=\"application\">Readline</span>\u529f\u80fd\u3002\u9605\u8bfb\u5176\u6587\u6863\u4ee5\u83b7\u53d6\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\u3002\uff09</p>\n<p lang=\"zh\"><code class=\"option\">-n</code>\uff08<code class=\"option\">--no-readline</code>\uff09\u547d\u4ee4\u884c\u9009\u9879\u4e5f\u53ef\u7528\u4e8e\u5728\u5355\u6b21\u8fd0\u884c<span class=\"application\">psql</span>\u65f6\u7981\u7528 <span class=\"application\">Readline</span>\u3002\u8fd9\u4f1a\u963b\u6b62TAB \u8865\u5168\u3001\u547d\u4ee4\u884c\u5386\u53f2\u7684\u4f7f\u7528\u6216\u8bb0\u5f55\uff0c\u4ee5\u53ca\u591a\u884c\u547d\u4ee4\u7684\u7f16\u8f91\u3002\u5f53\u4f60\u9700\u8981\u590d\u5236\u7c98\u8d34\u5305\u542b <code class=\"literal\">TAB</code> \u5b57\u7b26\u7684\u6587\u672c\u65f6\uff0c\u5b83\u5c24\u5176\u6709\u7528\u3002</p>\n</div>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PSQL-ENVIRONMENT\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-ENVIRONMENT-COLUMNS\"><span class=\"term\"><code class=\"envar\">COLUMNS</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c<code class=\"literal\">\\pset columns</code>\u4e3a\u96f6\uff0c\u8fd9\u4e2a\u73af\u5883\u53d8\u91cf\u63a7\u5236\u7528\u4e8e<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u5bbd\u5ea6\u4ee5\u53ca\u7528\u6765\u786e\u5b9a\u8f83\u5bbd\u7684\u8f93\u51fa\u662f\u5426\u9700\u8981\u5206\u9875\u5668\uff0c\u6216\u8005\u662f\u5426\u5e94\u5207\u6362\u5230\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e2d\u7684\u5782\u76f4\u683c\u5f0f\u7684\u5bbd\u5ea6\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PGDATABASE\"><span class=\"term\"><code class=\"envar\">PGDATABASE</code><br/></span><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\uff08\u89c1<a class=\"xref\" href=\"/docs/19/libpq-envars.html\" title=\"32.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a032.15\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PG-COLOR\"><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PSQL-EDITOR\"><span class=\"term\"><code class=\"envar\">PSQL_EDITOR</code><br/></span><span class=\"term\"><code class=\"envar\">EDITOR</code><br/></span><span class=\"term\"><code class=\"envar\">VISUAL</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"command\">\\e</code>\u3001<code class=\"command\">\\ef</code>\u4ee5\u53ca<code class=\"command\">\\ev</code>\u547d\u4ee4\u6240\u4f7f\u7528\u7684\u7f16\u8f91\u5668\u3002\u4f1a\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u68c0\u67e5\u8fd9\u4e9b\u53d8\u91cf\uff0c\u7b2c\u4e00\u4e2a\u88ab\u8bbe\u7f6e\u7684\u5c06\u88ab\u4f7f\u7528\u3002\u5982\u679c\u90fd\u6ca1\u6709\u88ab\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u662f\u4f7f\u7528Unix\u7cfb\u7edf\u4e0a\u7684<code class=\"filename\">vi</code>\u6216\u8005Windows\u7cfb\u7edf\u4e0a\u7684<code class=\"filename\">notepad.exe</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PSQL-EDITOR-LINENUMBER-ARG\"><span class=\"term\"><code class=\"envar\">PSQL_EDITOR_LINENUMBER_ARG</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5f53 <code class=\"command\">\\e</code>\u3001<code class=\"command\">\\ef</code> \u6216 <code class=\"command\">\\ev</code> \u5e26\u6709\u884c\u53f7\u53c2\u6570\u4f7f\u7528\u65f6\uff0c\u6b64\u53d8\u91cf\u6307\u5b9a\u5c06\u8d77\u59cb\u884c\u53f7\u4f20\u7ed9\u7528\u6237\u7f16\u8f91\u5668\u65f6\u6240\u7528\u7684\u547d\u4ee4\u884c\u53c2\u6570\u3002\u5bf9\u4e8e <span class=\"productname\">Emacs</span> \u6216 <span class=\"productname\">vi</span> \u4e4b\u7c7b\u7684\u7f16\u8f91\u5668\uff0c\u8fd9\u4e2a\u53c2\u6570\u662f\u4e00\u4e2a\u52a0\u53f7\u3002\u5982\u679c\u9009\u9879\u540d\u548c\u884c\u53f7\u4e4b\u95f4\u9700\u8981\u7a7a\u683c\uff0c\u8bf7\u5728\u53d8\u91cf\u503c\u4e2d\u5305\u542b\u672b\u5c3e\u7a7a\u683c\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">PSQL_EDITOR_LINENUMBER_ARG='+'\nPSQL_EDITOR_LINENUMBER_ARG='--line '\n</pre>\n<p lang=\"zh\">\u5728 Unix \u7cfb\u7edf\u4e0a\u9ed8\u8ba4\u662f<code class=\"literal\">+</code>\uff08\u5bf9\u5e94\u4e8e\u9ed8\u8ba4\u7f16\u8f91\u5668<code class=\"filename\">vi</code>\uff0c\u4e14\u5bf9\u5f88\u591a\u5176\u4ed6\u5e38\u89c1\u7f16\u8f91\u5668\u53ef\u7528\uff09\u3002\u5728 Windows \u7cfb\u7edf\u4e0a\u6ca1\u6709\u9ed8\u8ba4\u503c\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PSQL-HISTORY\"><span class=\"term\"><code class=\"envar\">PSQL_HISTORY</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u547d\u4ee4\u5386\u53f2\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08<code class=\"literal\">~</code>\uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PAGER\"><span class=\"term\"><code class=\"envar\">PSQL_PAGER</code><br/></span><span class=\"term\"><code class=\"envar\">PAGER</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u67e5\u8be2\u7ed3\u679c\u65e0\u6cd5\u5728\u5c4f\u5e55\u4e0a\u663e\u793a\u5b8c\u6574\uff0c\u5b83\u4eec\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6b64\u547d\u4ee4\u3002\u5178\u578b\u7684\u503c\u662f<code class=\"literal\">more</code>\u6216<code class=\"literal\">less</code>\u3002\u53ef\u4ee5\u901a\u8fc7\u5c06<code class=\"envar\">PSQL_PAGER</code>\u6216<code class=\"envar\">PAGER</code>\u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u6216\u901a\u8fc7\u8c03\u6574<code class=\"command\">\\pset</code>\u547d\u4ee4\u7684\u4e0e\u5206\u9875\u76f8\u5173\u7684\u9009\u9879\u6765\u7981\u7528\u5206\u9875\u5668\u3002\u8fd9\u4e9b\u53d8\u91cf\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u8fdb\u884c\u68c0\u67e5\uff1b\u4f7f\u7528\u6309\u8be5\u987a\u5e8f\u627e\u5230\u7684\u7b2c\u4e00\u4e2a\u5df2\u8bbe\u7f6e\u7684\u53d8\u91cf\u3002\u5982\u679c\u5b83\u4eec\u90fd\u6ca1\u6709\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5728\u5927\u591a\u6570\u5e73\u53f0\u4e0a\u4f7f\u7528<code class=\"literal\">more</code>\uff0c\u4f46\u5728Cygwin\u4e0a\u4f7f\u7528<code class=\"literal\">less</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PSQL-WATCH-PAGER\"><span class=\"term\"><code class=\"envar\">PSQL_WATCH_PAGER</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528 \\watch \u547d\u4ee4\u53cd\u590d\u6267\u884c\u67e5\u8be2\u65f6\uff0c\u9ed8\u8ba4\u4e0d\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\u3002\u5728 Unix \u7cfb\u7edf\u4e0a\uff0c\u53ef\u4ee5\u5c06 PSQL_WATCH_PAGER \u8bbe\u4e3a\u5206\u9875\u7a0b\u5e8f\u547d\u4ee4\u6765\u6539\u53d8\u6b64\u884c\u4e3a\u3002pspg \u5206\u9875\u7a0b\u5e8f\uff08\u4e0d\u5c5e\u4e8e PostgreSQL\uff0c\u4f46\u8bb8\u591a\u5f00\u6e90\u8f6f\u4ef6\u53d1\u884c\u7248\u90fd\u63d0\u4f9b\u5b83\uff09\u4ee5 --stream \u9009\u9879\u542f\u52a8\u65f6\uff0c\u53ef\u4ee5\u663e\u793a \\watch \u7684\u8f93\u51fa\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PSQLRC\"><span class=\"term\"><code class=\"envar\">PSQLRC</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7528\u6237\u7684<code class=\"filename\">.psqlrc</code>\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08<code class=\"literal\">~</code>\uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-SHELL\"><span class=\"term\"><code class=\"envar\">SHELL</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u88ab<code class=\"command\">\\!</code>\u547d\u4ee4\u6267\u884c\u7684\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-TMPDIR\"><span class=\"term\"><code class=\"envar\">TMPDIR</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b58\u50a8\u4e34\u65f6\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u662f<code class=\"filename\">/tmp</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6 <span class=\"productname\">PostgreSQL</span> \u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528 <span class=\"application\">libpq</span> \u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/19/libpq-envars.html\" title=\"32.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a032.15\u00a0\u8282</a>\uff09\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.21.10\">\n<h2 lang=\"zh\">\u6587\u4ef6</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-FILES-PSQLRC\" lang=\"zh\"><span class=\"term\"><code class=\"filename\">psqlrc</code> \u548c <code class=\"filename\">~/.psqlrc</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u6ca1\u6709<code class=\"option\">-X</code>\u9009\u9879\uff0c\u5728\u8fde\u63a5\u5230\u6570\u636e\u5e93\u540e\u4f46\u5728\u63a5\u6536\u6b63\u5e38\u7684\u547d\u4ee4\u4e4b\u524d\uff0c<span class=\"application\">psql</span>\u4f1a\u5c1d\u8bd5\u4f9d\u6b21\u4ece\u7cfb\u7edf\u7ea7\u7684\u542f\u52a8\u6587\u4ef6\uff08<code class=\"filename\">psqlrc</code>\uff09\u548c\u7528\u6237\u7684\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\uff08<code class=\"filename\">~/.psqlrc</code>\uff09\u4e2d\u8bfb\u53d6\u5e76\u4e14\u6267\u884c\u547d\u4ee4\u3002\u8fd9\u4e9b\u6587\u4ef6\u53ef\u4ee5\u88ab\u7528\u6765\u8bbe\u7f6e\u5ba2\u6237\u7aef\u6216\u8005\u670d\u52a1\u5668\uff0c\u901a\u5e38\u662f\u4e00\u4e9b<code class=\"command\">\\set</code>\u548c<code class=\"command\">SET</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u7cfb\u7edf\u8303\u56f4\u7684\u542f\u52a8\u6587\u4ef6\u540d\u4e3a <code class=\"filename\">psqlrc</code>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4f1a\u5728\u5b89\u88c5\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u7cfb\u7edf\u914d\u7f6e</span>\u201d</span>\u76ee\u5f55\u4e2d\u67e5\u627e\u5b83\uff0c\u6700\u53ef\u9760\u7684\u8bc6\u522b\u65b9\u5f0f\u662f\u8fd0\u884c <code class=\"literal\">pg_config --sysconfdir</code>\u3002\u901a\u5e38\u8fd9\u4e2a\u76ee\u5f55\u662f\u76f8\u5bf9\u4e8e\u5305\u542b <span class=\"productname\">PostgreSQL</span> \u53ef\u6267\u884c\u6587\u4ef6\u7684\u76ee\u5f55\u7684 <code class=\"filename\">../etc/</code>\u3002\u4e5f\u53ef\u4ee5\u901a\u8fc7 <code class=\"envar\">PGSYSCONFDIR</code> \u73af\u5883\u53d8\u91cf\u663e\u5f0f\u6307\u5b9a\u67e5\u627e\u76ee\u5f55\u3002</p>\n<p lang=\"zh\">\u7528\u6237\u7684\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\u540d\u4e3a<code class=\"filename\">.psqlrc</code>\uff0c\u5e76\u4e14\u5728\u8c03\u7528\u7528\u6237\u7684\u4e3b\u76ee\u5f55\u4e2d\u5bfb\u627e\u3002\u5728Windows\u4e0a\uff0c\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\u7684\u540d\u79f0\u6539\u4e3a<code class=\"filename\">%APPDATA%\\postgresql\\psqlrc.conf</code>\u3002\u5728\u4efb\u4f55\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e<code class=\"envar\">PSQLRC</code>\u73af\u5883\u53d8\u91cf\u6765\u8986\u76d6\u6b64\u9ed8\u8ba4\u6587\u4ef6\u8def\u5f84\u3002</p>\n<p lang=\"zh\">\u7cfb\u7edf\u8303\u56f4\u7684\u542f\u52a8\u6587\u4ef6\u548c\u7528\u6237\u4e2a\u4eba\u7684\u542f\u52a8\u6587\u4ef6\u90fd\u53ef\u4ee5\u901a\u8fc7\u5728\u6587\u4ef6\u540d\u540e\u9644\u52a0\u8fde\u5b57\u7b26\u548c<span class=\"productname\">PostgreSQL</span>\u7684\u5927\u7248\u672c\u6216\u5c0f\u7248\u672c\u6807\u8bc6\u7b26\u6765\u4f7f\u5176\u4e0e<span class=\"application\">psql</span>\u7248\u672c\u76f8\u5173\uff0c\u4f8b\u5982<code class=\"filename\">~/.psqlrc-19</code>\u6216<code class=\"filename\">~/.psqlrc-19beta4</code>\u3002\u6700\u5177\u4f53\u7248\u672c\u5339\u914d\u7684\u6587\u4ef6\u5c06\u4f18\u5148\u8bfb\u53d6\uff0c\u800c\u4e0d\u662f\u975e\u7279\u5b9a\u7248\u672c\u7684\u6587\u4ef6\u3002\u8fd9\u4e9b\u7248\u672c\u540e\u7f00\u662f\u5728\u786e\u5b9a\u6587\u4ef6\u8def\u5f84\u540e\u6dfb\u52a0\u7684\uff0c\u5982\u4e0a\u6240\u8ff0\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-FILES-PSQL-HISTORY\"><span class=\"term\"><code class=\"filename\">.psql_history</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u547d\u4ee4\u884c\u5386\u53f2\u88ab\u5b58\u50a8\u5728\u6587\u4ef6<code class=\"filename\">~/.psql_history</code>\u4e2d\uff0c\u5728 Windows \u4e0a\u5219\u5b58\u50a8\u5728\u6587\u4ef6<code class=\"filename\">%APPDATA%\\postgresql\\psql_history</code>\u4e2d\u3002</p>\n<p lang=\"zh\">\u5386\u53f2\u6587\u4ef6\u7684\u4f4d\u7f6e\u53ef\u4ee5\u901a\u8fc7<code class=\"varname\">HISTFILE</code> <span class=\"application\">psql</span>\u53d8\u91cf\u6216\u8005<code class=\"envar\">PSQL_HISTORY</code>\u73af\u5883\u53d8\u91cf\u663e\u5f0f\u8bbe\u7f6e\u3002</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.21.11\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">psql</span>\u6700\u9002\u5408\u4e0e\u76f8\u540c\u6216\u8f83\u65e7\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\u914d\u5408\u4f7f\u7528\u3002\u5982\u679c\u670d\u52a1\u5668\u7684\u7248\u672c\u6bd4<span class=\"application\">psql</span>\u672c\u8eab\u66f4\u65b0\uff0c\u53cd\u659c\u7ebf\u547d\u4ee4\u7279\u522b\u5bb9\u6613\u5931\u8d25\u3002\u7136\u800c\uff0c<code class=\"literal\">\\d</code>\u7cfb\u5217\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u5e94\u8be5\u53ef\u4ee5\u5728\u6700\u4f4e\u81f3 9.2 \u7248\u672c\u7684\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\uff0c\u4f46\u4e0d\u4e00\u5b9a\u9002\u7528\u4e8e\u6bd4<span class=\"application\">psql</span>\u672c\u8eab\u66f4\u65b0\u7684\u670d\u52a1\u5668\u3002\u8fd0\u884cSQL\u547d\u4ee4\u548c\u663e\u793a\u67e5\u8be2\u7ed3\u679c\u7684\u4e00\u822c\u529f\u80fd\u4e5f\u5e94\u8be5\u53ef\u4ee5\u5728\u66f4\u65b0\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\uff0c\u4f46\u4e0d\u80fd\u4fdd\u8bc1\u5728\u6240\u6709\u60c5\u51b5\u4e0b\u90fd\u80fd\u5b9e\u73b0\u3002</p>\n<p>\u5982\u679c\u4f60\u60f3\u7528<span class=\"application\">psql</span>\u8fde\u63a5\u5230\u591a\u4e2a\u5177\u6709\u4e0d\u540c\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\uff0c\u63a8\u8350\u4f7f\u7528\u6700\u65b0\u7248\u672c\u7684<span class=\"application\">psql</span>\u3002\u6216\u8005\uff0c\u4f60\u53ef\u4ee5\u4e3a\u6bcf\u4e00\u4e2a\u5927\u7248\u672c\u4fdd\u7559\u4e00\u4efd<span class=\"application\">psql</span>\u62f7\u8d1d\uff0c\u5e76\u4e14\u9488\u5bf9\u76f8\u5e94\u7684\u670d\u52a1\u5668\u4f7f\u7528\u5339\u914d\u7684\u7248\u672c\u3002\u4f46\u5b9e\u9645\u4e0a\uff0c\u8fd9\u79cd\u989d\u5916\u7684\u9ebb\u70e6\u662f\u4e0d\u5fc5\u8981\u7684\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5728 <span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\uff0c<code class=\"option\">-c</code> \u9009\u9879\u610f\u5473\u7740 <code class=\"option\">-X</code>\uff08<code class=\"option\">--no-psqlrc</code>\uff09\uff1b\u73b0\u5728\u5df2\u7ecf\u4e0d\u662f\u8fd9\u6837\u4e86\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5728<span class=\"productname\">PostgreSQL</span> 8.4 \u4e4b\u524d\uff0c<span class=\"application\">psql</span>\u5141\u8bb8\u4e00\u4e2a\u5355\u5b57\u6bcd\u53cd\u659c\u7ebf\u547d\u4ee4\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u76f4\u63a5\u5199\u5728\u8be5\u547d\u4ee4\u540e\u9762\uff0c\u4e2d\u95f4\u4e0d\u9700\u8981\u7a7a\u767d\u3002\u73b0\u5728\u5219\u8981\u6c42\u7528\u7a7a\u767d\u5206\u9694\u3002</p>\n</li>\n</ul>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.21.12\">\n<h2 lang=\"zh\">\u7ed9 Windows \u7528\u6237\u7684\u6ce8\u89e3</h2>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u662f\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u63a7\u5236\u53f0\u5e94\u7528</span>\u201d</span>\u3002\u7531\u4e8e Windows \u7684\u63a7\u5236\u53f0\u7a97\u53e3\u4f7f\u7528\u7684\u662f\u4e00\u79cd\u548c\u7cfb\u7edf\u4e2d\u5176\u4ed6\u5e94\u7528\u4e0d\u540c\u7684\u7f16\u7801\uff0c\u5728<span class=\"application\">psql</span>\u4e2d\u4f7f\u7528 8 \u4f4d\u5b57\u7b26\u65f6\u8981\u7279\u522b\u6ce8\u610f\u3002\u5982\u679c<span class=\"application\">psql</span>\u68c0\u6d4b\u5230\u4e00\u4e2a\u6709\u95ee\u9898\u7684\u63a7\u5236\u53f0\u4ee3\u7801\u9875\uff0c\u5b83\u5c06\u4f1a\u5728\u542f\u52a8\u65f6\u8b66\u544a\u4f60\u3002\u8981\u66f4\u6539\u63a7\u5236\u53f0\u4ee3\u7801\u9875\uff0c\u6709\u4e24\u4ef6\u4e8b\u662f\u5fc5\u8981\u7684\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u8f93\u5165<strong class=\"userinput\"><code>cmd.exe /c chcp 1252</code></strong>\u53ef\u4ee5\u8bbe\u7f6e\u4ee3\u7801\u9875\uff081252 \u662f\u9002\u7528\u4e8e\u5fb7\u8bed\u7684\u4e00\u4e2a\u4ee3\u7801\u9875\uff0c\u8bf7\u5728\u8fd9\u91cc\u66ff\u6362\u6210\u4f60\u7684\u503c\uff09\u3002\u5982\u679c\u6b63\u5728\u4f7f\u7528 Cygwin\uff0c\u53ef\u4ee5\u628a\u8fd9\u4e2a\u547d\u4ee4\u653e\u5728<code class=\"filename\">/etc/profile</code>\u4e2d\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u628a\u63a7\u5236\u53f0\u5b57\u4f53\u8bbe\u7f6e\u4e3a<code class=\"literal\">Lucida Console</code>\uff0c\u56e0\u4e3a\u6805\u683c\u5b57\u4f53\u65e0\u6cd5\u4e0e ANSI \u4ee3\u7801\u9875\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</li>\n</ul>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PSQL-EXAMPLES\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u7b2c\u4e00\u4e2a\u793a\u4f8b\u5c55\u793a\u4e86\u5982\u4f55\u628a\u4e00\u6761\u547d\u4ee4\u5206\u6563\u5230\u591a\u884c\u8f93\u5165\u4e2d\u3002\u6ce8\u610f\u63d0\u793a\u7b26\u7684\u53d8\u5316\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>CREATE TABLE my_table (</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code> first integer NOT NULL DEFAULT 0,</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code> second text)</code></strong>\ntestdb-&gt; <strong class=\"userinput\"><code>;</code></strong>\nCREATE TABLE\n</pre>\n<p lang=\"zh\">\u73b0\u5728\u518d\u6765\u770b\u4e00\u4e0b\u8fd9\u4e2a\u8868\u7684\u5b9a\u4e49\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\d my_table</code></strong>\n              Table \"public.my_table\"\n Column |  Type   | Collation | Nullable | Default\n--------+---------+-----------+----------+---------\n first  | integer |           | not null | 0\n second | text    |           |          |\n</pre>\n<p lang=\"zh\">\u73b0\u5728\u6211\u4eec\u628a\u63d0\u793a\u7b26\u6539\u6210\u66f4\u6709\u8da3\u7684\u5f62\u5f0f\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set PROMPT1 '%n@%m %~%R%# '</code></strong>\npeter@localhost testdb=&gt;\n</pre>\n<p lang=\"zh\">\u5047\u8bbe\u4f60\u5df2\u7ecf\u5411\u8868\u4e2d\u586b\u5165\u6570\u636e\uff0c\u5e76\u60f3\u770b\u4e00\u770b\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; SELECT * FROM my_table;\n first | second\n-------+--------\n     1 | one\n     2 | two\n     3 | three\n     4 | four\n(4 rows)\n</pre>\n<p lang=\"zh\">\u4f60\u53ef\u4ee5\u4f7f\u7528 <code class=\"command\">\\pset</code> \u547d\u4ee4\u4ee5\u4e0d\u540c\u65b9\u5f0f\u663e\u793a\u8868\u683c\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 2</code></strong>\nBorder style is 2.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\n+-------+--------+\n| first | second |\n+-------+--------+\n|     1 | one    |\n|     2 | two    |\n|     3 | three  |\n|     4 | four   |\n+-------+--------+\n(4 rows)\n\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 0</code></strong>\nBorder style is 0.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\nfirst second\n----- ------\n    1 one\n    2 two\n    3 three\n    4 four\n(4 rows)\n\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 1</code></strong>\nBorder style is 1.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset format csv</code></strong>\nOutput format is csv.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset tuples_only</code></strong>\nTuples only is on.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT second, first FROM my_table;</code></strong>\none,1\ntwo,2\nthree,3\nfour,4\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset format unaligned</code></strong>\nOutput format is unaligned.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset fieldsep '\\t'</code></strong>\nField separator is \"    \".\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT second, first FROM my_table;</code></strong>\none     1\ntwo     2\nthree   3\nfour    4\n</pre>\n<p lang=\"zh\">\u6216\u8005\u4f7f\u7528\u77ed\u547d\u4ee4\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\a \\t \\x</code></strong>\nOutput format is aligned.\nTuples only is off.\nExpanded display is on.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\n-[ RECORD 1 ]-\nfirst  | 1\nsecond | one\n-[ RECORD 2 ]-\nfirst  | 2\nsecond | two\n-[ RECORD 3 ]-\nfirst  | 3\nsecond | three\n-[ RECORD 4 ]-\nfirst  | 4\nsecond | four\n</pre>\n<p lang=\"zh\">\u6b64\u5916\uff0c\u53ef\u4ee5\u4f7f\u7528<code class=\"literal\">\\g</code>\u4e3a\u4e00\u4e2a\u67e5\u8be2\u8bbe\u7f6e\u8fd9\u4e9b\u8f93\u51fa\u683c\u5f0f\u9009\u9879\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table</code></strong>\npeter@localhost testdb-&gt; <strong class=\"userinput\"><code>\\g (format=aligned tuples_only=off expanded=on)</code></strong>\n-[ RECORD 1 ]-\nfirst  | 1\nsecond | one\n-[ RECORD 2 ]-\nfirst  | 2\nsecond | two\n-[ RECORD 3 ]-\nfirst  | 3\nsecond | three\n-[ RECORD 4 ]-\nfirst  | 4\nsecond | four\n</pre>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4e00\u4e2a\u4f7f\u7528 <code class=\"command\">\\df</code> \u547d\u4ee4\u53ea\u67e5\u627e\u540d\u79f0\u5339\u914d <code class=\"literal\">int*pl</code> \u4e14\u7b2c\u4e8c\u4e2a\u53c2\u6570\u7c7b\u578b\u4e3a <code class=\"type\">bigint</code> \u7684\u51fd\u6570\u7684\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\df int*pl * bigint</code></strong>\n                          List of functions\n   Schema   |  Name   | Result data type | Argument data types | Type\n------------+---------+------------------+---------------------+------\n pg_catalog | int28pl | bigint           | smallint, bigint    | func\n pg_catalog | int48pl | bigint           | integer, bigint     | func\n pg_catalog | int8pl  | bigint           | bigint, bigint      | func\n(3 rows)\n</pre>\n<p lang=\"zh\">\u8fd9\u91cc\uff0c<code class=\"literal\">+</code> \u9009\u9879\u7528\u4e8e\u663e\u793a\u5176\u4e2d\u4e00\u4e2a\u51fd\u6570\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u800c <code class=\"literal\">x</code> \u7528\u4e8e\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u7ed3\u679c\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\df+x int*pl integer bigint</code></strong>\nList of functions\n-[ RECORD 1 ]-------+-----------------------------\nSchema              | pg_catalog\nName                | int48pl\nResult data type    | bigint\nArgument data types | integer, bigint\nType                | func\nVolatility          | immutable\nParallel            | safe\nOwner               | postgres\nSecurity            | invoker\nLeakproof?          | no\nAccess privileges   |\nLanguage            | internal\nInternal name       | int48pl\nDescription         | implementation of + operator\n</pre>\n<p lang=\"zh\">\u5728\u9002\u5408\u7684\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u4f7f\u7528 <code class=\"command\">\\crosstabview</code> \u547d\u4ee4\u5c06\u67e5\u8be2\u7ed3\u679c\u663e\u793a\u4e3a\u4ea4\u53c9\u8868\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>SELECT first, second, first &gt; 2 AS gt2 FROM my_table;</code></strong>\n first | second | gt2\n-------+--------+-----\n     1 | one    | f\n     2 | two    | f\n     3 | three  | t\n     4 | four   | t\n(4 rows)\n\ntestdb=&gt; <strong class=\"userinput\"><code>\\crosstabview first second</code></strong>\n first | one | two | three | four\n-------+-----+-----+-------+------\n     1 | f   |     |       |\n     2 |     | f   |       |\n     3 |     |     | t     |\n     4 |     |     |       | t\n(4 rows)\n</pre>\n<p lang=\"zh\">\u7b2c\u4e8c\u4e2a\u793a\u4f8b\u5c55\u793a\u4e86\u4e00\u4e2a\u4e58\u6cd5\u8868\uff0c\u5176\u4e2d\u884c\u6309\u6570\u5b57\u5012\u5e8f\u6392\u5217\uff0c\u800c\u5217\u6309\u72ec\u7acb\u7684\u5347\u5e8f\u6570\u5b57\u6392\u5217\u3002</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>SELECT t1.first AS \"A\", t2.first+100 AS \"B\", t1.first*(t2.first+100) AS \"AxB\",</code></strong>\ntestdb-&gt; <strong class=\"userinput\"><code>row_number() OVER (ORDER BY t2.first) AS ord</code></strong>\ntestdb-&gt; <strong class=\"userinput\"><code>FROM my_table t1 CROSS JOIN my_table t2 ORDER BY 1 DESC</code></strong>\ntestdb-&gt; <strong class=\"userinput\"><code>\\crosstabview \"A\" \"B\" \"AxB\" ord</code></strong>\n A | 101 | 102 | 103 | 104\n---+-----+-----+-----+-----\n 4 | 404 | 408 | 412 | 416\n 3 | 303 | 306 | 309 | 312\n 2 | 202 | 204 | 206 | 208\n 1 | 101 | 102 | 103 | 104\n(4 rows)\n</pre>\n</div>\n</div></div>", "manual_path": "app-psql.html", "localization": {"status": "complete", "sources": [{"url": "/docs/19/app-psql.html", "method": "same-major semantic node", "sha256": "1351be06967585f99a84454a26dff346091ea378daf6c7ed9fa18edee9d1131c", "language": "zh", "matched_nodes": ["#APP-PSQL/div[10]/div[1]/ul[0]/li[0]", "#APP-PSQL/div[10]/div[1]/ul[0]/li[1]", "#APP-PSQL/div[10]/div[1]/ul[0]/li[2]", "#APP-PSQL/div[10]/h2[0]", "#APP-PSQL/div[11]/div[2]/ul[0]/li[0]", "#APP-PSQL/div[11]/div[2]/ul[0]/li[1]", "#APP-PSQL/div[11]/h2[0]", "#APP-PSQL/div[11]/p[1]", "#APP-PSQL/div[12]/p[11]", "#APP-PSQL/div[12]/p[13]", "#APP-PSQL/div[12]/p[15]", "#APP-PSQL/div[12]/p[17]", "#APP-PSQL/div[12]/p[19]", "#APP-PSQL/div[12]/p[1]", "#APP-PSQL/div[12]/p[21]", "#APP-PSQL/div[12]/p[3]", "#APP-PSQL/div[12]/p[5]", "#APP-PSQL/div[12]/p[7]", "#APP-PSQL/div[12]/p[9]", "#APP-PSQL/div[2]/p[1]", "#APP-PSQL/div[3]/h2[0]", "#APP-PSQL/div[4]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[11]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[13]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[15]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]/p[2]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[19]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[21]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[23]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[25]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[25]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[27]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[29]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[31]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[35]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[37]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[39]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[3]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[41]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]/div[1]/h3[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]/div[1]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[45]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[47]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[49]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[51]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[53]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[55]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[55]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[57]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[57]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[59]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[5]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[61]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[63]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[65]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[67]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[67]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[69]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[3]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[5]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[6]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[7]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[9]", "#APP-PSQL/div[6]/h2[0]", "#APP-PSQL/div[6]/p[1]", "#APP-PSQL/div[7]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[1]/p[1]", "#APP-PSQL/div[7]/div[1]/p[2]", "#APP-PSQL/div[7]/div[1]/p[5]", "#APP-PSQL/div[7]/div[1]/p[6]", "#APP-PSQL/div[7]/div[1]/p[7]", "#APP-PSQL/div[7]/div[2]/h3[0]", "#APP-PSQL/div[7]/div[2]/p[1]", "#APP-PSQL/div[7]/div[2]/p[3]", "#APP-PSQL/div[7]/div[2]/p[4]", "#APP-PSQL/div[7]/div[2]/p[5]", "#APP-PSQL/div[7]/div[2]/p[6]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[101]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[103]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[105]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[105]/div[4]/p[1]/a[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[105]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[105]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[105]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[105]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[107]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[107]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[107]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[109]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[109]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[109]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[109]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[111]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[113]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[115]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[115]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[115]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[115]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[117]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[119]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[119]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[119]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[119]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[119]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[11]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[11]/div[1]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[11]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[121]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[121]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[123]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[125]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[127]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[127]/p[0]/a[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[127]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[127]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[127]/p[5]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[131]/div[2]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[131]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[131]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[133]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[135]/div[2]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[135]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[135]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[137]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[137]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[137]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[137]/p[5]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[137]/p[6]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[139]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[13]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[13]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[141]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[143]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[145]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[145]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[145]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[147]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[149]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[151]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[151]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[151]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[151]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[153]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[155]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[155]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[157]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[159]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[159]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[15]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[15]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[17]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[19]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[19]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[19]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[19]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[19]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[21]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[21]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[21]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[21]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[21]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[23]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[25]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[27]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[27]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[31]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[35]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[35]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[37]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[41]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[43]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[45]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[47]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[47]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[47]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dt[10]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dt[34]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dt[36]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dt[38]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[5]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/p[4]/a[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[163]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[165]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[167]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[169]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[171]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[173]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[173]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[173]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[173]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[173]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[175]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[177]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[177]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[179]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[179]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[179]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[17]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[17]/div[5]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[17]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[17]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[181]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[181]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[181]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[181]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[181]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[181]/p[5]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[183]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[185]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[187]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[189]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[189]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[191]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[191]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[193]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[195]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[197]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[199]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[201]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[201]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[203]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[203]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[205]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[207]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[207]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[207]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[207]/p[5]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[21]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[21]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[21]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[23]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[23]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[23]/p[0]/a[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[23]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[23]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[23]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[25]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[29]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[31]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[37]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[3]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[3]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[3]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[41]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[43]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[45]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[45]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[45]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[47]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[49]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[49]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[51]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[53]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[55]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[57]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[57]/div[1]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[57]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[59]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[5]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[5]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[61]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[63]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[65]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[67]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[69]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[71]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[73]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[75]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[77]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[79]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[7]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[7]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[7]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[7]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[7]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[81]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[83]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[83]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[85]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[85]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[85]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[87]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[87]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[89]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[89]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[91]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[93]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[95]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[97]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[99]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[104]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[130]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[132]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[134]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[138]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[140]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[150]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[152]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[162]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[166]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[192]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[6]", "#APP-PSQL/div[7]/div[3]/div[12]/p[2]", "#APP-PSQL/div[7]/div[3]/div[12]/p[3]", "#APP-PSQL/div[7]/div[3]/div[12]/p[4]", "#APP-PSQL/div[7]/div[3]/div[12]/p[6]", "#APP-PSQL/div[7]/div[3]/div[12]/p[7]", "#APP-PSQL/div[7]/div[3]/h3[0]", "#APP-PSQL/div[7]/div[3]/p[10]", "#APP-PSQL/div[7]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/p[2]", "#APP-PSQL/div[7]/div[3]/p[3]", "#APP-PSQL/div[7]/div[3]/p[4]", "#APP-PSQL/div[7]/div[3]/p[4]/a[2]", "#APP-PSQL/div[7]/div[3]/p[5]", "#APP-PSQL/div[7]/div[3]/p[7]", "#APP-PSQL/div[7]/div[3]/p[8]", "#APP-PSQL/div[7]/div[3]/p[9]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[15]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[17]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/div[2]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[21]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[21]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[23]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[23]/p[2]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[41]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[43]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[45]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[47]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[47]/p[0]/a[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[49]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[53]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[55]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[57]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[59]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[61]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[63]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[65]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[67]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[69]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[71]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[73]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[75]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[77]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[79]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[4]/div[1]/div[8]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/p[10]", "#APP-PSQL/div[7]/div[4]/div[1]/p[11]", "#APP-PSQL/div[7]/div[4]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/p[2]", "#APP-PSQL/div[7]/div[4]/div[1]/p[4]", "#APP-PSQL/div[7]/div[4]/div[1]/p[6]", "#APP-PSQL/div[7]/div[4]/div[1]/p[7]", "#APP-PSQL/div[7]/div[4]/div[1]/p[9]", "#APP-PSQL/div[7]/div[4]/div[2]/p[10]", "#APP-PSQL/div[7]/div[4]/div[2]/p[11]", "#APP-PSQL/div[7]/div[4]/div[2]/p[12]", "#APP-PSQL/div[7]/div[4]/div[2]/p[1]", "#APP-PSQL/div[7]/div[4]/div[2]/p[3]", "#APP-PSQL/div[7]/div[4]/div[2]/p[4]", "#APP-PSQL/div[7]/div[4]/div[2]/p[6]", "#APP-PSQL/div[7]/div[4]/div[2]/p[7]", "#APP-PSQL/div[7]/div[4]/div[2]/p[9]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[15]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[17]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[21]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[29]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[31]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[37]/p[0]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[37]/p[2]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[4]/div[3]/div[5]/p[1]", "#APP-PSQL/div[7]/div[4]/div[3]/p[1]", "#APP-PSQL/div[7]/div[4]/div[3]/p[2]", "#APP-PSQL/div[7]/div[4]/div[4]/h4[0]", "#APP-PSQL/div[7]/div[4]/div[4]/p[3]", "#APP-PSQL/div[7]/div[4]/div[4]/p[4]", "#APP-PSQL/div[7]/div[4]/div[4]/p[5]", "#APP-PSQL/div[7]/div[4]/div[4]/p[7]", "#APP-PSQL/div[7]/div[4]/div[4]/p[8]", "#APP-PSQL/div[7]/div[4]/h3[0]", "#APP-PSQL/div[7]/h2[0]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[11]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[13]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[17]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[19]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[1]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[21]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[3]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[5]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[7]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]/p[0]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]/p[2]", "#APP-PSQL/div[8]/p[2]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[0]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[1]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[2]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[3]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[3]/p[0]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[3]/p[1]", "#APP-PSQL/div[9]/div[1]/dl[0]/dt[0]", "#APP-PSQL/div[9]/h2[0]"]}, {"url": "/docs/19/indexes-index-only-scans.html", "method": "same-major semantic node", "sha256": "b11e418aaefa22e881a0303d8a9c8d770ff6c20cda07e27b68d10579fdea0ce1", "language": "zh", "matched_nodes": ["#INDEXES-INDEX-ONLY-SCANS/p[25]/span[2]"]}], "language": "zh", "original_text": {"/versions/19/description/0": "psql \u2014 PostgreSQL interactive terminal", "/versions/19/facts/0/label": "Documented executable", "/versions/19/facts/1/label": "Executable version", "/versions/19/facts/2/label": "Reference inventory", "/versions/19/facts/2/value": "Client applications", "/versions/19/facts/3/label": "Option definition groups", "/versions/19/tables/0/title": "Documented options", "/versions/19/tables/1/title": "Environment variables", "/versions/19/related/0/label": "psql meta-commands", "/versions/19/related/1/label": "libpq connection parameters", "/versions/19/tables/0/rows/0/summary": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all .", "/versions/19/tables/0/rows/1/summary": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned .", "/versions/19/tables/0/rows/2/summary": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors .", "/versions/19/tables/0/rows/3/summary": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence.", "/versions/19/tables/0/rows/4/summary": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv .", "/versions/19/tables/0/rows/5/summary": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "/versions/19/tables/0/rows/6/summary": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries .", "/versions/19/tables/0/rows/7/summary": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on .", "/versions/19/tables/0/rows/8/summary": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i .", "/versions/19/tables/0/rows/9/summary": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f .", "/versions/19/tables/0/columns/0/label": "Option and arguments", "/versions/19/tables/0/columns/1/label": "Description", "/versions/19/tables/0/rows/10/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket.", "/versions/19/tables/0/rows/11/summary": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command.", "/versions/19/tables/0/rows/12/summary": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list .", "/versions/19/tables/0/rows/13/summary": "Write all query output into file filename , in addition to the normal output destination.", "/versions/19/tables/0/rows/14/summary": "Do not use Readline for line editing and do not use the command history (see the section called \u201cCommand-Line Editing\u201d below).", "/versions/19/tables/0/rows/15/summary": "Put all query output into file filename . This is equivalent to the command \\o .", "/versions/19/tables/0/rows/16/summary": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432.", "/versions/19/tables/0/rows/17/summary": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex .", "/versions/19/tables/0/rows/18/summary": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on .", "/versions/19/tables/0/rows/19/summary": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep .", "/versions/19/tables/0/rows/20/summary": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts.", "/versions/19/tables/0/rows/21/summary": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does.", "/versions/19/tables/0/rows/22/summary": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only .", "/versions/19/tables/0/rows/23/summary": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details.", "/versions/19/tables/0/rows/24/summary": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)", "/versions/19/tables/0/rows/25/summary": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later.", "/versions/19/tables/0/rows/26/summary": "Print the psql version and exit.", "/versions/19/tables/0/rows/27/summary": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/19/tables/0/rows/28/summary": "Force psql to prompt for a password before connecting to a database, even if the password will not be used.", "/versions/19/tables/0/rows/29/summary": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded .", "/versions/19/tables/0/rows/30/summary": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file).", "/versions/19/tables/0/rows/31/summary": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero .", "/versions/19/tables/0/rows/32/summary": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero .", "/versions/19/tables/0/rows/33/summary": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied.", "/versions/19/tables/0/rows/34/summary": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables.", "/versions/19/tables/1/columns/0/label": "Variable", "/versions/19/tables/1/columns/1/label": "Meaning", "/versions/19/tables/1/rows/0/description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode.", "/versions/19/tables/1/rows/1/description": "Default connection parameters (see Section 32.15 ).", "/versions/19/tables/1/rows/2/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .", "/versions/19/tables/1/rows/3/description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems.", "/versions/19/tables/1/rows/4/description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems.", "/versions/19/tables/1/rows/5/description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed.", "/versions/19/tables/1/rows/6/description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If neither of them is set, the default is to use more on most platforms, but less on Cygwin.", "/versions/19/tables/1/rows/7/description": "When a query is executed repeatedly with the \\watch command, a pager is not used by default. This behavior can be changed by setting PSQL_WATCH_PAGER to a pager command, on Unix systems. The pspg pager (not part of PostgreSQL but available in many open source software distributions) can display the output of \\watch if started with the option --stream .", "/versions/19/tables/1/rows/8/description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed.", "/versions/19/tables/1/rows/9/description": "Command executed by the \\! command.", "/versions/19/tables/1/rows/10/description": "Directory for storing temporary files. The default is /tmp ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "cf702a193ae72c220f19f393512961b41d8ee6b99f3c76a175f6f2a13cfd30ad"}, "comparison_data": {"options": [{"names": ["-a", "--echo-all"], "signature": "-a --echo-all", "description": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all ."}, {"names": ["-A", "--no-align"], "signature": "-A --no-align", "description": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned ."}, {"names": ["-b", "--echo-errors"], "signature": "-b --echo-errors", "description": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors ."}, {"names": ["-c command", "--command= command"], "signature": "-c command --command= command", "description": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. command must be either a command string that is completely parsable by the server (i.e., it contains no psql -specific features), or a single backslash command. Thus you cannot mix SQL and psql meta-commands within a -c option. To achieve that, you could use repeated -c options or pipe the string into psql , for example: psql -c '\\x' -c 'SELECT * FROM foo;' or echo '\\x \\\\ SELECT * FROM foo;' | psql ( \\\\ is the separator meta-command.) Each SQL command string passed to -c is sent to the server as a single request. Because of this, the server executes it as a single transaction even if the string contains multiple SQL commands, unless there are explicit BEGIN / COMMIT commands included in the string to divide it into multiple transactions. (See Section 54.2.2.1 for more details about how the server handles multi-query strings.) If having several commands executed in one transaction is not desired, use repeated -c commands or feed multiple commands to psql 's standard input, either using echo as illustrated above, or via a shell here-document, for example: psql <<EOF \\x SELECT * FROM foo; EOF"}, {"names": ["--csv"], "signature": "--csv", "description": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv ."}, {"names": ["-d dbname", "--dbname= dbname"], "signature": "-d dbname --dbname= dbname", "description": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--echo-queries"], "signature": "-e --echo-queries", "description": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries ."}, {"names": ["-E", "--echo-hidden"], "signature": "-E --echo-hidden", "description": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on ."}, {"names": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i . If filename is - (hyphen), then standard input is read until an EOF indication or \\q meta-command. This can be used to intersperse interactive input with input from files. Note however that Readline is not used in this case (much as if -n had been specified). Using this option is subtly different from writing psql < filename . In general, both will do what you expect, but using -f enables some nice features such as error messages with line numbers. There is also a slight chance that using this option will reduce the start-up overhead. On the other hand, the variant using the shell's input redirection is (in theory) guaranteed to yield exactly the same output you would have received had you entered everything by hand."}, {"names": ["-F separator", "--field-separator= separator"], "signature": "-F separator --field-separator= separator", "description": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f ."}, {"names": ["-h hostname", "--host= hostname"], "signature": "-h hostname --host= hostname", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket."}, {"names": ["-H", "--html"], "signature": "-H --html", "description": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command."}, {"names": ["-l", "--list"], "signature": "-l --list", "description": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list . When this option is used, psql will connect to the database postgres , unless a different database is named on the command line (option -d or non-option argument, possibly via a service entry, but not via an environment variable)."}, {"names": ["-L filename", "--log-file= filename"], "signature": "-L filename --log-file= filename", "description": "Write all query output into file filename , in addition to the normal output destination."}, {"names": ["-n", "--no-readline"], "signature": "-n --no-readline", "description": "Do not use Readline for line editing and do not use the command history (see the section called \u201cCommand-Line Editing\u201d below)."}, {"names": ["-o filename", "--output= filename"], "signature": "-o filename --output= filename", "description": "Put all query output into file filename . This is equivalent to the command \\o ."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432."}, {"names": ["-P assignment", "--pset= assignment"], "signature": "-P assignment --pset= assignment", "description": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex ."}, {"names": ["-q", "--quiet"], "signature": "-q --quiet", "description": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on ."}, {"names": ["-R separator", "--record-separator= separator"], "signature": "-R separator --record-separator= separator", "description": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep ."}, {"names": ["-s", "--single-step"], "signature": "-s --single-step", "description": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts."}, {"names": ["-S", "--single-line"], "signature": "-S --single-line", "description": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does. Note This mode is provided for those who insist on it, but you are not necessarily encouraged to use it. In particular, if you mix SQL and meta-commands on a line the order of execution might not always be clear to the inexperienced user."}, {"names": ["-t", "--tuples-only"], "signature": "-t --tuples-only", "description": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only ."}, {"names": ["-T table_options", "--table-attr= table_options"], "signature": "-T table_options --table-attr= table_options", "description": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)"}, {"names": ["-v assignment", "--set= assignment", "--variable= assignment"], "signature": "-v assignment --set= assignment --variable= assignment", "description": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the psql version and exit."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Force psql to prompt for a password before connecting to a database, even if the password will not be used. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, psql will prompt for a password in any case. However, psql will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-x", "--expanded"], "signature": "-x --expanded", "description": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded ."}, {"names": ["-X", "--no-psqlrc"], "signature": "-X --no-psqlrc", "description": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file)."}, {"names": ["-z", "--field-separator-zero"], "signature": "-z --field-separator-zero", "description": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero ."}, {"names": ["-0", "--record-separator-zero"], "signature": "-0 --record-separator-zero", "description": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero ."}, {"names": ["-1", "--single-transaction"], "signature": "-1 --single-transaction", "description": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied. If the commands themselves contain BEGIN , COMMIT , or ROLLBACK , this option will not have the desired effects. Also, if an individual command cannot be executed inside a transaction block, specifying this option will cause the whole transaction to fail."}, {"names": ["-?", "--help[= topic ]"], "signature": "-? --help[= topic ]", "description": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables."}], "synopsis": ["psql [ option ...] [ dbname [ username ]]"], "environment": [{"name": "COLUMNS", "description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode."}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters (see Section 32.15 )."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems."}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems."}, {"name": "PSQL_HISTORY", "description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed."}, {"name": "PSQL_PAGER PAGER", "description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If neither of them is set, the default is to use more on most platforms, but less on Cygwin."}, {"name": "PSQL_WATCH_PAGER", "description": "When a query is executed repeatedly with the \\watch command, a pager is not used by default. This behavior can be changed by setting PSQL_WATCH_PAGER to a pager command, on Unix systems. The pspg pager (not part of PostgreSQL but available in many open source software distributions) can display the output of \\watch if started with the option --stream ."}, {"name": "PSQLRC", "description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed."}, {"name": "SHELL", "description": "Command executed by the \\! command."}, {"name": "TMPDIR", "description": "Directory for storing temporary files. The default is /tmp ."}]}, "comparison_hash": "7e52d8ca2dae4caec99412af17f0657a086f7413f9904aa5e55efb826f752e8b", "manual_language": "zh"}, "20": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "psql"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "20devel"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "35"}], "tables": [{"key": "options", "rows": [{"summary": "\u5728\u8bfb\u5165\u65f6\u5c06\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u884c\u8bfb\u53d6\uff09\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a all \u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-ECHO-ALL", "text": "-a --echo-all"}}, {"summary": "\u5207\u6362\u5230\u975e\u5bf9\u9f50\u8f93\u51fa\u6a21\u5f0f\uff08\u9ed8\u8ba4\u8f93\u51fa\u6a21\u5f0f\u662f aligned \uff09\u3002\u8fd9\u7b49\u6548\u4e8e \\pset format unaligned \u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-NO-ALIGN", "text": "-A --no-align"}}, {"summary": "\u628a\u5931\u8d25\u7684 SQL \u547d\u4ee4\u6253\u5370\u5230\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a errors \u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-ECHO-ERRORS", "text": "-b --echo-errors"}}, {"summary": "\u6307\u5b9a psql \u6267\u884c\u4e00\u4e2a\u7ed9\u5b9a\u7684\u547d\u4ee4\u5b57\u7b26\u4e32 command \u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u591a\u6b21\u5e76\u4e14\u4ee5\u4efb\u4f55\u987a\u5e8f\u4e0e -f \u9009\u9879\u7ec4\u5408\u5728\u4e00\u8d77\u3002\u5f53 -c \u6216\u8005 -f \u88ab\u6307\u5b9a\u65f6\uff0c psql \u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709 -c \u548c -f \u9009\u9879\u540e\u7ec8\u6b62\u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-COMMAND", "text": "-c command --command= command"}}, {"summary": "\u5207\u6362\u5230 CSV \uff08\u9017\u53f7\u5206\u9694\u503c\uff09\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u76f8\u5f53\u4e8e \\pset format csv \u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-CSV", "text": "--csv"}}, {"summary": "\u6307\u5b9a\u8981\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002\u8fd9\u7b49\u6548\u4e8e\u6307\u5b9a dbname \u4e3a\u547d\u4ee4\u884c\u4e0a\u7684\u7b2c\u4e00\u4e2a\u975e\u9009\u9879\u53c2\u6570\u3002 dbname \u53ef\u4ee5\u662f \u8fde\u63a5\u5b57\u7b26\u4e32 \u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u5c06\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-DBNAME", "text": "-d dbname --dbname= dbname"}}, {"summary": "\u4e5f\u628a\u53d1\u9001\u5230\u670d\u52a1\u5668\u7684\u6240\u6709 SQL \u547d\u4ee4\u590d\u5236\u5230\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a queries \u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-ECHO-QUERIES", "text": "-e --echo-queries"}}, {"summary": "\u56de\u663e \\d \u4ee5\u53ca\u5176\u4ed6\u53cd\u659c\u7ebf\u547d\u4ee4\u751f\u6210\u7684\u5b9e\u9645\u67e5\u8be2\u3002\u53ef\u4ee5\u7528\u5b83\u6765\u5b66\u4e60 psql \u7684\u5185\u90e8\u64cd\u4f5c\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO_HIDDEN \u8bbe\u7f6e\u4e3a on \u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-ECHO-HIDDEN", "text": "-E --echo-hidden"}}, {"summary": "\u4ece\u6587\u4ef6 filename \u800c\u4e0d\u662f\u6807\u51c6\u8f93\u5165\u4e2d\u8bfb\u53d6\u547d\u4ee4\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u6307\u5b9a\uff0c\u4e5f\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u4e0e -c \u9009\u9879\u7ec4\u5408\u4f7f\u7528\u3002\u5f53\u6307\u5b9a\u4e86 -c \u6216 -f \u65f6\uff0c psql \u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709 -c \u548c -f \u9009\u9879\u540e\u7ec8\u6b62\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u7b49\u4ef7\u4e8e\u5143\u547d\u4ee4 \\i \u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-FILE", "text": "-f filename --file= filename"}}, {"summary": "\u4f7f\u7528 separator \u4f5c\u4e3a\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e \\pset fieldsep \u6216\u8005 \\f \u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR", "text": "-F separator --field-separator= separator"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-FIELD-HOST", "text": "-h hostname --host= hostname"}}, {"summary": "\u5207\u6362\u5230 HTML \u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e \\pset format html \u6216\u8005 \\H \u547d\u4ee4\u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-HTML", "text": "-H --html"}}, {"summary": "\u5217\u51fa\u6240\u6709\u53ef\u7528\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u9000\u51fa\u3002\u5176\u4ed6\u975e\u8fde\u63a5\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002\u8fd9\u4e0e\u5143\u547d\u4ee4 \\list \u7c7b\u4f3c\u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-LIST", "text": "-l --list"}}, {"summary": "\u9664\u4e86\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u5199\u5230\u666e\u901a\u8f93\u51fa\u76ee\u6807\u4e4b\u5916\uff0c\u8fd8\u5199\u5230\u6587\u4ef6 filename \u4e2d\u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-LOG-FILE", "text": "-L filename --log-file= filename"}}, {"summary": "\u4e0d\u8981\u4f7f\u7528 Readline \u8fdb\u884c\u884c\u7f16\u8f91\uff0c\u4e5f\u4e0d\u8981\u4f7f\u7528\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\uff08\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684 \u201c\u547d\u4ee4\u884c\u7f16\u8f91\u201d\u4e00\u8282 \uff09\u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-NO-READLINE", "text": "-n --no-readline"}}, {"summary": "\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u653e\u5230\u6587\u4ef6 filename \u4e2d\u3002\u8fd9\u7b49\u6548\u4e8e\u547d\u4ee4 \\o \u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-OUTPUT", "text": "-o filename --output= filename"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u7684\u6587\u4ef6\u540d\u540e\u7f00\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u7684\u503c\uff1b\u672a\u8bbe\u7f6e\u65f6\uff0c\u4f7f\u7528\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u7aef\u53e3\uff0c\u901a\u5e38\u4e3a 5432\u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-PORT", "text": "-p port --port= port"}}, {"summary": "\u4ee5 \\pset \u7684\u5f62\u5f0f\u6307\u5b9a\u6253\u5370\u9009\u9879\u3002\u6ce8\u610f\uff0c\u8fd9\u91cc\u4f60\u5fc5\u987b\u7528\u4e00\u4e2a\u7b49\u53f7\u800c\u4e0d\u662f\u7a7a\u683c\u6765\u5206\u9694\u540d\u79f0\u548c\u503c\u3002\u4f8b\u5982\uff0c\u8981\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a LaTeX \uff0c\u5e94\u8be5\u5199\u6210 -P format=latex \u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-PSET", "text": "-P assignment --pset= assignment"}}, {"summary": "\u6307\u5b9a psql \u5e94\u8be5\u5b89\u9759\u5730\u5de5\u4f5c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4f1a\u6253\u5370\u51fa\u6b22\u8fce\u6d88\u606f\u548c\u5404\u79cd\u63d0\u793a\u4fe1\u606f\u3002\u5982\u679c\u4f7f\u7528\u4e86\u8fd9\u4e2a\u9009\u9879\uff0c\u4ee5\u4e0a\u90a3\u4e9b\u5c31\u90fd\u4e0d\u4f1a\u8f93\u51fa\u3002\u5728\u4f7f\u7528 -c \u9009\u9879\u65f6\uff0c\u914d\u5408\u8fd9\u4e2a\u9009\u9879\u5f88\u6709\u7528\u3002\u8fd9\u7b49\u6548\u4e8e\u8bbe\u7f6e\u53d8\u91cf QUIET \u4e3a on \u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-QUIET", "text": "-q --quiet"}}, {"summary": "\u628a separator \u7528\u4f5c\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e \\pset recordsep \u547d\u4ee4\u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR", "text": "-R separator --record-separator= separator"}}, {"summary": "\u8fd0\u884c\u5728\u5355\u6b65\u6a21\u5f0f\u4e2d\u3002\u8fd9\u610f\u5473\u7740\u5728\u6bcf\u4e2a\u547d\u4ee4\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u4e4b\u524d\u90fd\u4f1a\u63d0\u793a\u7528\u6237\uff0c\u5e76\u5141\u8bb8\u53d6\u6d88\u6267\u884c\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u8c03\u8bd5\u811a\u672c\u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-SINGLE-STEP", "text": "-s --single-step"}}, {"summary": "\u8fd0\u884c\u5728\u5355\u884c\u6a21\u5f0f\u4e2d\uff0c\u5176\u4e2d\u6362\u884c\u7b26\u4f1a\u7ec8\u6b62\u4e00\u4e2a SQL \u547d\u4ee4\uff0c\u5c31\u50cf\u5206\u53f7\u7684\u4f5c\u7528\u4e00\u6837\u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-SINGLE-LINE", "text": "-S --single-line"}}, {"summary": "\u5173\u95ed\u6253\u5370\u5217\u540d\u548c\u7ed3\u679c\u884c\u8ba1\u6570\u9875\u811a\u7b49\u3002\u8fd9\u7b49\u6548\u4e8e \\t \u6216\u8005 \\pset tuples_only \u547d\u4ee4\u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-TUPLES-ONLY", "text": "-t --tuples-only"}}, {"summary": "\u6307\u5b9a\u8981\u653e\u5728 HTML table \u6807\u7b7e\u5185\u7684\u9009\u9879\u3002\u8be6\u89c1 \\pset tableattr \u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-TABLE-ATTR", "text": "-T table_options --table-attr= table_options"}}, {"summary": "\u4f5c\u4e3a\u7528\u6237 username \u800c\u4e0d\u662f\u9ed8\u8ba4\u7528\u6237\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff08\u5f53\u7136\uff0c\u4f60\u5fc5\u987b\u5177\u6709\u8fd9\u6837\u505a\u7684\u6743\u9650\uff09\u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-USERNAME", "text": "-U username --username= username"}}, {"summary": "\u6267\u884c\u4e00\u6b21\u53d8\u91cf\u8d4b\u503c\uff0c\u548c \\set \u5143\u547d\u4ee4\u76f8\u4f3c\u3002\u6ce8\u610f\u4f60\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u7528\u7b49\u53f7\u5206\u9694\u540d\u5b57\u548c\u503c\uff08\u5982\u679c\u6709\uff09\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u7684\u8bbe\u7f6e\uff0c\u53bb\u6389\u7b49\u53f7\u5c31\u884c\u3002\u8981\u628a\u4e00\u4e2a\u53d8\u91cf\u8bbe\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u4f7f\u7528\u7b49\u53f7\u4f46\u662f\u53bb\u6389\u503c\u3002\u8fd9\u4e9b\u8d4b\u503c\u5728\u547d\u4ee4\u884c\u5904\u7406\u671f\u95f4\u88ab\u5b8c\u6210\uff0c\u56e0\u6b64\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u7684\u53d8\u91cf\u5c06\u5728\u7a0d\u540e\u88ab\u8986\u76d6\u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-VARIABLE", "text": "-v assignment --set= assignment --variable= assignment"}}, {"summary": "\u6253\u5370 psql \u7248\u672c\u5e76\u4e14\u9000\u51fa\u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-VERSION", "text": "-V --version"}}, {"summary": "\u6c38\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982 .pgpass \u6587\u4ef6\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u8fd9\u4e2a\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4efb\u52a1\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u65f6\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-NO-PASSWORD", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 psql \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\uff0c\u5373\u4f7f\u8be5\u5bc6\u7801\u5b9e\u9645\u4e0a\u4e0d\u4f1a\u88ab\u4f7f\u7528\u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-PASSWORD", "text": "-W --password"}}, {"summary": "\u6253\u5f00\u6269\u5c55\u8868\u683c\u5f0f\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e \\x \u6216\u8005 \\pset expanded \u547d\u4ee4\u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-EXPANDED", "text": "-x --expanded"}}, {"summary": "\u4e0d\u8bfb\u53d6\u542f\u52a8\u6587\u4ef6\uff08\u65e2\u4e0d\u8bfb\u53d6\u7cfb\u7edf\u8303\u56f4\u7684 psqlrc \u6587\u4ef6\uff0c\u4e5f\u4e0d\u8bfb\u53d6\u7528\u6237\u7684 ~/.psqlrc \u6587\u4ef6\uff09\u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-NO-PSQLRC", "text": "-X --no-psqlrc"}}, {"summary": "\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u8fd9\u7b49\u6548\u4e8e \\pset fieldsep_zero \u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR-ZERO", "text": "-z --field-separator-zero"}}, {"summary": "\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u4f8b\u5982\uff0c\u8fd9\u6709\u52a9\u4e8e\u4e0e xargs -0 \u914d\u5408\u4f7f\u7528\u3002\u8fd9\u7b49\u6548\u4e8e \\pset recordsep_zero \u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR-ZERO", "text": "-0 --record-separator-zero"}}, {"summary": "\u8fd9\u4e2a\u9009\u9879\u53ea\u80fd\u4e0e\u4e00\u4e2a\u6216\u591a\u4e2a -c \u548c/\u6216 -f \u9009\u9879\u7ed3\u5408\u4f7f\u7528\u3002\u5b83\u4f1a\u5bfc\u81f4 psql \u5728\u7b2c\u4e00\u4e2a\u8fd9\u6837\u7684\u9009\u9879\u4e4b\u524d\u53d1\u51fa\u4e00\u4e2a BEGIN \u547d\u4ee4\uff0c\u5e76\u5728\u6700\u540e\u4e00\u4e2a\u9009\u9879\u4e4b\u540e\u53d1\u51fa\u4e00\u4e2a COMMIT \u547d\u4ee4\uff0c\u4ece\u800c\u5c06\u6240\u6709\u547d\u4ee4\u5305\u88c5\u6210\u4e00\u4e2a\u5355\u72ec\u7684\u4e8b\u52a1\u3002\u5982\u679c\u4efb\u4f55\u547d\u4ee4\u5931\u8d25\u4e14\u53d8\u91cf ON_ERROR_STOP \u88ab\u8bbe\u7f6e\uff0c\u5219\u4f1a\u6539\u4e3a\u53d1\u9001\u4e00\u4e2a ROLLBACK \u547d\u4ee4\u3002\u8fd9\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-SINGLE-TRANSACTION", "text": "-1 --single-transaction"}}, {"summary": "\u663e\u793a\u6709\u5173 psql \u7684\u5e2e\u52a9\u5e76\u4e14\u9000\u51fa\u3002\u53ef\u9009\u7684 topic \u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a options \uff09\u9009\u62e9\u8981\u89e3\u91ca psql \u7684\u54ea\u4e00\u90e8\u5206\uff1a commands \u63cf\u8ff0 psql \u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b options \u63cf\u8ff0\u53ef\u4ee5\u88ab\u4f20\u9012\u7ed9 psql \u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c variables \u5219\u663e\u793a\u6709\u5173 psql \u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002", "signature": {"url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-HELP", "text": "-? --help[= topic ]"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "COLUMNS", "description": "\u5982\u679c \\pset columns \u4e3a\u96f6\uff0c\u8fd9\u4e2a\u73af\u5883\u53d8\u91cf\u63a7\u5236\u7528\u4e8e wrapped \u683c\u5f0f\u7684\u5bbd\u5ea6\u4ee5\u53ca\u7528\u6765\u786e\u5b9a\u8f83\u5bbd\u7684\u8f93\u51fa\u662f\u5426\u9700\u8981\u5206\u9875\u5668\uff0c\u6216\u8005\u662f\u5426\u5e94\u5207\u6362\u5230\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e2d\u7684\u5782\u76f4\u683c\u5f0f\u7684\u5bbd\u5ea6\u3002"}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\uff08\u89c1 \u7b2c 32.14 \u8282 \uff09\u3002"}, {"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "\\e \u3001 \\ef \u4ee5\u53ca \\ev \u547d\u4ee4\u6240\u4f7f\u7528\u7684\u7f16\u8f91\u5668\u3002\u4f1a\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u68c0\u67e5\u8fd9\u4e9b\u53d8\u91cf\uff0c\u7b2c\u4e00\u4e2a\u88ab\u8bbe\u7f6e\u7684\u5c06\u88ab\u4f7f\u7528\u3002\u5982\u679c\u90fd\u6ca1\u6709\u88ab\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u662f\u4f7f\u7528Unix\u7cfb\u7edf\u4e0a\u7684 vi \u6216\u8005Windows\u7cfb\u7edf\u4e0a\u7684 notepad.exe \u3002"}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "\u5f53 \\e \u3001 \\ef \u6216 \\ev \u5e26\u6709\u884c\u53f7\u53c2\u6570\u4f7f\u7528\u65f6\uff0c\u6b64\u53d8\u91cf\u6307\u5b9a\u5c06\u8d77\u59cb\u884c\u53f7\u4f20\u7ed9\u7528\u6237\u7f16\u8f91\u5668\u65f6\u6240\u7528\u7684\u547d\u4ee4\u884c\u53c2\u6570\u3002\u5bf9\u4e8e Emacs \u6216 vi \u4e4b\u7c7b\u7684\u7f16\u8f91\u5668\uff0c\u8fd9\u4e2a\u53c2\u6570\u662f\u4e00\u4e2a\u52a0\u53f7\u3002\u5982\u679c\u9009\u9879\u540d\u548c\u884c\u53f7\u4e4b\u95f4\u9700\u8981\u7a7a\u683c\uff0c\u8bf7\u5728\u53d8\u91cf\u503c\u4e2d\u5305\u542b\u672b\u5c3e\u7a7a\u683c\u3002\u4f8b\u5982\uff1a PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' \u5728 Unix \u7cfb\u7edf\u4e0a\u9ed8\u8ba4\u662f + \uff08\u5bf9\u5e94\u4e8e\u9ed8\u8ba4\u7f16\u8f91\u5668 vi \uff0c\u4e14\u5bf9\u5f88\u591a\u5176\u4ed6\u5e38\u89c1\u7f16\u8f91\u5668\u53ef\u7528\uff09\u3002\u5728 Windows \u7cfb\u7edf\u4e0a\u6ca1\u6709\u9ed8\u8ba4\u503c\u3002"}, {"name": "PSQL_HISTORY", "description": "\u547d\u4ee4\u5386\u53f2\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08 ~ \uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002"}, {"name": "PSQL_PAGER PAGER", "description": "\u5982\u679c\u67e5\u8be2\u7ed3\u679c\u65e0\u6cd5\u5728\u5c4f\u5e55\u4e0a\u663e\u793a\u5b8c\u6574\uff0c\u5b83\u4eec\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6b64\u547d\u4ee4\u3002\u5178\u578b\u7684\u503c\u662f more \u6216 less \u3002\u53ef\u4ee5\u901a\u8fc7\u5c06 PSQL_PAGER \u6216 PAGER \u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u6216\u901a\u8fc7\u8c03\u6574 \\pset \u547d\u4ee4\u7684\u4e0e\u5206\u9875\u76f8\u5173\u7684\u9009\u9879\u6765\u7981\u7528\u5206\u9875\u5668\u3002\u8fd9\u4e9b\u53d8\u91cf\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u8fdb\u884c\u68c0\u67e5\uff1b\u4f7f\u7528\u6309\u8be5\u987a\u5e8f\u627e\u5230\u7684\u7b2c\u4e00\u4e2a\u5df2\u8bbe\u7f6e\u7684\u53d8\u91cf\u3002\u5982\u679c\u5b83\u4eec\u90fd\u6ca1\u6709\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5728\u5927\u591a\u6570\u5e73\u53f0\u4e0a\u4f7f\u7528 more \uff0c\u4f46\u5728Cygwin\u4e0a\u4f7f\u7528 less \u3002"}, {"name": "PSQL_WATCH_PAGER", "description": "\u4f7f\u7528 \\watch \u547d\u4ee4\u53cd\u590d\u6267\u884c\u67e5\u8be2\u65f6\uff0c\u9ed8\u8ba4\u4e0d\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\u3002\u5728 Unix \u7cfb\u7edf\u4e0a\uff0c\u53ef\u4ee5\u5c06 PSQL_WATCH_PAGER \u8bbe\u4e3a\u5206\u9875\u7a0b\u5e8f\u547d\u4ee4\u6765\u6539\u53d8\u6b64\u884c\u4e3a\u3002pspg \u5206\u9875\u7a0b\u5e8f\uff08\u4e0d\u5c5e\u4e8e PostgreSQL\uff0c\u4f46\u8bb8\u591a\u5f00\u6e90\u8f6f\u4ef6\u53d1\u884c\u7248\u90fd\u63d0\u4f9b\u5b83\uff09\u4ee5 --stream \u9009\u9879\u542f\u52a8\u65f6\uff0c\u53ef\u4ee5\u663e\u793a \\watch \u7684\u8f93\u51fa\u3002"}, {"name": "PSQLRC", "description": "\u7528\u6237\u7684 .psqlrc \u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08 ~ \uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002"}, {"name": "SHELL", "description": "\u88ab \\! \u547d\u4ee4\u6267\u884c\u7684\u547d\u4ee4\u3002"}, {"name": "TMPDIR", "description": "\u5b58\u50a8\u4e34\u65f6\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u662f /tmp \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-a", "--echo-all"], "summary": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all .", "signature": "-a --echo-all", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-ECHO-ALL", "description": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all ."}, {"names": ["-A", "--no-align"], "summary": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned .", "signature": "-A --no-align", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-NO-ALIGN", "description": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned ."}, {"names": ["-b", "--echo-errors"], "summary": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors .", "signature": "-b --echo-errors", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-ECHO-ERRORS", "description": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors ."}, {"names": ["-c command", "--command= command"], "summary": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence.", "signature": "-c command --command= command", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-COMMAND", "description": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. command must be either a command string that is completely parsable by the server (i.e., it contains no psql -specific features), or a single backslash command. Thus you cannot mix SQL and psql meta-commands within a -c option. To achieve that, you could use repeated -c options or pipe the string into psql , for example: psql -c '\\x' -c 'SELECT * FROM foo;' or echo '\\x \\\\ SELECT * FROM foo;' | psql ( \\\\ is the separator meta-command.) Each SQL command string passed to -c is sent to the server as a single request. Because of this, the server executes it as a single transaction even if the string contains multiple SQL commands, unless there are explicit BEGIN / COMMIT commands included in the string to divide it into multiple transactions. (See Section 54.2.2.1 for more details about how the server handles multi-query strings.) If having several commands executed in one transaction is not desired, use repeated -c commands or feed multiple commands to psql 's standard input, either using echo as illustrated above, or via a shell here-document, for example: psql <<EOF \\x SELECT * FROM foo; EOF"}, {"names": ["--csv"], "summary": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv .", "signature": "--csv", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-CSV", "description": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv ."}, {"names": ["-d dbname", "--dbname= dbname"], "summary": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "signature": "-d dbname --dbname= dbname", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-DBNAME", "description": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--echo-queries"], "summary": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries .", "signature": "-e --echo-queries", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-ECHO-QUERIES", "description": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries ."}, {"names": ["-E", "--echo-hidden"], "summary": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on .", "signature": "-E --echo-hidden", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-ECHO-HIDDEN", "description": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on ."}, {"names": ["-f filename", "--file= filename"], "summary": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i .", "signature": "-f filename --file= filename", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-FILE", "description": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i . If filename is - (hyphen), then standard input is read until an EOF indication or \\q meta-command. This can be used to intersperse interactive input with input from files. Note however that Readline is not used in this case (much as if -n had been specified). Using this option is subtly different from writing psql < filename . In general, both will do what you expect, but using -f enables some nice features such as error messages with line numbers. There is also a slight chance that using this option will reduce the start-up overhead. On the other hand, the variant using the shell's input redirection is (in theory) guaranteed to yield exactly the same output you would have received had you entered everything by hand."}, {"names": ["-F separator", "--field-separator= separator"], "summary": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f .", "signature": "-F separator --field-separator= separator", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR", "description": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f ."}, {"names": ["-h hostname", "--host= hostname"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket.", "signature": "-h hostname --host= hostname", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-FIELD-HOST", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket."}, {"names": ["-H", "--html"], "summary": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command.", "signature": "-H --html", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-HTML", "description": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command."}, {"names": ["-l", "--list"], "summary": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list .", "signature": "-l --list", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-LIST", "description": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list . When this option is used, psql will connect to the database postgres , unless a different database is named on the command line (option -d or non-option argument, possibly via a service entry, but not via an environment variable)."}, {"names": ["-L filename", "--log-file= filename"], "summary": "Write all query output into file filename , in addition to the normal output destination.", "signature": "-L filename --log-file= filename", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-LOG-FILE", "description": "Write all query output into file filename , in addition to the normal output destination."}, {"names": ["-n", "--no-readline"], "summary": "Do not use Readline for line editing and do not use the command history (see the section called \u201cCommand-Line Editing\u201d below).", "signature": "-n --no-readline", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-NO-READLINE", "description": "Do not use Readline for line editing and do not use the command history (see the section called \u201cCommand-Line Editing\u201d below)."}, {"names": ["-o filename", "--output= filename"], "summary": "Put all query output into file filename . This is equivalent to the command \\o .", "signature": "-o filename --output= filename", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-OUTPUT", "description": "Put all query output into file filename . This is equivalent to the command \\o ."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432.", "signature": "-p port --port= port", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-PORT", "description": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432."}, {"names": ["-P assignment", "--pset= assignment"], "summary": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex .", "signature": "-P assignment --pset= assignment", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-PSET", "description": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex ."}, {"names": ["-q", "--quiet"], "summary": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on .", "signature": "-q --quiet", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-QUIET", "description": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on ."}, {"names": ["-R separator", "--record-separator= separator"], "summary": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep .", "signature": "-R separator --record-separator= separator", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR", "description": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep ."}, {"names": ["-s", "--single-step"], "summary": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts.", "signature": "-s --single-step", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-SINGLE-STEP", "description": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts."}, {"names": ["-S", "--single-line"], "summary": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does.", "signature": "-S --single-line", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-SINGLE-LINE", "description": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does. Note This mode is provided for those who insist on it, but you are not necessarily encouraged to use it. In particular, if you mix SQL and meta-commands on a line the order of execution might not always be clear to the inexperienced user."}, {"names": ["-t", "--tuples-only"], "summary": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only .", "signature": "-t --tuples-only", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-TUPLES-ONLY", "description": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only ."}, {"names": ["-T table_options", "--table-attr= table_options"], "summary": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details.", "signature": "-T table_options --table-attr= table_options", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-TABLE-ATTR", "description": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details."}, {"names": ["-U username", "--username= username"], "summary": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)", "signature": "-U username --username= username", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-USERNAME", "description": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)"}, {"names": ["-v assignment", "--set= assignment", "--variable= assignment"], "summary": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later.", "signature": "-v assignment --set= assignment --variable= assignment", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-VARIABLE", "description": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later."}, {"names": ["-V", "--version"], "summary": "Print the psql version and exit.", "signature": "-V --version", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-VERSION", "description": "Print the psql version and exit."}, {"names": ["-w", "--no-password"], "summary": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-NO-PASSWORD", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-W", "--password"], "summary": "Force psql to prompt for a password before connecting to a database, even if the password will not be used.", "signature": "-W --password", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-PASSWORD", "description": "Force psql to prompt for a password before connecting to a database, even if the password will not be used. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, psql will prompt for a password in any case. However, psql will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-x", "--expanded"], "summary": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded .", "signature": "-x --expanded", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-EXPANDED", "description": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded ."}, {"names": ["-X", "--no-psqlrc"], "summary": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file).", "signature": "-X --no-psqlrc", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-NO-PSQLRC", "description": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file)."}, {"names": ["-z", "--field-separator-zero"], "summary": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero .", "signature": "-z --field-separator-zero", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR-ZERO", "description": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero ."}, {"names": ["-0", "--record-separator-zero"], "summary": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero .", "signature": "-0 --record-separator-zero", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR-ZERO", "description": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero ."}, {"names": ["-1", "--single-transaction"], "summary": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied.", "signature": "-1 --single-transaction", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-SINGLE-TRANSACTION", "description": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied. If the commands themselves contain BEGIN , COMMIT , or ROLLBACK , this option will not have the desired effects. Also, if an individual command cannot be executed inside a transaction block, specifying this option will cause the whole transaction to fail."}, {"names": ["-?", "--help[= topic ]"], "summary": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables.", "signature": "-? --help[= topic ]", "source_url": "/docs/devel/app-psql.html#APP-PSQL-OPTION-HELP", "description": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables."}], "related": [{"url": "/wiki/psql/?v=20", "label": "psql \u5143\u547d\u4ee4"}, {"url": "/wiki/conn/?v=20", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/snapshot/dev/postgresql-snapshot.tar.bz2", "label": "20devel", "major": "20", "channel": "devel", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/20/postgresql-20-A4.pdf", "bytes": 16030631, "pages": 3052, "sha256": "bd5d82c0ce38fc18f92a0447818a91a193a261776bca1c37564bf9a683e177d0", "built_at": "2026-09-28"}, "US": {"url": "/files/documentation/pdf/20/postgresql-20-US.pdf", "bytes": 15936613, "pages": 3223, "sha256": "d97d9e0db479a02f4234b175f50fcad70c3661619afc8d6df9b9437882e3c299", "built_at": "2026-09-28"}}, "tree": "0", "index": "index.html", "major": "20", "pages": 1156, "release": "20devel", "source_url": "https://ftp.postgresql.org/pub/snapshot/dev/postgresql-snapshot.tar.bz2", "svg_assets": 6, "source_mode": "en SGML built with pinned official archive", "source_sha256": "4d3346909b201ac1648232cf290462a7070c119326f56196f1f0253ed80fae41", "source_snapshot_utc": "26-Sep-2026 20:22"}, "revision": "2eba5e0fd4c3bffb2803247b6cd537878e9d6ee5a6dfbe3c50ece8b421b80918", "evidence_kind": "English manual and source declarations", "source_sha256": "4d3346909b201ac1648232cf290462a7070c119326f56196f1f0253ed80fae41"}, "sources": [{"url": "https://pg.center/docs/devel/app-psql.html", "file": "app-psql.html", "label": "20devel English manual \u00b7 app-psql.html", "anchor": "", "sha256": "6df5f6fbaff7800ae0e4a08a3116090d890a0cdcc02fddc31c1f220725905f87", "language": "en", "original_url": "/docs/devel/app-psql.html"}, {"url": "https://pg.center/docs/devel/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "a6c7ba748fa1d9feac5bb7cde41d1d36a1f4c26d5963e07fb103d02918b2a8ca", "language": "en", "original_url": "/docs/devel/reference-client.html"}], "sections": [], "synopsis": ["psql [ option ...] [ dbname [ username ]]"], "signature": "psql [ option ...] [ dbname [ username ]]", "description": ["psql \u2014 PostgreSQL \u7684\u4ea4\u4e92\u5f0f\u7ec8\u7aef"], "environment": [{"name": "COLUMNS", "description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode."}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters (see Section 32.14 )."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems."}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems."}, {"name": "PSQL_HISTORY", "description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed."}, {"name": "PSQL_PAGER PAGER", "description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If neither of them is set, the default is to use more on most platforms, but less on Cygwin."}, {"name": "PSQL_WATCH_PAGER", "description": "When a query is executed repeatedly with the \\watch command, a pager is not used by default. This behavior can be changed by setting PSQL_WATCH_PAGER to a pager command, on Unix systems. The pspg pager (not part of PostgreSQL but available in many open source software distributions) can display the output of \\watch if started with the option --stream ."}, {"name": "PSQLRC", "description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed."}, {"name": "SHELL", "description": "Command executed by the \\! command."}, {"name": "TMPDIR", "description": "Directory for storing temporary files. The default is /tmp ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PSQL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></h2>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u2014 <span class=\"productname\">PostgreSQL</span>\u7684\u4ea4\u4e92\u5f0f\u7ec8\u7aef</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.21.4.1\"><code class=\"command\">psql</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em> [<em class=\"replaceable\"><code>username</code></em>]]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.21.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u662f<span class=\"productname\">PostgreSQL</span>\u7684\u4e00\u4e2a\u57fa\u4e8e\u7ec8\u7aef\u7684\u524d\u7aef\u3002\u5b83\u4f7f\u4f60\u80fd\u591f\u4ea4\u4e92\u5f0f\u5730\u8f93\u5165\u67e5\u8be2\uff0c\u5c06\u5176\u53d1\u9001\u7ed9<span class=\"productname\">PostgreSQL</span>\uff0c\u5e76\u67e5\u770b\u67e5\u8be2\u7ed3\u679c\u3002\u4e5f\u53ef\u4ee5\u4ece\u6587\u4ef6\u6216\u547d\u4ee4\u884c\u53c2\u6570\u63d0\u4f9b\u8f93\u5165\u3002\u6b64\u5916\uff0c<span class=\"application\">psql</span>\u8fd8\u63d0\u4f9b\u4e86\u82e5\u5e72\u5143\u547d\u4ee4\u548c\u591a\u79cd\u7c7b\u4f3c shell \u7684\u7279\u6027\uff0c\u4ee5\u4fbf\u4e8e\u7f16\u5199\u811a\u672c\u548c\u81ea\u52a8\u5316\u6267\u884c\u5404\u79cd\u4efb\u52a1\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-PSQL-3\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-OPTION-ECHO-ALL\"><span class=\"term\"><code class=\"option\">-a</code><br/></span><span class=\"term\"><code class=\"option\">--echo-all</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8bfb\u5165\u65f6\u5c06\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u884c\u8bfb\u53d6\uff09\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a <code class=\"literal\">all</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-NO-ALIGN\"><span class=\"term\"><code class=\"option\">-A</code><br/></span><span class=\"term\"><code class=\"option\">--no-align</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230\u975e\u5bf9\u9f50\u8f93\u51fa\u6a21\u5f0f\uff08\u9ed8\u8ba4\u8f93\u51fa\u6a21\u5f0f\u662f<code class=\"literal\">aligned</code>\uff09\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset format unaligned</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-ECHO-ERRORS\"><span class=\"term\"><code class=\"option\">-b</code><br/></span><span class=\"term\"><code class=\"option\">--echo-errors</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u5931\u8d25\u7684 SQL \u547d\u4ee4\u6253\u5370\u5230\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">errors</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-COMMAND\"><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>command</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--command=<em class=\"replaceable\"><code>command</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a<span class=\"application\">psql</span>\u6267\u884c\u4e00\u4e2a\u7ed9\u5b9a\u7684\u547d\u4ee4\u5b57\u7b26\u4e32<em class=\"replaceable\"><code>command</code></em>\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u591a\u6b21\u5e76\u4e14\u4ee5\u4efb\u4f55\u987a\u5e8f\u4e0e<code class=\"option\">-f</code>\u9009\u9879\u7ec4\u5408\u5728\u4e00\u8d77\u3002\u5f53<code class=\"option\">-c</code>\u6216\u8005<code class=\"option\">-f</code>\u88ab\u6307\u5b9a\u65f6\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709<code class=\"option\">-c</code>\u548c<code class=\"option\">-f</code>\u9009\u9879\u540e\u7ec8\u6b62\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>command</code></em>\u5fc5\u987b\u662f\u4e00\u4e2a\u670d\u52a1\u5668\u5b8c\u5168\u53ef\u89e3\u6790\u7684\u547d\u4ee4\u5b57\u7b26\u4e32\uff08\u5373\u4e0d\u5305\u542b<span class=\"application\">psql</span>\u4e13\u6709\u7684\u7279\u6027\uff09\u6216\u8005\u5355\u4e2a\u53cd\u659c\u7ebf\u547d\u4ee4\u3002\u56e0\u6b64\u4e0d\u80fd\u5728\u4e00\u4e2a<code class=\"option\">-c</code>\u9009\u9879\u4e2d\u6df7\u5408<acronym class=\"acronym\">SQL</acronym>\u548c<span class=\"application\">psql</span>\u5143\u547d\u4ee4\u3002\u8981\u90a3\u6837\u505a\uff0c\u53ef\u4ee5\u4f7f\u7528\u591a\u4e2a<code class=\"option\">-c</code>\u9009\u9879\u6216\u8005\u628a\u5b57\u7b26\u4e32\u7528\u7ba1\u9053\u8f93\u9001\u5230<span class=\"application\">psql</span>\u4e2d\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">psql -c '\\x' -c 'SELECT * FROM foo;'\n</pre>\n<p lang=\"zh\">\u6216\u8005</p>\n<pre class=\"programlisting\">echo '\\x \\\\ SELECT * FROM foo;' | psql\n</pre>\n<p lang=\"zh\">\uff08<code class=\"literal\">\\\\</code>\u662f\u5206\u9694\u7b26\u5143\u547d\u4ee4\uff09\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u5b57\u7b26\u4e32\u4f20\u9012\u7ed9<code class=\"option\">-c</code>\u90fd\u4f5c\u4e3a\u4e00\u4e2a\u5355\u72ec\u7684\u8bf7\u6c42\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u56e0\u6b64\uff0c\u5373\u4f7f\u5b57\u7b26\u4e32\u5305\u542b\u591a\u4e2a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\uff0c\u670d\u52a1\u5668\u4e5f\u4f1a\u5c06\u5176\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff0c\u9664\u975e\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u660e\u786e\u7684<code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code>\u547d\u4ee4\u5c06\u5176\u5206\u6210\u591a\u4e2a\u4e8b\u52a1\u3002\uff08\u6709\u5173\u670d\u52a1\u5668\u5982\u4f55\u5904\u7406\u591a\u67e5\u8be2\u5b57\u7b26\u4e32\u7684\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/devel/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT\" title=\"54.2.2.1.\u00a0\u4e00\u4e2a\u7b80\u5355\u67e5\u8be2\u4e2d\u7684\u591a\u6761\u8bed\u53e5\">\u7b2c\u00a054.2.2.1\u00a0\u8282</a>\u3002\uff09</p>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u5e0c\u671b\u5728\u4e00\u4e2a\u4e8b\u52a1\u4e2d\u6267\u884c\u591a\u4e2a\u547d\u4ee4\uff0c\u53ef\u4ee5\u4f7f\u7528\u91cd\u590d\u7684<code class=\"option\">-c</code>\u547d\u4ee4\uff0c\u6216\u5c06\u591a\u4e2a\u547d\u4ee4\u8f93\u5165\u5230<span class=\"application\">psql</span>\u7684\u6807\u51c6\u8f93\u5165\uff0c\u53ef\u4ee5\u50cf\u4e0a\u9762\u793a\u4f8b\u4e2d\u4f7f\u7528<span class=\"application\">echo</span>\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7shell\u7684here-document\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">psql &lt;&lt;EOF\n\\x\nSELECT * FROM foo;\nEOF\n</pre>\n</dd>\n<dt id=\"APP-PSQL-OPTION-CSV\"><span class=\"term\"><code class=\"option\">--csv</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230<acronym class=\"acronym\">CSV</acronym>\uff08\u9017\u53f7\u5206\u9694\u503c\uff09\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u76f8\u5f53\u4e8e<code class=\"command\">\\pset format csv</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-DBNAME\"><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>dbname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>dbname</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002\u8fd9\u7b49\u6548\u4e8e\u6307\u5b9a<em class=\"replaceable\"><code>dbname</code></em>\u4e3a\u547d\u4ee4\u884c\u4e0a\u7684\u7b2c\u4e00\u4e2a\u975e\u9009\u9879\u53c2\u6570\u3002<em class=\"replaceable\"><code>dbname</code></em> \u53ef\u4ee5\u662f<a class=\"link\" href=\"/docs/devel/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u5c06\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-ECHO-QUERIES\"><span class=\"term\"><code class=\"option\">-e</code><br/></span><span class=\"term\"><code class=\"option\">--echo-queries</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e5f\u628a\u53d1\u9001\u5230\u670d\u52a1\u5668\u7684\u6240\u6709 SQL \u547d\u4ee4\u590d\u5236\u5230\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">queries</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-ECHO-HIDDEN\"><span class=\"term\"><code class=\"option\">-E</code><br/></span><span class=\"term\"><code class=\"option\">--echo-hidden</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u56de\u663e<code class=\"command\">\\d</code>\u4ee5\u53ca\u5176\u4ed6\u53cd\u659c\u7ebf\u547d\u4ee4\u751f\u6210\u7684\u5b9e\u9645\u67e5\u8be2\u3002\u53ef\u4ee5\u7528\u5b83\u6765\u5b66\u4e60<span class=\"application\">psql</span>\u7684\u5185\u90e8\u64cd\u4f5c\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO_HIDDEN</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-FILE\"><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u800c\u4e0d\u662f\u6807\u51c6\u8f93\u5165\u4e2d\u8bfb\u53d6\u547d\u4ee4\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u6307\u5b9a\uff0c\u4e5f\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u4e0e<code class=\"option\">-c</code>\u9009\u9879\u7ec4\u5408\u4f7f\u7528\u3002\u5f53\u6307\u5b9a\u4e86<code class=\"option\">-c</code>\u6216<code class=\"option\">-f</code>\u65f6\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709<code class=\"option\">-c</code>\u548c<code class=\"option\">-f</code>\u9009\u9879\u540e\u7ec8\u6b62\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u7b49\u4ef7\u4e8e\u5143\u547d\u4ee4<code class=\"command\">\\i</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c<em class=\"replaceable\"><code>filename</code></em>\u662f<code class=\"literal\">-</code>\uff08\u8fde\u5b57\u7b26\uff09\uff0c\u5219\u4f1a\u8bfb\u53d6\u6807\u51c6\u8f93\u5165\uff0c\u76f4\u5230\u9047\u5230 <acronym class=\"acronym\">EOF</acronym> \u6307\u793a\u6216<code class=\"command\">\\q</code>\u5143\u547d\u4ee4\u3002\u8fd9\u53ef\u7528\u4e8e\u5c06\u4ea4\u4e92\u5f0f\u8f93\u5165\u4e0e\u6587\u4ef6\u8f93\u5165\u4ea4\u9519\u4f7f\u7528\u3002\u4e0d\u8fc7\u8bf7\u6ce8\u610f\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\u4e0d\u4f1a\u4f7f\u7528 <span class=\"application\">Readline</span>\uff08\u5f88\u50cf\u6307\u5b9a\u4e86<code class=\"option\">-n</code>\u65f6\u7684\u60c5\u51b5\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u4e0e\u5199\u6210<code class=\"literal\">psql &lt; <em class=\"replaceable\"><code>filename</code></em></code>\u6709\u7ec6\u5fae\u5dee\u522b\u3002\u901a\u5e38\u4e24\u79cd\u5f62\u5f0f\u90fd\u4f1a\u5f97\u5230\u4f60\u671f\u671b\u7684\u7ed3\u679c\uff0c\u4f46\u4f7f\u7528<code class=\"literal\">-f</code>\u53ef\u4ee5\u542f\u7528\u4e00\u4e9b\u6709\u7528\u7684\u7279\u6027\uff0c\u4f8b\u5982\u5e26\u884c\u53f7\u7684\u9519\u8bef\u6d88\u606f\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u4e5f\u8fd8\u6709\u4e00\u70b9\u673a\u4f1a\u964d\u4f4e\u542f\u52a8\u5f00\u9500\u3002\u53e6\u4e00\u65b9\u9762\uff0c\u4f7f\u7528 shell \u8f93\u5165\u91cd\u5b9a\u5411\u7684\u5f62\u5f0f\u5728\u7406\u8bba\u4e0a\u80fd\u4fdd\u8bc1\u5f97\u5230\u4e0e\u4f60\u624b\u5de5\u9010\u884c\u8f93\u5165\u65f6\u5b8c\u5168\u76f8\u540c\u7684\u8f93\u51fa\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-FIELD-SEPARATOR\"><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>separator</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--field-separator=<em class=\"replaceable\"><code>separator</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f7f\u7528<em class=\"replaceable\"><code>separator</code></em>\u4f5c\u4e3a\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset fieldsep</code>\u6216\u8005<code class=\"command\">\\f</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-FIELD-HOST\"><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>hostname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>hostname</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-HTML\"><span class=\"term\"><code class=\"option\">-H</code><br/></span><span class=\"term\"><code class=\"option\">--html</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230<acronym class=\"acronym\">HTML</acronym>\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset format html</code>\u6216\u8005<code class=\"command\">\\H</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-LIST\"><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--list</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u6240\u6709\u53ef\u7528\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u9000\u51fa\u3002\u5176\u4ed6\u975e\u8fde\u63a5\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002\u8fd9\u4e0e\u5143\u547d\u4ee4<code class=\"command\">\\list</code>\u7c7b\u4f3c\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8be5\u9009\u9879\u65f6\uff0c<span class=\"application\">psql</span>\u5c06\u8fde\u63a5\u5230\u6570\u636e\u5e93<code class=\"literal\">postgres</code>\uff0c\u9664\u975e\u547d\u4ee4\u884c\u4e0a\u6307\u5b9a\u4e86\u5176\u4ed6\u6570\u636e\u5e93\uff08\u901a\u8fc7<code class=\"option\">-d</code>\u9009\u9879\u6216\u975e\u9009\u9879\u53c2\u6570\uff0c\u4e5f\u53ef\u80fd\u901a\u8fc7\u670d\u52a1\u9879\uff0c\u4f46\u4e0d\u80fd\u901a\u8fc7\u73af\u5883\u53d8\u91cf\uff09\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-LOG-FILE\"><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--log-file=<em class=\"replaceable\"><code>filename</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9664\u4e86\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u5199\u5230\u666e\u901a\u8f93\u51fa\u76ee\u6807\u4e4b\u5916\uff0c\u8fd8\u5199\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-NO-READLINE\"><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-readline</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8981\u4f7f\u7528<span class=\"application\">Readline</span>\u8fdb\u884c\u884c\u7f16\u8f91\uff0c\u4e5f\u4e0d\u8981\u4f7f\u7528\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\uff08\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/devel/app-psql.html#APP-PSQL-READLINE\" title=\"\u547d\u4ee4\u884c\u7f16\u8f91\">\u201c\u547d\u4ee4\u884c\u7f16\u8f91\u201d\u4e00\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-OUTPUT\"><span class=\"term\"><code class=\"option\">-o <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--output=<em class=\"replaceable\"><code>filename</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u653e\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u3002\u8fd9\u7b49\u6548\u4e8e\u547d\u4ee4<code class=\"command\">\\o</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-PORT\"><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u7684\u6587\u4ef6\u540d\u540e\u7f00\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u7684\u503c\uff1b\u672a\u8bbe\u7f6e\u65f6\uff0c\u4f7f\u7528\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u7aef\u53e3\uff0c\u901a\u5e38\u4e3a 5432\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-PSET\"><span class=\"term\"><code class=\"option\">-P <em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--pset=<em class=\"replaceable\"><code>assignment</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ee5<code class=\"command\">\\pset</code>\u7684\u5f62\u5f0f\u6307\u5b9a\u6253\u5370\u9009\u9879\u3002\u6ce8\u610f\uff0c\u8fd9\u91cc\u4f60\u5fc5\u987b\u7528\u4e00\u4e2a\u7b49\u53f7\u800c\u4e0d\u662f\u7a7a\u683c\u6765\u5206\u9694\u540d\u79f0\u548c\u503c\u3002\u4f8b\u5982\uff0c\u8981\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a<span class=\"application\">LaTeX</span>\uff0c\u5e94\u8be5\u5199\u6210<code class=\"literal\">-P format=latex</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-QUIET\"><span class=\"term\"><code class=\"option\">-q</code><br/></span><span class=\"term\"><code class=\"option\">--quiet</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a<span class=\"application\">psql</span>\u5e94\u8be5\u5b89\u9759\u5730\u5de5\u4f5c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4f1a\u6253\u5370\u51fa\u6b22\u8fce\u6d88\u606f\u548c\u5404\u79cd\u63d0\u793a\u4fe1\u606f\u3002\u5982\u679c\u4f7f\u7528\u4e86\u8fd9\u4e2a\u9009\u9879\uff0c\u4ee5\u4e0a\u90a3\u4e9b\u5c31\u90fd\u4e0d\u4f1a\u8f93\u51fa\u3002\u5728\u4f7f\u7528<code class=\"option\">-c</code>\u9009\u9879\u65f6\uff0c\u914d\u5408\u8fd9\u4e2a\u9009\u9879\u5f88\u6709\u7528\u3002\u8fd9\u7b49\u6548\u4e8e\u8bbe\u7f6e\u53d8\u91cf<code class=\"varname\">QUIET</code>\u4e3a<code class=\"literal\">on</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-RECORD-SEPARATOR\"><span class=\"term\"><code class=\"option\">-R <em class=\"replaceable\"><code>separator</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--record-separator=<em class=\"replaceable\"><code>separator</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a<em class=\"replaceable\"><code>separator</code></em>\u7528\u4f5c\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset recordsep</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-SINGLE-STEP\"><span class=\"term\"><code class=\"option\">-s</code><br/></span><span class=\"term\"><code class=\"option\">--single-step</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5728\u5355\u6b65\u6a21\u5f0f\u4e2d\u3002\u8fd9\u610f\u5473\u7740\u5728\u6bcf\u4e2a\u547d\u4ee4\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u4e4b\u524d\u90fd\u4f1a\u63d0\u793a\u7528\u6237\uff0c\u5e76\u5141\u8bb8\u53d6\u6d88\u6267\u884c\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u8c03\u8bd5\u811a\u672c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-SINGLE-LINE\"><span class=\"term\"><code class=\"option\">-S</code><br/></span><span class=\"term\"><code class=\"option\">--single-line</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd0\u884c\u5728\u5355\u884c\u6a21\u5f0f\u4e2d\uff0c\u5176\u4e2d\u6362\u884c\u7b26\u4f1a\u7ec8\u6b62\u4e00\u4e2a SQL \u547d\u4ee4\uff0c\u5c31\u50cf\u5206\u53f7\u7684\u4f5c\u7528\u4e00\u6837\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u79cd\u6a21\u5f0f\u662f\u4e3a\u575a\u6301\u4f7f\u7528\u5b83\u7684\u7528\u6237\u63d0\u4f9b\u7684\uff0c\u4f46\u5e76\u4e0d\u4e00\u5b9a\u503c\u5f97\u63a8\u8350\u3002\u7279\u522b\u662f\uff0c\u5982\u679c\u5728\u4e00\u884c\u4e2d\u6df7\u5408\u4e86<acronym class=\"acronym\">SQL</acronym>\u548c\u5143\u547d\u4ee4\uff0c\u5bf9\u4e8e\u6ca1\u6709\u7ecf\u9a8c\u7684\u7528\u6237\u6765\u8bf4\uff0c\u5b83\u4eec\u7684\u6267\u884c\u987a\u5e8f\u672a\u5fc5\u603b\u662f\u6e05\u695a\u7684\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-OPTION-TUPLES-ONLY\"><span class=\"term\"><code class=\"option\">-t</code><br/></span><span class=\"term\"><code class=\"option\">--tuples-only</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5173\u95ed\u6253\u5370\u5217\u540d\u548c\u7ed3\u679c\u884c\u8ba1\u6570\u9875\u811a\u7b49\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\t</code>\u6216\u8005<code class=\"command\">\\pset tuples_only</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-TABLE-ATTR\"><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>table_options</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--table-attr=<em class=\"replaceable\"><code>table_options</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u653e\u5728<acronym class=\"acronym\">HTML</acronym> <code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u9009\u9879\u3002\u8be6\u89c1<code class=\"command\">\\pset tableattr</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-USERNAME\"><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f5c\u4e3a\u7528\u6237<em class=\"replaceable\"><code>username</code></em>\u800c\u4e0d\u662f\u9ed8\u8ba4\u7528\u6237\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff08\u5f53\u7136\uff0c\u4f60\u5fc5\u987b\u5177\u6709\u8fd9\u6837\u505a\u7684\u6743\u9650\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-VARIABLE\"><span class=\"term\"><code class=\"option\">-v <em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--set=<em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--variable=<em class=\"replaceable\"><code>assignment</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6267\u884c\u4e00\u6b21\u53d8\u91cf\u8d4b\u503c\uff0c\u548c<code class=\"command\">\\set</code>\u5143\u547d\u4ee4\u76f8\u4f3c\u3002\u6ce8\u610f\u4f60\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u7528\u7b49\u53f7\u5206\u9694\u540d\u5b57\u548c\u503c\uff08\u5982\u679c\u6709\uff09\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u7684\u8bbe\u7f6e\uff0c\u53bb\u6389\u7b49\u53f7\u5c31\u884c\u3002\u8981\u628a\u4e00\u4e2a\u53d8\u91cf\u8bbe\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u4f7f\u7528\u7b49\u53f7\u4f46\u662f\u53bb\u6389\u503c\u3002\u8fd9\u4e9b\u8d4b\u503c\u5728\u547d\u4ee4\u884c\u5904\u7406\u671f\u95f4\u88ab\u5b8c\u6210\uff0c\u56e0\u6b64\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u7684\u53d8\u91cf\u5c06\u5728\u7a0d\u540e\u88ab\u8986\u76d6\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-VERSION\"><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">psql</span>\u7248\u672c\u5e76\u4e14\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-NO-PASSWORD\"><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6c38\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u8fd9\u4e2a\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4efb\u52a1\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u65f6\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u6574\u4e2a\u4f1a\u8bdd\u671f\u95f4\u90fd\u4f1a\u4fdd\u6301\u751f\u6548\uff0c\u56e0\u6b64\u5b83\u4e0d\u4ec5\u5f71\u54cd\u521d\u59cb\u8fde\u63a5\u5c1d\u8bd5\uff0c\u4e5f\u4f1a\u5f71\u54cd\u5143\u547d\u4ee4<code class=\"command\">\\connect</code>\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-PASSWORD\"><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236<span class=\"application\">psql</span>\u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\uff0c\u5373\u4f7f\u8be5\u5bc6\u7801\u5b9e\u9645\u4e0a\u4e0d\u4f1a\u88ab\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff0c\u5219<span class=\"application\">psql</span>\u65e0\u8bba\u5982\u4f55\u90fd\u4f1a\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">psql</span>\u9700\u8981\u5148\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\uff0c\u624d\u80fd\u77e5\u9053\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u663e\u5f0f\u6307\u5b9a<code class=\"option\">-W</code>\u503c\u5f97\u7528\u6765\u907f\u514d\u8fd9\u6b21\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u6574\u4e2a\u4f1a\u8bdd\u671f\u95f4\u90fd\u4f1a\u4fdd\u6301\u751f\u6548\uff0c\u56e0\u6b64\u5b83\u4e0d\u4ec5\u5f71\u54cd\u521d\u59cb\u8fde\u63a5\u5c1d\u8bd5\uff0c\u4e5f\u4f1a\u5f71\u54cd\u5143\u547d\u4ee4<code class=\"command\">\\connect</code>\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-EXPANDED\"><span class=\"term\"><code class=\"option\">-x</code><br/></span><span class=\"term\"><code class=\"option\">--expanded</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5f00\u6269\u5c55\u8868\u683c\u5f0f\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\x</code>\u6216\u8005<code class=\"command\">\\pset expanded</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-NO-PSQLRC\"><span class=\"term\"><code class=\"option\">-X</code><br/></span><span class=\"term\"><code class=\"option\">--no-psqlrc</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8bfb\u53d6\u542f\u52a8\u6587\u4ef6\uff08\u65e2\u4e0d\u8bfb\u53d6\u7cfb\u7edf\u8303\u56f4\u7684<code class=\"filename\">psqlrc</code>\u6587\u4ef6\uff0c\u4e5f\u4e0d\u8bfb\u53d6\u7528\u6237\u7684<code class=\"filename\">~/.psqlrc</code>\u6587\u4ef6\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-FIELD-SEPARATOR-ZERO\"><span class=\"term\"><code class=\"option\">-z</code><br/></span><span class=\"term\"><code class=\"option\">--field-separator-zero</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset fieldsep_zero</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-RECORD-SEPARATOR-ZERO\"><span class=\"term\"><code class=\"option\">-0</code><br/></span><span class=\"term\"><code class=\"option\">--record-separator-zero</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u4f8b\u5982\uff0c\u8fd9\u6709\u52a9\u4e8e\u4e0e<code class=\"literal\">xargs -0</code>\u914d\u5408\u4f7f\u7528\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset recordsep_zero</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-SINGLE-TRANSACTION\"><span class=\"term\"><code class=\"option\">-1</code><br/></span><span class=\"term\"><code class=\"option\">--single-transaction</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u9009\u9879\u53ea\u80fd\u4e0e\u4e00\u4e2a\u6216\u591a\u4e2a<code class=\"option\">-c</code>\u548c/\u6216<code class=\"option\">-f</code>\u9009\u9879\u7ed3\u5408\u4f7f\u7528\u3002\u5b83\u4f1a\u5bfc\u81f4<span class=\"application\">psql</span>\u5728\u7b2c\u4e00\u4e2a\u8fd9\u6837\u7684\u9009\u9879\u4e4b\u524d\u53d1\u51fa\u4e00\u4e2a<code class=\"command\">BEGIN</code>\u547d\u4ee4\uff0c\u5e76\u5728\u6700\u540e\u4e00\u4e2a\u9009\u9879\u4e4b\u540e\u53d1\u51fa\u4e00\u4e2a<code class=\"command\">COMMIT</code>\u547d\u4ee4\uff0c\u4ece\u800c\u5c06\u6240\u6709\u547d\u4ee4\u5305\u88c5\u6210\u4e00\u4e2a\u5355\u72ec\u7684\u4e8b\u52a1\u3002\u5982\u679c\u4efb\u4f55\u547d\u4ee4\u5931\u8d25\u4e14\u53d8\u91cf<code class=\"varname\">ON_ERROR_STOP</code>\u88ab\u8bbe\u7f6e\uff0c\u5219\u4f1a\u6539\u4e3a\u53d1\u9001\u4e00\u4e2a<code class=\"command\">ROLLBACK</code>\u547d\u4ee4\u3002\u8fd9\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u547d\u4ee4\u672c\u8eab\u5305\u542b<code class=\"command\">BEGIN</code>\u3001<code class=\"command\">COMMIT</code>\u6216<code class=\"command\">ROLLBACK</code>\uff0c\u8fd9\u4e2a\u9009\u9879\u5c31\u4e0d\u4f1a\u4ea7\u751f\u671f\u671b\u7684\u6548\u679c\u3002\u53e6\u5916\uff0c\u5982\u679c\u67d0\u4e2a\u5355\u72ec\u547d\u4ee4\u4e0d\u80fd\u5728\u4e8b\u52a1\u5757\u4e2d\u6267\u884c\uff0c\u6307\u5b9a\u8fd9\u4e2a\u9009\u9879\u5c06\u5bfc\u81f4\u6574\u4e2a\u4e8b\u52a1\u5931\u8d25\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-HELP\"><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help[=<em class=\"replaceable\"><code>topic</code></em>]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u6709\u5173<span class=\"application\">psql</span>\u7684\u5e2e\u52a9\u5e76\u4e14\u9000\u51fa\u3002\u53ef\u9009\u7684<em class=\"replaceable\"><code>topic</code></em>\u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a<code class=\"literal\">options</code>\uff09\u9009\u62e9\u8981\u89e3\u91ca<span class=\"application\">psql</span>\u7684\u54ea\u4e00\u90e8\u5206\uff1a<code class=\"literal\">commands</code>\u63cf\u8ff0<span class=\"application\">psql</span>\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b<code class=\"literal\">options</code>\u63cf\u8ff0\u53ef\u4ee5\u88ab\u4f20\u9012\u7ed9<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c<code class=\"literal\">variables</code>\u5219\u663e\u793a\u6709\u5173<span class=\"application\">psql</span>\u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.21.7\">\n<h2 lang=\"zh\">\u9000\u51fa\u72b6\u6001</h2>\n<p lang=\"zh\">\u5982\u679c<span class=\"application\">psql</span>\u6b63\u5e38\u7ed3\u675f\uff0c\u5b83\u4f1a\u5411 shell \u8fd4\u56de 0\uff1b\u5982\u679c\u5b83\u81ea\u8eab\u53d1\u751f\u81f4\u547d\u9519\u8bef\uff08\u4f8b\u5982\u5185\u5b58\u8017\u5c3d\u3001\u627e\u4e0d\u5230\u6587\u4ef6\uff09\uff0c\u5219\u8fd4\u56de 1\uff1b\u5982\u679c\u5230\u670d\u52a1\u5668\u7684\u8fde\u63a5\u53d1\u751f\u6545\u969c\u4e14\u8be5\u4f1a\u8bdd\u4e0d\u662f\u4ea4\u4e92\u5f0f\u7684\uff0c\u5219\u8fd4\u56de 2\uff1b\u5982\u679c\u811a\u672c\u4e2d\u53d1\u751f\u9519\u8bef\u4e14\u53d8\u91cf<code class=\"varname\">ON_ERROR_STOP</code>\u5df2\u8bbe\u7f6e\uff0c\u5219\u8fd4\u56de 3\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.21.8\">\n<h2 lang=\"zh\">\u7528\u6cd5</h2>\n<div class=\"refsect2\" id=\"R2-APP-PSQL-CONNECTING\">\n<h3 lang=\"zh\">\u8fde\u63a5\u5230\u6570\u636e\u5e93</h3>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u662f\u5e38\u89c4\u7684 <span class=\"productname\">PostgreSQL</span> \u5ba2\u6237\u7aef\u5e94\u7528\u7a0b\u5e8f\u3002\u8981\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff0c\u4f60\u9700\u8981\u77e5\u9053\u76ee\u6807\u6570\u636e\u5e93\u540d\u79f0\u3001\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u548c\u7aef\u53e3\u53f7\uff0c\u4ee5\u53ca\u8981\u4ee5\u54ea\u4e2a\u6570\u636e\u5e93\u7528\u6237\u540d\u8fde\u63a5\u3002<span class=\"application\">psql</span> \u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u9009\u9879 <code class=\"option\">-d</code>\u3001<code class=\"option\">-h</code>\u3001<code class=\"option\">-p</code> \u548c <code class=\"option\">-U</code> \u5206\u522b\u6307\u5b9a\u8fd9\u4e9b\u53c2\u6570\u3002\u5982\u679c\u9047\u5230\u4e00\u4e2a\u4e0d\u5c5e\u4e8e\u4efb\u4f55\u9009\u9879\u7684\u53c2\u6570\uff0c\u5b83\u5c06\u88ab\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u540d\uff08\u5982\u679c\u6570\u636e\u5e93\u540d\u5df2\u7ecf\u7ed9\u51fa\uff0c\u5219\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u7528\u6237\u540d\uff09\u3002\u5e76\u975e\u6240\u6709\u8fd9\u4e9b\u9009\u9879\u90fd\u662f\u5fc5\u9700\u7684\uff1b\u5b83\u4eec\u90fd\u6709\u6709\u7528\u7684\u9ed8\u8ba4\u503c\u3002\u5982\u679c\u7701\u7565\u4e3b\u673a\u540d\uff0c<span class=\"application\">psql</span> \u5728 Unix \u4e0a\u5c06\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u5230\u672c\u5730\u4e3b\u673a\u4e0a\u7684\u670d\u52a1\u5668\uff0c\u5728 Windows \u4e0a\u5219\u901a\u8fc7 TCP/IP \u8fde\u63a5\u5230 <code class=\"literal\">localhost</code>\u3002\u9ed8\u8ba4\u7aef\u53e3\u53f7\u5728\u7f16\u8bd1\u65f6\u786e\u5b9a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u670d\u52a1\u5668\u4f7f\u7528\u76f8\u540c\u7684\u9ed8\u8ba4\u503c\uff0c\u56e0\u6b64\u5728\u5927\u591a\u6570\u60c5\u51b5\u4e0b\u4e0d\u5fc5\u6307\u5b9a\u7aef\u53e3\u3002\u9ed8\u8ba4\u6570\u636e\u5e93\u7528\u6237\u540d\u662f\u4f60\u7684\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\u3002\u6570\u636e\u5e93\u7528\u6237\u540d\u786e\u5b9a\u540e\uff0c\u5b83\u4e5f\u4f1a\u88ab\u7528\u4f5c\u9ed8\u8ba4\u6570\u636e\u5e93\u540d\u3002\u8bf7\u6ce8\u610f\uff0c\u4f60\u4e0d\u80fd\u968f\u610f\u4ee5\u4efb\u610f\u6570\u636e\u5e93\u7528\u6237\u540d\u8fde\u63a5\u5230\u4efb\u610f\u6570\u636e\u5e93\u3002\u6570\u636e\u5e93\u7ba1\u7406\u5458\u5e94\u5f53\u5df2\u7ecf\u544a\u77e5\u4f60\u62e5\u6709\u7684\u8bbf\u95ee\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5f53\u9ed8\u8ba4\u503c\u4e0d\u5b8c\u5168\u5408\u9002\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7\u628a\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGDATABASE</code>\u3001<code class=\"envar\">PGHOST</code>\u3001<code class=\"envar\">PGPORT</code>\u548c<code class=\"envar\">PGUSER</code>\u8bbe\u7f6e\u4e3a\u9002\u5f53\u7684\u503c\u6765\u5c11\u6572\u4e00\u4e9b\u952e\u76d8\uff08\u989d\u5916\u7684\u73af\u5883\u53d8\u91cf\u89c1<a class=\"xref\" href=\"/docs/devel/libpq-envars.html\" title=\"32.14.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a032.14\u00a0\u8282</a>\uff09\u3002\u53e6\u5916\uff0c\u51c6\u5907\u4e00\u4e2a<code class=\"filename\">~/.pgpass</code>\u6587\u4ef6\u4e5f\u5f88\u65b9\u4fbf\uff0c\u8fd9\u6837\u5c31\u4e0d\u5fc5\u7ecf\u5e38\u624b\u5de5\u8f93\u5165\u5bc6\u7801\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/devel/libpq-pgpass.html\" title=\"32.15.\u00a0\u5bc6\u7801\u6587\u4ef6\">\u7b2c\u00a032.15\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u53e6\u4e00\u79cd\u6307\u5b9a\u8fde\u63a5\u53c2\u6570\u7684\u65b9\u6cd5\u662f\u4f7f\u7528 conninfo \u5b57\u7b26\u4e32\u6216 URI \u6765\u4ee3\u66ff\u6570\u636e\u5e93\u540d\u3002\u6b64\u673a\u5236\u5141\u8bb8\u5bf9\u8fde\u63a5\u8fdb\u884c\u975e\u5e38\u5e7f\u6cdb\u7684\u63a7\u5236\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">$ <strong class=\"userinput\"><code>psql \"service=myservice sslmode=require\"</code></strong>\n$ <strong class=\"userinput\"><code>psql postgresql://dbmaster:5433/mydb?sslmode=require</code></strong>\n</pre>\n<p lang=\"zh\">\u7528\u8fd9\u79cd\u65b9\u5f0f\uff0c\u4f60\u4e5f\u53ef\u4ee5\u628a<acronym class=\"acronym\">LDAP</acronym>\u7528\u4e8e<a class=\"xref\" href=\"/docs/devel/libpq-ldap.html\" title=\"32.17.\u00a0\u8fde\u63a5\u53c2\u6570\u7684 LDAP \u67e5\u627e\">\u7b2c\u00a032.17\u00a0\u8282</a>\u4e2d\u63cf\u8ff0\u7684\u8fde\u63a5\u53c2\u6570\u67e5\u627e\u3002\u53ef\u7528\u8fde\u63a5\u9009\u9879\u7684\u66f4\u591a\u4fe1\u606f\u8bf7\u89c1<a class=\"xref\" href=\"/docs/devel/libpq-connect.html#LIBPQ-PARAMKEYWORDS\" title=\"32.1.2.\u00a0\u53c2\u6570\u5173\u952e\u8bcd\">\u7b2c\u00a032.1.2\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7531\u4e8e\u4efb\u4f55\u539f\u56e0\uff08\u4f8b\u5982\u6743\u9650\u4e0d\u8db3\u3001\u670d\u52a1\u5668\u6ca1\u6709\u5728\u76ee\u6807\u4e3b\u673a\u4e0a\u8fd0\u884c\u7b49\uff09\u5bfc\u81f4\u8fde\u63a5\u65e0\u6cd5\u5efa\u7acb\uff0c<span class=\"application\">psql</span>\u5c06\u8fd4\u56de\u4e00\u4e2a\u9519\u8bef\u5e76\u4e14\u7ec8\u6b62\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6807\u51c6\u8f93\u5165\u548c\u6807\u51c6\u8f93\u51fa\u90fd\u662f\u7ec8\u7aef\uff0c\u90a3\u4e48<span class=\"application\">psql</span>\u4f1a\u628a\u5ba2\u6237\u7aef\u7f16\u7801\u8bbe\u7f6e\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">auto</span>\u201d</span>\uff0c\u4ece\u533a\u57df\u8bbe\u7f6e\u4e2d\u68c0\u6d4b\u5408\u9002\u7684\u5ba2\u6237\u7aef\u7f16\u7801\uff08\u5728 Unix \u7cfb\u7edf\u4e0a\u662f<code class=\"envar\">LC_CTYPE</code>\u73af\u5883\u53d8\u91cf\uff09\u3002\u5982\u679c\u7ed3\u679c\u4e0d\u7b26\u5408\u9884\u671f\uff0c\u53ef\u4ee5\u4f7f\u7528\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGCLIENTENCODING</code>\u8986\u76d6\u5ba2\u6237\u7aef\u7f16\u7801\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"R2-APP-PSQL-4\">\n<h3 lang=\"zh\">\u8f93\u5165 SQL \u547d\u4ee4</h3>\n<p lang=\"zh\">\u5728\u6b63\u5e38\u64cd\u4f5c\u65f6\uff0c<span class=\"application\">psql</span>\u4f1a\u63d0\u4f9b\u4e00\u4e2a\u63d0\u793a\u7b26\uff0c\u8be5\u63d0\u793a\u7b26\u662f<span class=\"application\">psql</span>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u540d\u79f0\u540e\u9762\u8ddf\u4e0a\u5b57\u7b26\u4e32<code class=\"literal\">=&gt;</code>\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">$ <strong class=\"userinput\"><code>psql testdb</code></strong>\npsql (20devel)\nType \"help\" for help.\n\ntestdb=&gt;\n</pre>\n<p lang=\"zh\">\u5728\u63d0\u793a\u7b26\u4e0b\uff0c\u7528\u6237\u53ef\u4ee5\u8f93\u5165<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u3002\u901a\u5e38\uff0c\u5f53\u9047\u5230\u8868\u793a\u547d\u4ee4\u7ed3\u675f\u7684\u5206\u53f7\u65f6\uff0c\u8f93\u5165\u7684\u5185\u5bb9\u5c31\u4f1a\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u3002\u884c\u7ed3\u675f\u5e76\u4e0d\u4f1a\u7ec8\u6b62\u4e00\u6761\u547d\u4ee4\uff0c\u56e0\u6b64\u4e3a\u4e86\u63d0\u9ad8\u6e05\u6670\u5ea6\uff0c\u547d\u4ee4\u53ef\u4ee5\u5206\u5e03\u5728\u591a\u884c\u4e0a\u3002\u5982\u679c\u547d\u4ee4\u88ab\u53d1\u9001\u5e76\u6210\u529f\u6267\u884c\uff0c\u5176\u7ed3\u679c\u5c31\u4f1a\u663e\u793a\u5728\u5c4f\u5e55\u4e0a\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u53d7\u4fe1\u4efb\u7684\u7528\u6237\u80fd\u591f\u8bbf\u95ee\u5c1a\u672a\u91c7\u7528<a class=\"link\" href=\"/docs/devel/ddl-schemas.html#DDL-SCHEMAS-PATTERNS\" title=\"5.11.7.\u00a0\u4f7f\u7528\u65b9\u5f0f\">\u6a21\u5f0f\u7684\u5b89\u5168\u4f7f\u7528\u65b9\u5f0f</a>\u7684\u6570\u636e\u5e93\uff0c\u8bf7\u5728\u4f1a\u8bdd\u5f00\u59cb\u65f6\u4ece<code class=\"varname\">search_path</code>\u4e2d\u79fb\u9664\u6240\u6709\u516c\u4f17\u53ef\u5199\u7684\u6a21\u5f0f\u3002\u53ef\u4ee5\u5728\u8fde\u63a5\u5b57\u7b26\u4e32\u4e2d\u52a0\u5165<code class=\"literal\">options=-csearch_path=</code>\uff0c\u6216\u8005\u5728\u6267\u884c\u5176\u4ed6 SQL \u547d\u4ee4\u4e4b\u524d\u53d1\u51fa<code class=\"literal\">SELECT pg_catalog.set_config('search_path', '', false)</code>\u3002\u8fd9\u79cd\u8003\u8651\u5e76\u975e<span class=\"application\">psql</span>\u7279\u6709\uff1b\u5b83\u9002\u7528\u4e8e\u4efb\u4f55\u6267\u884c\u4efb\u610f SQL \u547d\u4ee4\u7684\u63a5\u53e3\u3002</p>\n<p lang=\"zh\">\u6bcf\u5f53\u6267\u884c\u547d\u4ee4\u65f6\uff0c<span class=\"application\">psql</span>\u4e5f\u4f1a\u8f6e\u8be2\u7531<a class=\"link\" href=\"/docs/devel/sql-listen.html\" title=\"LISTEN\"><code class=\"command\">LISTEN</code></a>\u548c<a class=\"link\" href=\"/docs/devel/sql-notify.html\" title=\"NOTIFY\"><code class=\"command\">NOTIFY</code></a>\u751f\u6210\u7684\u5f02\u6b65\u901a\u77e5\u4e8b\u4ef6\u3002</p>\n<p lang=\"zh\">\u867d\u7136 C \u98ce\u683c\u7684\u5757\u6ce8\u91ca\u4f1a\u88ab\u4f20\u7ed9\u670d\u52a1\u5668\u5904\u7406\u5e76\u79fb\u9664\uff0c\u4f46 SQL \u6807\u51c6\u6ce8\u91ca\u4f1a\u7531<span class=\"application\">psql</span>\u81ea\u884c\u79fb\u9664\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"APP-PSQL-META-COMMANDS\">\n<h3 lang=\"zh\">\u5143\u547d\u4ee4</h3>\n<p lang=\"zh\">\u4f60\u8f93\u5165\u5230<span class=\"application\">psql</span>\u4e2d\u7684\u4efb\u4f55\u4ee5\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u5f00\u59cb\u7684\u4e1c\u897f\u90fd\u662f\u4e00\u4e2a<span class=\"application\">psql</span>\u5143\u547d\u4ee4\uff0c\u5b83\u4eec\u7531<span class=\"application\">psql</span>\u81ea\u884c\u5904\u7406\u3002\u8fd9\u4e9b\u547d\u4ee4\u8ba9<span class=\"application\">psql</span>\u5bf9\u7ba1\u7406\u548c\u7f16\u5199\u811a\u672c\u66f4\u6709\u7528\u3002\u5143\u547d\u4ee4\u5e38\u5e38\u88ab\u79f0\u4f5c\u659c\u7ebf\u6216\u8005\u53cd\u659c\u7ebf\u547d\u4ee4\u3002</p>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u547d\u4ee4\u7684\u683c\u5f0f\u662f\u7528\u53cd\u659c\u7ebf\u540e\u9762\u76f4\u63a5\u8ddf\u4e0a\u4e00\u4e2a\u547d\u4ee4\u52a8\u8bcd\uff0c\u7136\u540e\u662f\u4e00\u4e9b\u53c2\u6570\u3002\u53c2\u6570\u4e0e\u547d\u4ee4\u52a8\u8bcd\u548c\u5176\u4ed6\u53c2\u6570\u4e4b\u95f4\u7528\u4efb\u610f\u591a\u4e2a\u7a7a\u767d\u5b57\u7b26\u5206\u9694\u5f00\u3002</p>\n<p lang=\"zh\">\u8981\u5728\u53c2\u6570\u4e2d\u5305\u542b\u7a7a\u767d\uff0c\u53ef\u4ee5\u7528\u5355\u5f15\u53f7\u5c06\u5b83\u62ec\u8d77\u6765\u3002\u8981\u5728\u53c2\u6570\u4e2d\u5305\u542b\u4e00\u4e2a\u5355\u5f15\u53f7\uff0c\u53ef\u4ee5\u5728\u5355\u5f15\u53f7\u6587\u672c\u5185\u5199\u4e24\u4e2a\u5355\u5f15\u53f7\u3002\u5355\u5f15\u53f7\u4e2d\u7684\u5185\u5bb9\u8fd8\u4f1a\u63a5\u53d7\u7c7b\u4f3c C \u8bed\u8a00\u7684\u66ff\u6362\uff1a<code class=\"literal\">\\n</code>\uff08\u6362\u884c\uff09\u3001<code class=\"literal\">\\t</code>\uff08\u5236\u8868\u7b26\uff09\u3001<code class=\"literal\">\\b</code>\uff08\u9000\u683c\uff09\u3001<code class=\"literal\">\\r</code>\uff08\u56de\u8f66\uff09\u3001<code class=\"literal\">\\f</code>\uff08\u6362\u9875\uff09\u3001<code class=\"literal\">\\</code><em class=\"replaceable\"><code>digits</code></em>\uff08\u516b\u8fdb\u5236\uff09\u4ee5\u53ca<code class=\"literal\">\\x</code><em class=\"replaceable\"><code>digits</code></em>\uff08\u5341\u516d\u8fdb\u5236\uff09\u3002\u5728\u5355\u5f15\u53f7\u6587\u672c\u5185\uff0c\u53cd\u659c\u7ebf\u51fa\u73b0\u5728\u4efb\u4f55\u5176\u4ed6\u5b57\u7b26\u524d\u9762\u65f6\uff0c\u53ea\u662f\u5bf9\u8be5\u5355\u4e2a\u5b57\u7b26\u8fdb\u884c\u8f6c\u4e49\uff0c\u4e0d\u8bba\u5b83\u662f\u4ec0\u4e48\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u53c2\u6570\u4e2d\u51fa\u73b0\u4e00\u4e2a\u672a\u52a0\u5f15\u53f7\u7684\u5192\u53f7\uff08<code class=\"literal\">:</code>\uff09\uff0c\u540e\u9762\u7d27\u8ddf\u4e00\u4e2a<span class=\"application\">psql</span>\u53d8\u91cf\u540d\uff0c\u5b83\u5c31\u4f1a\u88ab\u8be5\u53d8\u91cf\u7684\u503c\u66ff\u6362\uff0c\u5982\u4e0b\u9762<a class=\"xref\" href=\"/docs/devel/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL \u63d2\u503c\">SQL \u63d2\u503c</a>\u6240\u8ff0\u3002\u5176\u4e2d\u4ecb\u7ecd\u7684<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u548c<code class=\"literal\">:\"<em class=\"replaceable\"><code>variable_name</code></em>\"</code>\u5f62\u5f0f\u4e5f\u540c\u6837\u9002\u7528\u3002<code class=\"literal\">:{?<em class=\"replaceable\"><code>variable_name</code></em>}</code>\u8bed\u6cd5\u5141\u8bb8\u6d4b\u8bd5\u53d8\u91cf\u662f\u5426\u5df2\u5b9a\u4e49\uff1b\u5b83\u4f1a\u88ab TRUE \u6216 FALSE \u66ff\u6362\u3002\u7528\u53cd\u659c\u7ebf\u8f6c\u4e49\u8be5\u5192\u53f7\u53ef\u4ee5\u9632\u6b62\u66ff\u6362\u53d1\u751f\u3002</p>\n<p lang=\"zh\">\u5728\u53c2\u6570\u4e2d\uff0c\u7528\u53cd\u5f15\u53f7\uff08<code class=\"literal\">`</code>\uff09\u5305\u56f4\u7684\u6587\u672c\u4f1a\u88ab\u89c6\u4e3a\u4f20\u7ed9 shell \u7684\u547d\u4ee4\u884c\u3002\u8be5\u547d\u4ee4\u7684\u8f93\u51fa\uff08\u53bb\u6389\u672b\u5c3e\u7684\u6362\u884c\u7b26\uff09\u4f1a\u66ff\u6362\u53cd\u5f15\u53f7\u4e2d\u7684\u6587\u672c\u3002\u5728\u53cd\u5f15\u53f7\u5305\u56f4\u7684\u6587\u672c\u5185\u90e8\uff0c\u4e0d\u4f1a\u8fdb\u884c\u7279\u6b8a\u7684\u5f15\u53f7\u5904\u7406\u6216\u5176\u4ed6\u5904\u7406\uff0c\u4f46\u51fa\u73b0<code class=\"literal\">:<em class=\"replaceable\"><code>variable_name</code></em></code>\u65f6\uff0c\u5982\u679c<em class=\"replaceable\"><code>variable_name</code></em>\u662f<span class=\"application\">psql</span>\u53d8\u91cf\u540d\uff0c\u5c31\u4f1a\u88ab\u66ff\u6362\u4e3a\u8be5\u53d8\u91cf\u7684\u503c\u3002\u6b64\u5916\uff0c<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u4e5f\u4f1a\u88ab\u66ff\u6362\u4e3a\u8be5\u53d8\u91cf\u7684\u503c\uff0c\u5e76\u4f1a\u9002\u5f53\u5730\u52a0\u4e0a\u5f15\u53f7\uff0c\u4f7f\u5176\u6210\u4e3a\u5355\u4e2a shell \u547d\u4ee4\u53c2\u6570\u3002\uff08\u540e\u4e00\u79cd\u5f62\u5f0f\u51e0\u4e4e\u603b\u662f\u66f4\u53ef\u53d6\uff0c\u9664\u975e\u4f60\u975e\u5e38\u786e\u5b9a\u53d8\u91cf\u4e2d\u5305\u542b\u4ec0\u4e48\u3002\uff09\u7531\u4e8e\u65e0\u6cd5\u4fdd\u8bc1\u5728\u6240\u6709\u5e73\u53f0\u4e0a\u90fd\u80fd\u5bf9\u56de\u8f66\u548c\u6362\u884c\u5b57\u7b26\u5b89\u5168\u5730\u52a0\u5f15\u53f7\uff0c\u5f53\u53d8\u91cf\u503c\u4e2d\u51fa\u73b0\u8fd9\u7c7b\u5b57\u7b26\u65f6\uff0c<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u5f62\u5f0f\u4f1a\u6253\u5370\u9519\u8bef\u6d88\u606f\uff0c\u5e76\u4e14\u4e0d\u4f1a\u66ff\u6362\u53d8\u91cf\u503c\u3002</p>\n<p lang=\"zh\">\u4e00\u4e9b\u547d\u4ee4\u63a5\u53d7 SQL \u6807\u8bc6\u7b26\uff08\u4f8b\u5982\u8868\u540d\uff09\u4f5c\u4e3a\u53c2\u6570\u3002\u8fd9\u4e9b\u53c2\u6570\u9075\u5faa SQL \u8bed\u6cd5\u89c4\u5219\uff1a\u672a\u52a0\u5f15\u53f7\u7684\u5b57\u6bcd\u4f1a\u5f3a\u5236\u8f6c\u6362\u4e3a\u5c0f\u5199\uff0c\u800c\u53cc\u5f15\u53f7\uff08\"\uff09\u4f1a\u4fdd\u62a4\u5b57\u6bcd\u4e0d\u88ab\u8f6c\u6362\u5927\u5c0f\u5199\uff0c\u5e76\u5141\u8bb8\u6807\u8bc6\u7b26\u5305\u542b\u7a7a\u767d\u5b57\u7b26\u3002\u5728\u53cc\u5f15\u53f7\u5185\u90e8\uff0c\u8fde\u7eed\u4e24\u4e2a\u53cc\u5f15\u53f7\u4f1a\u5728\u6700\u7ec8\u540d\u79f0\u4e2d\u53d8\u4e3a\u4e00\u4e2a\u53cc\u5f15\u53f7\u3002\u4f8b\u5982\uff0cFOO\"BAR\"BAZ \u4f1a\u88ab\u89e3\u91ca\u4e3a fooBARbaz\uff0c\u800c \"A weird\"\" name\" \u4f1a\u53d8\u4e3a A weird\" name\u3002</p>\n<p lang=\"zh\">\u53c2\u6570\u89e3\u6790\u4f1a\u5728\u884c\u5c3e\u6216\u9047\u5230\u53e6\u4e00\u4e2a\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u65f6\u505c\u6b62\u3002\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u4f1a\u88ab\u89c6\u4e3a\u65b0\u5143\u547d\u4ee4\u7684\u5f00\u59cb\u3002\u7279\u6b8a\u5e8f\u5217<code class=\"literal\">\\\\</code>\uff08\u4e24\u4e2a\u53cd\u659c\u7ebf\uff09\u8868\u793a\u53c2\u6570\u7ed3\u675f\uff0c\u5e76\u7ee7\u7eed\u89e3\u6790<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\uff08\u5982\u679c\u8fd8\u6709\uff09\u3002\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u548c<span class=\"application\">psql</span>\u547d\u4ee4\u53ef\u4ee5\u81ea\u7531\u5730\u6df7\u5408\u5728\u540c\u4e00\u884c\u4e2d\u3002\u4f46\u65e0\u8bba\u5982\u4f55\uff0c\u5143\u547d\u4ee4\u7684\u53c2\u6570\u90fd\u4e0d\u80fd\u5ef6\u7eed\u5230\u4e0b\u4e00\u884c\u3002</p>\n<p lang=\"zh\">\u8bb8\u591a\u5143\u547d\u4ee4\u4f5c\u7528\u4e8e<em class=\"firstterm\">\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a</em>\u3002\u8fd9\u53ea\u662f\u4e00\u4e2a\u4fdd\u5b58\u5df2\u8f93\u5165\u4f46\u5c1a\u672a\u53d1\u9001\u5230\u670d\u52a1\u5668\u6267\u884c\u7684 SQL \u547d\u4ee4\u6587\u672c\u7684\u7f13\u51b2\u533a\u3002\u5176\u4e2d\u65e2\u5305\u62ec\u5148\u524d\u8f93\u5165\u7684\u884c\uff0c\u4e5f\u5305\u62ec\u540c\u4e00\u884c\u4e0a\u4f4d\u4e8e\u5143\u547d\u4ee4\u4e4b\u524d\u7684\u6587\u672c\u3002</p>\n<p lang=\"zh\">\u8bb8\u591a\u5143\u547d\u4ee4\u8fd8\u5141\u8bb8\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code> \u4f5c\u4e3a\u9009\u9879\u3002\u8fd9\u4f1a\u4f7f\u7ed3\u679c\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\uff0c\u5c31\u50cf\u4f7f\u7528\u4e86 <code class=\"command\">\\x</code> \u6216 <code class=\"command\">\\pset expanded</code> \u4e00\u6837\u3002</p>\n<p lang=\"zh\">\u5b9a\u4e49\u4e86\u4ee5\u4e0b\u5143\u547d\u4ee4\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-META-COMMAND-A\"><span class=\"term\"><code class=\"literal\">\\a</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u5f53\u524d\u8868\u683c\u8f93\u51fa\u683c\u5f0f\u662f\u975e\u5bf9\u9f50\uff0c\u5219\u5207\u6362\u4e3a\u5bf9\u9f50\uff1b\u5426\u5219\u5207\u6362\u4e3a\u975e\u5bf9\u9f50\u3002\u4fdd\u7559\u6b64\u547d\u4ee4\u662f\u4e3a\u4e86\u5411\u540e\u517c\u5bb9\u3002\u66f4\u901a\u7528\u7684\u89e3\u51b3\u65b9\u6848\u8bf7\u53c2\u89c1<code class=\"command\">\\pset</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-BIND\"><span class=\"term\"><code class=\"literal\">\\bind</code> [ <em class=\"replaceable\"><code>parameter</code></em> ] ...</span> </dt>\n<dd>\n<p lang=\"zh\">\u4e3a\u4e0b\u4e00\u6b21\u67e5\u8be2\u6267\u884c\u8bbe\u7f6e\u67e5\u8be2\u53c2\u6570\uff0c\u5e76\u5c06\u6307\u5b9a\u53c2\u6570\u4f20\u7ed9\u4efb\u610f\u53c2\u6570\u5360\u4f4d\u7b26\uff08<code class=\"literal\">$1</code> \u7b49\uff09\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">INSERT INTO tbl1 VALUES ($1, $2) \\bind 'first value' 'second value' \\g\n</pre>\n<p lang=\"zh\">\u8fd9\u5bf9\u9664 <code class=\"literal\">\\g</code> \u4e4b\u5916\u7684\u67e5\u8be2\u6267\u884c\u547d\u4ee4\u4e5f\u6709\u6548\uff0c\u4f8b\u5982 <code class=\"literal\">\\gx</code> \u548c <code class=\"literal\">\\gset</code>\u3002</p>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4f1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/devel/protocol-overview.html#PROTOCOL-QUERY-CONCEPTS\" title=\"54.1.2.\u00a0\u6269\u5c55\u67e5\u8be2\u6982\u8ff0\">\u7b2c\u00a054.1.2\u00a0\u8282</a>\uff09\uff0c\u4e0d\u540c\u4e8e<span class=\"application\">psql</span>\u901a\u5e38\u4f7f\u7528\u7684\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002\u56e0\u6b64\uff0c\u53ef\u4ee5\u7528\u5b83\u5728<span class=\"application\">psql</span>\u4e2d\u6d4b\u8bd5\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002\uff08\u5373\u4f7f\u67e5\u8be2\u6ca1\u6709\u53c2\u6570\uff0c\u800c\u4e14\u6b64\u547d\u4ee4\u6307\u5b9a\u4e86\u96f6\u4e2a\u53c2\u6570\uff0c\u4e5f\u4f1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002\uff09\u6b64\u547d\u4ee4\u53ea\u5f71\u54cd\u4e0b\u4e00\u6761\u88ab\u6267\u884c\u7684\u67e5\u8be2\uff1b\u4e4b\u540e\u7684\u6240\u6709\u67e5\u8be2\u9ed8\u8ba4\u4ecd\u4f1a\u4f7f\u7528\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-BIND-NAMED\"><span class=\"term\"><code class=\"literal\">\\bind_named</code> <em class=\"replaceable\"><code>statement_name</code></em> [ <em class=\"replaceable\"><code>parameter</code></em> ] ...</span> </dt>\n<dd>\n<p lang=\"zh\"><code class=\"literal\">\\bind_named</code> \u7b49\u540c\u4e8e <code class=\"literal\">\\bind</code>\uff0c\u4e0d\u540c\u4e4b\u5904\u5728\u4e8e\u5b83\u628a\u73b0\u6709\u9884\u5907\u8bed\u53e5\u7684\u540d\u79f0\u4f5c\u4e3a\u7b2c\u4e00\u4e2a\u53c2\u6570\u3002\u7a7a\u5b57\u7b26\u4e32\u8868\u793a\u672a\u547d\u540d\u7684\u9884\u5907\u8bed\u53e5\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">INSERT INTO tbls1 VALUES ($1, $2) \\parse stmt1\n\\bind_named stmt1 'first value' 'second value' \\g\n</pre>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4f1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/devel/protocol-overview.html#PROTOCOL-QUERY-CONCEPTS\" title=\"54.1.2.\u00a0\u6269\u5c55\u67e5\u8be2\u6982\u8ff0\">\u7b2c\u00a054.1.2\u00a0\u8282</a>\uff09\uff0c\u4e0d\u540c\u4e8e<span class=\"application\">psql</span>\u901a\u5e38\u4f7f\u7528\u7684\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002\u56e0\u6b64\uff0c\u53ef\u4ee5\u7528\u5b83\u5728<span class=\"application\">psql</span>\u4e2d\u6d4b\u8bd5\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-C-LC\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\c</code> \u6216 <code class=\"literal\">\\connect [ -reuse-previous=<em class=\"replaceable\"><code>on|off</code></em> ] [ <em class=\"replaceable\"><code>dbname</code></em> [ <em class=\"replaceable\"><code>username</code></em> ] [ <em class=\"replaceable\"><code>host</code></em> ] [ <em class=\"replaceable\"><code>port</code></em> ] | <em class=\"replaceable\"><code>conninfo</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5efa\u7acb\u5230<span class=\"productname\">PostgreSQL</span>\u670d\u52a1\u5668\u7684\u65b0\u8fde\u63a5\u3002\u53ef\u4ee5\u4f7f\u7528\u4f4d\u7f6e\u8bed\u6cd5\uff08\u6570\u636e\u5e93\u540d\u79f0\u3001\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\u4e2d\u7684\u4e00\u4e2a\u6216\u591a\u4e2a\uff09\u6307\u5b9a\u8981\u4f7f\u7528\u7684\u8fde\u63a5\u53c2\u6570\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528<em class=\"replaceable\"><code>conninfo</code></em>\u8fde\u63a5\u5b57\u7b26\u4e32\uff0c\u8be6\u89c1<a class=\"xref\" href=\"/docs/devel/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u7b2c\u00a032.1.1\u00a0\u8282</a>\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa\u53c2\u6570\uff0c\u5219\u4f7f\u7528\u4e0e\u4e4b\u524d\u76f8\u540c\u7684\u53c2\u6570\u5efa\u7acb\u65b0\u8fde\u63a5\u3002</p>\n<p lang=\"zh\">\u5c06<em class=\"replaceable\"><code>dbname</code></em>\u3001<em class=\"replaceable\"><code>username</code></em>\u3001<em class=\"replaceable\"><code>host</code></em>\u6216 <em class=\"replaceable\"><code>port</code></em>\u4e2d\u7684\u4efb\u610f\u4e00\u4e2a\u6307\u5b9a\u4e3a <code class=\"literal\">-</code>\uff0c\u7b49\u540c\u4e8e\u7701\u7565\u8be5\u53c2\u6570\u3002</p>\n<p lang=\"zh\">\u65b0\u8fde\u63a5\u53ef\u4ee5\u91cd\u7528\u524d\u4e00\u4e2a\u8fde\u63a5\u7684\u8fde\u63a5\u53c2\u6570\uff1b\u4e0d\u4ec5\u5305\u62ec\u6570\u636e\u5e93\u540d\u79f0\u3001\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\uff0c\u8fd8\u5305\u62ec\u5176\u4ed6\u8bbe\u7f6e\uff0c\u5982<em class=\"replaceable\"><code>sslmode</code></em>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53c2\u6570\u5728\u4f4d\u7f6e\u8bed\u6cd5\u4e2d\u88ab\u91cd\u7528\uff0c\u4f46\u5728\u7ed9\u5b9a<em class=\"replaceable\"><code>conninfo</code></em>\u5b57\u7b26\u4e32\u65f6\u4e0d\u4f1a\u88ab\u91cd\u7528\u3002\u4f20\u9012<code class=\"literal\">-reuse-previous=on</code>\u6216<code class=\"literal\">-reuse-previous=off</code>\u4f5c\u4e3a\u7b2c\u4e00\u4e2a\u53c2\u6570\u5c06\u8986\u76d6\u8be5\u9ed8\u8ba4\u8bbe\u7f6e\u3002\u5982\u679c\u53c2\u6570\u88ab\u91cd\u7528\uff0c\u5219\u4efb\u4f55\u672a\u660e\u786e\u6307\u5b9a\u4e3a\u4f4d\u7f6e\u53c2\u6570\u6216\u5728<em class=\"replaceable\"><code>conninfo</code></em>\u5b57\u7b26\u4e32\u4e2d\u7684\u53c2\u6570\u5c06\u4ece\u73b0\u6709\u8fde\u63a5\u7684\u53c2\u6570\u4e2d\u83b7\u53d6\u3002\u4e00\u4e2a\u4f8b\u5916\u662f\uff0c\u5982\u679c\u4f7f\u7528\u4f4d\u7f6e\u8bed\u6cd5\u66f4\u6539<em class=\"replaceable\"><code>host</code></em>\u8bbe\u7f6e\uff0c\u4f7f\u5176\u4e0d\u540c\u4e8e\u5148\u524d\u7684\u503c\uff0c\u5219\u73b0\u6709\u8fde\u63a5\u53c2\u6570\u4e2d\u5b58\u5728\u7684\u4efb\u4f55<em class=\"replaceable\"><code>hostaddr</code></em>\u8bbe\u7f6e\u5c06\u88ab\u5220\u9664\u3002\u6b64\u5916\uff0c\u4ec5\u5f53\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\u8bbe\u7f6e\u672a\u66f4\u6539\u65f6\uff0c\u624d\u4f1a\u91cd\u7528\u73b0\u6709\u8fde\u63a5\u4f7f\u7528\u7684\u4efb\u4f55\u5bc6\u7801\u3002\u5f53\u547d\u4ee4\u65e2\u4e0d\u6307\u5b9a\u4e5f\u4e0d\u91cd\u7528\u7279\u5b9a\u53c2\u6570\u65f6\uff0c\u5c06\u4f7f\u7528<span class=\"application\">libpq</span>\u7684\u9ed8\u8ba4\u503c\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u65b0\u8fde\u63a5\u6210\u529f\u5efa\u7acb\uff0c\u5219\u5173\u95ed\u5148\u524d\u7684\u8fde\u63a5\u3002\u5982\u679c\u8fde\u63a5\u5c1d\u8bd5\u5931\u8d25\uff08\u7528\u6237\u540d\u9519\u8bef\uff0c\u8bbf\u95ee\u88ab\u62d2\u7edd\u7b49\uff09\uff0c\u4e14<span class=\"application\">psql</span>\u5904\u4e8e\u4ea4\u4e92\u6a21\u5f0f\uff0c\u5219\u4fdd\u7559\u5148\u524d\u7684\u8fde\u63a5\u3002\u4f46\u5728\u6267\u884c\u975e\u4ea4\u4e92\u811a\u672c\u65f6\uff0c\u65e7\u8fde\u63a5\u5c06\u88ab\u5173\u95ed\u5e76\u62a5\u544a\u9519\u8bef\u3002\u8fd9\u53ef\u80fd\u4f1a\u6216\u53ef\u80fd\u4e0d\u4f1a\u7ec8\u6b62\u811a\u672c\uff1b\u5982\u679c\u6ca1\u6709\u7ec8\u6b62\uff0c\u76f4\u5230\u6210\u529f\u6267\u884c\u53e6\u4e00\u4e2a<code class=\"literal\">\\connect</code>\u547d\u4ee4\u4e4b\u524d\uff0c\u6240\u6709\u8bbf\u95ee\u6570\u636e\u5e93\u7684\u547d\u4ee4\u90fd\u5c06\u5931\u8d25\u3002\u91c7\u7528\u8fd9\u79cd\u533a\u522b\uff0c\u4e00\u65b9\u9762\u662f\u4e3a\u4e86\u65b9\u4fbf\u7528\u6237\u5e94\u5bf9\u8f93\u5165\u7b14\u8bef\uff0c\u53e6\u4e00\u65b9\u9762\u662f\u4e3a\u4e86\u9632\u6b62\u811a\u672c\u610f\u5916\u64cd\u4f5c\u9519\u8bef\u7684\u6570\u636e\u5e93\u3002\u8bf7\u6ce8\u610f\uff0c\u6bcf\u5f53<code class=\"literal\">\\connect</code>\u547d\u4ee4\u5c1d\u8bd5\u91cd\u65b0\u4f7f\u7528\u53c2\u6570\u65f6\uff0c\u91cd\u65b0\u4f7f\u7528\u7684\u503c\u662f\u6700\u540e\u4e00\u4e2a\u6210\u529f\u8fde\u63a5\u7684\u503c\uff0c\u800c\u4e0d\u662f\u968f\u540e\u7684\u4efb\u4f55\u5931\u8d25\u5c1d\u8bd5\u7684\u503c\u3002\u4f46\u662f\uff0c\u5728\u975e\u4ea4\u4e92<code class=\"literal\">\\connect</code>\u5931\u8d25\u7684\u60c5\u51b5\u4e0b\uff0c\u4e0d\u5141\u8bb8\u7a0d\u540e\u91cd\u65b0\u4f7f\u7528\u53c2\u6570\uff0c\u56e0\u4e3a\u811a\u672c\u53ef\u80fd\u671f\u671b\u4ece\u5931\u8d25\u7684<code class=\"literal\">\\connect</code>\u4e2d\u91cd\u65b0\u4f7f\u7528\u503c\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">=&gt; \\c mydb myuser host.dom 6432\n=&gt; \\c service=foo\n=&gt; \\c \"host=localhost port=5432 dbname=mydb connect_timeout=10 sslmode=disable\"\n=&gt; \\c -reuse-previous=on sslmode=require    -- changes only sslmode\n=&gt; \\c postgresql://tom@localhost/mydb?application_name=myapp\n</pre>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-C-UC\"><span class=\"term\"><code class=\"literal\">\\C [ <em class=\"replaceable\"><code>title</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u4f5c\u4e3a\u67e5\u8be2\u7ed3\u679c\u6253\u5370\u7684\u8868\u7684\u6807\u9898\uff0c\u6216\u53d6\u6d88\u6b64\u7c7b\u6807\u9898\u3002\u8be5\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset title <em class=\"replaceable\"><code>title</code></em></code>\u3002\uff08\u6b64\u547d\u4ee4\u7684\u540d\u79f0\u6e90\u81ea<span class=\"quote\">\u201c<span class=\"quote\">caption</span>\u201d</span>\uff0c\u56e0\u4e3a\u5b83\u8fc7\u53bb\u53ea\u7528\u4e8e\u8bbe\u7f6e<acronym class=\"acronym\">HTML</acronym>\u8868\u7684\u6807\u9898\u3002\uff09</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-CD\"><span class=\"term\"><code class=\"literal\">\\cd [ <em class=\"replaceable\"><code>directory</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u66f4\u6539\u4e3a <em class=\"replaceable\"><code>directory</code></em>\u3002\u5982\u679c\u6ca1\u6709\u53c2\u6570\uff0c\u5219\u5207\u6362\u5230\u5f53\u524d\u7528\u6237\u7684\u4e3b\u76ee\u5f55\u3002\u5173\u4e8e\u5982\u4f55\u786e\u5b9a\u4e3b\u76ee\u5f55\uff0c\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/devel/libpq-pgpass.html\" title=\"32.15.\u00a0\u5bc6\u7801\u6587\u4ef6\">\u7b2c\u00a032.15\u00a0\u8282</a>\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8981\u6253\u5370\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\uff0c\u8bf7\u4f7f\u7528<code class=\"literal\">\\! pwd</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-CLOSE-PREPARED\"><span class=\"term\"><code class=\"literal\">\\close_prepared</code> <em class=\"replaceable\"><code>prepared_statement_name</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u5173\u95ed\u6307\u5b9a\u7684\u9884\u5907\u8bed\u53e5\u3002\u7a7a\u5b57\u7b26\u4e32\u8868\u793a\u672a\u547d\u540d\u7684\u9884\u5907\u8bed\u53e5\u3002\u5982\u679c\u4e0d\u5b58\u5728\u8be5\u540d\u79f0\u7684\u9884\u5907\u8bed\u53e5\uff0c\u5219\u4e0d\u6267\u884c\u4efb\u4f55\u64cd\u4f5c\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">SELECT $1 \\parse stmt1\n\\close_prepared stmt1\n</pre>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4f1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\uff0c\u4e0d\u540c\u4e8e<span class=\"application\">psql</span>\u901a\u5e38\u4f7f\u7528\u7684\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002\u56e0\u6b64\uff0c\u53ef\u4ee5\u7528\u5b83\u5728<span class=\"application\">psql</span>\u4e2d\u6d4b\u8bd5\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-CONNINFO\"><span class=\"term\"><code class=\"literal\">\\conninfo</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8f93\u51fa\u5f53\u524d\u6570\u636e\u5e93\u8fde\u63a5\u7684\u4fe1\u606f\uff1b\u5982\u679c\u6b63\u5728\u4f7f\u7528 SSL\uff0c\u4e5f\u5305\u62ec\u4e0e SSL \u76f8\u5173\u7684\u4fe1\u606f\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c<code class=\"structfield\">Client User</code> \u5b57\u6bb5\u663e\u793a\u7684\u662f\u8fde\u63a5\u5efa\u7acb\u65f6\u7684\u7528\u6237\uff0c\u800c <code class=\"structfield\">Superuser</code> \u5b57\u6bb5\u8868\u793a\u5f53\u524d\u7528\u6237\uff08\u5728\u5f53\u524d\u6267\u884c\u4e0a\u4e0b\u6587\u4e2d\uff09\u662f\u5426\u5177\u6709\u8d85\u7ea7\u7528\u6237\u6743\u9650\u3002\u8fd9\u4e24\u4e2a\u7528\u6237\u901a\u5e38\u76f8\u540c\uff0c\u4f46\u4e5f\u53ef\u80fd\u4e0d\u540c\uff0c\u4f8b\u5982\u5f53\u524d\u7528\u6237\u66fe\u901a\u8fc7 <code class=\"command\">SET ROLE</code> \u547d\u4ee4\u88ab\u66f4\u6539\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMANDS-COPY\"><span class=\"term\"><code class=\"literal\">\\copy { <em class=\"replaceable\"><code>table</code></em> [ ( <em class=\"replaceable\"><code>column_list</code></em> ) ] } <code class=\"literal\">from</code> { <em class=\"replaceable\"><code>'filename'</code></em> | program <em class=\"replaceable\"><code>'command'</code></em> | stdin | pstdin } [ [ with ] ( <em class=\"replaceable\"><code>option</code></em> [, ...] ) ] [ where <em class=\"replaceable\"><code>condition</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\copy { <em class=\"replaceable\"><code>table</code></em> [ ( <em class=\"replaceable\"><code>column_list</code></em> ) ] | ( <em class=\"replaceable\"><code>query</code></em> ) } <code class=\"literal\">to</code> { <em class=\"replaceable\"><code>'filename'</code></em> | program <em class=\"replaceable\"><code>'command'</code></em> | stdout | pstdout } [ [ with ] ( <em class=\"replaceable\"><code>option</code></em> [, ...] ) ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6267\u884c\u524d\u7aef\uff08\u5ba2\u6237\u7aef\uff09\u590d\u5236\u3002\u8be5\u64cd\u4f5c\u4f1a\u8fd0\u884c\u4e00\u4e2a<acronym class=\"acronym\">SQL</acronym> <a class=\"link\" href=\"/docs/devel/sql-copy.html\" title=\"COPY\"><code class=\"command\">COPY</code></a>\u547d\u4ee4\uff0c\u4f46\u5e76\u4e0d\u662f\u7531\u670d\u52a1\u5668\u8bfb\u53d6\u6216\u5199\u5165\u6307\u5b9a\u6587\u4ef6\uff0c\u800c\u662f\u7531<span class=\"application\">psql</span>\u8bfb\u53d6\u6216\u5199\u5165\u6587\u4ef6\uff0c\u5e76\u5728\u670d\u52a1\u5668\u4e0e\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e4b\u95f4\u8f6c\u9001\u6570\u636e\u3002\u8fd9\u610f\u5473\u7740\u6587\u4ef6\u53ef\u8bbf\u95ee\u6027\u548c\u6743\u9650\u53d6\u51b3\u4e8e\u672c\u5730\u7528\u6237\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\uff0c\u4e5f\u4e0d\u9700\u8981 SQL \u8d85\u7ea7\u7528\u6237\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5f53\u6307\u5b9a<code class=\"literal\">program</code>\u65f6\uff0c<em class=\"replaceable\"><code>command</code></em> \u7531<span class=\"application\">psql</span>\u6267\u884c\uff0c\u4f20\u7ed9<em class=\"replaceable\"><code>command</code></em>\u7684\u6570\u636e\u6216\u4ece\u5176\u4e2d\u8bfb\u51fa\u7684\u6570\u636e\u90fd\u4f1a\u5728\u670d\u52a1\u5668\u4e0e\u5ba2\u6237\u7aef\u4e4b\u95f4\u8f6c\u9001\u3002\u518d\u6b21\u5f3a\u8c03\uff0c\u6267\u884c\u6743\u9650\u5c5e\u4e8e\u672c\u5730\u7528\u6237\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\uff0c\u4e5f\u4e0d\u9700\u8981 SQL \u8d85\u7ea7\u7528\u6237\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e \\copy ... from stdin\uff0c\u4ece\u53d1\u51fa\u547d\u4ee4\u7684\u540c\u4e00\u8f93\u5165\u6e90\u8bfb\u53d6\u6570\u636e\u884c\uff0c\u76f4\u5230\u8bfb\u53d6\u5230\u4ec5\u542b \\. \u7684\u4e00\u884c\u6216\u8f93\u5165\u6d41\u5230\u8fbe EOF\u3002\u8fd9\u9002\u5408\u5728 SQL \u811a\u672c\u4e2d\u5185\u8054\u586b\u5145\u8868\u3002\u5bf9\u4e8e \\copy ... to stdout\uff0c\u8f93\u51fa\u53d1\u5f80\u4e0e psql \u547d\u4ee4\u8f93\u51fa\u76f8\u540c\u7684\u4f4d\u7f6e\uff0c\u4e14\u4e0d\u6253\u5370 COPY count \u547d\u4ee4\u72b6\u6001\uff0c\u4ee5\u514d\u4e0e\u6570\u636e\u884c\u6df7\u6dc6\u3002\u82e5\u8981\u59cb\u7ec8\u8bfb\u5199 psql \u7684\u6807\u51c6\u8f93\u5165\u6216\u8f93\u51fa\uff0c\u800c\u4e0d\u53d7\u5f53\u524d\u547d\u4ee4\u6765\u6e90\u6216 \\o \u9009\u9879\u5f71\u54cd\uff0c\u8bf7\u4f7f\u7528 from pstdin \u6216 to pstdout\u3002</p>\n<p lang=\"zh\">\u8be5\u547d\u4ee4\u7684\u8bed\u6cd5\u4e0e<acronym class=\"acronym\">SQL</acronym> <a class=\"link\" href=\"/docs/devel/sql-copy.html\" title=\"COPY\"><code class=\"command\">COPY</code></a>\u547d\u4ee4\u7c7b\u4f3c\u3002\u9664\u6570\u636e\u6e90\u6216\u76ee\u6807\u4e4b\u5916\uff0c\u5176\u4ed6\u6240\u6709\u9009\u9879\u90fd\u4e0e<code class=\"command\">COPY</code>\u547d\u4ee4\u4e2d\u7684\u6307\u5b9a\u76f8\u540c\u3002\u56e0\u6b64\uff0c\u7279\u6b8a\u7684\u89e3\u6790\u89c4\u5219\u9002\u7528\u4e8e<code class=\"command\">\\copy</code>\u5143\u547d\u4ee4\u3002\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u5269\u4f59\u884c\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\copy</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u6267\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u53e6\u4e00\u79cd\u83b7\u5f97\u4e0e<code class=\"literal\">\\copy ... to</code>\u76f8\u540c\u7ed3\u679c\u7684\u65b9\u6cd5\u662f\u4f7f\u7528<acronym class=\"acronym\">SQL</acronym> <code class=\"literal\">COPY ... TO STDOUT</code>\u547d\u4ee4\uff0c\u5e76\u4ee5<code class=\"literal\">\\g <em class=\"replaceable\"><code>filename</code></em></code> \u6216<code class=\"literal\">\\g |<em class=\"replaceable\"><code>program</code></em></code>\u7ed3\u675f\u3002\u4e0e<code class=\"literal\">\\copy</code>\u4e0d\u540c\uff0c\u8fd9\u79cd\u65b9\u6cd5\u5141\u8bb8\u547d\u4ee4\u8de8\u8d8a\u591a\u884c\uff1b\u6b64\u5916\uff0c\u53ef\u4ee5\u4f7f\u7528\u53d8\u91cf\u63d2\u503c\u548c\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</div>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8fd9\u4e9b\u64cd\u4f5c\u4e0d\u5982\u4ee5\u6587\u4ef6\u6216\u7a0b\u5e8f\u4f5c\u4e3a\u6570\u636e\u6e90\u6216\u76ee\u6807\u7684 <acronym class=\"acronym\">SQL</acronym> <code class=\"command\">COPY</code> \u547d\u4ee4\u9ad8\u6548\uff0c\u56e0\u4e3a\u6240\u6709\u6570\u636e\u90fd\u5fc5\u987b\u901a\u8fc7\u5ba2\u6237\u7aef/\u670d\u52a1\u5668\u8fde\u63a5\u4f20\u8f93\u3002\u5bf9\u4e8e\u5927\u91cf\u6570\u636e\uff0c\u4f7f\u7528 <acronym class=\"acronym\">SQL</acronym> \u547d\u4ee4\u53ef\u80fd\u66f4\u5408\u9002\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-COPYRIGHT\"><span class=\"term\"><code class=\"literal\">\\copyright</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"productname\">PostgreSQL</span>\u7684\u7248\u6743\u548c\u5206\u53d1\u6761\u6b3e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMANDS-CROSSTABVIEW\"><span class=\"term\"><code class=\"literal\">\\crosstabview [ <em class=\"replaceable\"><code>colV</code></em> [ <em class=\"replaceable\"><code>colH</code></em> [ <em class=\"replaceable\"><code>colD</code></em> [ <em class=\"replaceable\"><code>sortcolH</code></em> ] ] ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6267\u884c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\uff08\u4e0e<code class=\"literal\">\\g</code>\u7c7b\u4f3c\uff09\uff0c\u5e76\u4ee5\u4ea4\u53c9\u8868\u7f51\u683c\u663e\u793a\u7ed3\u679c\u3002\u67e5\u8be2\u5fc5\u987b\u8fd4\u56de\u81f3\u5c11\u4e09\u5217\u3002\u7531<em class=\"replaceable\"><code>colV</code></em>\u6807\u8bc6\u7684\u8f93\u51fa\u5217\u6210\u4e3a\u7eb5\u5411\u8868\u5934\uff0c\u7531<em class=\"replaceable\"><code>colH</code></em>\u6807\u8bc6\u7684\u8f93\u51fa\u5217\u6210\u4e3a\u6a2a\u5411\u8868\u5934\u3002<em class=\"replaceable\"><code>colD</code></em>\u6807\u8bc6\u8981\u5728\u7f51\u683c\u4e2d\u663e\u793a\u7684\u8f93\u51fa\u5217\u3002<em class=\"replaceable\"><code>sortcolH</code></em>\u6807\u8bc6\u6a2a\u5411\u8868\u5934\u7684\u53ef\u9009\u6392\u5e8f\u5217\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a\u5217\u6307\u5b9a\u9879\u53ef\u4ee5\u662f\u4ece 1 \u5f00\u59cb\u7684\u5217\u53f7\uff0c\u4e5f\u53ef\u4ee5\u662f\u5217\u540d\uff1b\u5217\u540d\u9075\u5faa\u5e38\u89c4 SQL \u5927\u5c0f\u5199\u6298\u53e0\u548c\u5f15\u53f7\u89c4\u5219\u3002\u7701\u7565\u65f6\uff0ccolV \u9ed8\u8ba4\u4e3a\u7b2c 1 \u5217\uff0ccolH \u9ed8\u8ba4\u4e3a\u7b2c 2 \u5217\u3002colH \u5fc5\u987b\u4e0e colV \u4e0d\u540c\u3002\u82e5\u4e0d\u6307\u5b9a colD\uff0c\u67e5\u8be2\u7ed3\u679c\u5fc5\u987b\u6070\u6709\u4e09\u5217\uff0c\u65e2\u975e colV \u4e5f\u975e colH \u7684\u90a3\u4e00\u5217\u4f5c\u4e3a colD\u3002</p>\n<p lang=\"zh\">\u7eb5\u5411\u8868\u5934\u663e\u793a\u4e3a\u6700\u5de6\u5217\uff0c\u5305\u542b<em class=\"replaceable\"><code>colV</code></em>\u5217\u4e2d\u7684\u503c\uff0c\u5176\u987a\u5e8f\u4e0e\u67e5\u8be2\u7ed3\u679c\u4e2d\u76f8\u540c\uff0c\u4f46\u4f1a\u79fb\u9664\u91cd\u590d\u503c\u3002</p>\n<p lang=\"zh\">\u6a2a\u5411\u8868\u5934\u663e\u793a\u4e3a\u7b2c\u4e00\u884c\uff0c\u5305\u542b<em class=\"replaceable\"><code>colH</code></em>\u5217\u4e2d\u7684\u503c\uff0c\u5e76\u79fb\u9664\u91cd\u590d\u503c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4eec\u6309\u67e5\u8be2\u7ed3\u679c\u4e2d\u7684\u76f8\u540c\u987a\u5e8f\u663e\u793a\u3002\u4f46\u5982\u679c\u7ed9\u51fa\u4e86\u53ef\u9009\u7684<em class=\"replaceable\"><code>sortcolH</code></em>\u53c2\u6570\uff0c\u5b83\u6240\u6807\u8bc6\u7684\u5217\u7684\u503c\u5fc5\u987b\u662f\u6574\u6570\uff0c\u800c<em class=\"replaceable\"><code>colH</code></em>\u4e2d\u7684\u503c\u4f1a\u6309\u7167\u5bf9\u5e94\u7684<em class=\"replaceable\"><code>sortcolH</code></em>\u503c\u6392\u5e8f\u540e\u663e\u793a\u5728\u6a2a\u5411\u8868\u5934\u4e2d\u3002</p>\n<p lang=\"zh\">\u4ea4\u53c9\u8868\u4e2d\uff0c\u5bf9\u4e8e colH \u7684\u6bcf\u4e2a\u4e0d\u540c\u503c x \u548c colV \u7684\u6bcf\u4e2a\u4e0d\u540c\u503c y\uff0c\u4ea4\u70b9 (x,y) \u7684\u5355\u5143\u683c\u4fdd\u5b58\u67e5\u8be2\u7ed3\u679c\u4e2d colH=x \u4e14 colV=y \u90a3\u4e00\u884c\u7684 colD \u503c\u3002\u6ca1\u6709\u5339\u914d\u884c\u65f6\u5355\u5143\u683c\u4e3a\u7a7a\uff1b\u5b58\u5728\u591a\u884c\u65f6\u4f1a\u62a5\u9519\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-D\"><span class=\"term\"><code class=\"literal\">\\d[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5bf9\u4e8e\u6bcf\u4e2a\u4e0e<em class=\"replaceable\"><code>pattern</code></em>\u5339\u914d\u7684\u5173\u7cfb\uff08\u8868\u3001\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u7d22\u5f15\u3001\u5e8f\u5217\u6216\u5916\u90e8\u8868\uff09\u6216\u590d\u5408\u7c7b\u578b\uff0c\u663e\u793a\u6240\u6709\u5217\u3001\u5b83\u4eec\u7684\u7c7b\u578b\u3001\u8868\u7a7a\u95f4\uff08\u5982\u679c\u4e0d\u662f\u9ed8\u8ba4\u7684\uff09\u4ee5\u53ca\u4efb\u4f55\u7279\u6b8a\u5c5e\u6027\uff0c\u5982<code class=\"literal\">NOT NULL</code>\u6216\u9ed8\u8ba4\u503c\u3002\u8fd8\u663e\u793a\u76f8\u5173\u5bf9\u8c61\uff0c\u4f8b\u5982\u7d22\u5f15\u3001\u7ea6\u675f\u3001\u89c4\u5219\u3001\u89e6\u53d1\u5668\u548c\u53d1\u5e03\u3002\u5bf9\u4e8e\u5916\u90e8\u8868\uff0c\u8fd8\u663e\u793a\u5173\u8054\u7684\u5916\u90e8\u670d\u52a1\u5668\u3002\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u5339\u914d\u6a21\u5f0f</span>\u201d</span>\u7684\u5b9a\u4e49\u5728\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"\u6a21\u5f0f\">\u6a21\u5f0f</a>\u4e2d\u3002\uff09</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u67d0\u4e9b\u7c7b\u578b\u7684\u5173\u7cfb\uff0c<code class=\"literal\">\\d</code>\u663e\u793a\u6bcf\u5217\u7684\u9644\u52a0\u4fe1\u606f\uff1a\u5e8f\u5217\u7684\u5217\u503c\uff0c\u7d22\u5f15\u7684\u7d22\u5f15\u8868\u8fbe\u5f0f\uff0c\u5916\u90e8\u8868\u7684\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u547d\u4ee4\u5f62\u5f0f<code class=\"literal\">\\d+</code>\u4e0e\u524d\u8005\u76f8\u540c\uff0c\u4f46\u4f1a\u663e\u793a\u66f4\u591a\u4fe1\u606f\uff0c\u4f8b\u5982\uff1a\u8868\u5217\u5173\u8054\u7684\u6ce8\u91ca\u3001\u8868\u662f\u5426\u5305\u542b OID\u3001\u5f53\u5173\u7cfb\u4e3a\u89c6\u56fe\u65f6\u7684\u89c6\u56fe\u5b9a\u4e49\u3001\u975e\u9ed8\u8ba4\u7684<a class=\"link\" href=\"/docs/devel/sql-altertable.html#SQL-ALTERTABLE-REPLICA-IDENTITY\">\u590d\u5236\u6807\u8bc6</a>\u8bbe\u7f6e\uff0c\u4ee5\u53ca\u5f53\u5173\u7cfb\u5177\u6709\u8bbf\u95ee\u65b9\u6cd5\u65f6\u7684<a class=\"link\" href=\"/docs/devel/sql-create-access-method.html\" title=\"CREATE ACCESS METHOD\">\u8bbf\u95ee\u65b9\u6cd5</a>\u540d\u79f0\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u4e00\u4e2a\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u4ee5\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528<code class=\"command\">\\d</code>\u800c\u6ca1\u6709<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\uff0c\u5b83\u7b49\u540c\u4e8e<code class=\"command\">\\dtvmsE</code>\uff0c\u5b83\u5c06\u663e\u793a\u6240\u6709\u53ef\u89c1\u7684\u8868\u3001\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u7684\u5217\u8868\u3002\u8fd9\u7eaf\u7cb9\u662f\u4e00\u79cd\u4fbf\u5229\u63aa\u65bd\u3002</p>\n<p lang=\"zh\">\u4e0e\u8bb8\u591a\u5176\u4ed6\u547d\u4ee4\u4e00\u6837\uff0c\u5728\u547d\u4ee4\u540d\u540e\u6dfb\u52a0 x \u4f1a\u4f7f\u7528\u6269\u5c55\u663e\u793a\u6a21\u5f0f\u3002\u4f46\u8fd9\u4ec5\u9002\u7528\u4e8e\u4e0d\u5e26 pattern \u53c2\u6570\u7684 \\d\uff0c\u4e14 x \u4e0d\u80fd\u7d27\u8ddf \\d\uff08\u56e0\u4e3a \\dx \u662f\u53e6\u4e00\u4e2a\u547d\u4ee4\uff09\uff0c\u53ea\u80fd\u4f4d\u4e8e S \u6216 + \u4fee\u9970\u7b26\u4e4b\u540e\u3002\u4f8b\u5982\uff0c\\d+x \u7b49\u4ef7\u4e8e \\dtvmsE+x\uff0c\u5c06\u4ee5\u6269\u5c55\u6a21\u5f0f\u5217\u51fa\u6240\u6709\u5173\u7cfb\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DA-LC\"><span class=\"term\"><code class=\"literal\">\\da[Sx] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u805a\u5408\u51fd\u6570\uff0c\u4ee5\u53ca\u5b83\u4eec\u7684\u8fd4\u56de\u7c7b\u578b\u548c\u6240\u4f5c\u7528\u7684\u6570\u636e\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u805a\u5408\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DA-UC\"><span class=\"term\"><code class=\"literal\">\\dA[x+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8bbf\u95ee\u65b9\u6cd5\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bbf\u95ee\u65b9\u6cd5\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u8bbf\u95ee\u65b9\u6cd5\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u7684\u5904\u7406\u5668\u51fd\u6570\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DAC\"><span class=\"term\"><code class=\"literal\">\\dAc[x+] [<a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>input-type-pattern</code></em></a>]]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u64cd\u4f5c\u7b26\u7c7b\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/devel/xindex.html#XINDEX-OPCLASS\" title=\"36.16.1.\u00a0\u7d22\u5f15\u65b9\u6cd5\u548c\u64cd\u4f5c\u7b26\u7c7b\">\u7b2c\u00a036.16.1\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u7c7b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>input-type-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8f93\u5165\u7c7b\u578b\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u7c7b\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u7c7b\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u548c\u6240\u6709\u8005\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DAF\"><span class=\"term\"><code class=\"literal\">\\dAf[x+] [<a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>input-type-pattern</code></em></a>]]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u64cd\u4f5c\u7b26\u65cf\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/devel/xindex.html#XINDEX-OPFAMILY\" title=\"36.16.5.\u00a0\u64cd\u4f5c\u7b26\u7c7b\u548c\u64cd\u4f5c\u7b26\u65cf\">\u7b2c\u00a036.16.5\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>input-type-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8f93\u5165\u7c7b\u578b\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u65cf\u90fd\u4f1a\u8fde\u540c\u5176\u6240\u6709\u8005\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DAO\"><span class=\"term\"><code class=\"literal\">\\dAo[x+] [<a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>operator-family-pattern</code></em></a>]]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u4e0e\u64cd\u4f5c\u7b26\u65cf\u5173\u8054\u7684\u64cd\u4f5c\u7b26\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/devel/xindex.html#XINDEX-STRATEGIES\" title=\"36.16.2.\u00a0\u7d22\u5f15\u65b9\u6cd5\u7b56\u7565\">\u7b2c\u00a036.16.2\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u6240\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u6210\u5458\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>operator-family-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u8be5\u6a21\u5f0f\u5339\u914d\u7684\u64cd\u4f5c\u7b26\u65cf\u6210\u5458\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u90fd\u4f1a\u8fde\u540c\u5176\u6392\u5e8f\u64cd\u4f5c\u7b26\u65cf\uff08\u5982\u679c\u5b83\u662f\u6392\u5e8f\u64cd\u4f5c\u7b26\uff09\u4ee5\u53ca\u5176\u5e95\u5c42\u51fd\u6570\u662f\u5426\u9632\u6f0f\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DAP\"><span class=\"term\"><code class=\"literal\">\\dAp[x+] [<a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>operator-family-pattern</code></em></a>]]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u4e0e\u64cd\u4f5c\u7b26\u65cf\u5173\u8054\u7684\u652f\u6301\u51fd\u6570\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/devel/xindex.html#XINDEX-SUPPORT\" title=\"36.16.3.\u00a0\u7d22\u5f15\u65b9\u6cd5\u652f\u6301\u4f8b\u7a0b\">\u7b2c\u00a036.16.3\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u6240\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u51fd\u6570\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>operator-family-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u8be5\u6a21\u5f0f\u5339\u914d\u7684\u64cd\u4f5c\u7b26\u65cf\u51fd\u6570\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u51fd\u6570\u4f1a\u4ee5\u8be6\u7ec6\u5f62\u5f0f\u663e\u793a\uff0c\u5e76\u5e26\u6709\u5176\u5b9e\u9645\u53c2\u6570\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DB\"><span class=\"term\"><code class=\"literal\">\\db[x+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8868\u7a7a\u95f4\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8868\u7a7a\u95f4\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u8868\u7a7a\u95f4\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u9009\u9879\u3001\u78c1\u76d8\u5927\u5c0f\u3001\u6743\u9650\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DC-LC\"><span class=\"term\"><code class=\"literal\">\\dc[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5b57\u7b26\u96c6\u7f16\u7801\u4e4b\u95f4\u7684\u8f6c\u6362\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8f6c\u6362\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DCONFIG\"><span class=\"term\"><code class=\"literal\">\\dconfig[x+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u670d\u52a1\u5668\u914d\u7f6e\u53c2\u6570\u53ca\u5176\u503c\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u53c2\u6570\u3002\u4e0d\u5e26 <em class=\"replaceable\"><code>pattern</code></em> \u65f6\uff0c\u53ea\u5217\u51fa\u88ab\u8bbe\u7f6e\u4e3a\u975e\u9ed8\u8ba4\u503c\u7684\u53c2\u6570\u3002\uff08\u4f7f\u7528 <code class=\"literal\">\\dconfig *</code> \u53ef\u67e5\u770b\u6240\u6709\u53c2\u6570\u3002\uff09\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u53c2\u6570\u90fd\u4f1a\u8fde\u540c\u5176\u6570\u636e\u7c7b\u578b\u3001\u8be5\u53c2\u6570\u53ef\u8bbe\u7f6e\u7684\u4e0a\u4e0b\u6587\u4ee5\u53ca\u8bbf\u95ee\u6743\u9650\uff08\u5982\u679c\u5df2\u6388\u4e88\u975e\u9ed8\u8ba4\u8bbf\u95ee\u6743\u9650\uff09\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DC-UC\"><span class=\"term\"><code class=\"literal\">\\dC[x+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u7c7b\u578b\u8f6c\u6362\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u5176\u6e90\u7c7b\u578b\u6216\u76ee\u6807\u7c7b\u578b\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u7c7b\u578b\u8f6c\u6362\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u7c7b\u578b\u8f6c\u6362\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5176\u5e95\u5c42\u51fd\u6570\u662f\u5426\u9632\u6f0f\uff0c\u4ee5\u53ca\u8be5\u7c7b\u578b\u8f6c\u6362\u7684\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DD-LC\"><span class=\"term\"><code class=\"literal\">\\dd[Sx] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u663e\u793a<code class=\"literal\">constraint</code>\u3001<code class=\"literal\">operator class</code>\u3001<code class=\"literal\">operator family</code>\u3001<code class=\"literal\">rule</code>\u548c <code class=\"literal\">trigger</code>\u7c7b\u578b\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002\u5176\u4ed6\u6ce8\u91ca\u53ef\u901a\u8fc7\u5bf9\u5e94\u5bf9\u8c61\u7c7b\u578b\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u67e5\u770b\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">\\dd</code> \u663e\u793a\u4e0e <em class=\"replaceable\"><code>pattern</code></em> \u5339\u914d\u7684\u5bf9\u8c61\u63cf\u8ff0\uff1b\u5982\u679c\u6ca1\u6709\u7ed9\u51fa\u53c2\u6570\uff0c\u5219\u663e\u793a\u76f8\u5e94\u7c7b\u578b\u7684\u53ef\u89c1\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002\u4f46\u65e0\u8bba\u54ea\u79cd\u60c5\u51b5\uff0c\u53ea\u5217\u51fa\u90a3\u4e9b\u5df2\u6709\u63cf\u8ff0\u7684\u5bf9\u8c61\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528 <a class=\"link\" href=\"/docs/devel/sql-comment.html\" title=\"COMMENT\"><code class=\"command\">COMMENT</code></a> <acronym class=\"acronym\">SQL</acronym> \u547d\u4ee4\u521b\u5efa\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DD-UC\"><span class=\"term\"><code class=\"literal\">\\dD[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u57df\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u57df\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u6743\u9650\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DDP\"><span class=\"term\"><code class=\"literal\">\\ddp[x] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u9ed8\u8ba4\u8bbf\u95ee\u6743\u9650\u8bbe\u7f6e\u3002\u5bf9\u4e8e\u6bcf\u4e2a\u9ed8\u8ba4\u6743\u9650\u8bbe\u7f6e\u5df2\u504f\u79bb\u5185\u7f6e\u9ed8\u8ba4\u503c\u7684\u89d2\u8272\uff08\u4ee5\u53ca\u9002\u7528\u65f6\u7684\u6a21\u5f0f\uff09\uff0c\u90fd\u4f1a\u663e\u793a\u4e00\u6761\u8bb0\u5f55\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u89d2\u8272\u540d\u6216\u6a21\u5f0f\u540d\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bb0\u5f55\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002</p>\n<p lang=\"zh\"><a class=\"link\" href=\"/docs/devel/sql-alterdefaultprivileges.html\" title=\"ALTER DEFAULT PRIVILEGES\"><code class=\"command\">ALTER DEFAULT PRIVILEGES</code></a>\u547d\u4ee4\u7528\u4e8e\u8bbe\u7f6e\u9ed8\u8ba4\u8bbf\u95ee\u6743\u9650\u3002\u6743\u9650\u663e\u793a\u7684\u542b\u4e49\u5728<a class=\"xref\" href=\"/docs/devel/ddl-priv.html\" title=\"5.9.\u00a0\u6743\u9650\">\u7b2c\u00a05.9\u00a0\u8282</a>\u4e2d\u6709\u89e3\u91ca\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DE\"><span class=\"term\"><code class=\"literal\">\\dE[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\di[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dm[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\ds[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dt[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dv[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd9\u7ec4\u547d\u4ee4\u4e2d\uff0c\u5b57\u6bcd <code class=\"literal\">E</code>\u3001<code class=\"literal\">i</code>\u3001<code class=\"literal\">m</code>\u3001<code class=\"literal\">s</code>\u3001<code class=\"literal\">t</code> \u548c <code class=\"literal\">v</code> \u5206\u522b\u8868\u793a\u5916\u90e8\u8868\u3001\u7d22\u5f15\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u3001\u8868\u548c\u89c6\u56fe\u3002\u4f60\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u6307\u5b9a\u5176\u4e2d\u4efb\u610f\u4e00\u4e2a\u6216\u591a\u4e2a\u5b57\u6bcd\uff0c\u4ee5\u83b7\u53d6\u8fd9\u4e9b\u7c7b\u578b\u5bf9\u8c61\u7684\u5217\u8868\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dti</code> \u4f1a\u5217\u51fa\u8868\u548c\u7d22\u5f15\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u6301\u4e45\u6027\u72b6\u6001\uff08\u6c38\u4e45\u3001\u4e34\u65f6\u6216\u4e0d\u8bb0\u5f55 WAL\uff09\u3001\u78c1\u76d8\u4e0a\u7684\u7269\u7406\u5927\u5c0f\u4ee5\u53ca\u76f8\u5173\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u4e00\u8d77\u5217\u51fa\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u5bf9\u8c61\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DES\"><span class=\"term\"><code class=\"literal\">\\des[x+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u670d\u52a1\u5668\uff08\u52a9\u8bb0\u7b26\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external servers</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u670d\u52a1\u5668\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u670d\u52a1\u5668\u7684\u5b8c\u6574\u63cf\u8ff0\uff0c\u5305\u62ec\u670d\u52a1\u5668\u7684\u8bbf\u95ee\u6743\u9650\u3001\u7c7b\u578b\u3001\u7248\u672c\u3001\u9009\u9879\u548c\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DET\"><span class=\"term\"><code class=\"literal\">\\det[x+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u8868\uff08\u52a9\u8bb0\u7b26\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external tables</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u8868\u540d\u6216\u6a21\u5f0f\u540d\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6761\u76ee\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u8fd8\u4f1a\u663e\u793a\u901a\u7528\u9009\u9879\u4ee5\u53ca\u5916\u90e8\u8868\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DEU\"><span class=\"term\"><code class=\"literal\">\\deu[x+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u7528\u6237\u6620\u5c04\uff08\u52a9\u8bb0\u7b26\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external users</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u7528\u6237\u540d\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6620\u5c04\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u6620\u5c04\u7684\u9644\u52a0\u4fe1\u606f\u3002</p>\n<div class=\"caution\">\n<h3 class=\"title\" lang=\"zh\">\u5c0f\u5fc3</h3>\n<p lang=\"zh\"><code class=\"literal\">\\deu+</code>\u53ef\u80fd\u8fd8\u4f1a\u663e\u793a\u8fdc\u7a0b\u7528\u6237\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u56e0\u6b64\u5e94\u6ce8\u610f\u4e0d\u8981\u6cc4\u9732\u5b83\u4eec\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DEW\"><span class=\"term\"><code class=\"literal\">\\dew[x+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\uff08\u52a9\u8bb0\u7b26\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external wrappers</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u8fd8\u4f1a\u663e\u793a\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u7684\u8bbf\u95ee\u6743\u9650\u3001\u9009\u9879\u548c\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DF-LC\"><span class=\"term\"><code class=\"literal\">\\df[anptwSx+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> [ <em class=\"replaceable\"><code>arg_pattern</code></em> ... ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u51fd\u6570\uff0c\u4ee5\u53ca\u5b83\u4eec\u7684\u7ed3\u679c\u6570\u636e\u7c7b\u578b\u3001\u53c2\u6570\u6570\u636e\u7c7b\u578b\u548c\u51fd\u6570\u7c7b\u578b\uff0c\u51fd\u6570\u7c7b\u578b\u5206\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">agg</span>\u201d</span>\uff08\u805a\u5408\uff09\u3001<span class=\"quote\">\u201c<span class=\"quote\">normal</span>\u201d</span>\u3001<span class=\"quote\">\u201c<span class=\"quote\">procedure</span>\u201d</span>\u3001<span class=\"quote\">\u201c<span class=\"quote\">trigger</span>\u201d</span>\u6216<span class=\"quote\">\u201c<span class=\"quote\">window</span>\u201d</span>\u3002\u8981\u53ea\u663e\u793a\u7279\u5b9a\u7c7b\u578b\u7684\u51fd\u6570\uff0c\u8bf7\u5728\u547d\u4ee4\u540e\u6dfb\u52a0\u76f8\u5e94\u7684\u5b57\u6bcd <code class=\"literal\">a</code>\u3001<code class=\"literal\">n</code>\u3001<code class=\"literal\">p</code>\u3001<code class=\"literal\">t</code> \u6216 <code class=\"literal\">w</code>\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u51fd\u6570\u3002\u4efb\u4f55\u9644\u52a0\u53c2\u6570\u90fd\u662f\u7c7b\u578b\u540d\u6a21\u5f0f\uff0c\u5206\u522b\u4e0e\u51fd\u6570\u7b2c\u4e00\u3001\u7b2c\u4e8c\u7b49\u53c2\u6570\u7684\u7c7b\u578b\u540d\u5339\u914d\u3002\uff08\u5339\u914d\u5230\u7684\u51fd\u6570\u53ef\u4ee5\u6bd4\u4f60\u6307\u5b9a\u7684\u53c2\u6570\u66f4\u591a\uff1b\u82e5\u8981\u9632\u6b62\u8fd9\u79cd\u60c5\u51b5\uff0c\u53ef\u5c06\u8fde\u5b57\u7b26 <code class=\"literal\">-</code> \u5199\u6210\u6700\u540e\u4e00\u4e2a <em class=\"replaceable\"><code>arg_pattern</code></em>\u3002\uff09\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u51fd\u6570\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u6613\u53d8\u6027\u3001\u5e76\u884c\u5b89\u5168\u6027\u3001\u6240\u6709\u8005\u3001\u5b89\u5168\u5206\u7c7b\u3001\u662f\u5426\u9632\u6f0f\u3001\u8bbf\u95ee\u6743\u9650\u3001\u8bed\u8a00\u3001\u5185\u90e8\u540d\u79f0\uff08\u4ec5\u9002\u7528\u4e8e C \u548c internal \u51fd\u6570\uff09\u4ee5\u53ca\u63cf\u8ff0\u3002\u7279\u5b9a\u51fd\u6570\u7684\u6e90\u4ee3\u7801\u53ef\u901a\u8fc7 <code class=\"literal\">\\sf</code> \u67e5\u770b\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DF-UC\"><span class=\"term\"><code class=\"literal\">\\dF[x+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u914d\u7f6e\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u914d\u7f6e\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u914d\u7f6e\u7684\u5b8c\u6574\u63cf\u8ff0\uff0c\u5305\u62ec\u5e95\u5c42\u5168\u6587\u68c0\u7d22\u89e3\u6790\u5668\u4ee5\u53ca\u6bcf\u79cd\u89e3\u6790\u5668\u8bcd\u5143\u7c7b\u578b\u5bf9\u5e94\u7684\u8bcd\u5178\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DFD\"><span class=\"term\"><code class=\"literal\">\\dFd[x+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u8bcd\u5178\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bcd\u5178\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u6240\u9009\u8bcd\u5178\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5e95\u5c42\u5168\u6587\u68c0\u7d22\u6a21\u677f\u548c\u9009\u9879\u503c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DFP\"><span class=\"term\"><code class=\"literal\">\\dFp[x+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u89e3\u6790\u5668\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u89e3\u6790\u5668\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u89e3\u6790\u5668\u7684\u5b8c\u6574\u63cf\u8ff0\uff0c\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u548c\u53ef\u8bc6\u522b\u7684\u8bcd\u5143\u7c7b\u578b\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DFT\"><span class=\"term\"><code class=\"literal\">\\dFt[x+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u6a21\u677f\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6a21\u677f\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u6a21\u677f\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u540d\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DG\"><span class=\"term\"><code class=\"literal\">\\dg[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u5e93\u89d2\u8272\u3002\uff08\u7531\u4e8e<span class=\"quote\">\u201c<span class=\"quote\">\u7528\u6237</span>\u201d</span>\u548c<span class=\"quote\">\u201c<span class=\"quote\">\u7ec4</span>\u201d</span>\u7684\u6982\u5ff5\u5df2\u7ecf\u7edf\u4e00\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">\u89d2\u8272</span>\u201d</span>\uff0c\u6b64\u547d\u4ee4\u73b0\u5728\u7b49\u540c\u4e8e <code class=\"literal\">\\du</code>\u3002\uff09\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u89d2\u8272\uff1b\u63d0\u4f9b <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u89d2\u8272\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u89d2\u8272\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u89d2\u8272\u7684\u9644\u52a0\u4fe1\u606f\uff1b\u76ee\u524d\u8fd9\u4f1a\u589e\u52a0\u6bcf\u4e2a\u89d2\u8272\u7684\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DL-LC\"><span class=\"term\"><code class=\"literal\">\\dl[x+]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u662f <code class=\"command\">\\lo_list</code> \u7684\u522b\u540d\uff0c\u540e\u8005\u4f1a\u663e\u793a\u5927\u5bf9\u8c61\u5217\u8868\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u5217\u51fa\u6bcf\u4e2a\u5927\u5bf9\u8c61\u7684\u76f8\u5173\u6743\u9650\uff08\u5982\u679c\u6709\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DL-UC\"><span class=\"term\"><code class=\"literal\">\\dL[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8fc7\u7a0b\u8bed\u8a00\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bed\u8a00\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u8bed\u8a00\uff1b\u63d0\u4f9b <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u79cd\u8bed\u8a00\u90fd\u4f1a\u8fde\u540c\u5176\u8c03\u7528\u5904\u7406\u5668\u3001\u9a8c\u8bc1\u5668\u3001\u8bbf\u95ee\u6743\u9650\u4ee5\u53ca\u5b83\u662f\u5426\u4e3a\u7cfb\u7edf\u5bf9\u8c61\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DN\"><span class=\"term\"><code class=\"literal\">\\dn[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6a21\u5f0f\uff08\u547d\u540d\u7a7a\u95f4\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6a21\u5f0f\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u6743\u9650\u548c\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DO-LC\"><span class=\"term\"><code class=\"literal\">\\do[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> [ <em class=\"replaceable\"><code>arg_pattern</code></em> [ <em class=\"replaceable\"><code>arg_pattern</code></em> ] ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u64cd\u4f5c\u7b26\u53ca\u5176\u64cd\u4f5c\u6570\u7c7b\u578b\u548c\u7ed3\u679c\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u64cd\u4f5c\u7b26\u3002\u5982\u679c\u6307\u5b9a\u4e86\u4e00\u4e2a <em class=\"replaceable\"><code>arg_pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u5176\u53f3\u53c2\u6570\u7c7b\u578b\u540d\u79f0\u4e0e\u8be5\u6a21\u5f0f\u5339\u914d\u7684\u524d\u7f00\u64cd\u4f5c\u7b26\u3002\u5982\u679c\u6307\u5b9a\u4e86\u4e24\u4e2a <em class=\"replaceable\"><code>arg_pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u53c2\u6570\u7c7b\u578b\u540d\u79f0\u4e0e\u8fd9\u4e9b\u6a21\u5f0f\u5339\u914d\u7684\u4e8c\u5143\u64cd\u4f5c\u7b26\u3002\uff08\u5bf9\u4e8e\u4e00\u5143\u64cd\u4f5c\u7b26\u672a\u4f7f\u7528\u7684\u53c2\u6570\uff0c\u4e5f\u53ef\u4ee5\u5199\u6210 <code class=\"literal\">-</code>\u3002\uff09\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u540d\u4ee5\u53ca\u5b83\u662f\u5426\u9632\u6f0f\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DO-UC\"><span class=\"term\"><code class=\"literal\">\\dO[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6392\u5e8f\u89c4\u5219\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6392\u5e8f\u89c4\u5219\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u6392\u5e8f\u89c4\u5219\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u4e00\u8d77\u5217\u51fa\u3002\u8bf7\u6ce8\u610f\uff0c\u53ea\u4f1a\u663e\u793a\u4e0e\u5f53\u524d\u6570\u636e\u5e93\u7f16\u7801\u517c\u5bb9\u7684\u6392\u5e8f\u89c4\u5219\uff0c\u56e0\u6b64\u5728\u540c\u4e00\u5b89\u88c5\u4e2d\u7684\u4e0d\u540c\u6570\u636e\u5e93\u91cc\u7ed3\u679c\u53ef\u80fd\u4e0d\u540c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DP-LC\"><span class=\"term\"><code class=\"literal\">\\dp[Sx] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u53ca\u5176\u76f8\u5173\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002</p>\n<p lang=\"zh\"><a class=\"link\" href=\"/docs/devel/sql-grant.html\" title=\"GRANT\"><code class=\"command\">GRANT</code></a>\u548c <a class=\"link\" href=\"/docs/devel/sql-revoke.html\" title=\"REVOKE\"><code class=\"command\">REVOKE</code></a> \u547d\u4ee4\u7528\u4e8e\u8bbe\u7f6e\u8bbf\u95ee\u6743\u9650\u3002\u6743\u9650\u663e\u793a\u7684\u542b\u4e49\u5728<a class=\"xref\" href=\"/docs/devel/ddl-priv.html\" title=\"5.9.\u00a0\u6743\u9650\">\u7b2c\u00a05.9\u00a0\u8282</a>\u4e2d\u6709\u89e3\u91ca\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DP-UC\"><span class=\"term\"><code class=\"literal\">\\dP[itnx+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5206\u533a\u5173\u7cfb\u3002\u5982\u679c<em class=\"replaceable\"><code>pattern</code></em>\u88ab\u6307\u5b9a\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6761\u76ee\u3002\u4fee\u9970\u7b26<code class=\"literal\">t</code>\uff08\u8868\uff09\u548c<code class=\"literal\">i</code>\uff08\u7d22\u5f15\uff09\u53ef\u4ee5\u9644\u52a0\u5230\u547d\u4ee4\uff0c\u8fc7\u6ee4\u8981\u5217\u51fa\u7684\u5173\u7cfb\u7c7b\u578b\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5217\u51fa\u5206\u533a\u8868\u548c\u7d22\u5f15\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528\u4fee\u9970\u7b26<code class=\"literal\">n</code>\uff08<span class=\"quote\">\u201c<span class=\"quote\">nested</span>\u201d</span>\uff09\uff0c\u6216\u6307\u5b9a\u4e86\u6a21\u5f0f\uff0c\u5219\u5c06\u5305\u62ec\u975e\u6839\u5206\u533a\u5173\u7cfb\uff0c\u5e76\u663e\u793a\u4e00\u5217\uff0c\u7ed9\u51fa\u6bcf\u4e2a\u5206\u533a\u5173\u7cfb\u7684\u7236\u7ea7\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u5173\u7cfb\u5206\u533a\u5927\u5c0f\u7684\u603b\u548c\u4ee5\u53ca\u5173\u7cfb\u63cf\u8ff0\u3002\u5982\u679c <code class=\"literal\">n</code> \u4e0e <code class=\"literal\">+</code> \u7ec4\u5408\u4f7f\u7528\uff0c\u5219\u4f1a\u663e\u793a\u4e24\u4e2a\u5927\u5c0f\uff1a\u4e00\u4e2a\u5305\u62ec\u76f4\u63a5\u9644\u52a0\u7684\u53f6\u5206\u533a\u7684\u603b\u5927\u5c0f\uff0c\u53e6\u4e00\u4e2a\u663e\u793a\u5305\u62ec\u95f4\u63a5\u9644\u52a0\u5b50\u5206\u533a\u5728\u5185\u7684\u6240\u6709\u5206\u533a\u603b\u5927\u5c0f\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DRDS\"><span class=\"term\"><code class=\"literal\">\\drds[x] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>role-pattern</code></em></a> [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>database-pattern</code></em></a> ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5df2\u5b9a\u4e49\u7684\u914d\u7f6e\u8bbe\u7f6e\u3002\u8fd9\u4e9b\u8bbe\u7f6e\u53ef\u4ee5\u7279\u5b9a\u4e8e\u89d2\u8272\u3001\u7279\u5b9a\u4e8e\u6570\u636e\u5e93\uff0c\u6216\u540c\u65f6\u7279\u5b9a\u4e8e\u4e24\u8005\u3002<em class=\"replaceable\"><code>role-pattern</code></em>\u548c<em class=\"replaceable\"><code>database-pattern</code></em>\u5206\u522b\u7528\u4e8e\u9009\u62e9\u8981\u5217\u51fa\u7684\u89d2\u8272\u548c\u6570\u636e\u5e93\u3002\u7701\u7565\u67d0\u4e2a\u6a21\u5f0f\u53c2\u6570\u6216\u5c06\u5176\u6307\u5b9a\u4e3a<code class=\"literal\">*</code>\u65f6\uff0c\u4e0d\u4f1a\u6309\u8be5\u53c2\u6570\u7b5b\u9009\uff0c\u8fd8\u4f1a\u5206\u522b\u5305\u542b\u4e0d\u7279\u5b9a\u4e8e\u89d2\u8272\u6216\u4e0d\u7279\u5b9a\u4e8e\u6570\u636e\u5e93\u7684\u8bbe\u7f6e\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0<code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002</p>\n<p lang=\"zh\"><a class=\"link\" href=\"/docs/devel/sql-alterrole.html\" title=\"ALTER ROLE\"><code class=\"command\">ALTER ROLE</code></a>\u548c <a class=\"link\" href=\"/docs/devel/sql-alterdatabase.html\" title=\"ALTER DATABASE\"><code class=\"command\">ALTER DATABASE</code></a> \u547d\u4ee4\u7528\u4e8e\u5b9a\u4e49\u6bcf\u4e2a\u89d2\u8272\u548c\u6bcf\u4e2a\u6570\u636e\u5e93\u7684\u914d\u7f6e\u8bbe\u7f6e\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DRG\"><span class=\"term\"><code class=\"literal\">\\drg[Sx] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u6bcf\u4e2a\u88ab\u6388\u4e88\u89d2\u8272\u6210\u5458\u8eab\u4efd\u7684\u4fe1\u606f\uff0c\u5305\u62ec\u88ab\u6388\u4e88\u7684\u9009\u9879\uff08<code class=\"literal\">ADMIN</code>\u3001<code class=\"literal\">INHERIT</code> \u548c/\u6216 <code class=\"literal\">SET</code>\uff09\u4ee5\u53ca\u6388\u4e88\u8005\u3002\u5173\u4e8e\u89d2\u8272\u6210\u5458\u8eab\u4efd\uff0c\u53c2\u89c1 <a class=\"link\" href=\"/docs/devel/sql-grant.html\" title=\"GRANT\"><code class=\"command\">GRANT</code></a> \u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u6388\u4e88\u7528\u6237\u521b\u5efa\u89d2\u8272\u7684\u6210\u5458\u8eab\u4efd\uff1b\u63d0\u4f9b <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u89d2\u8272\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u6388\u4e88\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u89d2\u8272\u7684\u6210\u5458\u8eab\u4efd\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DRP\"><span class=\"term\"><code class=\"literal\">\\dRp[x+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u903b\u8f91\u590d\u5236\u53d1\u5e03\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u53d1\u5e03\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u8fd8\u4f1a\u663e\u793a\u4e0e\u6bcf\u4e2a\u53d1\u5e03\u5173\u8054\u7684\u8868\u3001\u6392\u9664\u8868\u548c\u6a21\u5f0f\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DRS\"><span class=\"term\"><code class=\"literal\">\\dRs[x+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u903b\u8f91\u590d\u5236\u8ba2\u9605\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8ba2\u9605\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u8ba2\u9605\u7684\u5176\u4ed6\u5c5e\u6027\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DT\"><span class=\"term\"><code class=\"literal\">\\dT[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u7c7b\u578b\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u7c7b\u578b\u90fd\u4f1a\u8fde\u540c\u5176\u5185\u90e8\u540d\u79f0\u3001\u5927\u5c0f\u548c\u76f8\u5173\u6743\u9650\u4e00\u8d77\u5217\u51fa\uff1b\u5bf9\u4e8e <code class=\"type\">enum</code> \u7c7b\u578b\uff0c\u8fd8\u4f1a\u663e\u793a\u5176\u5141\u8bb8\u503c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DU\"><span class=\"term\"><code class=\"literal\">\\du[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u5e93\u89d2\u8272\u3002\uff08\u7531\u4e8e<span class=\"quote\">\u201c<span class=\"quote\">\u7528\u6237</span>\u201d</span>\u548c<span class=\"quote\">\u201c<span class=\"quote\">\u7ec4</span>\u201d</span>\u7684\u6982\u5ff5\u5df2\u7ecf\u7edf\u4e00\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">\u89d2\u8272</span>\u201d</span>\uff0c\u6b64\u547d\u4ee4\u73b0\u5728\u7b49\u540c\u4e8e <code class=\"literal\">\\dg</code>\u3002\uff09\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u89d2\u8272\uff1b\u63d0\u4f9b <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u89d2\u8272\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u89d2\u8272\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u89d2\u8272\u7684\u9644\u52a0\u4fe1\u606f\uff1b\u76ee\u524d\u8fd9\u4f1a\u589e\u52a0\u6bcf\u4e2a\u89d2\u8272\u7684\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DX-LC\"><span class=\"term\"><code class=\"literal\">\\dx[x+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5df2\u5b89\u88c5\u7684\u6269\u5c55\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6269\u5c55\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u5217\u51fa\u5c5e\u4e8e\u6bcf\u4e2a\u5339\u914d\u6269\u5c55\u7684\u5168\u90e8\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DX-UC\"><span class=\"term\"><code class=\"literal\">\\dX[x+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u6269\u5c55\u7edf\u8ba1\u4fe1\u606f\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6269\u5c55\u7edf\u8ba1\u4fe1\u606f\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n<p lang=\"zh\">\u6bcf\u79cd\u6269\u5c55\u7edf\u8ba1\u7684\u72b6\u6001\u663e\u793a\u5728\u4ee5\u7edf\u8ba1\u79cd\u7c7b\u547d\u540d\u7684\u5217\u4e2d\uff0c\u4f8b\u5982 Ndistinct\u3002defined \u8868\u793a\u521b\u5efa\u7edf\u8ba1\u65f6\u8bf7\u6c42\u4e86\u8be5\u7edf\u8ba1\uff0cNULL \u8868\u793a\u672a\u8bf7\u6c42\u3002\u82e5\u8981\u5224\u65ad ANALYZE \u662f\u5426\u8fd0\u884c\u8fc7\u3001\u7edf\u8ba1\u662f\u5426\u53ef\u4f9b\u89c4\u5212\u5668\u4f7f\u7528\uff0c\u53ef\u67e5\u8be2 pg_stats_ext\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DY\"><span class=\"term\"><code class=\"literal\">\\dy[x+] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u4e8b\u4ef6\u89e6\u53d1\u5668\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u4e8b\u4ef6\u89e6\u53d1\u5668\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-EDIT\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\e</code> \u6216 <code class=\"literal\">\\edit</code> <code class=\"literal\">[ <span class=\"optional\"><em class=\"replaceable\"><code>filename</code></em></span> ] [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5219\u7f16\u8f91\u8be5\u6587\u4ef6\uff1b\u7f16\u8f91\u5668\u9000\u51fa\u540e\uff0c\u6587\u4ef6\u5185\u5bb9\u5c06\u88ab\u590d\u5236\u5230\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5219\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u590d\u5236\u5230\u4e34\u65f6\u6587\u4ef6\u4e2d\uff0c\u7136\u540e\u4ee5\u76f8\u540c\u65b9\u5f0f\u8fdb\u884c\u7f16\u8f91\u3002\u6216\u8005\uff0c\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u5c06\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u590d\u5236\u5230\u4e34\u65f6\u6587\u4ef6\u4e2d\uff0c\u5e76\u4ee5\u76f8\u540c\u65b9\u5f0f\u8fdb\u884c\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7f16\u8f91\u6587\u4ef6\u6216\u4e0a\u4e00\u4e2a\u67e5\u8be2\u540e\u5728\u672a\u4fee\u6539\u6587\u4ef6\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5219\u67e5\u8be2\u7f13\u51b2\u533a\u5c06\u88ab\u6e05\u9664\u3002\u5426\u5219\uff0c\u67e5\u8be2\u7f13\u51b2\u533a\u7684\u65b0\u5185\u5bb9\u5c06\u6839\u636e<span class=\"application\">psql</span>\u7684\u6b63\u5e38\u89c4\u5219\u91cd\u65b0\u89e3\u6790\uff0c\u5c06\u6574\u4e2a\u7f13\u51b2\u533a\u89c6\u4e3a\u5355\u884c\u3002\u4efb\u4f55\u5b8c\u6574\u7684\u67e5\u8be2\u5c06\u7acb\u5373\u6267\u884c\uff1b\u4e5f\u5c31\u662f\u8bf4\uff0c\u5982\u679c\u67e5\u8be2\u7f13\u51b2\u533a\u5305\u542b\u5206\u53f7\u6216\u4ee5\u5206\u53f7\u7ed3\u5c3e\uff0c\u5219\u6267\u884c\u5e76\u4ece\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u5220\u9664\u5230\u8be5\u70b9\u7684\u6240\u6709\u5185\u5bb9\u3002\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u5269\u4f59\u7684\u5185\u5bb9\u5c06\u91cd\u65b0\u663e\u793a\u3002\u8f93\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u8f93\u5165<code class=\"literal\">\\r</code>\u901a\u8fc7\u6e05\u9664\u67e5\u8be2\u7f13\u51b2\u533a\u6765\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u5c06\u7f13\u51b2\u533a\u89c6\u4e3a\u5355\u884c\u4e3b\u8981\u5f71\u54cd\u5143\u547d\u4ee4\uff1a\u5728\u5143\u547d\u4ee4\u540e\u7684\u7f13\u51b2\u533a\u5c06\u88ab\u89c6\u4e3a\u5143\u547d\u4ee4\u7684\u53c2\u6570\uff0c\u5373\u4f7f\u5b83\u8de8\u8d8a\u591a\u884c\u3002\uff08\u56e0\u6b64\uff0c\u4e0d\u80fd\u7528\u8fd9\u79cd\u65b9\u5f0f\u521b\u5efa\u4f7f\u7528\u5143\u547d\u4ee4\u7684\u811a\u672c\u3002\u8bf7\u4f7f\u7528<code class=\"command\">\\i</code>\u3002\uff09</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u5c06\u5149\u6807\u5b9a\u4f4d\u5728\u6587\u4ef6\u6216\u67e5\u8be2\u7f13\u51b2\u533a\u7684\u6307\u5b9a\u884c\u4e0a\u3002\u8bf7\u6ce8\u610f\uff0c\u5982\u679c\u53ea\u7ed9\u51fa\u4e00\u4e2a\u5168\u662f\u6570\u5b57\u7684\u53c2\u6570\uff0c<span class=\"application\">psql</span>\u4f1a\u5047\u5b9a\u5b83\u662f\u4e00\u4e2a\u884c\u53f7\uff0c\u800c\u4e0d\u662f\u6587\u4ef6\u540d\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5173\u4e8e\u5982\u4f55\u914d\u7f6e\u548c\u81ea\u5b9a\u4e49\u7f16\u8f91\u5668\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/devel/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"\u73af\u5883\">\u73af\u5883</a>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-ECHO\"><span class=\"term\"><code class=\"literal\">\\echo <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6c42\u503c\u540e\u7684\u53c2\u6570\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff0c\u7528\u7a7a\u683c\u5206\u9694\uff0c\u5e76\u5728\u672b\u5c3e\u52a0\u4e0a\u6362\u884c\u7b26\u3002\u8fd9\u5bf9\u4e8e\u5728\u811a\u672c\u8f93\u51fa\u4e2d\u7a7f\u63d2\u4fe1\u606f\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>\\echo `date`</code></strong>\nTue Oct 26 21:40:57 CEST 1999\n</pre>\n<p lang=\"zh\">\u5982\u679c\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f\u672a\u52a0\u5f15\u53f7\u7684<code class=\"literal\">-n</code>\uff0c\u5219\u4e0d\u4f1a\u5199\u5165\u5c3e\u968f\u7684\u6362\u884c\u7b26\uff08\u4e5f\u4e0d\u4f1a\u5199\u5165\u7b2c\u4e00\u4e2a\u53c2\u6570\uff09\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528<code class=\"command\">\\o</code>\u547d\u4ee4\u91cd\u5b9a\u5411\u67e5\u8be2\u8f93\u51fa\uff0c\u53ef\u80fd\u4f1a\u60f3\u7528<code class=\"command\">\\qecho</code>\u4ee3\u66ff\u8fd9\u4e2a\u547d\u4ee4\u3002\u53e6\u8bf7\u53c2\u9605<code class=\"command\">\\warn</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-EF\"><span class=\"term\"><code class=\"literal\">\\ef [ <span class=\"optional\"><em class=\"replaceable\"><code>function_description</code></em> [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</span> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u7f16\u8f91\u6307\u5b9a\u51fd\u6570\u6216\u8fc7\u7a0b\u7684\u5b9a\u4e49\uff0c\u5f62\u5f0f\u4e3a<code class=\"command\">CREATE OR REPLACE FUNCTION</code>\u6216 <code class=\"command\">CREATE OR REPLACE PROCEDURE</code>\u547d\u4ee4\u3002\u7f16\u8f91\u65b9\u5f0f\u4e0e<code class=\"literal\">\\edit</code>\u76f8\u540c\u3002\u5982\u679c\u5728\u4e0d\u4fdd\u5b58\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5219\u8be5\u8bed\u53e5\u4f1a\u88ab\u4e22\u5f03\u3002\u5982\u679c\u4fdd\u5b58\u5e76\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5e76\u5728\u5176\u4e2d\u6dfb\u52a0\u4e86\u5206\u53f7\uff0c\u5219\u66f4\u65b0\u540e\u7684\u547d\u4ee4\u4f1a\u7acb\u5373\u6267\u884c\u3002\u5426\u5219\u5b83\u4f1a\u91cd\u65b0\u663e\u793a\uff1b\u952e\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u7528<code class=\"literal\">\\r</code>\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u76ee\u6807\u51fd\u6570\u53ef\u4ec5\u7528\u540d\u79f0\u6307\u5b9a\uff0c\u4e5f\u53ef\u7528\u540d\u79f0\u548c\u53c2\u6570\u6307\u5b9a\uff0c\u4f8b\u5982 foo(integer, text)\u3002\u82e5\u6709\u591a\u4e2a\u540c\u540d\u51fd\u6570\uff0c\u5219\u5fc5\u987b\u63d0\u4f9b\u53c2\u6570\u7c7b\u578b\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u51fd\u6570\uff0c\u5219\u4f1a\u5448\u73b0\u4e00\u4e2a\u7a7a\u7684<code class=\"command\">CREATE FUNCTION</code>\u6a21\u677f\u4f9b\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u5c06\u5149\u6807\u5b9a\u4f4d\u5728\u51fd\u6570\u4f53\u7684\u6307\u5b9a\u884c\u4e0a\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u51fd\u6570\u4f53\u901a\u5e38\u4e0d\u4f1a\u4ece\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u5f00\u59cb\u3002\uff09</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\ef</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5173\u4e8e\u5982\u4f55\u914d\u7f6e\u548c\u81ea\u5b9a\u4e49\u7f16\u8f91\u5668\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/devel/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"\u73af\u5883\">\u73af\u5883</a>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-ENCODING\"><span class=\"term\"><code class=\"literal\">\\encoding [ <em class=\"replaceable\"><code>encoding</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5ba2\u6237\u7aef\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u6ca1\u6709\u53c2\u6570\u65f6\uff0c\u6b64\u547d\u4ee4\u663e\u793a\u5f53\u524d\u7f16\u7801\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-ERRVERBOSE\"><span class=\"term\"><code class=\"literal\">\\errverbose</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ee5\u6700\u5927\u7684\u8be6\u7ec6\u7a0b\u5ea6\u91cd\u590d\u6700\u8fd1\u7684\u670d\u52a1\u5668\u9519\u8bef\u6d88\u606f\uff0c\u5c31\u597d\u50cf<code class=\"varname\">VERBOSITY</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">verbose</code>\uff0c<code class=\"varname\">SHOW_CONTEXT</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">always</code>\u4e00\u6837\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-EV\"><span class=\"term\"><code class=\"literal\">\\ev [ <span class=\"optional\"><em class=\"replaceable\"><code>view_name</code></em> [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</span> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u7f16\u8f91\u6307\u5b9a\u89c6\u56fe\u7684\u5b9a\u4e49\uff0c\u5f62\u5f0f\u4e3a<code class=\"command\">CREATE OR REPLACE VIEW</code>\u547d\u4ee4\u3002\u7f16\u8f91\u65b9\u5f0f\u4e0e<code class=\"literal\">\\edit</code>\u76f8\u540c\u3002\u5982\u679c\u5728\u4e0d\u4fdd\u5b58\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5219\u8be5\u8bed\u53e5\u4f1a\u88ab\u4e22\u5f03\u3002\u5982\u679c\u4fdd\u5b58\u5e76\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5e76\u5728\u5176\u4e2d\u6dfb\u52a0\u4e86\u5206\u53f7\uff0c\u5219\u66f4\u65b0\u540e\u7684\u547d\u4ee4\u4f1a\u7acb\u5373\u6267\u884c\uff1b\u5426\u5219\u5c06\u91cd\u65b0\u663e\u793a\uff1b\u8f93\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u7528<code class=\"literal\">\\r</code>\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u89c6\u56fe\uff0c\u5219\u4f1a\u5448\u73b0\u4e00\u4e2a\u7a7a\u7684<code class=\"command\">CREATE VIEW</code>\u6a21\u677f\u4f9b\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u5c06\u5149\u6807\u5b9a\u4f4d\u5728\u89c6\u56fe\u5b9a\u4e49\u7684\u6307\u5b9a\u884c\u4e0a\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\ev</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-F\"><span class=\"term\"><code class=\"literal\">\\f [ <em class=\"replaceable\"><code>string</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u67e5\u8be2\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u9ed8\u8ba4\u503c\u662f\u7ad6\u7ebf\uff08<code class=\"literal\">|</code>\uff09\u3002\u5b83\u7b49\u540c\u4e8e<code class=\"command\">\\pset fieldsep</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-G\"><span class=\"term\"><code class=\"literal\">\\g [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\g [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u6267\u884c\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728<code class=\"literal\">\\g</code>\u540e\u9762\u51fa\u73b0\u62ec\u53f7\uff0c\u5219\u62ec\u53f7\u4e2d\u662f\u7528\u7a7a\u683c\u5206\u9694\u7684<em class=\"replaceable\"><code>option</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em>\u683c\u5f0f\u9009\u9879\u5b50\u53e5\u5217\u8868\u3002\u8fd9\u4e9b\u5b50\u53e5\u7684\u89e3\u91ca\u65b9\u5f0f\u4e0e<code class=\"literal\">\\pset</code> <em class=\"replaceable\"><code>option</code></em> <em class=\"replaceable\"><code>value</code></em>\u547d\u4ee4\u76f8\u540c\uff0c\u4f46\u4ec5\u5728\u6b64\u67e5\u8be2\u6267\u884c\u671f\u95f4\u751f\u6548\u3002\u5728\u6b64\u5217\u8868\u4e2d\uff0c<code class=\"literal\">=</code>\u7b26\u53f7\u5468\u56f4\u4e0d\u5141\u8bb8\u6709\u7a7a\u683c\uff0c\u4f46\u9009\u9879\u5b50\u53e5\u4e4b\u95f4\u5fc5\u987b\u6709\u7a7a\u683c\u3002\u5982\u679c<code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em>\u88ab\u7701\u7565\uff0c\u5219\u6307\u5b9a\u7684<em class=\"replaceable\"><code>option</code></em>\u4f1a\u6309\u4ee5\u4e0b\u547d\u4ee4\u7684\u65b9\u5f0f\u66f4\u6539\uff1a<code class=\"literal\">\\pset</code> <em class=\"replaceable\"><code>option</code></em>\uff0c\u5176\u4e2d\u4e0d\u663e\u5f0f\u6307\u5b9a<em class=\"replaceable\"><code>value</code></em>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7ed9\u51fa\u4e86<em class=\"replaceable\"><code>filename</code></em>\u6216<code class=\"literal\">|</code><em class=\"replaceable\"><code>command</code></em>\u53c2\u6570\uff0c\u67e5\u8be2\u8f93\u51fa\u5c31\u4f1a\u5199\u5165\u6307\u5b9a\u6587\u4ef6\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6307\u5b9a\u7684 shell \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u7167\u5e38\u663e\u793a\u3002\u53ea\u6709\u5f53\u67e5\u8be2\u6210\u529f\u8fd4\u56de\u96f6\u4e2a\u6216\u591a\u4e2a\u5143\u7ec4\u65f6\uff0c\u624d\u4f1a\u5411\u6587\u4ef6\u6216\u547d\u4ee4\u5199\u5165\uff1b\u5982\u679c\u67e5\u8be2\u5931\u8d25\uff0c\u6216\u6267\u884c\u7684\u662f\u4e0d\u8fd4\u56de\u6570\u636e\u7684 SQL \u547d\u4ee4\uff0c\u5219\u4e0d\u4f1a\u5199\u5165\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u5c06\u88ab\u91cd\u65b0\u6267\u884c\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u6ca1\u6709\u4efb\u4f55\u53c2\u6570\u7684<code class=\"literal\">\\g</code>\u57fa\u672c\u4e0a\u7b49\u540c\u4e8e\u4e00\u4e2a\u5206\u53f7\u3002\u5e26\u6709\u53c2\u6570\u7684<code class=\"literal\">\\g</code>\u63d0\u4f9b\u4e86\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u4e00\u6b21\u6027</span>\u201d</span>\u66ff\u4ee3<code class=\"command\">\\o</code>\u547d\u4ee4\u7684\u9009\u62e9\uff0c\u5e76\u4e14\u8fd8\u5141\u8bb8\u4e00\u6b21\u6027\u8c03\u6574\u901a\u5e38\u7531<code class=\"literal\">\\pset</code>\u8bbe\u7f6e\u7684\u8f93\u51fa\u683c\u5f0f\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u5f53\u6700\u540e\u4e00\u4e2a\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\u65f6\uff0c\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u90fd\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u65e2\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\uff0c\u4e5f\u4e0d\u8fdb\u884c\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u90e8\u5206\u4f1a\u76f4\u63a5\u6309\u5b57\u9762\u4f20\u7ed9 shell\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-GDESC\"><span class=\"term\"><code class=\"literal\">\\gdesc</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u663e\u793a\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u67e5\u8be2\u7ed3\u679c\u7684\u63cf\u8ff0\uff08\u5373\u5217\u540d\u548c\u6570\u636e\u7c7b\u578b\uff09\u3002\u67e5\u8be2\u5e76\u4e0d\u4f1a\u5b9e\u9645\u6267\u884c\uff1b\u4e0d\u8fc7\uff0c\u5982\u679c\u5176\u4e2d\u5b58\u5728\u8bed\u6cd5\u9519\u8bef\uff0c\u4f1a\u6309\u901a\u5e38\u7684\u65b9\u5f0f\u62a5\u544a\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6539\u4e3a\u63cf\u8ff0\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-GETENV\"><span class=\"term\"><code class=\"literal\">\\getenv <em class=\"replaceable\"><code>psql_var</code></em> <em class=\"replaceable\"><code>env_var</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u83b7\u53d6\u73af\u5883\u53d8\u91cf<em class=\"replaceable\"><code>env_var</code></em>\u7684\u503c\uff0c\u5e76\u5c06\u5176\u8d4b\u7ed9<span class=\"application\">psql</span>\u53d8\u91cf<em class=\"replaceable\"><code>psql_var</code></em>\u3002\u5982\u679c<em class=\"replaceable\"><code>env_var</code></em>\u5728<span class=\"application\">psql</span>\u8fdb\u7a0b\u7684\u73af\u5883\u4e2d\u672a\u5b9a\u4e49\uff0c<em class=\"replaceable\"><code>psql_var</code></em>\u4e0d\u4f1a\u88ab\u6539\u53d8\u3002\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>\\getenv home HOME</code></strong>\n=&gt; <strong class=\"userinput\"><code>\\echo :home</code></strong>\n/home/postgres\n</pre>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-GEXEC\"><span class=\"term\"><code class=\"literal\">\\gexec</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u7136\u540e\u5c06\u67e5\u8be2\u8f93\u51fa\u7684\u6bcf\u884c\u6bcf\u5217\u89c6\u4e3a\u8981\u6267\u884c\u7684SQL\u8bed\u53e5\u3002\u4f8b\u5982\uff0c\u8981\u5728<code class=\"structname\">my_table</code>\u7684\u6bcf\u4e00\u5217\u4e0a\u521b\u5efa\u7d22\u5f15\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT format('CREATE INDEX ON my_table (%I)', attname)</code></strong>\n-&gt; <strong class=\"userinput\"><code>FROM pg_attribute</code></strong>\n-&gt; <strong class=\"userinput\"><code>WHERE attrelid = 'my_table'::regclass AND attnum &gt; 0</code></strong>\n-&gt; <strong class=\"userinput\"><code>ORDER BY attnum</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gexec</code></strong>\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\n</pre>\n<p lang=\"zh\">\u751f\u6210\u7684\u67e5\u8be2\u6309\u8fd4\u56de\u884c\u7684\u987a\u5e8f\u6267\u884c\uff1b\u540c\u4e00\u884c\u6709\u591a\u5217\u65f6\u4ece\u5de6\u5230\u53f3\u6267\u884c\uff0c\u5ffd\u7565 NULL \u5b57\u6bb5\u3002\u67e5\u8be2\u539f\u6837\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u56e0\u6b64\u4e0d\u80fd\u662f psql \u5143\u547d\u4ee4\uff0c\u4e5f\u4e0d\u80fd\u5305\u542b psql \u53d8\u91cf\u5f15\u7528\u3002\u9664\u975e\u8bbe\u7f6e ON_ERROR_STOP\uff0c\u67d0\u6761\u67e5\u8be2\u5931\u8d25\u540e\u4ecd\u7ee7\u7eed\u6267\u884c\u5176\u4f59\u67e5\u8be2\u3002\u6bcf\u6761\u67e5\u8be2\u5747\u9075\u5faa ECHO \u8bbe\u7f6e\uff08\u4f7f\u7528 \\gexec \u65f6\uff0c\u901a\u5e38\u5efa\u8bae\u5c06 ECHO \u8bbe\u4e3a all \u6216 queries\uff09\uff0c\u67e5\u8be2\u65e5\u5fd7\u3001\u5355\u6b65\u6a21\u5f0f\u3001\u8ba1\u65f6\u7b49\u6267\u884c\u529f\u80fd\u4e5f\u5206\u522b\u5e94\u7528\u4e8e\u6bcf\u6761\u751f\u6210\u7684\u67e5\u8be2\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-GSET\"><span class=\"term\"><code class=\"literal\">\\gset [ <em class=\"replaceable\"><code>prefix</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u5e76\u5c06\u67e5\u8be2\u8f93\u51fa\u5b58\u5165 <span class=\"application\">psql</span> \u53d8\u91cf\uff08\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/devel/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\uff09\u3002\u8981\u6267\u884c\u7684\u67e5\u8be2\u5fc5\u987b\u6070\u597d\u8fd4\u56de\u4e00\u884c\u3002\u8be5\u884c\u7684\u6bcf\u4e00\u5217\u5206\u522b\u5b58\u5165\u4e00\u4e2a\u53d8\u91cf\uff0c\u53d8\u91cf\u540d\u4e0e\u5217\u540d\u76f8\u540c\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT 'hello' AS var1, 10 AS var2</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gset</code></strong>\n=&gt; <strong class=\"userinput\"><code>\\echo :var1 :var2</code></strong>\nhello 10\n</pre>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>prefix</code></em>\uff0c\u5219\u4f1a\u5c06\u8be5\u5b57\u7b26\u4e32\u52a0\u5230\u67e5\u8be2\u7684\u5217\u540d\u524d\u9762\uff0c\u4ee5\u6784\u6210\u8981\u4f7f\u7528\u7684\u53d8\u91cf\u540d\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT 'hello' AS var1, 10 AS var2</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gset result_</code></strong>\n=&gt; <strong class=\"userinput\"><code>\\echo :result_var1 :result_var2</code></strong>\nhello 10\n</pre>\n<p lang=\"zh\">\u5982\u679c\u67d0\u4e00\u5217\u7684\u7ed3\u679c\u4e3a NULL\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u5bf9\u5e94\u7684\u53d8\u91cf\uff0c\u800c\u4e0d\u662f\u8bbe\u7f6e\u5b83\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u67e5\u8be2\u5931\u8d25\u6216\u6ca1\u6709\u6070\u597d\u8fd4\u56de\u4e00\u884c\uff0c\u5219\u4e0d\u4f1a\u66f4\u6539\u4efb\u4f55\u53d8\u91cf\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-GX\"><span class=\"term\"><code class=\"literal\">\\gx [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\gx [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\\gx \u4e0e \\g \u7b49\u4ef7\uff0c\u4f46\u4f1a\u5f3a\u5236\u6b64\u67e5\u8be2\u4f7f\u7528\u6269\u5c55\u8f93\u51fa\u6a21\u5f0f\uff0c\u76f8\u5f53\u4e8e\u5728 \\pset \u9009\u9879\u5217\u8868\u4e2d\u6307\u5b9a expanded=on\u3002\u53e6\u89c1 \\x\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-HELP\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\h</code>\u6216<code class=\"literal\">\\help</code> <code class=\"literal\">[ <em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u7ed9\u51fa\u6307\u5b9a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u7684\u8bed\u6cd5\u5e2e\u52a9\u3002\u5982\u679c\u672a\u6307\u5b9a<em class=\"replaceable\"><code>command</code></em>\uff0c\u5219<span class=\"application\">psql</span>\u5c06\u5217\u51fa\u6240\u6709\u53ef\u7528\u8bed\u6cd5\u5e2e\u52a9\u7684\u547d\u4ee4\u3002\u5982\u679c<em class=\"replaceable\"><code>command</code></em>\u662f\u661f\u53f7\uff08<code class=\"literal\">*</code>\uff09\uff0c\u5219\u663e\u793a\u6240\u6709<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u7684\u8bed\u6cd5\u5e2e\u52a9\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\help</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u4e3a\u4e86\u7b80\u5316\u8f93\u5165\uff0c\u7531\u591a\u4e2a\u5355\u8bcd\u7ec4\u6210\u7684\u547d\u4ee4\u4e0d\u9700\u8981\u52a0\u5f15\u53f7\u3002\u56e0\u6b64\uff0c\u53ef\u4ee5\u76f4\u63a5\u8f93\u5165<strong class=\"userinput\"><code>\\help alter table</code></strong>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-HTML\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\H</code> \u6216 <code class=\"literal\">\\html</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5f00<acronym class=\"acronym\">HTML</acronym>\u67e5\u8be2\u8f93\u51fa\u683c\u5f0f\u3002\u5982\u679c<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u5df2\u7ecf\u6253\u5f00\uff0c\u5219\u5207\u6362\u56de\u9ed8\u8ba4\u7684\u5bf9\u9f50\u6587\u672c\u683c\u5f0f\u3002\u6b64\u547d\u4ee4\u662f\u4e3a\u517c\u5bb9\u6027\u548c\u4fbf\u5229\u6027\u800c\u4fdd\u7559\u7684\uff1b\u8bbe\u7f6e\u5176\u4ed6\u8f93\u51fa\u9009\u9879\u7684\u65b9\u6cd5\u89c1<code class=\"command\">\\pset</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-INCLUDE\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\i</code> \u6216 <code class=\"literal\">\\include</code> <em class=\"replaceable\"><code>filename</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u8bfb\u53d6\u8f93\u5165\uff0c\u5e76\u50cf\u5728\u952e\u76d8\u4e0a\u8f93\u5165\u4e00\u6837\u6267\u884c\u5b83\u3002</p>\n<p lang=\"zh\">\u5982\u679c<em class=\"replaceable\"><code>filename</code></em>\u662f<code class=\"literal\">-</code>\uff08\u8fde\u5b57\u7b26\uff09\uff0c\u5219\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\uff0c\u76f4\u5230\u9047\u5230 EOF \u6307\u793a\u6216<code class=\"command\">\\q</code>\u5143\u547d\u4ee4\u3002\u8fd9\u53ef\u7528\u4e8e\u5c06\u4ea4\u4e92\u5f0f\u8f93\u5165\u4e0e\u6587\u4ef6\u8f93\u5165\u4ea4\u9519\u4f7f\u7528\u3002\u8bf7\u6ce8\u610f\uff0c\u53ea\u6709\u5728\u6700\u5916\u5c42\u542f\u7528\u4e86 Readline\uff0c\u6b64\u5904\u624d\u4f1a\u4f7f\u7528 Readline \u529f\u80fd\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5982\u679c\u60f3\u5728\u5c4f\u5e55\u4e0a\u770b\u5230\u88ab\u8bfb\u5165\u7684\u5404\u884c\uff0c\u8bf7\u5c06\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">all</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"PSQL-METACOMMAND-IF\"><span class=\"term\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\elif</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\else</code><br/></span><span class=\"term\"><code class=\"literal\">\\endif</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u7ec4\u547d\u4ee4\u5b9e\u73b0\u4e86\u53ef\u5d4c\u5957\u7684\u6761\u4ef6\u5757\u3002\u6761\u4ef6\u5757\u5fc5\u987b\u4ee5<code class=\"command\">\\if</code>\u5f00\u59cb\uff0c\u5e76\u4ee5<code class=\"command\">\\endif</code>\u7ed3\u675f\u3002\u5728\u4e24\u8005\u4e4b\u95f4\u53ef\u4ee5\u6709\u4efb\u610f\u6570\u91cf\u7684<code class=\"command\">\\elif</code>\u5b50\u53e5\uff0c\u540e\u9762\u53ef\u4ee5\u9009\u62e9\u6027\u5730\u8ddf\u7740\u4e00\u4e2a<code class=\"command\">\\else</code>\u5b50\u53e5\u3002\u5728\u5f62\u6210\u6761\u4ef6\u5757\u7684\u547d\u4ee4\u4e4b\u95f4\u901a\u5e38\u4f1a\u51fa\u73b0\u666e\u901a\u67e5\u8be2\u548c\u5176\u4ed6\u7c7b\u578b\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\\if \u548c \\elif \u8bfb\u53d6\u53c2\u6570\u5e76\u5c06\u5176\u4f5c\u4e3a\u5e03\u5c14\u8868\u8fbe\u5f0f\u6c42\u503c\u3002\u7ed3\u679c\u4e3a\u771f\u65f6\u7ee7\u7eed\u6b63\u5e38\u5904\u7406\uff0c\u5426\u5219\u8df3\u8fc7\u540e\u7eed\u884c\uff0c\u76f4\u5230\u9047\u5230\u5339\u914d\u7684 \\elif\u3001\\else \u6216 \\endif\u3002\u67d0\u4e2a \\if \u6216 \\elif \u6761\u4ef6\u6210\u7acb\u540e\uff0c\u540c\u4e00\u5757\u4e2d\u540e\u7eed \\elif \u7684\u53c2\u6570\u4e0d\u518d\u6c42\u503c\uff0c\u76f4\u63a5\u89c6\u4e3a\u5047\u3002\u53ea\u6709\u4e4b\u524d\u5339\u914d\u7684 \\if \u548c \\elif \u5747\u672a\u6210\u7acb\uff0c\u624d\u5904\u7406 \\else \u540e\u7684\u884c\u3002</p>\n<p lang=\"zh\">\u4e0e\u5176\u4ed6\u53cd\u659c\u6760\u547d\u4ee4\u53c2\u6570\u4e00\u6837\uff0c\\if \u6216 \\elif \u7684\u8868\u8fbe\u5f0f\u53c2\u6570\u5148\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u548c\u53cd\u5f15\u53f7\u5c55\u5f00\uff0c\u7136\u540e\u50cf\u5f00\u5173\u9009\u9879\u53d8\u91cf\u4e00\u6837\u6c42\u503c\u3002\u6709\u6548\u503c\u4e3a true\u3001false\u30011\u30010\u3001on\u3001off\u3001yes\u3001no \u7684\u4efb\u610f\u65e0\u6b67\u4e49\u3001\u4e0d\u533a\u5206\u5927\u5c0f\u5199\u7684\u5339\u914d\u3002\u4f8b\u5982 t\u3001T \u548c tR \u90fd\u4f1a\u89c6\u4e3a\u771f\u3002</p>\n<p lang=\"zh\">\u4e0d\u80fd\u6b63\u786e\u6c42\u503c\u4e3a\u771f\u6216\u5047\u7684\u8868\u8fbe\u5f0f\u4f1a\u4ea7\u751f\u8b66\u544a\uff0c\u5e76\u88ab\u89c6\u4e3a\u5047\u3002</p>\n<p lang=\"zh\">\u88ab\u8df3\u8fc7\u7684\u884c\u4f1a\u88ab\u6b63\u5e38\u89e3\u6790\u4ee5\u8bc6\u522b\u67e5\u8be2\u548c\u53cd\u659c\u7ebf\u547d\u4ee4\uff0c\u4f46\u67e5\u8be2\u4e0d\u4f1a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u4e14\u9664\u4e86\u6761\u4ef6\u547d\u4ee4\uff08<code class=\"command\">\\if</code>\u3001<code class=\"command\">\\elif</code>\u3001<code class=\"command\">\\else</code>\u3001<code class=\"command\">\\endif</code>\uff09\u4e4b\u5916\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u4f1a\u88ab\u5ffd\u7565\u3002\u4ec5\u68c0\u67e5\u8df3\u8fc7\u884c\u4e2d\u6761\u4ef6\u547d\u4ee4\u7684\u6709\u6548\u5d4c\u5957\u3002\u8df3\u8fc7\u884c\u4e2d\u7684\u53d8\u91cf\u5f15\u7528\u4e0d\u4f1a\u88ab\u5c55\u5f00\uff0c\u4e5f\u4e0d\u4f1a\u6267\u884c\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<p lang=\"zh\">\u540c\u4e00\u4e2a\u6761\u4ef6\u5757\u7684\u6240\u6709\u53cd\u659c\u7ebf\u547d\u4ee4\u5fc5\u987b\u51fa\u73b0\u5728\u540c\u4e00\u4e2a\u6e90\u6587\u4ef6\u4e2d\u3002\u5982\u679c\u4e3b\u8f93\u5165\u6587\u4ef6\u6216\u901a\u8fc7<code class=\"command\">\\include</code>\u5f15\u5165\u7684\u6587\u4ef6\u5230\u8fbe EOF \u65f6\uff0c\u4ecd\u6709\u672c\u5730<code class=\"command\">\\if</code>\u5757\u672a\u5173\u95ed\uff0c<span class=\"application\">psql</span>\u5c31\u4f1a\u62a5\u9519\u3002</p>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4e00\u4e2a\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">-- check for the existence of two separate records in the database and store\n-- the results in separate psql variables\nSELECT\n    EXISTS (SELECT 1 FROM customer WHERE customer_id = 123) AS is_customer,\n    EXISTS (SELECT 1 FROM employee WHERE employee_id = 456) AS is_employee\n\\gset\n\\if :is_customer\n    SELECT * FROM customer WHERE customer_id = 123;\n\\elif :is_employee\n    \\echo 'is not a customer but is an employee'\n    SELECT * FROM employee WHERE employee_id = 456;\n\\else\n    \\if yes\n        \\echo 'not a customer or employee'\n    \\else\n        \\echo 'this will never print'\n    \\endif\n\\endif\n</pre>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-INCLUDE-RELATIVE\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\ir</code> \u6216 <code class=\"literal\">\\include_relative</code> <em class=\"replaceable\"><code>filename</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"literal\">\\ir</code>\u547d\u4ee4\u4e0e<code class=\"literal\">\\i</code>\u76f8\u4f3c\uff0c\u4f46\u89e3\u6790\u76f8\u5bf9\u6587\u4ef6\u540d\u7684\u65b9\u5f0f\u4e0d\u540c\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\u6267\u884c\u65f6\uff0c\u8fd9\u4e24\u4e2a\u547d\u4ee4\u7684\u884c\u4e3a\u76f8\u540c\u3002\u4e0d\u8fc7\uff0c\u5728\u811a\u672c\u4e2d\u8c03\u7528\u65f6\uff0c<code class=\"literal\">\\ir</code>\u4f1a\u76f8\u5bf9\u4e8e\u811a\u672c\u6240\u5728\u7684\u76ee\u5f55\u6765\u89e3\u91ca\u6587\u4ef6\u540d\uff0c\u800c\u4e0d\u662f\u76f8\u5bf9\u4e8e\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-LIST\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\l[x+]</code>\u6216<code class=\"literal\">\\list[x+] [ <a class=\"link\" href=\"/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"\u6a21\u5f0f\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u670d\u52a1\u5668\u4e2d\u7684\u6570\u636e\u5e93\uff0c\u5e76\u663e\u793a\u5176\u540d\u79f0\u3001\u6240\u6709\u8005\u3001\u5b57\u7b26\u96c6\u7f16\u7801\u548c\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6570\u636e\u5e93\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u8fd8\u4f1a\u663e\u793a\u6570\u636e\u5e93\u5927\u5c0f\u3001\u9ed8\u8ba4\u8868\u7a7a\u95f4\u548c\u63cf\u8ff0\u3002\u5f53\u524d\u7528\u6237\u5bf9\u5176\u62e5\u6709 <code class=\"literal\">CONNECT</code> \u6743\u9650\u7684\u6570\u636e\u5e93\u53ef\u4ee5\u663e\u793a\u5927\u5c0f\u4fe1\u606f\uff1b\u5982\u679c\u5f53\u524d\u7528\u6237\u662f\u8d85\u7ea7\u7528\u6237\u6216\u5177\u6709 <code class=\"literal\">pg_read_all_stats</code> \u89d2\u8272\u7684\u6743\u9650\uff0c\u4e5f\u53ef\u4ee5\u663e\u793a\u5927\u5c0f\u4fe1\u606f\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-LO-EXPORT\"><span class=\"term\"><code class=\"literal\">\\lo_export <em class=\"replaceable\"><code>loid</code></em> <em class=\"replaceable\"><code>filename</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6570\u636e\u5e93\u4e2d\u8bfb\u53d6\u5177\u6709<acronym class=\"acronym\">OID</acronym><em class=\"replaceable\"><code>loid</code></em>\u7684\u5927\u5bf9\u8c61\uff0c\u5e76\u5c06\u5176\u5199\u5165<em class=\"replaceable\"><code>filename</code></em>\u3002\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e0e\u670d\u52a1\u5668\u51fd\u6570 <code class=\"function\">lo_export</code>\u7565\u6709\u4e0d\u540c\uff0c\u540e\u8005\u4f7f\u7528\u8fd0\u884c\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7528\u6237\u7684\u6743\u9650\uff0c\u5e76\u5728\u670d\u52a1\u5668\u7684\u6587\u4ef6\u7cfb\u7edf\u4e0a\u64cd\u4f5c\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u4f7f\u7528 \\lo_list \u67e5\u627e\u5927\u5bf9\u8c61\u7684 OID\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-LO-IMPORT\"><span class=\"term\"><code class=\"literal\">\\lo_import <em class=\"replaceable\"><code>filename</code></em> [ <em class=\"replaceable\"><code>comment</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6587\u4ef6\u5b58\u50a8\u5230\u4e00\u4e2a<span class=\"productname\">PostgreSQL</span>\u5927\u5bf9\u8c61\u4e2d\u3002\u53ef\u9009\u5730\uff0c\u5b83\u5c06\u7ed9\u5b9a\u7684\u6ce8\u91ca\u4e0e\u5bf9\u8c61\u5173\u8054\u8d77\u6765\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">foo=&gt; <strong class=\"userinput\"><code>\\lo_import '/home/peter/pictures/photo.xcf' 'a picture of me'</code></strong>\nlo_import 152801\n</pre>\n<p lang=\"zh\">\u54cd\u5e94\u8868\u660e\u5927\u5bf9\u8c61\u83b7\u5f97\u4e86\u5bf9\u8c61 ID 152801\uff0c\u8fd9\u4e2a ID \u53ef\u4ee5\u7528\u6765\u5728\u5c06\u6765\u8bbf\u95ee\u65b0\u521b\u5efa\u7684\u5927\u5bf9\u8c61\u3002\u4e3a\u4fbf\u4e8e\u9605\u8bfb\uff0c\u5efa\u8bae\u59cb\u7ec8\u4e3a\u6bcf\u4e2a\u5bf9\u8c61\u5173\u8054\u4e00\u6761\u4fbf\u4e8e\u4eba\u9605\u8bfb\u7684\u6ce8\u91ca\u3002\u67e5\u770b OID \u548c\u6ce8\u91ca\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528<code class=\"command\">\\lo_list</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u6b64\u547d\u4ee4\u4e0e\u670d\u52a1\u5668\u7aef\u7684<code class=\"function\">lo_import</code>\u7565\u6709\u4e0d\u540c\uff0c\u56e0\u4e3a\u5b83\u4f5c\u4e3a\u672c\u5730\u7528\u6237\u5728\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e0a\u64cd\u4f5c\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\u7684\u7528\u6237\u548c\u6587\u4ef6\u7cfb\u7edf\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-LO-LIST\"><span class=\"term\"><code class=\"literal\">\\lo_list[x+]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5f53\u524d\u5b58\u50a8\u5728\u6570\u636e\u5e93\u4e2d\u7684\u5168\u90e8 <span class=\"productname\">PostgreSQL</span> \u5927\u5bf9\u8c61\u5217\u8868\uff0c\u4ee5\u53ca\u4e3a\u5b83\u4eec\u63d0\u4f9b\u7684\u4efb\u4f55\u6ce8\u91ca\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u5217\u51fa\u6bcf\u4e2a\u5927\u5bf9\u8c61\u7684\u76f8\u5173\u6743\u9650\uff08\u5982\u679c\u6709\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-LO-UNLINK\"><span class=\"term\"><code class=\"literal\">\\lo_unlink <em class=\"replaceable\"><code>loid</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6570\u636e\u5e93\u4e2d\u5220\u9664<acronym class=\"acronym\">OID</acronym> \u4e3a <em class=\"replaceable\"><code>loid</code></em>\u7684\u5927\u5bf9\u8c61\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u4f7f\u7528 \\lo_list \u67e5\u627e\u5927\u5bf9\u8c61\u7684 OID\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-OUT\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\o</code> \u6216 <code class=\"literal\">\\out [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\o</code> \u6216 <code class=\"literal\">\\out [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u540e\u7eed\u67e5\u8be2\u7ed3\u679c\u4fdd\u5b58\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9 shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002\u5982\u679c\u6ca1\u6709\u6307\u5b9a\u53c2\u6570\uff0c\u67e5\u8be2\u8f93\u51fa\u5c06\u6062\u590d\u4e3a\u6807\u51c6\u8f93\u51fa\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\uff0c\u5219\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u7684\u5185\u5bb9\u53ea\u4f1a\u539f\u6837\u4f20\u9012\u7ed9 shell\u3002</p>\n<p lang=\"zh\"><span class=\"quote\">\u201c<span class=\"quote\">\u67e5\u8be2\u7ed3\u679c</span>\u201d</span>\u5305\u62ec\u4ece\u6570\u636e\u5e93\u670d\u52a1\u5668\u83b7\u53d6\u7684\u6240\u6709\u8868\u683c\u3001\u547d\u4ee4\u54cd\u5e94\u548c\u901a\u77e5\uff0c\u4ee5\u53ca\u67e5\u8be2\u6570\u636e\u5e93\u7684\u5404\u79cd\u53cd\u659c\u7ebf\u547d\u4ee4\u7684\u8f93\u51fa\uff08\u4f8b\u5982<code class=\"command\">\\d</code>\uff09\uff1b\u4f46\u4e0d\u5305\u62ec\u9519\u8bef\u6d88\u606f\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8981\u5728\u67e5\u8be2\u7ed3\u679c\u4e4b\u95f4\u63d2\u5165\u6587\u672c\u8f93\u51fa\uff0c\u4f7f\u7528<code class=\"command\">\\qecho</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PRINT\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\p</code>\u6216<code class=\"literal\">\\print</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\u3002\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6253\u5370\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PARSE\"><span class=\"term\"><code class=\"literal\">\\parse <em class=\"replaceable\"><code>statement_name</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u57fa\u4e8e\u76ee\u6807\u9884\u5907\u8bed\u53e5\u5bf9\u8c61\u7684\u540d\u79f0\uff0c\u4ece\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u521b\u5efa\u4e00\u4e2a\u9884\u5907\u8bed\u53e5\u3002\u7a7a\u5b57\u7b26\u4e32\u8868\u793a\u672a\u547d\u540d\u7684\u9884\u5907\u8bed\u53e5\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">SELECT $1 \\parse stmt1\n</pre>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4f1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\uff0c\u4e0d\u540c\u4e8e<span class=\"application\">psql</span>\u901a\u5e38\u4f7f\u7528\u7684\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002\u8be5\u547d\u4ee4\u4f1a\u53d1\u51fa\u4e00\u6761<a class=\"xref\" href=\"/docs/devel/protocol-message-formats.html#PROTOCOL-MESSAGE-FORMATS-PARSE\">Parse (F)</a>\u6d88\u606f\uff0c\u56e0\u6b64\u53ef\u7528\u4e8e\u5728<span class=\"application\">psql</span>\u4e2d\u6d4b\u8bd5\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002\u6b64\u547d\u4ee4\u53ea\u5f71\u54cd\u4e0b\u4e00\u6761\u88ab\u6267\u884c\u7684\u67e5\u8be2\uff1b\u4e4b\u540e\u7684\u6240\u6709\u67e5\u8be2\u9ed8\u8ba4\u4ecd\u4f1a\u4f7f\u7528\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PASSWORD\"><span class=\"term\"><code class=\"literal\">\\password [ <em class=\"replaceable\"><code>username</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u66f4\u6539\u6307\u5b9a\u7528\u6237\uff08\u9ed8\u8ba4\u4e3a\u5f53\u524d\u7528\u6237\uff09\u7684\u5bc6\u7801\u3002\u6b64\u547d\u4ee4\u63d0\u793a\u8f93\u5165\u65b0\u5bc6\u7801\uff0c\u5bf9\u5176\u8fdb\u884c\u52a0\u5bc6\uff0c\u5e76\u5c06\u5176\u4f5c\u4e3a<code class=\"command\">ALTER ROLE</code>\u547d\u4ee4\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u65b0\u5bc6\u7801\u4e0d\u4f1a\u4ee5\u660e\u6587\u5f62\u5f0f\u51fa\u73b0\u5728\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\u3001\u670d\u52a1\u5668\u65e5\u5fd7\u6216\u5176\u4ed6\u5730\u65b9\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PROMPT\"><span class=\"term\"><code class=\"literal\">\\prompt [ <em class=\"replaceable\"><code>text</code></em> ] <em class=\"replaceable\"><code>name</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u63d0\u793a\u7528\u6237\u63d0\u4f9b\u6587\u672c\uff0c\u5c06\u5176\u8d4b\u503c\u7ed9\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u3002\u53ef\u4ee5\u6307\u5b9a\u4e00\u4e2a\u53ef\u9009\u7684\u63d0\u793a\u5b57\u7b26\u4e32<em class=\"replaceable\"><code>text</code></em>\u3002\uff08\u5bf9\u4e8e\u591a\u4e2a\u5355\u8bcd\u7684\u63d0\u793a\uff0c\u7528\u5355\u5f15\u53f7\u62ec\u8d77\u6587\u672c\u3002\uff09</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"literal\">\\prompt</code> \u4f7f\u7528\u7ec8\u7aef\u8fdb\u884c\u8f93\u5165\u548c\u8f93\u51fa\u3002\u7136\u800c\uff0c\u5982\u679c\u4f7f\u7528\u4e86 <code class=\"option\">-f</code> \u547d\u4ee4\u884c\u5f00\u5173\uff0c<code class=\"literal\">\\prompt</code> \u5c06\u4f7f\u7528\u6807\u51c6\u8f93\u5165\u548c\u6807\u51c6\u8f93\u51fa\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET\"><span class=\"term\"><code class=\"literal\">\\pset [ <em class=\"replaceable\"><code>option</code></em> [ <em class=\"replaceable\"><code>value</code></em> ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u8bbe\u7f6e\u5f71\u54cd\u67e5\u8be2\u7ed3\u679c\u8868\u8f93\u51fa\u7684\u9009\u9879\u3002<em class=\"replaceable\"><code>option</code></em>\u6307\u5b9a\u8981\u8bbe\u7f6e\u54ea\u4e2a\u9009\u9879\u3002<em class=\"replaceable\"><code>value</code></em>\u7684\u542b\u4e49\u53d6\u51b3\u4e8e\u6240\u9009\u7684\u9009\u9879\u3002\u5bf9\u4e8e\u67d0\u4e9b\u9009\u9879\uff0c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\u4f1a\u5207\u6362\u6216\u53d6\u6d88\u8bbe\u7f6e\u8be5\u9009\u9879\uff0c\u5177\u4f53\u89c1\u5404\u9009\u9879\u7684\u8bf4\u660e\u3002\u5982\u679c\u6ca1\u6709\u63d0\u53ca\u8fd9\u7c7b\u884c\u4e3a\uff0c\u90a3\u4e48\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\u53ea\u4f1a\u663e\u793a\u5f53\u524d\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\">\u4e0d\u5e26\u4efb\u4f55\u53c2\u6570\u7684<code class=\"command\">\\pset</code>\u4f1a\u663e\u793a\u6240\u6709\u6253\u5370\u9009\u9879\u7684\u5f53\u524d\u72b6\u6001\u3002</p>\n<p lang=\"zh\">\u53ef\u8c03\u6574\u6253\u5370\u9009\u9879\u6709\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-META-COMMAND-PSET-BORDER\"><span class=\"term\"><code class=\"literal\">border</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><em class=\"replaceable\"><code>value</code></em>\u5fc5\u987b\u662f\u6570\u5b57\u3002\u4e00\u822c\u6765\u8bf4\uff0c\u6570\u5b57\u8d8a\u5927\uff0c\u8868\u683c\u7684\u8fb9\u6846\u548c\u5206\u9694\u7ebf\u5c31\u8d8a\u591a\uff0c\u4f46\u7ec6\u8282\u53d6\u51b3\u4e8e\u5177\u4f53\u683c\u5f0f\u3002\u5728<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u4e2d\uff0c\u5b83\u4f1a\u76f4\u63a5\u8f6c\u6362\u4e3a<code class=\"literal\">border=...</code>\u5c5e\u6027\u3002\u5728\u5927\u591a\u6570\u5176\u4ed6\u683c\u5f0f\u4e2d\uff0c\u53ea\u6709\u503c 0\uff08\u65e0\u8fb9\u6846\uff09\u30011\uff08\u5185\u90e8\u5206\u9694\u7ebf\uff09\u548c 2\uff08\u8868\u683c\u5916\u6846\uff09\u6709\u610f\u4e49\uff0c\u5927\u4e8e 2 \u7684\u503c\u4f1a\u4e0e<code class=\"literal\">border = 2</code>\u4f5c\u76f8\u540c\u5904\u7406\u3002<code class=\"literal\">latex</code>\u548c<code class=\"literal\">latex-longtable</code>\u683c\u5f0f\u8fd8\u5141\u8bb8\u4f7f\u7528\u503c 3\uff0c\u4ee5\u5728\u6570\u636e\u884c\u4e4b\u95f4\u6dfb\u52a0\u5206\u9694\u7ebf\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-COLUMNS\" lang=\"zh\"><em>\u5217</em></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u76ee\u6807\u5bbd\u5ea6\uff0c\u540c\u65f6\u4e5f\u662f\u786e\u5b9a\u8f93\u51fa\u662f\u5426\u8db3\u591f\u5bbd\u4ee5\u9700\u8981\u5206\u9875\u5668\u6216\u5728\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e0b\u5207\u6362\u5230\u5782\u76f4\u663e\u793a\u7684\u5bbd\u5ea6\u9650\u5236\u3002\u96f6\uff08\u9ed8\u8ba4\u503c\uff09\u4f1a\u5bfc\u81f4\u76ee\u6807\u5bbd\u5ea6\u7531\u73af\u5883\u53d8\u91cf<code class=\"envar\">COLUMNS</code>\u63a7\u5236\uff0c\u6216\u8005\u5982\u679c\u672a\u8bbe\u7f6e <code class=\"envar\">COLUMNS</code>\u5219\u7531\u68c0\u6d4b\u5230\u7684\u5c4f\u5e55\u5bbd\u5ea6\u63a7\u5236\u3002\u53e6\u5916\uff0c\u5982\u679c<code class=\"literal\">columns</code>\u4e3a\u96f6\uff0c\u5219<code class=\"literal\">wrapped</code>\u683c\u5f0f\u4ec5\u5f71\u54cd\u5c4f\u5e55\u8f93\u51fa\u3002\u5982\u679c<code class=\"literal\">columns</code>\u4e3a\u975e\u96f6\uff0c\u5219\u6587\u4ef6\u548c\u7ba1\u9053\u8f93\u51fa\u4e5f\u4f1a\u6309\u8be5\u5bbd\u5ea6\u6298\u884c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-CSV-FIELDSEP\"><span class=\"term\"><code class=\"literal\">csv_fieldsep</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728<acronym class=\"acronym\">CSV</acronym>\u8f93\u51fa\u683c\u5f0f\u4e2d\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u5982\u679c\u5206\u9694\u7b26\u5b57\u7b26\u51fa\u73b0\u5728\u5b57\u6bb5\u7684\u503c\u4e2d\uff0c\u5219\u8be5\u5b57\u6bb5\u5c06\u6839\u636e\u6807\u51c6<acronym class=\"acronym\">CSV</acronym>\u89c4\u5219\u5728\u53cc\u5f15\u53f7\u5185\u8f93\u51fa\u3002\u9ed8\u8ba4\u503c\u662f\u9017\u53f7\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-DISPLAY-FALSE\"><span class=\"term\"><code class=\"literal\">display_false</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u66ff\u4ee3\u5047\u503c\u6253\u5370\u7684\u5b57\u7b26\u4e32\u3002\u9ed8\u8ba4\u6253\u5370 <code class=\"literal\">f</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-DISPLAY-TRUE\"><span class=\"term\"><code class=\"literal\">display_true</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u66ff\u4ee3\u771f\u503c\u6253\u5370\u7684\u5b57\u7b26\u4e32\u3002\u9ed8\u8ba4\u6253\u5370 <code class=\"literal\">t</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-EXPANDED\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">expanded</code>\uff08\u6216<code class=\"literal\">x</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff08\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u6269\u5c55\u6a21\u5f0f\uff09\uff0c\u6216\u8005\u662f<code class=\"literal\">auto</code>\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5f00\u542f\u548c\u5173\u95ed\u8bbe\u7f6e\u4e4b\u95f4\u5207\u6362\u3002\u542f\u7528\u6269\u5c55\u6a21\u5f0f\u65f6\uff0c\u67e5\u8be2\u7ed3\u679c\u4ee5\u4e24\u5217\u663e\u793a\uff0c\u5de6\u4fa7\u4e3a\u5217\u540d\uff0c\u53f3\u4fa7\u4e3a\u6570\u636e\u3002\u5982\u679c\u6570\u636e\u5728\u901a\u5e38\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u6a2a\u5411</span>\u201d</span>\u6a21\u5f0f\u4e0b\u65e0\u6cd5\u9002\u5e94\u5c4f\u5e55\uff0c\u8fd9\u79cd\u6a21\u5f0f\u5c31\u5f88\u6709\u7528\u3002\u5728\u81ea\u52a8\u8bbe\u7f6e\u4e0b\uff0c\u5f53\u67e5\u8be2\u8f93\u51fa\u5305\u542b\u591a\u5217\u4e14\u5bbd\u5ea6\u8d85\u8fc7\u5c4f\u5e55\u65f6\uff0c\u4f1a\u4f7f\u7528\u6269\u5c55\u6a21\u5f0f\uff1b\u5426\u5219\u4f7f\u7528\u5e38\u89c4\u6a21\u5f0f\u3002\u81ea\u52a8\u8bbe\u7f6e\u53ea\u5728\u5bf9\u9f50\u548c\u6298\u884c\u683c\u5f0f\u4e2d\u6709\u6548\u3002\u5728\u5176\u4ed6\u683c\u5f0f\u4e2d\uff0c\u5b83\u7684\u884c\u4e3a\u59cb\u7ec8\u4e0e\u5173\u95ed\u6269\u5c55\u6a21\u5f0f\u76f8\u540c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-FIELDSEP\"><span class=\"term\"><code class=\"literal\">fieldsep</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u6837\u53ef\u4ee5\u521b\u5efa\u4f8b\u5982\u5236\u8868\u7b26\u5206\u9694\u7684\u8f93\u51fa\uff0c\u8fd9\u53ef\u80fd\u66f4\u7b26\u5408\u5176\u4ed6\u7a0b\u5e8f\u7684\u9700\u8981\u3002\u8981\u5c06\u5236\u8868\u7b26\u8bbe\u7f6e\u4e3a\u5b57\u6bb5\u5206\u9694\u7b26\uff0c\u8bf7\u8f93\u5165<code class=\"literal\">\\pset fieldsep '\\t'</code>\u3002\u9ed8\u8ba4\u5b57\u6bb5\u5206\u9694\u7b26\u662f<code class=\"literal\">'|'</code>\uff08\u7ad6\u7ebf\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-FIELDSEP-ZERO\"><span class=\"term\"><code class=\"literal\">fieldsep_zero</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u8bbe\u7f6e\u4e3a\u96f6\u5b57\u8282\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-FOOTER\"><span class=\"term\"><code class=\"literal\">footer</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u8868\u683c\u9875\u811a\uff08<code class=\"literal\">(<em class=\"replaceable\"><code>n</code></em> rows)</code>\u8ba1\u6570\uff09\u7684\u663e\u793a\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5207\u6362\u9875\u811a\u663e\u793a\u7684\u5f00\u5173\u72b6\u6001\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-FORMAT\"><span class=\"term\"><code class=\"literal\">format</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a<code class=\"literal\">aligned</code>\u3001<code class=\"literal\">asciidoc</code>\u3001<code class=\"literal\">csv</code>\u3001<code class=\"literal\">html</code>\u3001<code class=\"literal\">latex</code>\u3001<code class=\"literal\">latex-longtable</code>\u3001<code class=\"literal\">troff-ms</code>\u3001<code class=\"literal\">unaligned</code>\u6216<code class=\"literal\">wrapped</code>\u3002\u5141\u8bb8\u4f7f\u7528\u552f\u4e00\u7f29\u5199\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">aligned</code>\u683c\u5f0f\u662f\u6807\u51c6\u7684\u3001\u9002\u5408\u4eba\u9605\u8bfb\u4e14\u6392\u7248\u6574\u9f50\u7684\u6587\u672c\u8f93\u51fa\uff1b\u8fd9\u662f\u9ed8\u8ba4\u683c\u5f0f\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">unaligned</code>\u683c\u5f0f\u5c06\u4e00\u884c\u4e2d\u7684\u6240\u6709\u5217\u5199\u5728\u4e00\u884c\u4e0a\uff0c\u7531\u5f53\u524d\u6d3b\u52a8\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u5206\u9694\u3002\u8fd9\u5bf9\u4e8e\u521b\u5efa\u53ef\u80fd\u88ab\u5176\u4ed6\u7a0b\u5e8f\u8bfb\u53d6\u7684\u8f93\u51fa\u5f88\u6709\u7528\uff0c\u4f8b\u5982\uff0c\u5236\u8868\u7b26\u5206\u9694\u6216\u9017\u53f7\u5206\u9694\u683c\u5f0f\u3002\u7136\u800c\uff0c\u5982\u679c\u5b57\u6bb5\u5206\u9694\u7b26\u5b57\u7b26\u51fa\u73b0\u5728\u5217\u7684\u503c\u4e2d\uff0c\u5219\u4e0d\u4f1a\u88ab\u7279\u6b8a\u5904\u7406\uff1b\u56e0\u6b64\uff0c<acronym class=\"acronym\">CSV</acronym>\u683c\u5f0f\u53ef\u80fd\u66f4\u9002\u5408\u8fd9\u4e9b\u76ee\u7684\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">csv</code>\u683c\u5f0f<a class=\"indexterm\" id=\"id-1.9.4.21.8.4.11.1.81.2.3.1.10.2.4.2\" name=\"id-1.9.4.21.8.4.11.1.81.2.3.1.10.2.4.2\"></a>\u6309\u9017\u53f7\u5206\u9694\u7684\u5217\u503c\u8f93\u51fa\uff0c\u5e76\u5e94\u7528 <a class=\"ulink\" href=\"https://datatracker.ietf.org/doc/html/rfc4180\" target=\"_top\">RFC 4180</a> \u4e2d\u63cf\u8ff0\u7684\u52a0\u5f15\u53f7\u89c4\u5219\u3002\u6b64\u8f93\u51fa\u4e0e\u670d\u52a1\u5668\u7684CSV\u683c\u5f0f\u7684 <code class=\"command\">COPY</code>\u547d\u4ee4\u517c\u5bb9\u3002\u751f\u6210\u5305\u542b\u5217\u540d\u7684\u8868\u5934\u884c\uff0c\u9664\u975e <code class=\"literal\">tuples_only</code>\u53c2\u6570\u8bbe\u7f6e\u4e3a <code class=\"literal\">on</code>\u3002\u4e0d\u6253\u5370\u8868\u683c\u6807\u9898\u548c\u9875\u811a\u3002\u6bcf\u884c\u4ee5\u7cfb\u7edf\u76f8\u5173\u7684\u884c\u7ed3\u675f\u5b57\u7b26\u7ed3\u675f\uff0c\u5bf9\u4e8e\u7c7bUnix\u7cfb\u7edf\u901a\u5e38\u662f\u5355\u4e2a\u6362\u884c\u7b26\uff08<code class=\"literal\">\\n</code>\uff09\uff0c\u5bf9\u4e8eMicrosoft Windows\u5219\u662f\u56de\u8f66\u548c\u6362\u884c\u5e8f\u5217\uff08<code class=\"literal\">\\r\\n</code>\uff09\u3002\u53ef\u4ee5\u7528<code class=\"command\">\\pset csv_fieldsep</code>\u9009\u62e9\u9017\u53f7\u4ee5\u5916\u7684\u5b57\u6bb5\u5206\u9694\u5b57\u7b26\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">wrapped</code>\u683c\u5f0f\u4e0e<code class=\"literal\">aligned</code>\u76f8\u4f3c\uff0c\u4f46\u4f1a\u5c06\u8f83\u5bbd\u7684\u6570\u636e\u503c\u6298\u6210\u591a\u884c\uff0c\u4f7f\u8f93\u51fa\u9002\u5e94\u76ee\u6807\u5217\u5bbd\u3002\u76ee\u6807\u5bbd\u5ea6\u7684\u786e\u5b9a\u65b9\u5f0f\u89c1<code class=\"literal\">columns</code>\u9009\u9879\u7684\u8bf4\u660e\u3002\u8bf7\u6ce8\u610f\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u5c1d\u8bd5\u5bf9\u5217\u6807\u9898\u6298\u884c\uff1b\u56e0\u6b64\uff0c\u5982\u679c\u5217\u6807\u9898\u6240\u9700\u7684\u603b\u5bbd\u5ea6\u8d85\u8fc7\u76ee\u6807\u5bbd\u5ea6\uff0c<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u884c\u4e3a\u5c31\u4e0e<code class=\"literal\">aligned</code>\u76f8\u540c\u3002</p>\n<p lang=\"zh\">asciidoc\u3001html\u3001latex\u3001latex-longtable \u548c troff-ms \u683c\u5f0f\u8f93\u51fa\u7684\u662f\u53ef\u5d4c\u5165\u76f8\u5e94\u6807\u8bb0\u8bed\u8a00\u6587\u6863\u7684\u8868\u683c\uff0c\u5e76\u975e\u5b8c\u6574\u6587\u6863\u3002HTML \u53ef\u80fd\u4e0d\u8981\u6c42\u5b8c\u6574\u5c01\u88c5\uff0c\u4f46 LaTeX \u5fc5\u987b\u6709\u5b8c\u6574\u6587\u6863\u7ed3\u6784\u3002latex \u4f7f\u7528 LaTeX \u7684 tabular \u73af\u5883\uff1blatex-longtable \u9700\u8981 LaTeX \u7684 longtable \u548c booktabs \u5b8f\u5305\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-LINESTYLE\"><span class=\"term\"><code class=\"literal\">linestyle</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u8fb9\u6846\u7ebf\u7ed8\u5236\u6837\u5f0f\u4e3a<code class=\"literal\">ascii</code>\u3001<code class=\"literal\">old-ascii</code>\u6216<code class=\"literal\">unicode</code>\u4e4b\u4e00\u3002\u5141\u8bb8\u4f7f\u7528\u552f\u4e00\u7f29\u5199\u3002\uff08\u8fd9\u610f\u5473\u7740\u4e00\u4e2a\u5b57\u6bcd\u5c31\u8db3\u591f\u4e86\u3002\uff09\u9ed8\u8ba4\u8bbe\u7f6e\u4e3a<code class=\"literal\">ascii</code>\u3002\u6b64\u9009\u9879\u4ec5\u5f71\u54cd<code class=\"literal\">aligned</code>\u548c<code class=\"literal\">wrapped</code>\u8f93\u51fa\u683c\u5f0f\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">ascii</code>\u6837\u5f0f\u4f7f\u7528\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u53f3\u8fb9\u7f18\u7684<code class=\"literal\">+</code>\u7b26\u53f7\u8868\u793a\u3002\u5f53<code class=\"literal\">wrapped</code>\u683c\u5f0f\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u628a\u6570\u636e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u4f1a\u5728\u7b2c\u4e00\u884c\u7684\u53f3\u8fb9\u7f18\u663e\u793a\u4e00\u4e2a\u70b9\uff08<code class=\"literal\">.</code>\uff09\uff0c\u5e76\u5728\u4e0b\u4e00\u884c\u7684\u5de6\u8fb9\u7f18\u518d\u6b21\u663e\u793a\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">old-ascii</code>\u6837\u5f0f\u4f7f\u7528\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\uff0c\u91c7\u7528<span class=\"productname\">PostgreSQL</span> 8.4 \u53ca\u66f4\u65e9\u7248\u672c\u7684\u683c\u5f0f\u6837\u5f0f\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u66ff\u4ee3\u5de6\u4fa7\u5217\u5206\u9694\u7b26\u7684<code class=\"literal\">:</code>\u7b26\u53f7\u8868\u793a\u3002\u5f53\u6570\u636e\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u5219\u7528<code class=\"literal\">;</code>\u7b26\u53f7\u66ff\u4ee3\u5de6\u4fa7\u5217\u5206\u9694\u7b26\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">unicode</code>\u6837\u5f0f\u4f7f\u7528 Unicode \u6846\u7ebf\u7ed8\u5236\u5b57\u7b26\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u53f3\u8fb9\u7f18\u7684\u56de\u8f66\u7b26\u53f7\u8868\u793a\u3002\u5f53\u6570\u636e\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u4f1a\u5728\u7b2c\u4e00\u884c\u7684\u53f3\u8fb9\u7f18\u663e\u793a\u7701\u7565\u53f7\u7b26\u53f7\uff0c\u5e76\u5728\u4e0b\u4e00\u884c\u7684\u5de6\u8fb9\u7f18\u518d\u6b21\u663e\u793a\u3002</p>\n<p lang=\"zh\">\u5f53<code class=\"literal\">border</code>\u8bbe\u7f6e\u5927\u4e8e\u96f6\u65f6\uff0c<code class=\"literal\">linestyle</code>\u9009\u9879\u8fd8\u51b3\u5b9a\u7528\u54ea\u4e9b\u5b57\u7b26\u7ed8\u5236\u8fb9\u6846\u7ebf\u3002\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\u5728\u4efb\u4f55\u73af\u5883\u4e2d\u90fd\u53ef\u7528\uff0c\u4f46\u5728\u652f\u6301 Unicode \u7684\u663e\u793a\u8bbe\u5907\u4e0a\uff0cUnicode \u5b57\u7b26\u66f4\u7f8e\u89c2\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-NULL\"><span class=\"term\"><code class=\"literal\">null</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u7528\u4e8e\u4ee3\u66ff\u7a7a\u503c\u6253\u5370\u7684\u5b57\u7b26\u4e32\u3002\u9ed8\u8ba4\u4e0d\u6253\u5370\u4efb\u4f55\u5185\u5bb9\uff0c\u8fd9\u5f88\u5bb9\u6613\u88ab\u8bef\u8ba4\u4e3a\u7a7a\u5b57\u7b26\u4e32\u3002\u4f8b\u5982\uff0c\u4f60\u53ef\u80fd\u66f4\u559c\u6b22\u4f7f\u7528<code class=\"literal\">\\pset null '(null)'</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-NUMERICLOCALE\"><span class=\"term\"><code class=\"literal\">numericlocale</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u4f7f\u7528\u533a\u57df\u8bbe\u7f6e\u7279\u5b9a\u7684\u5b57\u7b26\u6765\u5206\u9694\u5c0f\u6570\u70b9\u5de6\u4fa7\u7684\u6570\u5b57\u7ec4\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5e38\u89c4\u6570\u5b57\u8f93\u51fa\u548c\u533a\u57df\u8bbe\u7f6e\u7279\u5b9a\u7684\u6570\u5b57\u8f93\u51fa\u4e4b\u95f4\u5207\u6362\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-PAGER\"><span class=\"term\"><code class=\"literal\">pager</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u63a7\u5236\u67e5\u8be2\u7ed3\u679c\u4e0e psql \u5e2e\u52a9\u8f93\u51fa\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\u7684\u65b9\u5f0f\u3002\u5f53 pager \u4e3a off \u65f6\uff0c\u4e0d\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\uff1b\u4e3a on \u65f6\uff0c\u5728\u9002\u5f53\u60c5\u51b5\u4e0b\u4f7f\u7528\uff0c\u5373\u8f93\u51fa\u76ee\u6807\u662f\u7ec8\u7aef\u4e14\u5185\u5bb9\u65e0\u6cd5\u5728\u5c4f\u5e55\u5185\u663e\u793a\u5b8c\u3002\u8bbe\u4e3a always \u65f6\uff0c\u6240\u6709\u7ec8\u7aef\u8f93\u51fa\u5747\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\uff0c\u65e0\u8bba\u662f\u5426\u80fd\u5728\u5c4f\u5e55\u5185\u663e\u793a\u5b8c\u3002\u4e0d\u5e26\u503c\u7684 \\pset pager \u4f1a\u5207\u6362\u5206\u9875\u7684\u5f00\u5173\u72b6\u6001\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u8bbe\u7f6e\u4e86\u73af\u5883\u53d8\u91cf<code class=\"envar\">PSQL_PAGER</code>\u6216<code class=\"envar\">PAGER</code>\uff0c\u9700\u8981\u5206\u9875\u7684\u8f93\u51fa\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6307\u5b9a\u7a0b\u5e8f\u3002\u5426\u5219\uff0c\u4f7f\u7528\u4e0e\u5e73\u53f0\u6709\u5173\u7684\u9ed8\u8ba4\u7a0b\u5e8f\uff08\u5982<code class=\"filename\">more</code>\uff09\u3002</p>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 <code class=\"literal\">\\watch</code> \u547d\u4ee4\u91cd\u590d\u6267\u884c\u67e5\u8be2\u65f6\uff0c\u5728 Unix \u7cfb\u7edf\u4e0a\u4f1a\u6539\u7528\u73af\u5883\u53d8\u91cf <code class=\"envar\">PSQL_WATCH_PAGER</code> \u6765\u67e5\u627e\u5206\u9875\u5668\u7a0b\u5e8f\u3002\u4e4b\u6240\u4ee5\u5355\u72ec\u914d\u7f6e\u5b83\uff0c\u662f\u56e0\u4e3a\u8fd9\u79cd\u7528\u6cd5\u53ef\u80fd\u4f1a\u8ba9\u4f20\u7edf\u5206\u9875\u5668\u65e0\u6cd5\u6b63\u5e38\u5de5\u4f5c\uff1b\u4f46\u5b83\u53ef\u7528\u4e8e\u628a\u8f93\u51fa\u53d1\u9001\u7ed9\u80fd\u591f\u7406\u89e3 <span class=\"application\">psql</span> \u8f93\u51fa\u683c\u5f0f\u7684\u5de5\u5177\uff08\u4f8b\u5982 <code class=\"filename\">pspg --stream</code>\uff09\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-PAGER-MIN-LINES\"><span class=\"term\"><code class=\"literal\">pager_min_lines</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u82e5 pager_min_lines \u5927\u4e8e\u5c4f\u5e55\u9875\u9ad8\uff0c\u53ea\u6709\u8f93\u51fa\u884c\u6570\u8fbe\u5230\u8be5\u503c\u65f6\u624d\u8c03\u7528\u5206\u9875\u7a0b\u5e8f\u3002\u9ed8\u8ba4\u503c\u4e3a 0\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-RECORDSEP\"><span class=\"term\"><code class=\"literal\">recordsep</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u8bb0\u5f55\uff08\u884c\uff09\u5206\u9694\u7b26\u3002\u9ed8\u8ba4\u4e3a\u6362\u884c\u7b26\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-RECORDSEP-ZERO\"><span class=\"term\"><code class=\"literal\">recordsep_zero</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u8bbe\u7f6e\u4e3a\u96f6\u5b57\u8282\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-TABLEATTR\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">tableattr</code>\uff08\u6216<code class=\"literal\">T</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\u5728<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u4e2d\uff0c\u8fd9\u6307\u5b9a\u8981\u653e\u5728<code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u5c5e\u6027\uff0c\u4f8b\u5982<code class=\"literal\">cellpadding</code>\u6216<code class=\"literal\">bgcolor</code>\u3002\u8bf7\u6ce8\u610f\uff0c\u4f60\u53ef\u80fd\u4e0d\u9700\u8981\u5728\u8fd9\u91cc\u6307\u5b9a<code class=\"literal\">border</code>\uff0c\u56e0\u4e3a<code class=\"literal\">\\pset border</code>\u5df2\u7ecf\u8d1f\u8d23\u5904\u7406\u5b83\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u8868\u683c\u5c5e\u6027\u3002</p>\n<p lang=\"zh\">\u5728<code class=\"literal\">latex-longtable</code>\u683c\u5f0f\u4e2d\uff0c\u8fd9\u63a7\u5236\u6bcf\u4e2a\u5305\u542b\u5de6\u5bf9\u9f50\u6570\u636e\u7c7b\u578b\u7684\u5217\u7684\u5bbd\u5ea6\u6bd4\u4f8b\u3002\u5b83\u4ee5\u7a7a\u767d\u5206\u9694\u7684\u503c\u5217\u8868\u6307\u5b9a\uff0c\u4f8b\u5982<code class=\"literal\">'0.2 0.2 0.6'</code>\u3002\u672a\u6307\u5b9a\u7684\u8f93\u51fa\u5217\u4f7f\u7528\u6700\u540e\u6307\u5b9a\u7684\u503c\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-TITLE\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">title</code>\uff08\u6216<code class=\"literal\">C</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u968f\u540e\u6253\u5370\u7684\u6240\u6709\u8868\u683c\u7684\u6807\u9898\u3002\u8fd9\u53ef\u4ee5\u4e3a\u8f93\u51fa\u63d0\u4f9b\u63cf\u8ff0\u6027\u6807\u7b7e\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u6807\u9898\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-TUPLES-ONLY\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">tuples_only</code>\uff08\u6216<code class=\"literal\">t</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u4ec5\u5143\u7ec4\u6a21\u5f0f\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5e38\u89c4\u8f93\u51fa\u548c\u4ec5\u5143\u7ec4\u8f93\u51fa\u4e4b\u95f4\u5207\u6362\u3002\u5e38\u89c4\u8f93\u51fa\u5305\u542b\u5217\u6807\u9898\u3001\u8868\u683c\u6807\u9898\u548c\u5404\u79cd\u9875\u811a\u7b49\u9644\u52a0\u4fe1\u606f\u3002\u5728\u4ec5\u5143\u7ec4\u6a21\u5f0f\u4e0b\uff0c\u53ea\u663e\u793a\u5b9e\u9645\u7684\u8868\u683c\u6570\u636e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-UNICODE-BORDER-LINESTYLE\"><span class=\"term\"><code class=\"literal\">unicode_border_linestyle</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u8fb9\u6846\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-UNICODE-COLUMN-LINESTYLE\"><span class=\"term\"><code class=\"literal\">unicode_column_linestyle</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u5217\u5206\u9694\u7ebf\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-UNICODE-HEADER-LINESTYLE\"><span class=\"term\"><code class=\"literal\">unicode_header_linestyle</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u8868\u5934\u5206\u9694\u7ebf\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-XHEADER-WIDTH\"><span class=\"term\"><code class=\"literal\">xheader_width</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6269\u5c55\u8f93\u51fa\u6807\u9898\u7684\u6700\u5927\u5bbd\u5ea6\u8bbe\u4e3a full\uff08\u9ed8\u8ba4\u503c\uff09\u3001column\u3001page \u6216\u4e00\u4e2a\u6574\u6570\u503c\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">full</code>\uff1a\u6269\u5c55\u8868\u5934\u4e0d\u622a\u65ad\uff0c\u5176\u5bbd\u5ea6\u4e0e\u6700\u5bbd\u7684\u8f93\u51fa\u884c\u76f8\u540c\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">column</code>\uff1a\u5c06\u8868\u5934\u884c\u622a\u65ad\u4e3a\u7b2c\u4e00\u5217\u7684\u5bbd\u5ea6\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">page</code>\uff1a\u5c06\u8868\u5934\u884c\u622a\u65ad\u4e3a\u7ec8\u7aef\u5bbd\u5ea6\u3002</p>\n<p lang=\"zh\">\u6574\u6570\u503c\uff1a\u7cbe\u786e\u6307\u5b9a\u6807\u9898\u884c\u7684\u6700\u5927\u5bbd\u5ea6\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8fd9\u4e9b\u4e0d\u540c\u683c\u5f0f\u7684\u5916\u89c2\u793a\u4f8b\u53ef\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/devel/app-psql.html#APP-PSQL-EXAMPLES\" title=\"\u793a\u4f8b\">\u793a\u4f8b</a>\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u6709\u5404\u79cd\u5feb\u6377\u547d\u4ee4\u7528\u4e8e<code class=\"command\">\\pset</code>\u3002\u8bf7\u53c2\u89c1<code class=\"command\">\\a</code>\u3001<code class=\"command\">\\C</code>\u3001<code class=\"command\">\\f</code>\u3001<code class=\"command\">\\H</code>\u3001<code class=\"command\">\\t</code>\u3001<code class=\"command\">\\T</code>\u548c<code class=\"command\">\\x</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-QUIT\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\q</code>\u6216<code class=\"literal\">\\quit</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9000\u51fa<span class=\"application\">psql</span>\u7a0b\u5e8f\u3002\u5728\u811a\u672c\u6587\u4ef6\u4e2d\uff0c\u53ea\u4f1a\u7ec8\u6b62\u8be5\u811a\u672c\u7684\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-QECHO\"><span class=\"term\"><code class=\"literal\">\\qecho <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u547d\u4ee4\u4e0e<code class=\"command\">\\echo</code>\u76f8\u540c\uff0c\u53ea\u662f\u8f93\u51fa\u4f1a\u5199\u5165\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u7684\u67e5\u8be2\u8f93\u51fa\u901a\u9053\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-RESET\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\r</code>\u6216<code class=\"literal\">\\reset</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u91cd\u7f6e\uff08\u6e05\u7a7a\uff09\u67e5\u8be2\u7f13\u51b2\u533a\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-RESTRICT\"><span class=\"term\"><code class=\"literal\">\\restrict <em class=\"replaceable\"><code>restrict_key</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528\u7ed9\u5b9a\u7684\u5bc6\u94a5\u8fdb\u5165<span class=\"quote\">\u201c<span class=\"quote\">\u53d7\u9650</span>\u201d</span>\u6a21\u5f0f\u3002\u5728\u8be5\u6a21\u5f0f\u4e0b\uff0c\u552f\u4e00\u5141\u8bb8\u7684\u5143\u547d\u4ee4\u662f\u7528\u4e8e\u9000\u51fa\u53d7\u9650\u6a21\u5f0f\u7684<code class=\"command\">\\unrestrict</code>\u3002\u5bc6\u94a5\u53ea\u80fd\u5305\u542b\u5b57\u6bcd\u6570\u5b57\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4e3b\u8981\u7528\u4e8e pg_dump\u3001pg_dumpall \u548c pg_restore \u751f\u6210\u7684\u7eaf\u6587\u672c\u8f6c\u50a8\uff0c\u4e5f\u53ef\u80fd\u9002\u7528\u4e8e\u5176\u4ed6\u573a\u666f\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-S\"><span class=\"term\"><code class=\"literal\">\\s [ <em class=\"replaceable\"><code>filename</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u5386\u53f2\u8bb0\u5f55\u5230<em class=\"replaceable\"><code>filename</code></em>\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5386\u53f2\u8bb0\u5f55\u5c06\u88ab\u5199\u5165\u6807\u51c6\u8f93\u51fa\uff08\u5982\u679c\u9002\u7528\uff0c\u5c06\u4f7f\u7528\u5206\u9875\u5668\uff09\u3002\u5982\u679c<span class=\"application\">psql</span>\u5728\u6784\u5efa\u65f6\u6ca1\u6709\u4f7f\u7528<span class=\"application\">Readline</span>\u652f\u6301\uff0c\u5219\u6b64\u547d\u4ee4\u4e0d\u53ef\u7528\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-SET\"><span class=\"term\"><code class=\"literal\">\\set [ <em class=\"replaceable\"><code>name</code></em> [ <em class=\"replaceable\"><code>value</code></em> [ ... ] ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e<span class=\"application\">psql</span>\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u4e3a<em class=\"replaceable\"><code>value</code></em>\uff0c\u5982\u679c\u7ed9\u51fa\u591a\u4e2a\u503c\uff0c\u5219\u8bbe\u7f6e\u4e3a\u6240\u6709\u503c\u7684\u8fde\u63a5\u3002\u5982\u679c\u53ea\u7ed9\u51fa\u4e00\u4e2a\u53c2\u6570\uff0c\u5219\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\u503c\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u8bbe\u7f6e\uff0c\u8bf7\u4f7f\u7528<code class=\"command\">\\unset</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\"><code class=\"command\">\\set</code>\u6ca1\u6709\u4efb\u4f55\u53c2\u6570\u65f6\uff0c\u663e\u793a\u5f53\u524d\u8bbe\u7f6e\u7684\u6240\u6709<span class=\"application\">psql</span>\u53d8\u91cf\u7684\u540d\u79f0\u548c\u503c\u3002</p>\n<p lang=\"zh\">\u6709\u6548\u7684\u53d8\u91cf\u540d\u53ef\u4ee5\u5305\u542b\u5b57\u6bcd\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u3002\u6709\u5173\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/devel/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002\u53d8\u91cf\u540d\u533a\u5206\u5927\u5c0f\u5199\u3002</p>\n<p lang=\"zh\">\u67d0\u4e9b\u53d8\u91cf\u662f\u7279\u6b8a\u7684\uff0c\u5b83\u4eec\u63a7\u5236<span class=\"application\">psql</span>\u7684\u884c\u4e3a\u6216\u8005\u81ea\u52a8\u8bbe\u7f6e\u4ee5\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u3002\u8fd9\u4e9b\u53d8\u91cf\u5728\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/devel/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u4e2d\u6709\u6587\u6863\u8bb0\u5f55\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u4e0e<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4<a class=\"link\" href=\"/docs/devel/sql-set.html\" title=\"SET\"><code class=\"command\">SET</code></a>\u65e0\u5173\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-SETENV\"><span class=\"term\"><code class=\"literal\">\\setenv <em class=\"replaceable\"><code>name</code></em> [ <em class=\"replaceable\"><code>value</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u4e3a<em class=\"replaceable\"><code>value</code></em>\uff0c\u6216\u8005\u5982\u679c\u672a\u63d0\u4f9b<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3002\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\setenv PAGER less</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>\\setenv LESS -imx4F</code></strong>\n</pre>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-SF\"><span class=\"term\"><code class=\"literal\">\\sf[+] <em class=\"replaceable\"><code>function_description</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u663e\u793a\u6307\u5b9a\u51fd\u6570\u6216\u8fc7\u7a0b\u7684\u5b9a\u4e49\uff0c\u4ee5<code class=\"command\">CREATE OR REPLACE FUNCTION</code>\u6216 <code class=\"command\">CREATE OR REPLACE PROCEDURE</code>\u547d\u4ee4\u7684\u5f62\u5f0f\u5448\u73b0\u3002\u5b9a\u4e49\u5c06\u6253\u5370\u5230\u5f53\u524d\u67e5\u8be2\u8f93\u51fa\u901a\u9053\uff0c\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\">\u76ee\u6807\u51fd\u6570\u53ef\u4ec5\u7528\u540d\u79f0\u6307\u5b9a\uff0c\u4e5f\u53ef\u7528\u540d\u79f0\u548c\u53c2\u6570\u6307\u5b9a\uff0c\u4f8b\u5982 foo(integer, text)\u3002\u82e5\u6709\u591a\u4e2a\u540c\u540d\u51fd\u6570\uff0c\u5219\u5fc5\u987b\u63d0\u4f9b\u53c2\u6570\u7c7b\u578b\u3002</p>\n<p lang=\"zh\">\u5728\u547d\u4ee4\u540d\u540e\u6dfb\u52a0 +\uff0c\u4f1a\u4e3a\u8f93\u51fa\u884c\u7f16\u53f7\uff0c\u51fd\u6570\u4f53\u7b2c\u4e00\u884c\u4e3a\u7b2c 1 \u884c\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\sf</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-SV\"><span class=\"term\"><code class=\"literal\">\\sv[+] <em class=\"replaceable\"><code>view_name</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u6307\u5b9a\u89c6\u56fe\u7684\u5b9a\u4e49\uff0c\u5e76\u4ee5<code class=\"command\">CREATE OR REPLACE VIEW</code>\u547d\u4ee4\u7684\u5f62\u5f0f\u663e\u793a\u3002\u5b9a\u4e49\u4f1a\u6253\u5370\u5230\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u7684\u5f53\u524d\u67e5\u8be2\u8f93\u51fa\u901a\u9053\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u547d\u4ee4\u540d\u79f0\u540e\u6dfb\u52a0<code class=\"literal\">+</code>\uff0c\u90a3\u4e48\u8f93\u51fa\u884c\u5c06\u4ece1\u5f00\u59cb\u7f16\u53f7\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\sv</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PIPELINE\"><span class=\"term\"><code class=\"literal\">\\startpipeline</code><br/></span><span class=\"term\"><code class=\"literal\">\\sendpipeline</code><br/></span><span class=\"term\"><code class=\"literal\">\\syncpipeline</code><br/></span><span class=\"term\"><code class=\"literal\">\\endpipeline</code><br/></span><span class=\"term\"><code class=\"literal\">\\flushrequest</code><br/></span><span class=\"term\"><code class=\"literal\">\\flush</code><br/></span><span class=\"term\"><code class=\"literal\">\\getresults [ <em class=\"replaceable\"><code>number_results</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u7ec4\u547d\u4ee4\u5b9e\u73b0 SQL \u8bed\u53e5\u7684\u7ba1\u9053\u5316\u3002\u4e00\u4e2a\u7ba1\u9053\u5fc5\u987b\u4ee5 <code class=\"command\">\\startpipeline</code> \u5f00\u59cb\uff0c\u5e76\u4ee5 <code class=\"command\">\\endpipeline</code> \u7ed3\u675f\u3002\u5176\u95f4\u53ef\u4ee5\u51fa\u73b0\u4efb\u610f\u6570\u91cf\u7684 <code class=\"command\">\\syncpipeline</code> \u547d\u4ee4\uff0c\u5b83\u4f1a\u53d1\u9001\u4e00\u6761<a class=\"link\" href=\"/docs/devel/protocol-flow.html#PROTOCOL-FLOW-EXT-QUERY\" title=\"54.2.3.\u00a0\u6269\u5c55\u67e5\u8be2\">\u540c\u6b65\u6d88\u606f</a>\uff0c\u800c\u4e0d\u4f1a\u7ed3\u675f\u5f53\u524d\u7ba1\u9053\uff0c\u4e5f\u4e0d\u4f1a\u5237\u65b0\u53d1\u9001\u7f13\u51b2\u533a\u3002\u5728\u7ba1\u9053\u6a21\u5f0f\u4e0b\uff0c\u8bed\u53e5\u4f1a\u88ab\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u4e0d\u7b49\u5f85\u524d\u9762\u8bed\u53e5\u7684\u7ed3\u679c\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/devel/libpq-pipeline-mode.html\" title=\"32.5.\u00a0\u7ba1\u9053\u6a21\u5f0f\">\u7b2c\u00a032.5\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u7ba1\u9053\u8fdb\u884c\u671f\u95f4\u6267\u884c\u7684\u6240\u6709\u67e5\u8be2\u90fd\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002\u4ee5\u5206\u53f7\u7ed3\u675f\u7684\u67e5\u8be2\u4f1a\u88ab\u8ffd\u52a0\u5230\u7ba1\u9053\u4e2d\u3002\u5143\u547d\u4ee4 <code class=\"literal\">\\bind</code>\u3001<code class=\"literal\">\\bind_named</code>\u3001<code class=\"literal\">\\close_prepared</code> \u548c <code class=\"literal\">\\parse</code> \u53ef\u4ee5\u5728\u8fdb\u884c\u4e2d\u7684\u7ba1\u9053\u91cc\u4f7f\u7528\u3002\u7ba1\u9053\u8fdb\u884c\u671f\u95f4\uff0c<code class=\"literal\">\\sendpipeline</code> \u4f1a\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u8ffd\u52a0\u5230\u7ba1\u9053\u4e2d\u3002\u5176\u4ed6\u5143\u547d\u4ee4\uff0c\u5982 <code class=\"literal\">\\g</code>\u3001<code class=\"literal\">\\gx</code> \u6216 <code class=\"literal\">\\gdesc</code>\uff0c\u5219\u4e0d\u5141\u8bb8\u5728\u7ba1\u9053\u6a21\u5f0f\u4e2d\u4f7f\u7528\u3002</p>\n<p lang=\"zh\"><code class=\"command\">\\flushrequest</code> \u4f1a\u5411\u7ba1\u9053\u8ffd\u52a0\u4e00\u6761 flush \u547d\u4ee4\uff0c\u4f7f\u5f97\u53ef\u4ee5\u5728\u4e0d\u53d1\u9001 sync \u6216\u7ed3\u675f\u7ba1\u9053\u7684\u60c5\u51b5\u4e0b\u901a\u8fc7 <code class=\"command\">\\getresults</code> \u8bfb\u53d6\u7ed3\u679c\u3002<code class=\"command\">\\getresults</code> \u4f1a\u81ea\u52a8\u5c06\u5c1a\u672a\u53d1\u9001\u7684\u6570\u636e\u63a8\u9001\u5230\u670d\u52a1\u5668\u3002<code class=\"command\">\\flush</code> \u53ef\u7528\u4e8e\u624b\u52a8\u63a8\u9001\u672a\u53d1\u9001\u7684\u6570\u636e\u3002</p>\n<p lang=\"zh\"><code class=\"command\">\\getresults</code> \u63a5\u53d7\u4e00\u4e2a\u53ef\u9009\u7684 <em class=\"replaceable\"><code>number_results</code></em> \u53c2\u6570\u3002\u5982\u679c\u63d0\u4f9b\uff0c\u5219\u53ea\u8bfb\u53d6\u524d <em class=\"replaceable\"><code>number_results</code></em> \u4e2a\u5f85\u5904\u7406\u7ed3\u679c\u3002\u82e5\u7701\u7565\u8be5\u53c2\u6570\u6216\u5176\u503c\u4e3a <code class=\"literal\">0</code>\uff0c\u5219\u8bfb\u53d6\u6240\u6709\u5f85\u5904\u7406\u7ed3\u679c\u3002</p>\n<p lang=\"zh\">\u5f53\u7ba1\u9053\u6a21\u5f0f\u5904\u4e8e\u6d3b\u52a8\u72b6\u6001\u65f6\uff0c\u53ef\u4f7f\u7528\u4e00\u4e2a\u4e13\u7528\u7684\u63d0\u793a\u7b26\u53d8\u91cf\u6765\u62a5\u544a\u7ba1\u9053\u72b6\u6001\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/devel/app-psql.html#APP-PSQL-PROMPTING-P-UC\"><code class=\"literal\">%P</code></a>\u3002</p>\n<p lang=\"zh\"><code class=\"command\">COPY</code> \u5728\u7ba1\u9053\u6a21\u5f0f\u4e2d\u4e0d\u652f\u6301\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\startpipeline\nSELECT * FROM pg_class;\nSELECT 1 \\bind \\sendpipeline\n\\flushrequest\n\\getresults\n\\endpipeline\n</pre>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-T-LC\"><span class=\"term\"><code class=\"literal\">\\t</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u8f93\u51fa\u4e2d\u7684\u5217\u540d\u6807\u9898\u548c\u884c\u6570\u9875\u811a\u7684\u663e\u793a\u72b6\u6001\u3002\u8fd9\u4e2a\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset tuples_only</code>\uff0c\u63d0\u4f9b\u5b83\u662f\u4e3a\u4e86\u4f7f\u7528\u65b9\u4fbf\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-T-UC\"><span class=\"term\"><code class=\"literal\">\\T <em class=\"replaceable\"><code>table_options</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728<acronym class=\"acronym\">HTML</acronym>\u8f93\u51fa\u683c\u5f0f\u4e2d\u653e\u5728<code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u5c5e\u6027\u3002\u8fd9\u4e2a\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset tableattr <em class=\"replaceable\"><code>table_options</code></em></code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-TIMING\"><span class=\"term\"><code class=\"literal\">\\timing [ <em class=\"replaceable\"><code>on</code></em> | <em class=\"replaceable\"><code>off</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5e26\u53c2\u6570\u65f6\uff0c\u5f00\u542f\u6216\u5173\u95ed\u6bcf\u6761 SQL \u8bed\u53e5\u6267\u884c\u8017\u65f6\u7684\u663e\u793a\u3002\u4e0d\u5e26\u53c2\u6570\u65f6\uff0c\u5207\u6362\u663e\u793a\u7684\u5f00\u5173\u72b6\u6001\u3002\u8017\u65f6\u4ee5\u6beb\u79d2\u663e\u793a\uff1b\u8d85\u8fc7 1 \u79d2\u7684\u65f6\u95f4\u95f4\u9694\u8fd8\u4f1a\u4ee5\u5206\u949f:\u79d2\u7684\u683c\u5f0f\u663e\u793a\uff0c\u5fc5\u8981\u65f6\u6dfb\u52a0\u5c0f\u65f6\u548c\u5929\u5b57\u6bb5\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-UNRESTRICT\"><span class=\"term\"><code class=\"literal\">\\unrestrict <em class=\"replaceable\"><code>restrict_key</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u9000\u51fa<span class=\"quote\">\u201c<span class=\"quote\">\u53d7\u9650</span>\u201d</span>\u6a21\u5f0f\uff08\u5373\u6240\u6709\u5176\u4ed6\u5143\u547d\u4ee4\u90fd\u88ab\u963b\u6b62\u7684\u6a21\u5f0f\uff09\uff0c\u524d\u63d0\u662f\u6307\u5b9a\u7684\u5bc6\u94a5\u4e0e\u8fdb\u5165\u53d7\u9650\u6a21\u5f0f\u65f6\u4f20\u7ed9<code class=\"command\">\\restrict</code>\u7684\u5bc6\u94a5\u5339\u914d\u3002</p>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4e3b\u8981\u7528\u4e8e pg_dump\u3001pg_dumpall \u548c pg_restore \u751f\u6210\u7684\u7eaf\u6587\u672c\u8f6c\u50a8\uff0c\u4e5f\u53ef\u80fd\u9002\u7528\u4e8e\u5176\u4ed6\u573a\u666f\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u5269\u4f59\u884c\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\unrestrict</code>\u7684\u53c2\u6570\uff0c\u5e76\u4e14\u4e0d\u4f1a\u6267\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-UNSET\"><span class=\"term\"><code class=\"literal\">\\unset <em class=\"replaceable\"><code>name</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u53d6\u6d88\u8bbe\u7f6e\uff08\u5220\u9664\uff09<span class=\"application\">psql</span>\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u3002</p>\n<p lang=\"zh\">\u5927\u591a\u6570\u63a7\u5236<span class=\"application\">psql</span>\u884c\u4e3a\u7684\u53d8\u91cf\u4e0d\u80fd\u53d6\u6d88\u8bbe\u7f6e\uff1b\u5bf9\u4e8e\u8fd9\u4e9b\u53d8\u91cf\uff0c<code class=\"literal\">\\unset</code>\u547d\u4ee4\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u5176\u8bbe\u7f6e\u4e3a\u9ed8\u8ba4\u503c\u3002\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/devel/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-WRITE\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\w</code> \u6216 <code class=\"literal\">\\write</code> <em class=\"replaceable\"><code>filename</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\w</code> \u6216 <code class=\"literal\">\\write</code> <code class=\"literal\">|</code><em class=\"replaceable\"><code>command</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u5199\u5165\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u9012\u7ed9 shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6539\u4e3a\u5199\u5165\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\uff0c\u5219\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u7684\u5185\u5bb9\u53ea\u4f1a\u539f\u6837\u4f20\u9012\u7ed9 shell\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-WARN\"><span class=\"term\"><code class=\"literal\">\\warn <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u547d\u4ee4\u4e0e<code class=\"command\">\\echo</code>\u547d\u4ee4\u76f8\u540c\uff0c\u53ea\u662f\u8f93\u51fa\u5c06\u88ab\u5199\u5165<span class=\"application\">psql</span>\u7684\u6807\u51c6\u9519\u8bef\u901a\u9053\uff0c\u800c\u4e0d\u662f\u6807\u51c6\u8f93\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-WATCH\"><span class=\"term\"><code class=\"literal\">\\watch [ i[nterval]=<em class=\"replaceable\"><code>seconds</code></em> ] [ c[ount]=<em class=\"replaceable\"><code>times</code></em> ] [ m[in_rows]=<em class=\"replaceable\"><code>rows</code></em> ] [ <em class=\"replaceable\"><code>seconds</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u91cd\u590d\u6267\u884c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\uff08\u5982\u540c <code class=\"literal\">\\g</code> \u4e00\u6837\uff09\uff0c\u76f4\u5230\u88ab\u4e2d\u65ad\u3001\u67e5\u8be2\u5931\u8d25\u3001\u8fbe\u5230\u6267\u884c\u6b21\u6570\u4e0a\u9650\uff08\u5982\u679c\u7ed9\u5b9a\uff09\u6216\u67e5\u8be2\u8fd4\u56de\u7684\u884c\u6570\u4f4e\u4e8e\u6700\u5c0f\u8981\u6c42\u3002\u4e24\u6b21\u6267\u884c\u4e4b\u95f4\u7b49\u5f85\u6307\u5b9a\u7684\u79d2\u6570\uff08\u9ed8\u8ba4 2 \u79d2\uff09\u3002\u9ed8\u8ba4\u7b49\u5f85\u65f6\u95f4\u53ef\u901a\u8fc7\u53d8\u91cf<a class=\"xref\" href=\"/docs/devel/app-psql.html#APP-PSQL-VARIABLES-WATCH-INTERVAL\"><code class=\"varname\">WATCH_INTERVAL</code></a>\u4fee\u6539\u3002\u4e3a\u4fdd\u6301\u5411\u540e\u517c\u5bb9\uff0c<em class=\"replaceable\"><code>seconds</code></em> \u53ef\u4ee5\u5e26\u6216\u4e0d\u5e26 <code class=\"literal\">interval=</code> \u524d\u7f00\u3002\u6bcf\u6b21\u67e5\u8be2\u7ed3\u679c\u90fd\u4f1a\u5e26\u6709\u4e00\u4e2a\u5934\u90e8\uff0c\u5176\u4e2d\u5305\u542b <code class=\"literal\">\\pset title</code> \u5b57\u7b26\u4e32\uff08\u5982\u679c\u6709\uff09\u3001\u67e5\u8be2\u5f00\u59cb\u65f6\u7684\u65f6\u95f4\u4ee5\u53ca\u5ef6\u8fdf\u95f4\u9694\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-X\"><span class=\"term\"><code class=\"literal\">\\x [ <em class=\"replaceable\"><code>on</code></em> | <em class=\"replaceable\"><code>off</code></em> | <em class=\"replaceable\"><code>auto</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u6216\u5207\u6362\u6269\u5c55\u8868\u683c\u683c\u5f0f\u6a21\u5f0f\u3002\u5b83\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset expanded</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-Z\"><span class=\"term\"><code class=\"literal\">\\z[Sx] [ <a class=\"link\" href=\"https://pg.center/docs/devel/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u53ca\u5176\u76f8\u5173\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002</p>\n<p lang=\"zh\">\u8fd9\u662f<code class=\"command\">\\dp</code>\u7684\u522b\u540d\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u663e\u793a\u6743\u9650</span>\u201d</span>\uff09\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-EXCLAMATION-MARK\"><span class=\"term\"><code class=\"literal\">\\! [ <em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u5e26\u53c2\u6570\u65f6\uff0c\u8fdb\u5165\u4e00\u4e2a\u5b50 shell\uff1b\u5b50 shell \u9000\u51fa\u540e\uff0c<span class=\"application\">psql</span>\u6062\u590d\u8fd0\u884c\u3002\u5e26\u53c2\u6570\u65f6\uff0c\u6267\u884c shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\!</code>\u7684\u53c2\u6570\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u5185\u5bb9\u4f1a\u539f\u6837\u4f20\u7ed9 shell\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-QUESTION-MARK\"><span class=\"term\"><code class=\"literal\">\\? [ <em class=\"replaceable\"><code>topic</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5e2e\u52a9\u4fe1\u606f\u3002\u53ef\u9009\u7684<em class=\"replaceable\"><code>topic</code></em>\u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a<code class=\"literal\">commands</code>\uff09\u9009\u62e9\u8981\u89e3\u91ca\u7684<span class=\"application\">psql</span>\u7684\u54ea\u4e2a\u90e8\u5206\uff1a<code class=\"literal\">commands</code>\u63cf\u8ff0<span class=\"application\">psql</span>\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b<code class=\"literal\">options</code>\u63cf\u8ff0\u53ef\u4ee5\u4f20\u9012\u7ed9<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c<code class=\"literal\">variables</code>\u663e\u793a\u5173\u4e8e<span class=\"application\">psql</span>\u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-SEMICOLON\"><span class=\"term\"><code class=\"literal\">\\;</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u53cd\u659c\u7ebf\u5206\u53f7\u4e0d\u50cf\u524d\u9762\u7684\u547d\u4ee4\u90a3\u6837\u662f\u4e00\u4e2a\u5143\u547d\u4ee4\uff1b\u76f8\u53cd\uff0c\u5b83\u53ea\u662f\u5728\u4e0d\u8fdb\u884c\u8fdb\u4e00\u6b65\u5904\u7406\u7684\u60c5\u51b5\u4e0b\u5c06\u4e00\u4e2a\u5206\u53f7\u6dfb\u52a0\u5230\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u3002</p>\n<p lang=\"zh\">\u901a\u5e38\uff0c<span class=\"application\">psql</span>\u4f1a\u5728\u5230\u8fbe\u547d\u4ee4\u7ed3\u675f\u7684\u5206\u53f7\u65f6\u7acb\u5373\u5c06SQL\u547d\u4ee4\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u5373\u4f7f\u5f53\u524d\u884c\u8fd8\u6709\u66f4\u591a\u8f93\u5165\u3002\u56e0\u6b64\uff0c\u4f8b\u5982\u8f93\u5165</p>\n<pre class=\"programlisting\">SELECT 1; SELECT 2; SELECT 3;\n</pre>\n<p lang=\"zh\">\u5c06\u5bfc\u81f4\u4e09\u4e2aSQL\u547d\u4ee4\u5206\u522b\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u6bcf\u4e2a\u547d\u4ee4\u7684\u7ed3\u679c\u5728\u7ee7\u7eed\u4e0b\u4e00\u4e2a\u547d\u4ee4\u4e4b\u524d\u663e\u793a\u3002\u7136\u800c\uff0c\u8f93\u5165\u4e3a<code class=\"literal\">\\;</code>\u7684\u5206\u53f7\u4e0d\u4f1a\u89e6\u53d1\u547d\u4ee4\u5904\u7406\uff0c\u56e0\u6b64\u5b83\u4e4b\u524d\u548c\u4e4b\u540e\u7684\u547d\u4ee4\u5b9e\u9645\u4e0a\u88ab\u5408\u5e76\u5e76\u4f5c\u4e3a\u4e00\u4e2a\u8bf7\u6c42\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u56e0\u6b64\uff0c\u4f8b\u5982</p>\n<pre class=\"programlisting\">SELECT 1\\; SELECT 2\\; SELECT 3;\n</pre>\n<p lang=\"zh\">\u4f1a\u5728\u9047\u5230\u524d\u9762\u6ca1\u6709\u53cd\u659c\u7ebf\u7684\u5206\u53f7\u65f6\uff0c\u5c06\u8fd9\u4e09\u4e2a SQL \u547d\u4ee4\u4f5c\u4e3a\u5355\u4e2a\u8bf7\u6c42\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u670d\u52a1\u5668\u4f1a\u5c06\u6b64\u7c7b\u8bf7\u6c42\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff0c\u9664\u975e\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u663e\u5f0f\u7684<code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code>\u547d\u4ee4\u5c06\u5176\u5206\u6210\u591a\u4e2a\u4e8b\u52a1\u3002\uff08\u6709\u5173\u670d\u52a1\u5668\u5982\u4f55\u5904\u7406\u591a\u67e5\u8be2\u5b57\u7b26\u4e32\u7684\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/devel/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT\" title=\"54.2.2.1.\u00a0\u4e00\u4e2a\u7b80\u5355\u67e5\u8be2\u4e2d\u7684\u591a\u6761\u8bed\u53e5\">\u7b2c\u00a054.2.2.1\u00a0\u8282</a>\u3002\uff09</p>\n</dd>\n</dl>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-PATTERNS\">\n<h4 lang=\"zh\">\u6a21\u5f0f</h4>\n<p lang=\"zh\">\u5f88\u591a<code class=\"literal\">\\d</code>\u547d\u4ee4\u90fd\u53ef\u4ee5\u7528\u4e00\u4e2a<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\u6765\u6307\u5b9a\u8981\u88ab\u663e\u793a\u7684\u5bf9\u8c61\u540d\u79f0\u3002\u5728\u6700\u7b80\u5355\u7684\u60c5\u51b5\u4e0b\uff0c\u6a21\u5f0f\u6b63\u597d\u5c31\u662f\u8be5\u5bf9\u8c61\u7684\u51c6\u786e\u540d\u79f0\u3002\u5728\u6a21\u5f0f\u4e2d\u7684\u5b57\u7b26\u901a\u5e38\u4f1a\u88ab\u53d8\u6210\u5c0f\u5199\u5f62\u5f0f\uff08\u5c31\u50cf\u5728 SQL \u540d\u79f0\u4e2d\u90a3\u6837\uff09\uff0c\u4f8b\u5982<code class=\"literal\">\\dt FOO</code>\u5c06\u4f1a\u663e\u793a\u540d\u4e3a<code class=\"literal\">foo</code>\u7684\u8868\u3002\u5c31\u50cf\u5728 SQL \u540d\u79f0\u4e2d\u90a3\u6837\uff0c\u628a\u6a21\u5f0f\u653e\u5728\u53cc\u5f15\u53f7\u4e2d\u53ef\u4ee5\u963b\u6b62\u5b83\u88ab\u8f6c\u6362\u6210\u5c0f\u5199\u5f62\u5f0f\u3002\u5982\u679c\u9700\u8981\u5728\u4e00\u4e2a\u6a21\u5f0f\u4e2d\u5305\u62ec\u4e00\u4e2a\u771f\u6b63\u7684\u53cc\u5f15\u53f7\u5b57\u7b26\uff0c\u5219\u9700\u8981\u5728\u53cc\u5f15\u53f7\u5305\u56f4\u7684\u6587\u672c\u5185\u628a\u5b83\u5199\u6210\u4e24\u4e2a\u76f8\u90bb\u7684\u53cc\u5f15\u53f7\uff0c\u8fd9\u540c\u6837\u662f\u7b26\u5408 SQL \u52a0\u5f15\u53f7\u6807\u8bc6\u7b26\u7684\u89c4\u5219\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dt \"FOO\"\"BAR\"</code>\u5c06\u663e\u793a\u540d\u4e3a<code class=\"literal\">FOO\"BAR</code>\uff08\u4e0d\u662f<code class=\"literal\">foo\"bar</code>\uff09\u7684\u8868\u3002\u548c\u666e\u901a\u7684 SQL \u540d\u79f0\u89c4\u5219\u4e0d\u540c\uff0c\u4f60\u53ef\u4ee5\u53ea\u5728\u6a21\u5f0f\u7684\u4e00\u90e8\u5206\u5468\u56f4\u653e\u4e0a\u53cc\u5f15\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">\\dt FOO\"FOO\"BAR</code>\u5c06\u4f1a\u663e\u793a\u540d\u4e3a<code class=\"literal\">fooFOObar</code>\u7684\u8868\u3002</p>\n<p lang=\"zh\">\u53ea\u8981\u5b8c\u5168\u7701\u7565<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\uff0c<code class=\"literal\">\\d</code>\u547d\u4ee4\u5c31\u4f1a\u663e\u793a\u5f53\u524d\u6a21\u5f0f\u641c\u7d22\u8def\u5f84\u4e2d\u53ef\u89c1\u7684\u5168\u90e8\u5bf9\u8c61 \u2014 \u8fd9\u7b49\u4ef7\u4e8e\u7528<code class=\"literal\">*</code>\u4f5c\u4e3a\u6a21\u5f0f\uff08\u5982\u679c\u4e00\u4e2a\u5bf9\u8c61\u6240\u5728\u7684\u6a21\u5f0f\u4f4d\u4e8e\u641c\u7d22\u8def\u5f84\u4e2d\uff0c\u5e76\u4e14\u5728\u641c\u7d22\u8def\u5f84\u4e2d\u8be5\u6a21\u5f0f\u4e4b\u524d\u6ca1\u6709\u540c\u7c7b\u4e14\u540c\u540d\u7684\u5bf9\u8c61\uff0c\u5219\u8be5\u5bf9\u8c61\u5c31\u662f<em class=\"firstterm\">\u53ef\u89c1</em>\u7684\u3002\u8fd9\u8868\u793a\u53ef\u4ee5\u76f4\u63a5\u7528\u540d\u79f0\u5f15\u7528\u8be5\u5bf9\u8c61\uff0c\u800c\u4e0d\u9700\u8981\u7528\u6a21\u5f0f\u6765\u9650\u5b9a\uff09\u3002\u8981\u67e5\u770b\u6570\u636e\u5e93\u4e2d\u6240\u6709\u5bf9\u8c61\u800c\u4e0d\u8003\u8651\u5176\u53ef\u89c1\u6027\uff0c\u53ef\u4ee5\u628a<code class=\"literal\">*.*</code>\u7528\u4f5c\u6a21\u5f0f\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u653e\u5728\u4e00\u4e2a\u6a21\u5f0f\u4e2d\uff0c<code class=\"literal\">*</code>\u5c06\u5339\u914d\u4efb\u610f\u5b57\u7b26\u5e8f\u5217\uff08\u5305\u62ec\u7a7a\u5e8f\u5217\uff09\uff0c\u800c<code class=\"literal\">?</code>\u4f1a\u5339\u914d\u4efb\u610f\u7684\u5355\u4e2a\u5b57\u7b26\uff08\u8fd9\u79cd\u8bb0\u53f7\u65b9\u6cd5\u5c31\u50cf Unix shell \u7684\u6587\u4ef6\u540d\u6a21\u5f0f\u4e00\u6837\uff09\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dt int*</code>\u4f1a\u663e\u793a\u540d\u79f0\u4ee5<code class=\"literal\">int</code>\u5f00\u59cb\u7684\u8868\u3002\u4f46\u662f\u5982\u679c\u88ab\u653e\u5728\u53cc\u5f15\u53f7\u5185\uff0c<code class=\"literal\">*</code>\u548c<code class=\"literal\">?</code>\u5c31\u4f1a\u5931\u53bb\u8fd9\u4e9b\u7279\u6b8a\u542b\u4e49\u800c\u53d8\u6210\u666e\u901a\u7684\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u5305\u542b\u70b9\u53f7\uff08.\uff09\u7684\u5173\u7cfb\u540d\u6a21\u5f0f\u4f1a\u88ab\u89e3\u91ca\u4e3a\u6a21\u5f0f\u540d\u5339\u914d\u6a21\u5f0f\uff0c\u540e\u63a5\u5bf9\u8c61\u540d\u5339\u914d\u6a21\u5f0f\u3002\u4f8b\u5982\uff0c\\dt foo*.*bar* \u4f1a\u663e\u793a\u6240\u6709\u6a21\u5f0f\u540d\u4ee5 foo \u5f00\u5934\u3001\u8868\u540d\u5305\u542b bar \u7684\u8868\u3002\u6ca1\u6709\u70b9\u53f7\u65f6\uff0c\u53ea\u5339\u914d\u5f53\u524d\u6a21\u5f0f\u641c\u7d22\u8def\u5f84\u4e2d\u53ef\u89c1\u7684\u5bf9\u8c61\u3002\u540c\u6837\uff0c\u53cc\u5f15\u53f7\u5185\u7684\u70b9\u53f7\u4e0d\u5177\u6709\u7279\u6b8a\u542b\u4e49\uff0c\u6309\u5b57\u9762\u5339\u914d\u3002\u5305\u542b\u4e24\u4e2a\u70b9\u53f7\uff08.\uff09\u7684\u5173\u7cfb\u540d\u6a21\u5f0f\u4f1a\u88ab\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u540d\uff0c\u540e\u63a5\u6a21\u5f0f\u540d\u5339\u914d\u6a21\u5f0f\uff0c\u518d\u63a5\u5bf9\u8c61\u540d\u5339\u914d\u6a21\u5f0f\u3002\u6570\u636e\u5e93\u540d\u90e8\u5206\u4e0d\u4f5c\u4e3a\u5339\u914d\u6a21\u5f0f\uff0c\u5fc5\u987b\u4e0e\u5f53\u524d\u8fde\u63a5\u7684\u6570\u636e\u5e93\u540d\u79f0\u76f8\u540c\uff0c\u5426\u5219\u4f1a\u62a5\u9519\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7528\u4e8e\u5339\u914d\u6a21\u5f0f\u540d\u7684\u6a21\u5f0f\u5305\u542b\u4e00\u4e2a\u70b9\uff08<code class=\"literal\">.</code>\uff09\uff0c\u5219\u4f1a\u88ab\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u540d\uff0c\u540e\u63a5\u6a21\u5f0f\u540d\u7684\u5339\u914d\u6a21\u5f0f\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dn mydb.*foo*</code>\u4f1a\u663e\u793a\u540d\u79f0\u4e2d\u5305\u542b<code class=\"literal\">foo</code>\u7684\u6240\u6709\u6a21\u5f0f\u3002\u6570\u636e\u5e93\u540d\u90e8\u5206\u4e0d\u4f1a\u88ab\u5f53\u4f5c\u5339\u914d\u6a21\u5f0f\uff0c\u5fc5\u987b\u4e0e\u5f53\u524d\u8fde\u63a5\u7684\u6570\u636e\u5e93\u540d\u76f8\u540c\uff0c\u5426\u5219\u4f1a\u62a5\u9519\u3002</p>\n<p lang=\"zh\">\u9ad8\u7ea7\u7528\u6237\u53ef\u4ee5\u4f7f\u7528\u5b57\u7b26\u7c7b\u7b49\u6b63\u5219\u8868\u8fbe\u5f0f\u8bb0\u6cd5\uff0c\u5982<code class=\"literal\">[0-9]</code>\u53ef\u4ee5\u5339\u914d\u4efb\u610f\u6570\u5b57\u3002\u6240\u6709\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u90fd\u6309\u7167<a class=\"xref\" href=\"/docs/devel/functions-matching.html#POSIX-SYNTAX-DETAILS\" title=\"9.7.3.2.\u00a0POSIX \u6b63\u5219\u8868\u8fbe\u5f0f\u7ec6\u8282\">\u7b2c\u00a09.7.3.2\u00a0\u8282</a>\u6240\u8bf4\u7684\u5de5\u4f5c\uff0c\u4ee5\u4e0b\u5b57\u7b26\u9664\u5916\uff1a<code class=\"literal\">.</code>\u4f1a\u6309\u7167\u4e0a\u9762\u6240\u8bf4\u7684\u4f5c\u4e3a\u4e00\u79cd\u5206\u9694\u7b26\uff0c<code class=\"literal\">*</code>\u4f1a\u88ab\u7ffb\u8bd1\u6210\u6b63\u5219\u8868\u8fbe\u5f0f\u8bb0\u53f7<code class=\"literal\">.*</code>\uff0c<code class=\"literal\">?</code>\u4f1a\u88ab\u7ffb\u8bd1\u6210<code class=\"literal\">.</code>\uff0c\u800c<code class=\"literal\">$</code>\u5219\u6309\u5b57\u9762\u610f\u601d\u5339\u914d\u3002\u6839\u636e\u9700\u8981\uff0c\u53ef\u4ee5\u7528<code class=\"literal\">?</code>\u6a21\u62df<code class=\"literal\">.</code>\uff0c\u7528<code class=\"literal\">(<em class=\"replaceable\"><code>R</code></em>+|)</code>\u6a21\u62df<code class=\"literal\"><em class=\"replaceable\"><code>R</code></em>*</code>\uff0c\u6216\u7528<code class=\"literal\">(<em class=\"replaceable\"><code>R</code></em>|)</code>\u6a21\u62df<code class=\"literal\"><em class=\"replaceable\"><code>R</code></em>?</code>\u3002<code class=\"literal\">$</code>\u4e0d\u9700\u8981\u4f5c\u4e3a\u4e00\u4e2a\u6b63\u5219\u8868\u8fbe\u5f0f\u5b57\u7b26\uff0c\u56e0\u4e3a\u6a21\u5f0f\u5fc5\u987b\u5339\u914d\u6574\u4e2a\u540d\u79f0\uff0c\u800c\u4e0d\u662f\u50cf\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5e38\u89c4\u7528\u6cd5\u90a3\u6837\u89e3\u91ca\uff08\u6362\u53e5\u8bdd\u8bf4\uff0c<code class=\"literal\">$</code>\u4f1a\u88ab\u81ea\u52a8\u5730\u8ffd\u52a0\u5230\u6a21\u5f0f\u4e0a\uff09\u3002\u5982\u679c\u4e0d\u5e0c\u671b\u8be5\u6a21\u5f0f\u7684\u5339\u914d\u4f4d\u7f6e\u88ab\u56fa\u5b9a\uff0c\u53ef\u4ee5\u5728\u5f00\u5934\u6216\u8005\u7ed3\u5c3e\u5199\u4e0a<code class=\"literal\">*</code>\u3002\u6ce8\u610f\u5728\u53cc\u5f15\u53f7\u5185\uff0c\u6240\u6709\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u4f1a\u5931\u53bb\u5176\u7279\u6b8a\u542b\u4e49\u5e76\u4e14\u6309\u7167\u5176\u5b57\u9762\u610f\u601d\u8fdb\u884c\u5339\u914d\u3002\u8fd8\u6709\uff0c\u5728\u64cd\u4f5c\u7b26\u540d\u79f0\u6a21\u5f0f\u4e2d\uff08\u5373\u4f5c\u4e3a<code class=\"literal\">\\do</code>\u7684\u53c2\u6570\uff09\uff0c\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u4e5f\u6309\u7167\u5b57\u9762\u610f\u601d\u8fdb\u884c\u5339\u914d\u3002</p>\n</div>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.21.8.5\">\n<h3 lang=\"zh\">\u9ad8\u7ea7\u7279\u6027</h3>\n<div class=\"refsect3\" id=\"APP-PSQL-VARIABLES\">\n<h4 lang=\"zh\">\u53d8\u91cf</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u63d0\u4f9b\u4e86\u548c\u666e\u901a Unix \u547d\u4ee4 shell \u76f8\u4f3c\u7684\u53d8\u91cf\u66ff\u6362\u7279\u6027\u3002\u53d8\u91cf\u7b80\u5355\u6765\u8bf4\u5c31\u662f\u4e00\u5bf9\u540d\u79f0/\u503c\uff0c\u5176\u4e2d\u503c\u53ef\u4ee5\u662f\u4efb\u610f\u957f\u5ea6\u7684\u4efb\u610f\u5b57\u7b26\u4e32\u3002\u540d\u79f0\u5fc5\u987b\u7531\u5b57\u6bcd\uff08\u5305\u62ec\u975e\u62c9\u4e01\u5b57\u6bcd\uff09\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u6784\u6210\u3002</p>\n<p lang=\"zh\">\u8981\u8bbe\u7f6e\u4e00\u4e2a\u53d8\u91cf\uff0c\u53ef\u4ee5\u4f7f\u7528<span class=\"application\">psql</span>\u7684\u5143\u547d\u4ee4<code class=\"command\">\\set</code>\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo bar</code></strong>\n</pre>\n<p lang=\"zh\">\u4f1a\u5c06<code class=\"literal\">foo</code>\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">bar</code>\u3002\u8981\u68c0\u7d22\u8be5\u53d8\u91cf\u7684\u5185\u5bb9\uff0c\u53ef\u4ee5\u5728\u540d\u79f0\u524d\u653e\u4e00\u4e2a\u5192\u53f7\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\echo :foo</code></strong>\nbar\n</pre>\n<p lang=\"zh\">\u8fd9\u5728\u5e38\u89c4 SQL \u547d\u4ee4\u548c\u5143\u547d\u4ee4\u4e2d\u5747\u6709\u6548\uff0c\u4e0b\u6587\u7684<a class=\"xref\" href=\"/docs/devel/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL \u63d2\u503c\">SQL \u63d2\u503c</a>\u4e2d\u6709\u66f4\u591a\u7ec6\u8282\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u8c03\u7528<code class=\"command\">\\set</code>\u65f6\u6ca1\u6709\u7b2c\u4e8c\u4e2a\u53c2\u6570\uff0c\u8be5\u53d8\u91cf\u4f1a\u88ab\u8bbe\u7f6e\u4e3a\u4e00\u4e2a\u7a7a\u5b57\u7b26\u4e32\u503c\u3002\u8981\u53d6\u6d88\u8bbe\u7f6e\uff08\u5373\u5220\u9664\uff09\u4e00\u4e2a\u53d8\u91cf\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4<code class=\"command\">\\unset</code>\u3002\u8981\u663e\u793a\u6240\u6709\u53d8\u91cf\u7684\u503c\uff0c\u5728\u8c03\u7528<code class=\"command\">\\set</code>\u65f6\u4e0d\u5e26\u4efb\u4f55\u53c2\u6570\u5373\u53ef\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\"><code class=\"command\">\\set</code>\u7684\u53c2\u6570\u670d\u4ece\u4e0e\u5176\u4ed6\u547d\u4ee4\u76f8\u540c\u7684\u66ff\u6362\u89c4\u5219\u3002\u56e0\u6b64\u53ef\u4ee5\u6784\u9020\u6709\u8da3\u7684\u5f15\u7528\uff0c\u4f8b\u5982<code class=\"literal\">\\set :foo 'something'</code>\u4ee5\u53ca\u5206\u522b\u5f97\u5230<span class=\"productname\">Perl</span>\u6216\u8005<span class=\"productname\"><acronym class=\"acronym\">PHP</acronym></span>\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u8f6f\u94fe\u63a5</span>\u201d</span>\u6216\u8005<span class=\"quote\">\u201c<span class=\"quote\">\u53ef\u53d8\u53d8\u91cf</span>\u201d</span>\u3002\u4e0d\u5e78\u7684\u662f\uff08\u6216\u8005\u5e78\u8fd0\u7684\u662f\uff1f\uff09\uff0c\u8fd9\u4e9b\u6784\u9020\u51fa\u6765\u7684\u4e1c\u897f\u5e76\u6ca1\u6709\u4ec0\u4e48\u7528\u5904\u3002\u5728\u53e6\u4e00\u65b9\u9762\uff0c<code class=\"literal\">\\set bar :foo</code>\u662f\u4e00\u79cd\u5f88\u597d\u7684\u62f7\u8d1d\u53d8\u91cf\u7684\u65b9\u6cd5\u3002</p>\n</div>\n<p lang=\"zh\">\u6709\u4e00\u4e9b\u53d8\u91cf\u4f1a\u88ab<span class=\"application\">psql</span>\u7279\u6b8a\u5bf9\u5f85\u3002\u5b83\u4eec\u8868\u793a\u7279\u5b9a\u7684\u9009\u9879\u8bbe\u7f6e\uff0c\u8fd0\u884c\u65f6\u8fd9\u7c7b\u9009\u9879\u8bbe\u7f6e\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539\u8be5\u53d8\u91cf\u7684\u503c\u6765\u6539\u53d8\uff0c\u6216\u8005\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u5b83\u4eec\u8868\u793a<span class=\"application\">psql</span>\u7684\u53ef\u66f4\u6539\u7684\u72b6\u6001\u3002\u6309\u7167\u60ef\u4f8b\uff0c\u6240\u6709\u88ab\u7279\u6b8a\u5bf9\u5f85\u7684\u53d8\u91cf\u7684\u540d\u79f0\u7531\u5168\u90e8\u5927\u5199\u5f62\u5f0f\u7684 ASCII \u5b57\u6bcd\uff08\u8fd8\u6709\u53ef\u80fd\u662f\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\uff09\u7ec4\u6210\u3002\u4e3a\u4e86\u786e\u4fdd\u672a\u6765\u6700\u5927\u7684\u517c\u5bb9\u6027\uff0c\u6700\u597d\u907f\u514d\u628a\u8fd9\u7c7b\u53d8\u91cf\u540d\u7528\u4e8e\u81ea\u5df1\u7684\u76ee\u7684\u3002</p>\n<p lang=\"zh\">\u63a7\u5236<span class=\"application\">psql</span>\u884c\u4e3a\u7684\u53d8\u91cf\u901a\u5e38\u4e0d\u80fd\u88ab\u53d6\u6d88\u8bbe\u7f6e\u6216\u8005\u8bbe\u7f6e\u4e3a\u65e0\u6548\u503c\u3002\u5141\u8bb8<code class=\"literal\">\\unset</code>\u547d\u4ee4\uff0c\u4f46\u5b83\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u5b83\u7684\u9ed8\u8ba4\u503c\u3002\u6ca1\u6709\u7b2c\u4e8c\u53c2\u6570\u7684<code class=\"literal\">\\set</code>\u547d\u4ee4\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\uff08\u5bf9\u4e8e\u63a5\u53d7\u8be5\u503c\u7684\u63a7\u5236\u53d8\u91cf\uff09\uff0c\u5bf9\u4e0d\u63a5\u53d7\u8be5\u503c\u7684\u53d8\u91cf\u5219\u4f1a\u62d2\u7edd\u8fd9\u4e2a\u547d\u4ee4\u3002\u6b64\u5916\uff0c\u63a5\u53d7\u503c<code class=\"literal\">on</code>\u548c<code class=\"literal\">off</code>\u7684\u63a7\u5236\u53d8\u91cf\u4e5f\u80fd\u63a5\u53d7\u5176\u4ed6\u5e38\u89c1\u7684\u5e03\u5c14\u503c\u62fc\u5199\u65b9\u5f0f\uff0c\u4f8b\u5982<code class=\"literal\">true</code>\u548c<code class=\"literal\">false</code>\u3002</p>\n<p lang=\"zh\">\u88ab\u7279\u6b8a\u5bf9\u5f85\u7684\u53d8\u91cf\u662f\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-VARIABLES-AUTOCOMMIT\"><span class=\"term\"><code class=\"varname\">AUTOCOMMIT</code> </span> </dt>\n<dd>\n<p lang=\"zh\">\u5728\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\uff08\u9ed8\u8ba4\uff09\u65f6\uff0c\u6bcf\u4e00\u4e2a SQL \u547d\u4ee4\u5728\u6210\u529f\u5b8c\u6210\u65f6\u4f1a\u88ab\u81ea\u52a8\u63d0\u4ea4\u3002\u5728\u8fd9\u79cd\u6a21\u5f0f\u4e2d\u8981\u63a8\u8fdf\u63d0\u4ea4\uff0c\u5fc5\u987b\u8f93\u5165\u4e00\u4e2a<code class=\"command\">BEGIN</code>\u6216\u8005<code class=\"command\">START TRANSACTION</code> SQL \u547d\u4ee4\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">off</code>\u6216\u8005\u88ab\u53d6\u6d88\u8bbe\u7f6e\u65f6\uff0c\u5728\u663e\u5f0f\u53d1\u51fa<code class=\"command\">COMMIT</code>\u6216\u8005<code class=\"command\">END</code>\u4e4b\u524d\uff0cSQL \u547d\u4ee4\u4e0d\u4f1a\u88ab\u63d0\u4ea4\u3002\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u4f1a\u4e3a\u4f60\u53d1\u51fa\u4e00\u4e2a\u9690\u5f0f\u7684<code class=\"command\">BEGIN</code>\uff0c\u8fd9\u4f1a\u53d1\u751f\u5728\u547d\u4ee4\u6267\u884c\u4e4b\u524d\uff0c\u524d\u63d0\u662f\u8be5\u547d\u4ee4\u4e0d\u5728\u4e8b\u52a1\u5757\u4e2d\uff0c\u4e14\u5176\u672c\u8eab\u65e2\u4e0d\u662f<code class=\"command\">BEGIN</code>\u6216\u5176\u4ed6\u4e8b\u52a1\u63a7\u5236\u547d\u4ee4\uff0c\u4e5f\u4e0d\u662f\u65e0\u6cd5\u5728\u4e8b\u52a1\u5757\u4e2d\u6267\u884c\u7684\u547d\u4ee4\uff08\u4f8b\u5982<code class=\"command\">VACUUM</code>\uff09\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u4e2d\uff0c\u5fc5\u987b\u901a\u8fc7<code class=\"command\">ABORT</code>\u6216\u8005<code class=\"command\">ROLLBACK</code>\u663e\u5f0f\u5730\u653e\u5f03\u4efb\u4f55\u5931\u8d25\u7684\u4e8b\u52a1\u3002\u8fd8\u8981\u8bb0\u4f4f\uff0c\u5982\u679c\u9000\u51fa\u4f1a\u8bdd\u65f6\u6ca1\u6709\u63d0\u4ea4\uff0c\u5219\u6240\u6709\u7684\u5de5\u4f5c\u90fd\u4f1a\u4e22\u5931\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u81ea\u52a8\u63d0\u4ea4\u6253\u5f00\u6a21\u5f0f\u662f<span class=\"productname\">PostgreSQL</span>\u7684\u4f20\u7edf\u884c\u4e3a\uff0c\u4f46\u662f\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u66f4\u63a5\u8fd1\u4e8e SQL \u7684\u89c4\u8303\u3002\u5982\u679c\u66f4\u559c\u6b22\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\uff0c\u53ef\u4ee5\u5728\u7cfb\u7edf\u7ea7\u7684<code class=\"filename\">psqlrc</code>\u6587\u4ef6\u6216\u8005\u4e2a\u4eba\u7684<code class=\"filename\">~/.psqlrc</code>\u6587\u4ef6\u4e2d\u8bbe\u7f6e\u5b83\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-COMP-KEYWORD-CASE\"><span class=\"term\"><code class=\"varname\">COMP_KEYWORD_CASE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u786e\u5b9a\u5728\u8865\u5168\u4e00\u4e2a SQL \u5173\u952e\u8bcd\u65f6\u8981\u4f7f\u7528\u7684\u5927\u5c0f\u5199\u5f62\u5f0f\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">lower</code>\u6216\u8005<code class=\"literal\">upper</code>\uff0c\u8865\u5168\u540e\u7684\u8bcd\u5c06\u5206\u522b\u662f\u5c0f\u5199\u6216\u8005\u5927\u5199\u5f62\u5f0f\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">preserve-lower</code>\u6216\u8005<code class=\"literal\">preserve-upper</code>\uff08\u9ed8\u8ba4\uff09\uff0c\u8865\u5168\u540e\u7684\u8bcd\u5c06\u4f1a\u4fdd\u6301\u8be5\u8bcd\u5df2\u8f93\u5165\u90e8\u5206\u7684\u5927\u5c0f\u5199\u5f62\u5f0f\uff0c\u4f46\u662f\u5982\u679c\u88ab\u8865\u5168\u7684\u8bcd\u8fd8\u6ca1\u6709\u88ab\u8f93\u5165\uff0c\u5219\u5b83\u4f1a\u88ab\u5206\u522b\u8865\u5168\u6210\u5c0f\u5199\u6216\u8005\u5927\u5199\u5f62\u5f0f\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-DBNAME\"><span class=\"term\"><code class=\"varname\">DBNAME</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u5df2\u8fde\u63a5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u662f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ECHO\"><span class=\"term\"><code class=\"varname\">ECHO</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">all</code>\uff0c\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u4f1a\u5728\u8bfb\u5165\u65f6\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u8bfb\u53d6\u7684\u884c\uff09\u3002\u8981\u5728\u7a0b\u5e8f\u5f00\u59cb\u65f6\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\uff0c\u53ef\u4ee5\u4f7f\u7528\u5f00\u5173<code class=\"option\">-a</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">queries</code>\uff0c<span class=\"application\">psql</span>\u4f1a\u5728\u53d1\u9001\u6bcf\u4e2a\u67e5\u8be2\u7ed9\u670d\u52a1\u5668\u65f6\u5c06\u5b83\u4eec\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\u3002\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\u7684\u5f00\u5173\u662f<code class=\"option\">-e</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">errors</code>\uff0c\u90a3\u4e48\u53ea\u6709\u5931\u8d25\u7684\u67e5\u8be2\u4f1a\u88ab\u663e\u793a\u5728\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u4e0a\u3002\u8fd9\u79cd\u884c\u4e3a\u7684\u5f00\u5173\u662f<code class=\"option\">-b</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">none</code>\uff08\u9ed8\u8ba4\u503c\uff09\u5219\u4e0d\u4f1a\u663e\u793a\u4efb\u4f55\u67e5\u8be2\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ECHO-HIDDEN\"><span class=\"term\"><code class=\"varname\">ECHO_HIDDEN</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u4e14\u4e00\u4e2a\u53cd\u659c\u7ebf\u547d\u4ee4\u67e5\u8be2\u6570\u636e\u5e93\u65f6\uff0c\u76f8\u5e94\u7684\u67e5\u8be2\u4f1a\u88ab\u5148\u663e\u793a\u3002\u8fd9\u79cd\u7279\u6027\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u5b66\u4e60<span class=\"productname\">PostgreSQL</span>\u7684\u5185\u90e8\u5e76\u4e14\u5728\u81ea\u5df1\u7684\u7a0b\u5e8f\u4e2d\u63d0\u4f9b\u7c7b\u4f3c\u7684\u529f\u80fd\uff08\u8981\u5728\u7a0b\u5e8f\u5f00\u59cb\u65f6\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\uff0c\u53ef\u4ee5\u4f7f\u7528\u5f00\u5173<code class=\"option\">-E</code>\uff09\u3002\u5982\u679c\u628a\u8fd9\u4e2a\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">noexec</code>\uff0c\u5219\u5bf9\u5e94\u7684\u67e5\u8be2\u53ea\u4f1a\u88ab\u663e\u793a\u800c\u5e76\u4e0d\u771f\u6b63\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u6267\u884c\u3002\u9ed8\u8ba4\u503c\u662f<code class=\"literal\">off</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ENCODING\"><span class=\"term\"><code class=\"varname\">ENCODING</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u7684\u5ba2\u6237\u7aef\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u6bcf\u4e00\u6b21\u4f60\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\uff09\u65f6\u4ee5\u53ca\u5f53\u4f60\u7528<code class=\"literal\">\\encoding</code>\u66f4\u6539\u7f16\u7801\u65f6\uff0c\u8fd9\u4e2a\u53d8\u91cf\u90fd\u4f1a\u88ab\u8bbe\u7f6e\uff0c\u4f46\u5b83\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ERROR\"><span class=\"term\"><code class=\"varname\">ERROR</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u4e0a\u4e00\u4e2aSQL\u67e5\u8be2\u5931\u8d25\u5219\u4e3a<code class=\"literal\">true</code>\uff0c\u5982\u679c\u6210\u529f\u5219\u662f<code class=\"literal\">false</code>\u3002\u53e6\u89c1<code class=\"varname\">SQLSTATE</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-FETCH-COUNT\"><span class=\"term\"><code class=\"varname\">FETCH_COUNT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a\u4e00\u4e2a\u5927\u4e8e\u96f6\u7684\u6574\u6570\u503c\uff0c<code class=\"command\">SELECT</code>\u67e5\u8be2\u7684\u7ed3\u679c\u4f1a\u4ee5\u4e00\u7ec4\u4e00\u7ec4\u7684\u65b9\u5f0f\u53d6\u51fa\u5e76\u4e14\u663e\u793a\uff08\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u7684\u90a3\u6837\u628a\u6574\u4e2a\u7ed3\u679c\u96c6\u62ff\u5230\u4ee5\u540e\u518d\u663e\u793a\uff09\uff0c\u6bcf\u7ec4\u5305\u542b\u7684\u884c\u6570\u7b49\u4e8e\u8be5\u6574\u6570\u503c\u3002\u56e0\u6b64\uff0c\u8fd9\u79cd\u65b9\u5f0f\u53ea\u4f1a\u4f7f\u7528\u6709\u9650\u7684\u5185\u5b58\u91cf\uff0c\u800c\u4e0d\u7ba1\u6574\u4e2a\u7ed3\u679c\u96c6\u7684\u5927\u5c0f\u3002\u5728\u542f\u7528\u8fd9\u4e2a\u7279\u6027\u65f6\uff0c\u901a\u5e38\u4f1a\u4f7f\u7528 100 \u5230 1000 \u7684\u8bbe\u7f6e\u3002\u8bb0\u4f4f\u5728\u4f7f\u7528\u8fd9\u79cd\u7279\u6027\u65f6\uff0c\u4e00\u4e2a\u67e5\u8be2\u53ef\u80fd\u4f1a\u5728\u5df2\u7ecf\u663e\u793a\u4e86\u4e00\u4e9b\u884c\u4e4b\u540e\u5931\u8d25\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5c3d\u7ba1\u53ef\u4ee5\u628a\u8fd9\u79cd\u7279\u6027\u7528\u4e8e\u4efb\u4f55\u7684\u8f93\u51fa\u683c\u5f0f\uff0c\u4f46\u662f\u9ed8\u8ba4\u7684<code class=\"literal\">aligned</code>\u683c\u5f0f\u770b\u8d77\u6765\u4f1a\u6bd4\u8f83\u7cdf\u7cd5\uff0c\u56e0\u4e3a\u6bcf\u4e00\u7ec4\u7684<code class=\"varname\">FETCH_COUNT</code>\u884c\u5c06\u88ab\u5355\u72ec\u683c\u5f0f\u5316\uff0c\u8fd9\u5c31\u4f1a\u5bfc\u81f4\u4e0d\u540c\u7684\u884c\u7ec4\u7684\u5217\u5bbd\u4e0d\u540c\u3002\u5176\u4ed6\u7684\u8f93\u51fa\u683c\u5f0f\u4f1a\u66f4\u597d\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HIDE-TABLEAM\"><span class=\"term\"><code class=\"varname\">HIDE_TABLEAM</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6b64\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">true</code>\uff0c\u5219\u4e0d\u663e\u793a\u8868\u7684\u8bbf\u95ee\u65b9\u6cd5\u7684\u8be6\u7ec6\u4fe1\u606f\u3002\u8fd9\u4e3b\u8981\u7528\u4e8e\u56de\u5f52\u6d4b\u8bd5\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HIDE-TOAST-COMPRESSION\"><span class=\"term\"><code class=\"varname\">HIDE_TOAST_COMPRESSION</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">true</code>\uff0c\u4e0d\u663e\u793a\u5217\u538b\u7f29\u65b9\u6cd5\u7684\u7ec6\u8282\u3002\u8fd9\u4e3b\u8981\u7528\u4e8e\u56de\u5f52\u6d4b\u8bd5\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HISTCONTROL\"><span class=\"term\"><code class=\"varname\">HISTCONTROL</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">ignorespace</code>\uff0c\u5219\u4ee5\u4e00\u4e2a\u7a7a\u683c\u5f00\u59cb\u7684\u884c\u4e0d\u4f1a\u88ab\u653e\u5165\u5230\u5386\u53f2\u5217\u8868\u4e2d\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">ignoredups</code>\uff0c\u5219\u4e0e\u4e0a\u4e00\u6761\u5386\u53f2\u8bb0\u5f55\u76f8\u540c\u7684\u884c\u4e0d\u4f1a\u88ab\u653e\u5165\u3002\u503c<code class=\"literal\">ignoreboth</code>\u7ec4\u5408\u4e86\u4e0a\u8ff0\u4e24\u79cd\u503c\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">none</code>\uff08\u9ed8\u8ba4\u503c\uff09\uff0c\u6240\u6709\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e2d\u88ab\u8bfb\u5165\u7684\u884c\u90fd\u4f1a\u4fdd\u5b58\u5728\u5386\u53f2\u5217\u8868\u4e2d\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HISTFILE\"><span class=\"term\"><code class=\"varname\">HISTFILE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8be5\u6587\u4ef6\u540d\u5c06\u88ab\u7528\u4e8e\u5b58\u50a8\u5386\u53f2\u5217\u8868\u3002\u5982\u679c\u672a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff0c\u6587\u4ef6\u540d\u5c06\u4ece<code class=\"envar\">PSQL_HISTORY</code>\u73af\u5883\u53d8\u91cf\u4e2d\u53d6\u5f97\u3002\u5982\u679c\u8be5\u73af\u5883\u53d8\u91cf\u4e5f\u6ca1\u6709\u88ab\u8bbe\u7f6e\uff0c\u5219\u9ed8\u8ba4\u503c\u662f<code class=\"filename\">~/.psql_history</code>\uff0c\u5728Windows\u4e0a\u662f<code class=\"filename\">%APPDATA%\\postgresql\\psql_history</code>\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">\\set HISTFILE ~/.psql_history-:DBNAME\n</pre>\n<p lang=\"zh\">\u653e\u5728<code class=\"filename\">~/.psqlrc</code>\u4e2d\u5c06\u4f1a\u5bfc\u81f4<span class=\"application\">psql</span>\u4e3a\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u7ef4\u62a4\u4e00\u4e2a\u5355\u72ec\u7684\u5386\u53f2\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HISTSIZE\"><span class=\"term\"><code class=\"varname\">HISTSIZE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u547d\u4ee4\u5386\u53f2\u4e2d\u6700\u591a\u4fdd\u5b58\u7684\u547d\u4ee4\u6570\uff08\u9ed8\u8ba4 500\uff09\u3002\u8bbe\u4e3a\u8d1f\u503c\u65f6\uff0c\u4e0d\u8bbe\u4e0a\u9650\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HOST\"><span class=\"term\"><code class=\"varname\">HOST</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e3b\u673a\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u4e5f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-IGNOREEOF\"><span class=\"term\"><code class=\"varname\">IGNOREEOF</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8bbe\u4e3a 1 \u6216\u66f4\u5c0f\u7684\u503c\uff0c\u5411 psql \u4ea4\u4e92\u4f1a\u8bdd\u53d1\u9001 EOF \u5b57\u7b26\uff08\u901a\u5e38\u4e3a Control + D\uff09\u5c31\u4f1a\u7ec8\u6b62\u5e94\u7528\u3002\u5982\u679c\u8bbe\u4e3a\u66f4\u5927\u7684\u6570\u503c\uff0c\u5219\u5fc5\u987b\u8fde\u7eed\u8f93\u5165\u76f8\u5e94\u6b21\u6570\u7684 EOF \u5b57\u7b26\u624d\u4f1a\u7ec8\u6b62\u4ea4\u4e92\u4f1a\u8bdd\u3002\u5982\u679c\u53d8\u91cf\u8bbe\u4e3a\u975e\u6570\u503c\uff0c\u4f1a\u88ab\u89e3\u91ca\u4e3a 10\u3002\u9ed8\u8ba4\u503c\u4e3a 0\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-LASTOID\"><span class=\"term\"><code class=\"varname\">LASTOID</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6700\u8fd1\u4e00\u6b21\u53d7\u5f71\u54cd\u7684 OID \u503c\uff0c\u7531 INSERT \u6216 \\lo_import \u547d\u4ee4\u8fd4\u56de\u3002\u6b64\u53d8\u91cf\u4ec5\u4fdd\u8bc1\u5728\u4e0b\u4e00\u6761 SQL \u547d\u4ee4\u7684\u7ed3\u679c\u663e\u793a\u4e4b\u524d\u6709\u6548\u3002\u4ece\u7248\u672c 12 \u8d77\uff0cPostgreSQL \u670d\u52a1\u5668\u4e0d\u518d\u652f\u6301 OID \u7cfb\u7edf\u5217\uff0c\u56e0\u6b64\u8fde\u63a5\u5230\u8fd9\u4e9b\u670d\u52a1\u5668\u65f6\uff0c\u6267\u884c INSERT \u540e LASTOID \u59cb\u7ec8\u4e3a 0\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-LAST-ERROR-MESSAGE\"><span class=\"term\"><code class=\"varname\">LAST_ERROR_MESSAGE</code><br/></span><span class=\"term\"><code class=\"varname\">LAST_ERROR_SQLSTATE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d<span class=\"application\">psql</span>\u4f1a\u8bdd\u4e2d\u6700\u8fd1\u4e00\u4e2a\u5931\u8d25\u67e5\u8be2\u7684\u4e3b\u9519\u8bef\u6d88\u606f\u548c\u76f8\u5173\u7684SQLSTATE\u4ee3\u7801\uff0c\u5982\u679c\u5728\u5f53\u524d\u4f1a\u8bdd\u4e2d\u6ca1\u6709\u53d1\u751f\u9519\u8bef\uff0c\u5219\u662f\u4e00\u4e2a\u7a7a\u5b57\u7b26\u4e32\u548c<code class=\"literal\">00000</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ON-ERROR-ROLLBACK\"><span class=\"term\"><code class=\"varname\">ON_ERROR_ROLLBACK</code> </span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u65f6\uff0c\u5982\u679c\u4e8b\u52a1\u5757\u4e2d\u7684\u4e00\u4e2a\u8bed\u53e5\u4ea7\u751f\u4e00\u4e2a\u9519\u8bef\uff0c\u8be5\u9519\u8bef\u4f1a\u88ab\u5ffd\u7565\u5e76\u4e14\u8be5\u4e8b\u52a1\u4f1a\u7ee7\u7eed\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">interactive</code>\u65f6\uff0c\u53ea\u5728\u4ea4\u4e92\u5f0f\u4f1a\u8bdd\u4e2d\u5ffd\u7565\u8fd9\u7c7b\u9519\u8bef\uff0c\u800c\u8bfb\u53d6\u811a\u672c\u6587\u4ef6\u65f6\u5219\u4e0d\u4f1a\u5ffd\u7565\u9519\u8bef\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">off</code>\uff08\u9ed8\u8ba4\u503c\uff09\u65f6\uff0c\u4e8b\u52a1\u5757\u4e2d\u4ea7\u751f\u9519\u8bef\u7684\u4e00\u4e2a\u8bed\u53e5\u4f1a\u4e2d\u6b62\u6574\u4e2a\u4e8b\u52a1\u3002\u9519\u8bef\u56de\u6eda\u6a21\u5f0f\u7684\u5de5\u4f5c\u539f\u7406\u662f\u5728\u4e8b\u52a1\u5757\u7684\u6bcf\u4e2a\u547d\u4ee4\u4e4b\u524d\u90fd\u4e3a\u4f60\u53d1\u51fa\u4e00\u4e2a\u9690\u5f0f\u7684<code class=\"command\">SAVEPOINT</code>\uff0c\u7136\u540e\u5728\u8be5\u547d\u4ee4\u5931\u8d25\u65f6\u56de\u6eda\u5230\u8be5\u4fdd\u5b58\u70b9\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ON-ERROR-STOP\"><span class=\"term\"><code class=\"varname\">ON_ERROR_STOP</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u51fa\u9519\u540e\u4ecd\u4f1a\u7ee7\u7eed\u5904\u7406\u547d\u4ee4\u3002\u5c06\u6b64\u53d8\u91cf\u8bbe\u4e3a on \u540e\uff0c\u5904\u7406\u4f1a\u7acb\u5373\u505c\u6b62\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\uff0cpsql \u4f1a\u8fd4\u56de\u547d\u4ee4\u63d0\u793a\u7b26\uff1b\u5426\u5219\uff0cpsql \u4f1a\u9000\u51fa\u5e76\u8fd4\u56de\u9519\u8bef\u7801 3\uff0c\u4ee5\u533a\u522b\u4e8e\u9519\u8bef\u7801 1 \u6240\u8868\u793a\u7684\u81f4\u547d\u9519\u8bef\u3002\u65e0\u8bba\u54ea\u79cd\u60c5\u51b5\uff0c\u5f53\u524d\u6b63\u5728\u8fd0\u884c\u7684\u6240\u6709\u811a\u672c\uff08\u5982\u679c\u5b58\u5728\u9876\u5c42\u811a\u672c\uff0c\u5219\u5305\u62ec\u8be5\u811a\u672c\u53ca\u5176\u8c03\u7528\u7684\u5176\u4ed6\u811a\u672c\uff09\u90fd\u4f1a\u7acb\u5373\u7ec8\u6b62\u3002\u5982\u679c\u9876\u5c42\u547d\u4ee4\u5b57\u7b26\u4e32\u5305\u542b\u591a\u6761 SQL \u547d\u4ee4\uff0c\u5219\u4f1a\u5728\u5f53\u524d\u547d\u4ee4\u5904\u505c\u6b62\u5904\u7406\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-PIPELINE-COMMAND-COUNT\"><span class=\"term\"><code class=\"varname\">PIPELINE_COMMAND_COUNT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6b63\u5728\u8fd0\u884c\u7684\u7ba1\u9053\u4e2d\u6392\u961f\u7684\u547d\u4ee4\u6570\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-PIPELINE-RESULT-COUNT\"><span class=\"term\"><code class=\"varname\">PIPELINE_RESULT_COUNT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6b63\u5728\u8fdb\u884c\u7684\u7ba1\u9053\u4e2d\uff0c\u6709\u591a\u5c11\u6761\u547d\u4ee4\u540e\u9762\u8ddf\u7740 <code class=\"command\">\\flushrequest</code> \u6216 <code class=\"command\">\\syncpipeline</code>\uff0c\u4ece\u800c\u5f3a\u5236\u670d\u52a1\u5668\u53d1\u9001\u7ed3\u679c\u3002\u8fd9\u4e9b\u7ed3\u679c\u53ef\u4ee5\u901a\u8fc7 <code class=\"command\">\\getresults</code> \u53d6\u56de\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-PIPELINE-SYNC-COUNT\"><span class=\"term\"><code class=\"varname\">PIPELINE_SYNC_COUNT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6b63\u5728\u8fd0\u884c\u7684\u7ba1\u9053\u4e2d\u6392\u961f\u7684\u540c\u6b65\u6d88\u606f\u6570\u91cf\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-PORT\"><span class=\"term\"><code class=\"varname\">PORT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u7aef\u53e3\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u4e5f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-PROMPT\"><span class=\"term\"><code class=\"varname\">PROMPT1</code><br/></span><span class=\"term\"><code class=\"varname\">PROMPT2</code><br/></span><span class=\"term\"><code class=\"varname\">PROMPT3</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e9b\u53d8\u91cf\u6307\u5b9a<span class=\"application\">psql</span>\u53d1\u51fa\u7684\u63d0\u793a\u7b26\u7684\u6a21\u6837\u3002\u89c1\u4e0b\u6587\u7684<a class=\"xref\" href=\"/docs/devel/app-psql.html#APP-PSQL-PROMPTING\" title=\"\u63d0\u793a\u7b26\">\u63d0\u793a\u7b26</a>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-QUIET\"><span class=\"term\"><code class=\"varname\">QUIET</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u8fd9\u4e2a\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-q</code>\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\u53ef\u80fd\u7528\u5904\u4e0d\u5927\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ROW-COUNT\"><span class=\"term\"><code class=\"varname\">ROW_COUNT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6700\u8fd1\u4e00\u6761 SQL \u67e5\u8be2\u8fd4\u56de\u6216\u5f71\u54cd\u7684\u884c\u6570\uff1b\u5982\u679c\u67e5\u8be2\u5931\u8d25\u6216\u6ca1\u6709\u62a5\u544a\u884c\u6570\uff0c\u5219\u4e3a 0\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SERVER-VERSION-NAME\"><span class=\"term\"><code class=\"varname\">SERVER_VERSION_NAME</code><br/></span><span class=\"term\"><code class=\"varname\">SERVER_VERSION_NUM</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b57\u7b26\u4e32\u5f62\u5f0f\u7684\u670d\u52a1\u5668\u7248\u672c\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">9.6.2</code>\u3001<code class=\"literal\">10.1</code>\u6216\u8005<code class=\"literal\">11beta1</code>\uff0c\u4ee5\u53ca\u6570\u5b57\u5f62\u5f0f\u7684\u670d\u52a1\u5668\u7248\u672c\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">90602</code>\u6216\u8005<code class=\"literal\">100001</code>\u3002\u6bcf\u6b21\u4f60\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\uff09\u65f6\uff0c\u8fd9\u4e9b\u90fd\u4f1a\u88ab\u8bbe\u7f6e\uff0c\u4f46\u53ef\u4ee5\u88ab\u6539\u53d8\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SERVICE\"><span class=\"term\"><code class=\"varname\">SERVICE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u670d\u52a1\u540d\u79f0\uff08\u5982\u679c\u9002\u7528\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SERVICEFILE\"><span class=\"term\"><code class=\"varname\">SERVICEFILE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u670d\u52a1\u6587\u4ef6\u540d\uff08\u5982\u679c\u9002\u7528\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SHELL-ERROR\"><span class=\"term\"><code class=\"varname\">SHELL_ERROR</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6700\u540e\u4e00\u4e2a shell \u547d\u4ee4\u5931\u8d25\uff0c\u5219\u4e3a <code class=\"literal\">true</code>\uff1b\u5982\u679c\u6210\u529f\uff0c\u5219\u4e3a <code class=\"literal\">false</code>\u3002\u8fd9\u9002\u7528\u4e8e\u901a\u8fc7 <code class=\"literal\">\\!</code>\u3001<code class=\"literal\">\\g</code>\u3001<code class=\"literal\">\\o</code>\u3001<code class=\"literal\">\\w</code> \u548c <code class=\"literal\">\\copy</code> \u5143\u547d\u4ee4\u8c03\u7528\u7684 shell \u547d\u4ee4\uff0c\u4e5f\u9002\u7528\u4e8e\u53cd\u5f15\u53f7\uff08<code class=\"literal\">`</code>\uff09\u6269\u5c55\u3002\u8bf7\u6ce8\u610f\uff0c\u5bf9\u4e8e <code class=\"literal\">\\o</code>\uff0c\u8be5\u53d8\u91cf\u4f1a\u5728\u4e0b\u4e00\u4e2a <code class=\"literal\">\\o</code> \u547d\u4ee4\u5173\u95ed\u8f93\u51fa\u7ba1\u9053\u65f6\u66f4\u65b0\u3002\u53e6\u89c1 <code class=\"varname\">SHELL_EXIT_CODE</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SHELL-EXIT-CODE\"><span class=\"term\"><code class=\"varname\">SHELL_EXIT_CODE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u540e\u4e00\u4e2a shell \u547d\u4ee4\u8fd4\u56de\u7684\u9000\u51fa\u72b6\u6001\u30020\u2013127 \u8868\u793a\u7a0b\u5e8f\u9000\u51fa\u7801\uff0c128\u2013255 \u8868\u793a\u56e0\u4fe1\u53f7\u800c\u7ec8\u6b62\uff0c-1 \u8868\u793a\u672a\u80fd\u542f\u52a8\u7a0b\u5e8f\u6216\u672a\u80fd\u53d6\u5f97\u5176\u9000\u51fa\u72b6\u6001\u3002\u8fd9\u9002\u7528\u4e8e\u901a\u8fc7 <code class=\"literal\">\\!</code>\u3001<code class=\"literal\">\\g</code>\u3001<code class=\"literal\">\\o</code>\u3001<code class=\"literal\">\\w</code> \u548c <code class=\"literal\">\\copy</code> \u5143\u547d\u4ee4\u8c03\u7528\u7684 shell \u547d\u4ee4\uff0c\u4e5f\u9002\u7528\u4e8e\u53cd\u5f15\u53f7\uff08<code class=\"literal\">`</code>\uff09\u6269\u5c55\u3002\u8bf7\u6ce8\u610f\uff0c\u5bf9\u4e8e <code class=\"literal\">\\o</code>\uff0c\u8be5\u53d8\u91cf\u4f1a\u5728\u4e0b\u4e00\u4e2a <code class=\"literal\">\\o</code> \u547d\u4ee4\u5173\u95ed\u8f93\u51fa\u7ba1\u9053\u65f6\u66f4\u65b0\u3002\u53e6\u89c1 <code class=\"varname\">SHELL_ERROR</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SHOW-ALL-RESULTS\"><span class=\"term\"><code class=\"varname\">SHOW_ALL_RESULTS</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u6b64\u53d8\u91cf\u88ab\u8bbe\u4e3a <code class=\"literal\">off</code> \u65f6\uff0c\u7ec4\u5408\u67e5\u8be2\uff08<code class=\"literal\">\\;</code>\uff09\u53ea\u663e\u793a\u6700\u540e\u4e00\u4e2a\u7ed3\u679c\uff0c\u800c\u4e0d\u662f\u663e\u793a\u5168\u90e8\u7ed3\u679c\u3002\u9ed8\u8ba4\u503c\u4e3a <code class=\"literal\">on</code>\u3002\u8bbe\u4e3a off \u7684\u884c\u4e3a\u662f\u4e3a\u4e86\u517c\u5bb9\u65e7\u7248\u672c\u7684 <span class=\"application\">psql</span>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SHOW-CONTEXT\"><span class=\"term\"><code class=\"varname\">SHOW_CONTEXT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u53d8\u91cf\u53ef\u4ee5\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">never</code>\u3001<code class=\"literal\">errors</code>\u6216\u8005<code class=\"literal\">always</code>\u6765\u63a7\u5236\u662f\u5426\u5728\u6765\u81ea\u670d\u52a1\u5668\u7684\u6d88\u606f\u4e2d\u663e\u793a<code class=\"literal\">CONTEXT</code>\u5b57\u6bb5\u3002\u9ed8\u8ba4\u662f<code class=\"literal\">errors</code>\uff08\u8868\u793a\u5728\u9519\u8bef\u6d88\u606f\u4e2d\u663e\u793a\u4e0a\u4e0b\u6587\uff0c\u4f46\u5728\u901a\u77e5\u548c\u8b66\u544a\u6d88\u606f\u4e2d\u4e0d\u663e\u793a\uff09\u3002\u5f53<code class=\"varname\">VERBOSITY</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">terse</code>\u6216<code class=\"literal\">sqlstate</code>\u65f6\uff0c\u8fd9\u4e2a\u8bbe\u7f6e\u65e0\u6548\uff08\u53e6\u89c1<code class=\"command\">\\errverbose</code>\uff0c\u5b83\u53ef\u4ee5\u7528\u6765\u5f97\u5230\u521a\u9047\u5230\u7684\u9519\u8bef\u7684\u8be6\u7ec6\u4fe1\u606f\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SINGLELINE\"><span class=\"term\"><code class=\"varname\">SINGLELINE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u8fd9\u4e2a\u53d8\u91cf\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-S</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SINGLESTEP\"><span class=\"term\"><code class=\"varname\">SINGLESTEP</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u8fd9\u4e2a\u53d8\u91cf\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-s</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SQLSTATE\"><span class=\"term\"><code class=\"varname\">SQLSTATE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0e\u4e0a\u4e00\u4e2aSQL\u67e5\u8be2\u7684\u5931\u8d25\u76f8\u5173\u7684\u9519\u8bef\u4ee3\u7801\uff08\u89c1<a class=\"xref\" href=\"/docs/devel/errcodes-appendix.html\" title=\"\u9644\u5f55\u00a0A.\u00a0PostgreSQL\u9519\u8bef\u4ee3\u7801\">\u9644\u5f55\u00a0A</a>\uff09\uff0c\u5982\u679c\u4e0a\u4e00\u4e2a\u67e5\u8be2\u6210\u529f\u5219\u4e3a<code class=\"literal\">00000</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-USER\"><span class=\"term\"><code class=\"varname\">USER</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7528\u6237\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u662f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-VERBOSITY\"><span class=\"term\"><code class=\"varname\">VERBOSITY</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u53d8\u91cf\u53ef\u4ee5\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">default</code>\u3001<code class=\"literal\">verbose</code>\u3001<code class=\"literal\">terse</code>\u6216\u8005<code class=\"literal\">sqlstate</code>\u6765\u63a7\u5236\u9519\u8bef\u62a5\u544a\u7684\u8be6\u7ec6\u7a0b\u5ea6\uff08\u53e6\u89c1<code class=\"command\">\\errverbose</code>\uff0c\u5728\u60f3\u5f97\u5230\u521a\u9047\u5230\u7684\u9519\u8bef\u7684\u8be6\u7ec6\u4fe1\u606f\u65f6\u4f7f\u7528\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-VERSION\"><span class=\"term\"><code class=\"varname\">VERSION</code><br/></span><span class=\"term\"><code class=\"varname\">VERSION_NAME</code><br/></span><span class=\"term\"><code class=\"varname\">VERSION_NUM</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e9b\u53d8\u91cf\u5728\u7a0b\u5e8f\u542f\u52a8\u65f6\u88ab\u8bbe\u7f6e\u4ee5\u53cd\u6620<span class=\"application\">psql</span>\u7684\u7248\u672c\uff0c\u5206\u522b\u662f\u4e00\u4e2a\u8be6\u7ec6\u7684\u5b57\u7b26\u4e32\u3001\u4e00\u4e2a\u77ed\u5b57\u7b26\u4e32\uff08\u4f8b\u5982<code class=\"literal\">9.6.2</code>\u3001<code class=\"literal\">10.1</code>\u6216\u8005<code class=\"literal\">11beta1</code>\uff09\u4ee5\u53ca\u4e00\u4e2a\u6570\u5b57\uff08\u4f8b\u5982<code class=\"literal\">90602</code>\u6216\u8005<code class=\"literal\">100001</code>\uff09\u3002\u5b83\u4eec\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-WATCH-INTERVAL\"><span class=\"term\"><code class=\"varname\">WATCH_INTERVAL</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6b64\u53d8\u91cf\u8bbe\u7f6e<code class=\"command\">\\watch</code>\u5728\u4e24\u6b21\u6267\u884c\u67e5\u8be2\u4e4b\u95f4\u7b49\u5f85\u7684\u9ed8\u8ba4\u95f4\u9694\uff0c\u5355\u4f4d\u4e3a\u79d2\u3002\u9ed8\u8ba4\u503c\u4e3a 2 \u79d2\u3002\u82e5\u5728\u547d\u4ee4\u4e2d\u6307\u5b9a\u4e86\u95f4\u9694\uff0c\u5219\u4f1a\u8986\u76d6\u6b64\u53d8\u91cf\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-INTERPOLATION\">\n<h4 lang=\"zh\">SQL \u63d2\u503c</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u53d8\u91cf\u7684\u4e00\u4e2a\u5173\u952e\u7279\u6027\u662f\u53ef\u4ee5\u628a\u5b83\u4eec\u66ff\u6362\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u63d2\u503c</span>\u201d</span>\uff09\u5230\u5e38\u89c4<acronym class=\"acronym\">SQL</acronym>\u8bed\u53e5\u4e2d\uff0c\u4e5f\u53ef\u4ee5\u628a\u5b83\u4eec\u66ff\u6362\u5230\u5143\u547d\u4ee4\u7684\u53c2\u6570\u4e2d\u3002\u6b64\u5916\uff0c<span class=\"application\">psql</span>\u8fd8\u63d0\u4f9b\u4e86\u529f\u80fd\u6765\u786e\u4fdd\u88ab\u7528\u4f5c SQL \u5b57\u9762\u91cf\u548c\u6807\u8bc6\u7b26\u7684\u53d8\u91cf\u503c\u4f1a\u88ab\u6b63\u786e\u5730\u52a0\u5f15\u53f7\u3002\u4e0d\u52a0\u5f15\u53f7\u5730\u63d2\u503c\u4e00\u4e2a\u503c\u7684\u8bed\u6cd5\u662f\u5728\u53d8\u91cf\u540d\u524d\u9762\u52a0\u4e0a\u4e00\u4e2a\u5192\u53f7\uff08<code class=\"literal\">:</code>\uff09\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo 'my_table'</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM :foo;</code></strong>\n</pre>\n<p lang=\"zh\">\u5c06\u67e5\u8be2\u8868<code class=\"structname\">my_table</code>\u3002\u6ce8\u610f\u8fd9\u53ef\u80fd\u4f1a\u4e0d\u5b89\u5168\uff1a\u8be5\u53d8\u91cf\u7684\u503c\u4f1a\u88ab\u6309\u5b57\u9762\u62f7\u8d1d\uff0c\u56e0\u6b64\u5b83\u53ef\u80fd\u5305\u542b\u4e0d\u5e73\u8861\u7684\u5f15\u53f7\u751a\u81f3\u53cd\u659c\u7ebf\u547d\u4ee4\u3002\u5fc5\u987b\u786e\u4fdd\u628a\u5b83\u653e\u5728\u90a3\u91cc\u662f\u6709\u610f\u4e49\u7684\u3002</p>\n<p lang=\"zh\">\u5f53\u4e00\u4e2a\u503c\u8981\u7528\u4f5c SQL \u5b57\u9762\u91cf\u6216\u6807\u8bc6\u7b26\u65f6\uff0c\u6700\u5b89\u5168\u7684\u505a\u6cd5\u662f\u4e3a\u5b83\u52a0\u4e0a\u5f15\u53f7\u3002\u8981\u5c06\u53d8\u91cf\u503c\u4f5c\u4e3a SQL \u5b57\u9762\u91cf\u52a0\u5f15\u53f7\uff0c\u5e94\u5199\u4e00\u4e2a\u5192\u53f7\uff0c\u540e\u9762\u8ddf\u7528\u5355\u5f15\u53f7\u62ec\u8d77\u6765\u7684\u53d8\u91cf\u540d\u3002\u8981\u5c06\u53d8\u91cf\u503c\u4f5c\u4e3a SQL \u6807\u8bc6\u7b26\u52a0\u5f15\u53f7\uff0c\u5219\u5728\u5192\u53f7\u540e\u9762\u7528\u53cc\u5f15\u53f7\u62ec\u8d77\u53d8\u91cf\u540d\u3002\u8fd9\u4e9b\u5199\u6cd5\u80fd\u6b63\u786e\u5904\u7406\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165\u7684\u5f15\u53f7\u548c\u5176\u4ed6\u7279\u6b8a\u5b57\u7b26\u3002\u524d\u9762\u7684\u793a\u4f8b\u53ef\u7528\u4ee5\u4e0b\u66f4\u5b89\u5168\u7684\u5199\u6cd5\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo 'my_table'</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM :\"foo\";</code></strong>\n</pre>\n<p lang=\"zh\">\u5728\u52a0\u5f15\u53f7\u7684<acronym class=\"acronym\">SQL</acronym>\u5b57\u9762\u91cf\u548c\u6807\u8bc6\u7b26\u5185\u90e8\uff0c\u4e0d\u4f1a\u6267\u884c\u53d8\u91cf\u63d2\u503c\u3002\u56e0\u6b64\uff0c<code class=\"literal\">':foo'</code>\u8fd9\u6837\u7684\u5199\u6cd5\u4e0d\u80fd\u6839\u636e\u53d8\u91cf\u503c\u751f\u6210\u52a0\u5f15\u53f7\u7684\u5b57\u9762\u91cf\uff08\u5373\u4f7f\u80fd\u591f\u751f\u6548\uff0c\u4e5f\u4e0d\u5b89\u5168\uff0c\u56e0\u4e3a\u5b83\u65e0\u6cd5\u6b63\u786e\u5904\u7406\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165\u7684\u5f15\u53f7\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8fd9\u79cd\u673a\u5236\u7684\u4e00\u4e2a\u793a\u4f8b\u662f\u628a\u4e00\u4e2a\u6587\u4ef6\u7684\u5185\u5bb9\u62f7\u8d1d\u5230\u4e00\u4e2a\u8868\u5217\u4e2d\u3002\u9996\u5148\u628a\u8be5\u6587\u4ef6\u8f7d\u5165\u5230\u4e00\u4e2a\u53d8\u91cf\uff0c\u7136\u540e\u628a\u8be5\u53d8\u91cf\u7684\u503c\u4f5c\u4e3a\u4e00\u4e2a\u52a0\u5f15\u53f7\u7684\u5b57\u7b26\u4e32\u8fdb\u884c\u63d2\u503c\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set content `cat my_file.txt`</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>INSERT INTO my_table VALUES (:'content');</code></strong>\n</pre>\n<p lang=\"zh\">\uff08\u6ce8\u610f\u5982\u679c<code class=\"filename\">my_file.txt</code>\u5305\u542b NUL \u5b57\u8282\uff0c\u8fd9\u6837\u4e5f\u4e0d\u884c\u3002<span class=\"application\">psql</span>\u4e0d\u652f\u6301\u5728\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165 NUL \u5b57\u8282\uff09\u3002</p>\n<p lang=\"zh\">\u56e0\u4e3a\u5192\u53f7\u53ef\u4ee5\u5408\u6cd5\u5730\u51fa\u73b0\u5728 SQL \u547d\u4ee4\u4e2d\uff0c\u770b\u4f3c\u63d2\u503c\u7684\u5199\u6cd5\uff08\u5373<code class=\"literal\">:name</code>\u3001<code class=\"literal\">:'name'</code>\u6216\u8005<code class=\"literal\">:\"name\"</code>\uff09\u4e0d\u4f1a\u88ab\u66ff\u6362\uff0c\u9664\u975e\u6240\u6307\u7684\u53d8\u91cf\u5f53\u524d\u5df2\u8bbe\u7f6e\u3002\u5728\u4efb\u4f55\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u7528\u4e00\u4e2a\u53cd\u659c\u7ebf\u5bf9\u5192\u53f7\u8fdb\u884c\u8f6c\u4e49\u4ee5\u907f\u514d\u5b83\u88ab\u66ff\u6362\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">:{?<em class=\"replaceable\"><code>name</code></em>}</code>\u7279\u6b8a\u8bed\u6cd5\u4f1a\u6839\u636e\u8be5\u53d8\u91cf\u662f\u5426\u5b58\u5728\u8fd4\u56de TRUE \u6216 FALSE\uff0c\u56e0\u6b64\u603b\u662f\u4f1a\u88ab\u66ff\u6362\uff0c\u9664\u975e\u5192\u53f7\u88ab\u53cd\u659c\u7ebf\u8f6c\u4e49\u3002</p>\n<p lang=\"zh\">\u53d8\u91cf\u7684\u5192\u53f7\u8bed\u6cd5\u5bf9\u5d4c\u5165\u5f0f\u67e5\u8be2\u8bed\u8a00\uff08\u4f8b\u5982<span class=\"application\">ECPG</span>\uff09\u6765\u8bf4\u662f\u6807\u51c6\u7684<acronym class=\"acronym\">SQL</acronym>\u3002\u7528\u4e8e\u6570\u7ec4\u5207\u7247\u548c\u7c7b\u578b\u8f6c\u6362\u7684\u5192\u53f7\u8bed\u6cd5\u662f<span class=\"productname\">PostgreSQL</span>\u6269\u5c55\uff0c\u5b83\u6709\u65f6\u53ef\u80fd\u4f1a\u4e0e\u6807\u51c6\u7528\u6cd5\u51b2\u7a81\u3002\u628a\u4e00\u4e2a\u53d8\u91cf\u503c\u8f6c\u4e49\u6210 SQL \u5b57\u9762\u91cf\u6216\u8005\u6807\u8bc6\u7b26\u7684\u5192\u53f7\u52a0\u5f15\u53f7\u8bed\u6cd5\u662f\u4e00\u79cd<span class=\"application\">psql</span>\u6269\u5c55\u3002</p>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-PROMPTING\">\n<h4 lang=\"zh\">\u63d0\u793a\u7b26</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u53d1\u51fa\u7684\u63d0\u793a\u7b26\u53ef\u4ee5\u6309\u4f60\u7684\u559c\u597d\u8fdb\u884c\u5b9a\u5236\u3002<code class=\"varname\">PROMPT1</code>\u3001<code class=\"varname\">PROMPT2</code> \u548c <code class=\"varname\">PROMPT3</code> \u8fd9\u4e09\u4e2a\u53d8\u91cf\u5305\u542b\u63cf\u8ff0\u63d0\u793a\u7b26\u5916\u89c2\u7684\u5b57\u7b26\u4e32\u548c\u7279\u6b8a\u8f6c\u4e49\u5e8f\u5217\u3002\u63d0\u793a\u7b26 1 \u662f <span class=\"application\">psql</span> \u8bf7\u6c42\u65b0\u547d\u4ee4\u65f6\u53d1\u51fa\u7684\u5e38\u89c4\u63d0\u793a\u7b26\u3002\u63d0\u793a\u7b26 2 \u4f1a\u5728\u5f55\u5165\u547d\u4ee4\u671f\u95f4\u8fd8\u9700\u8981\u66f4\u591a\u8f93\u5165\u65f6\u53d1\u51fa\uff0c\u4f8b\u5982\u547d\u4ee4\u5c1a\u672a\u4ee5\u5206\u53f7\u7ed3\u675f\uff0c\u6216\u8005\u5f15\u53f7\u5c1a\u672a\u95ed\u5408\u65f6\u3002\u5728\u6267\u884c <acronym class=\"acronym\">SQL</acronym> <code class=\"command\">COPY FROM STDIN</code> \u547d\u4ee4\u5e76\u9700\u8981\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4e00\u884c\u503c\u65f6\uff0c\u4f1a\u53d1\u51fa\u63d0\u793a\u7b26 3\u3002</p>\n<p lang=\"zh\">\u9009\u4e2d\u7684\u63d0\u793a\u7b26\u53d8\u91cf\u503c\u4f1a\u6309\u5b57\u9762\u8f93\u51fa\uff0c\u9664\u975e\u9047\u5230\u767e\u5206\u53f7\uff08<code class=\"literal\">%</code>\uff09\u3002\u6839\u636e\u4e0b\u4e00\u4e2a\u5b57\u7b26\u7684\u4e0d\u540c\uff0c\u4f1a\u66ff\u6362\u6210\u67d0\u4e9b\u5176\u4ed6\u6587\u672c\u3002\u5df2\u5b9a\u4e49\u7684\u66ff\u6362\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-PROMPTING-M-UC\"><span class=\"term\"><code class=\"literal\">%M</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5b8c\u6574\u4e3b\u673a\u540d\uff08\u542b\u57df\u540d\uff09\uff1b\u5982\u679c\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\uff0c\u5219\u4e3a<code class=\"literal\">[local]</code>\uff1b\u5982\u679c Unix \u57df\u5957\u63a5\u5b57\u4e0d\u5728\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u9ed8\u8ba4\u4f4d\u7f6e\uff0c\u5219\u4e3a<code class=\"literal\">[local:<em class=\"replaceable\"><code>/dir/name</code></em>]</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-M-LC\"><span class=\"term\"><code class=\"literal\">%m</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\uff0c\u5728\u7b2c\u4e00\u4e2a\u70b9\u53f7\u5904\u622a\u65ad\uff1b\u5982\u679c\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\uff0c\u5219\u4e3a<code class=\"literal\">[local]</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-GT\"><span class=\"term\"><code class=\"literal\">%&gt;</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u76d1\u542c\u7684\u7aef\u53e3\u53f7\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-N\"><span class=\"term\"><code class=\"literal\">%n</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u4f1a\u8bdd\u7528\u6237\u540d\u3002\uff08\u5728\u6570\u636e\u5e93\u4f1a\u8bdd\u671f\u95f4\uff0c<code class=\"command\">SET SESSION AUTHORIZATION</code>\u547d\u4ee4\u53ef\u80fd\u6539\u53d8\u8be5\u503c\u7684\u6269\u5c55\u7ed3\u679c\u3002\uff09</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-S\"><span class=\"term\"><code class=\"literal\">%S</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d<a class=\"xref\" href=\"/docs/devel/runtime-config-client.html#GUC-SEARCH-PATH\">search_path</a>\u7684\u503c\uff1b\u5982\u679c\u8fde\u63a5\u5230\u8fd0\u884c <span class=\"productname\">PostgreSQL</span> 17 \u6216\u66f4\u65e9\u7248\u672c\u7684\u670d\u52a1\u5668\uff0c\u5219\u4e3a <code class=\"literal\">?</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-S\"><span class=\"term\"><code class=\"literal\">%s</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u670d\u52a1\u540d\u79f0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-SLASH\"><span class=\"term\"><code class=\"literal\">%/</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-TILDE\"><span class=\"term\"><code class=\"literal\">%~</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7c7b\u4f3c <code class=\"literal\">%/</code>\uff0c\u4f46\u5982\u679c\u8be5\u6570\u636e\u5e93\u662f\u4f60\u7684\u9ed8\u8ba4\u6570\u636e\u5e93\uff0c\u5219\u8f93\u51fa <code class=\"literal\">~</code>\uff08\u6ce2\u6d6a\u53f7\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-NUMBERSIGN\"><span class=\"term\"><code class=\"literal\">%#</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u4f1a\u8bdd\u7528\u6237\u662f\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\uff0c\u5219\u4e3a<code class=\"literal\">#</code>\uff0c\u5426\u5219\u4e3a<code class=\"literal\">&gt;</code>\u3002\uff08\u5728\u6570\u636e\u5e93\u4f1a\u8bdd\u671f\u95f4\uff0c<code class=\"command\">SET SESSION AUTHORIZATION</code>\u547d\u4ee4\u53ef\u80fd\u6539\u53d8\u8be5\u503c\u7684\u6269\u5c55\u7ed3\u679c\u3002\uff09</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-P\"><span class=\"term\"><code class=\"literal\">%p</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u6240\u8fde\u63a5\u540e\u7aef\u7684\u8fdb\u7a0b ID\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-P-UC\"><span class=\"term\"><code class=\"literal\">%P</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7ba1\u9053\u72b6\u6001\uff1a\u4e0d\u5728\u7ba1\u9053\u4e2d\u65f6\u4e3a <code class=\"literal\">off</code>\uff0c\u5728\u8fdb\u884c\u4e2d\u7684\u7ba1\u9053\u4e2d\u65f6\u4e3a <code class=\"literal\">on</code>\uff0c\u5728\u5df2\u4e2d\u6b62\u7684\u7ba1\u9053\u4e2d\u65f6\u4e3a <code class=\"literal\">abort</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-R\"><span class=\"term\"><code class=\"literal\">%R</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5728\u63d0\u793a\u7b26 1 \u4e2d\uff0c\u901a\u5e38\u663e\u793a =\uff1b\u4f46\u5982\u679c\u4f1a\u8bdd\u5904\u4e8e\u6761\u4ef6\u5757\u4e2d\u672a\u6fc0\u6d3b\u7684\u5206\u652f\uff0c\u5219\u663e\u793a @\uff1b\u5982\u679c\u5904\u4e8e\u5355\u884c\u6a21\u5f0f\uff0c\u5219\u663e\u793a ^\uff1b\u5982\u679c\u4f1a\u8bdd\u5df2\u65ad\u5f00\u6570\u636e\u5e93\u8fde\u63a5\uff08\u4f8b\u5982 \\connect \u5931\u8d25\u65f6\uff09\uff0c\u5219\u663e\u793a !\u3002\u5728\u63d0\u793a\u7b26 2 \u4e2d\uff0c%R \u4f1a\u66ff\u6362\u4e3a\u8868\u793a psql \u7b49\u5f85\u66f4\u591a\u8f93\u5165\u539f\u56e0\u7684\u5b57\u7b26\uff1a\u547d\u4ee4\u5c1a\u672a\u7ed3\u675f\u65f6\u4e3a -\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684 /* ... */ \u6ce8\u91ca\u65f6\u4e3a *\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u5e26\u5f15\u53f7\u5b57\u7b26\u4e32\u65f6\u4e3a\u5355\u5f15\u53f7\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u5e26\u5f15\u53f7\u6807\u8bc6\u7b26\u65f6\u4e3a\u53cc\u5f15\u53f7\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u7f8e\u5143\u5f15\u7528\u5b57\u7b26\u4e32\u65f6\u4e3a\u7f8e\u5143\u7b26\u53f7\uff1b\u5b58\u5728\u672a\u5339\u914d\u7684\u5de6\u62ec\u53f7\u65f6\u4e3a (\u3002\u5728\u63d0\u793a\u7b26 3 \u4e2d\uff0c%R \u4e0d\u4ea7\u751f\u4efb\u4f55\u5185\u5bb9\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-I\"><span class=\"term\"><code class=\"literal\">%i</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8868\u793a\u6240\u8fde\u63a5\u7684\u670d\u52a1\u5668\u662f\u5426\u5904\u4e8e\u70ed\u5907\u6a21\u5f0f\u3002\u5982\u679c\u670d\u52a1\u5668\u5f53\u524d\u5904\u4e8e\u70ed\u5907\u72b6\u6001\uff0c\u5e76\u5c06 in_hot_standby \u62a5\u544a\u4e3a on\uff0c\u5219\u663e\u793a standby\uff1b\u5426\u5219\u663e\u793a primary\u3002\u8fde\u63a5\u591a\u4e2a\u670d\u52a1\u5668\u65f6\uff0c\u8fd9\u6709\u52a9\u4e8e\u5feb\u901f\u8bc6\u522b\u6bcf\u4e2a\u8fde\u63a5\u5bf9\u5e94\u7684\u89d2\u8272\u3002\u8fde\u63a5\u5230 PostgreSQL 13 \u6216\u66f4\u65e9\u7248\u672c\u7684\u670d\u52a1\u5668\u65f6\uff0c\u663e\u793a ?\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-X\"><span class=\"term\"><code class=\"literal\">%x</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u72b6\u6001\uff1a\u5982\u679c\u5f53\u524d\u4e0d\u5728\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff1b\u5982\u679c\u5904\u4e8e\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a <code class=\"literal\">*</code>\uff1b\u5982\u679c\u5904\u4e8e\u5931\u8d25\u7684\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a <code class=\"literal\">!</code>\uff1b\u5982\u679c\u4e8b\u52a1\u72b6\u6001\u4e0d\u786e\u5b9a\uff08\u4f8b\u5982\u56e0\u4e3a\u5f53\u524d\u6ca1\u6709\u8fde\u63a5\uff09\uff0c\u5219\u4e3a <code class=\"literal\">?</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-L\"><span class=\"term\"><code class=\"literal\">%l</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8bed\u53e5\u4e2d\u7684\u884c\u53f7\uff0c\u4ece <code class=\"literal\">1</code> \u5f00\u59cb\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-DIGITS\"><span class=\"term\"><code class=\"literal\">%</code><em class=\"replaceable\"><code>digits</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u66ff\u6362\u4e3a\u6307\u5b9a\u516b\u8fdb\u5236\u4ee3\u7801\u5bf9\u5e94\u7684\u5b57\u7b26\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-NAME\"><span class=\"term\"><code class=\"literal\">%:</code><em class=\"replaceable\"><code>name</code></em><code class=\"literal\">:</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><span class=\"application\">psql</span> \u53d8\u91cf <em class=\"replaceable\"><code>name</code></em> \u7684\u503c\u3002\u8be6\u89c1\u4e0a\u9762\u7684<a class=\"xref\" href=\"/docs/devel/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-COMMAND\"><span class=\"term\"><code class=\"literal\">%`</code><em class=\"replaceable\"><code>command</code></em><code class=\"literal\">`</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><em class=\"replaceable\"><code>command</code></em> \u7684\u8f93\u51fa\uff0c\u7c7b\u4f3c\u666e\u901a\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u53cd\u5f15\u53f7</span>\u201d</span>\u66ff\u6362\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-SQUARE-BRACKETS\"><span class=\"term\"><code class=\"literal\">%[</code> ... <code class=\"literal\">%]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u63d0\u793a\u7b26\u4e2d\u53ef\u4ee5\u5305\u542b\u7ec8\u7aef\u63a7\u5236\u5b57\u7b26\uff0c\u4f8b\u5982\u6539\u53d8\u63d0\u793a\u6587\u672c\u7684\u989c\u8272\u3001\u80cc\u666f\u6216\u6837\u5f0f\uff0c\u6216\u8005\u6539\u53d8\u7ec8\u7aef\u7a97\u53e3\u6807\u9898\u3002\u4e3a\u4e86\u8ba9 <span class=\"application\">Readline</span> \u7684\u884c\u7f16\u8f91\u529f\u80fd\u6b63\u5e38\u5de5\u4f5c\uff0c\u8fd9\u4e9b\u4e0d\u53ef\u6253\u5370\u7684\u63a7\u5236\u5b57\u7b26\u5fc5\u987b\u7528 <code class=\"literal\">%[</code> \u548c <code class=\"literal\">%]</code> \u5305\u56f4\u8d77\u6765\uff0c\u4ee5\u6807\u8bb0\u4e3a\u4e0d\u53ef\u89c1\u5b57\u7b26\u3002\u63d0\u793a\u7b26\u4e2d\u53ef\u4ee5\u51fa\u73b0\u591a\u7ec4\u8fd9\u6837\u7684\u6807\u8bb0\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; \\set PROMPT1 '%[%033[1;33;40m%]%n@%/%R%[%033[0m%]%# '\n</pre>\n<p lang=\"zh\">\u5176\u6548\u679c\u662f\u5728\u517c\u5bb9 VT100 \u4e14\u652f\u6301\u989c\u8272\u7684\u7ec8\u7aef\u4e0a\uff0c\u751f\u6210\u4e00\u4e2a\u7c97\u4f53\uff08<code class=\"literal\">1;</code>\uff09\u7684\u9ed1\u5e95\u9ec4\u5b57\u63d0\u793a\u7b26\uff08<code class=\"literal\">33;40</code>\uff09\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-W\"><span class=\"term\"><code class=\"literal\">%w</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0e\u6700\u8fd1\u4e00\u6b21\u8f93\u51fa\u7684 <code class=\"varname\">PROMPT1</code> \u5177\u6709\u76f8\u540c\u5bbd\u5ea6\u7684\u7a7a\u767d\u3002\u8fd9\u53ef\u7528\u4f5c <code class=\"varname\">PROMPT2</code> \u7684\u8bbe\u7f6e\uff0c\u4f7f\u591a\u884c\u8bed\u53e5\u4e0e\u7b2c\u4e00\u884c\u5bf9\u9f50\uff0c\u4f46\u4e0d\u663e\u793a\u53ef\u89c1\u7684\u4e8c\u7ea7\u63d0\u793a\u7b26\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8981\u5728\u63d0\u793a\u7b26\u4e2d\u63d2\u5165\u767e\u5206\u53f7\uff0c\u8bf7\u5199 %%\u3002\u63d0\u793a\u7b26 1 \u548c 2 \u7684\u9ed8\u8ba4\u503c\u4e3a '%/%R%x%# '\uff0c\u63d0\u793a\u7b26 3 \u7684\u9ed8\u8ba4\u503c\u4e3a '&gt;&gt; '\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">tcsh</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-READLINE\">\n<h4 lang=\"zh\">\u547d\u4ee4\u884c\u7f16\u8f91</h4>\n<p lang=\"zh\">\u5982\u679c\u53ef\u7528\uff0c<span class=\"application\">psql</span> \u4f1a\u4f7f\u7528<span class=\"application\">Readline</span>\u6216<span class=\"application\">libedit</span>\u5e93\uff0c\u4ee5\u4fbf\u8fdb\u884c\u4fbf\u6377\u7684\u884c\u7f16\u8f91\u548c\u5386\u53f2\u68c0\u7d22\u3002\u5f53<span class=\"application\">psql</span>\u9000\u51fa\u65f6\uff0c\u547d\u4ee4\u5386\u53f2\u4f1a\u81ea\u52a8\u4fdd\u5b58\uff1b\u5f53<span class=\"application\">psql</span>\u542f\u52a8\u65f6\uff0c\u53c8\u4f1a\u91cd\u65b0\u8f7d\u5165\u3002\u8f93\u5165\u4e0a\u7bad\u5934\u6216 control-P \u53ef\u4ee5\u53d6\u56de\u4e4b\u524d\u7684\u884c\u3002</p>\n<p lang=\"zh\">\u5728\u8bb8\u591a\uff08\u7edd\u975e\u5168\u90e8\uff09\u4e0a\u4e0b\u6587\u4e2d\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528 TAB \u8865\u5168\u90e8\u5206\u8f93\u5165\u7684\u5173\u952e\u5b57\u548c SQL \u5bf9\u8c61\u540d\u3002\u4f8b\u5982\uff0c\u5728\u547d\u4ee4\u5f00\u5934\u8f93\u5165<code class=\"literal\">ins</code>\u5e76\u6309\u4e0b TAB \u952e\uff0c\u4f1a\u8865\u5168\u4e3a<code class=\"literal\">insert into</code> \u3002\u7136\u540e\u8f93\u5165\u8868\u540d\u6216\u6a21\u5f0f\u540d\u7684\u51e0\u4e2a\u5b57\u7b26\uff0c\u518d\u6309\u4e0b<code class=\"literal\">TAB</code>\u952e\uff0c\u5c31\u4f1a\u8865\u5168\u5c1a\u672a\u8f93\u5b8c\u7684\u540d\u79f0\uff1b\u5982\u679c\u6709\u591a\u4e2a\u5019\u9009\u9879\uff0c\u5219\u4f1a\u7ed9\u51fa\u53ef\u80fd\u7684\u8865\u5168\u83dc\u5355\u3002\uff08\u5177\u4f53\u53d6\u51b3\u4e8e\u6240\u4f7f\u7528\u7684\u5e93\uff0c\u53ef\u80fd\u9700\u8981\u6309\u591a\u6b21<code class=\"literal\">TAB</code>\u952e\u624d\u80fd\u770b\u5230\u83dc\u5355\u3002\uff09</p>\n<p lang=\"zh\">\u5bf9 SQL \u5bf9\u8c61\u540d\u8fdb\u884c TAB \u8865\u5168\u65f6\uff0c\u9700\u8981\u5411\u670d\u52a1\u5668\u53d1\u9001\u67e5\u8be2\u6765\u67e5\u627e\u53ef\u80fd\u7684\u5339\u914d\u9879\u3002\u5728\u67d0\u4e9b\u4e0a\u4e0b\u6587\u4e2d\uff0c\u8fd9\u53ef\u80fd\u4f1a\u5e72\u6270\u5176\u4ed6\u64cd\u4f5c\u3002\u4f8b\u5982\uff0c\u5728<code class=\"command\">BEGIN</code>\u4e4b\u540e\uff0c\u5982\u679c\u4e2d\u95f4\u53d1\u51fa\u4e86\u4e00\u6b21 TAB \u8865\u5168\u67e5\u8be2\uff0c\u90a3\u4e48\u518d\u53d1\u51fa<code class=\"command\">SET TRANSACTION ISOLATION LEVEL</code>\u5c31\u4e3a\u65f6\u5df2\u665a\u4e86\u3002\u5982\u679c\u6839\u672c\u4e0d\u60f3\u4f7f\u7528 TAB \u8865\u5168\uff0c\u53ef\u4ee5\u628a\u4e0b\u9762\u7684\u5185\u5bb9\u653e\u5230\u4e3b\u76ee\u5f55\u4e2d\u540d\u4e3a<code class=\"filename\">.inputrc</code>\u7684\u6587\u4ef6\u91cc\uff0c\u4ece\u800c\u6c38\u4e45\u5173\u95ed\u5b83\uff1a</p>\n<pre class=\"programlisting\">$if psql\nset disable-completion on\n$endif\n</pre>\n<p lang=\"zh\">\uff08\u8fd9\u4e0d\u662f<span class=\"application\">psql</span>\u800c\u662f\u4e00\u4e2a<span class=\"application\">Readline</span>\u529f\u80fd\u3002\u9605\u8bfb\u5176\u6587\u6863\u4ee5\u83b7\u53d6\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\u3002\uff09</p>\n<p lang=\"zh\"><code class=\"option\">-n</code>\uff08<code class=\"option\">--no-readline</code>\uff09\u547d\u4ee4\u884c\u9009\u9879\u4e5f\u53ef\u7528\u4e8e\u5728\u5355\u6b21\u8fd0\u884c<span class=\"application\">psql</span>\u65f6\u7981\u7528 <span class=\"application\">Readline</span>\u3002\u8fd9\u4f1a\u963b\u6b62TAB \u8865\u5168\u3001\u547d\u4ee4\u884c\u5386\u53f2\u7684\u4f7f\u7528\u6216\u8bb0\u5f55\uff0c\u4ee5\u53ca\u591a\u884c\u547d\u4ee4\u7684\u7f16\u8f91\u3002\u5f53\u4f60\u9700\u8981\u590d\u5236\u7c98\u8d34\u5305\u542b <code class=\"literal\">TAB</code> \u5b57\u7b26\u7684\u6587\u672c\u65f6\uff0c\u5b83\u5c24\u5176\u6709\u7528\u3002</p>\n</div>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PSQL-ENVIRONMENT\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-ENVIRONMENT-COLUMNS\"><span class=\"term\"><code class=\"envar\">COLUMNS</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c<code class=\"literal\">\\pset columns</code>\u4e3a\u96f6\uff0c\u8fd9\u4e2a\u73af\u5883\u53d8\u91cf\u63a7\u5236\u7528\u4e8e<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u5bbd\u5ea6\u4ee5\u53ca\u7528\u6765\u786e\u5b9a\u8f83\u5bbd\u7684\u8f93\u51fa\u662f\u5426\u9700\u8981\u5206\u9875\u5668\uff0c\u6216\u8005\u662f\u5426\u5e94\u5207\u6362\u5230\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e2d\u7684\u5782\u76f4\u683c\u5f0f\u7684\u5bbd\u5ea6\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PGDATABASE\"><span class=\"term\"><code class=\"envar\">PGDATABASE</code><br/></span><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\uff08\u89c1<a class=\"xref\" href=\"/docs/devel/libpq-envars.html\" title=\"32.14.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a032.14\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PG-COLOR\"><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PSQL-EDITOR\"><span class=\"term\"><code class=\"envar\">PSQL_EDITOR</code><br/></span><span class=\"term\"><code class=\"envar\">EDITOR</code><br/></span><span class=\"term\"><code class=\"envar\">VISUAL</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"command\">\\e</code>\u3001<code class=\"command\">\\ef</code>\u4ee5\u53ca<code class=\"command\">\\ev</code>\u547d\u4ee4\u6240\u4f7f\u7528\u7684\u7f16\u8f91\u5668\u3002\u4f1a\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u68c0\u67e5\u8fd9\u4e9b\u53d8\u91cf\uff0c\u7b2c\u4e00\u4e2a\u88ab\u8bbe\u7f6e\u7684\u5c06\u88ab\u4f7f\u7528\u3002\u5982\u679c\u90fd\u6ca1\u6709\u88ab\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u662f\u4f7f\u7528Unix\u7cfb\u7edf\u4e0a\u7684<code class=\"filename\">vi</code>\u6216\u8005Windows\u7cfb\u7edf\u4e0a\u7684<code class=\"filename\">notepad.exe</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PSQL-EDITOR-LINENUMBER-ARG\"><span class=\"term\"><code class=\"envar\">PSQL_EDITOR_LINENUMBER_ARG</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5f53 <code class=\"command\">\\e</code>\u3001<code class=\"command\">\\ef</code> \u6216 <code class=\"command\">\\ev</code> \u5e26\u6709\u884c\u53f7\u53c2\u6570\u4f7f\u7528\u65f6\uff0c\u6b64\u53d8\u91cf\u6307\u5b9a\u5c06\u8d77\u59cb\u884c\u53f7\u4f20\u7ed9\u7528\u6237\u7f16\u8f91\u5668\u65f6\u6240\u7528\u7684\u547d\u4ee4\u884c\u53c2\u6570\u3002\u5bf9\u4e8e <span class=\"productname\">Emacs</span> \u6216 <span class=\"productname\">vi</span> \u4e4b\u7c7b\u7684\u7f16\u8f91\u5668\uff0c\u8fd9\u4e2a\u53c2\u6570\u662f\u4e00\u4e2a\u52a0\u53f7\u3002\u5982\u679c\u9009\u9879\u540d\u548c\u884c\u53f7\u4e4b\u95f4\u9700\u8981\u7a7a\u683c\uff0c\u8bf7\u5728\u53d8\u91cf\u503c\u4e2d\u5305\u542b\u672b\u5c3e\u7a7a\u683c\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">PSQL_EDITOR_LINENUMBER_ARG='+'\nPSQL_EDITOR_LINENUMBER_ARG='--line '\n</pre>\n<p lang=\"zh\">\u5728 Unix \u7cfb\u7edf\u4e0a\u9ed8\u8ba4\u662f<code class=\"literal\">+</code>\uff08\u5bf9\u5e94\u4e8e\u9ed8\u8ba4\u7f16\u8f91\u5668<code class=\"filename\">vi</code>\uff0c\u4e14\u5bf9\u5f88\u591a\u5176\u4ed6\u5e38\u89c1\u7f16\u8f91\u5668\u53ef\u7528\uff09\u3002\u5728 Windows \u7cfb\u7edf\u4e0a\u6ca1\u6709\u9ed8\u8ba4\u503c\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PSQL-HISTORY\"><span class=\"term\"><code class=\"envar\">PSQL_HISTORY</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u547d\u4ee4\u5386\u53f2\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08<code class=\"literal\">~</code>\uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PAGER\"><span class=\"term\"><code class=\"envar\">PSQL_PAGER</code><br/></span><span class=\"term\"><code class=\"envar\">PAGER</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u67e5\u8be2\u7ed3\u679c\u65e0\u6cd5\u5728\u5c4f\u5e55\u4e0a\u663e\u793a\u5b8c\u6574\uff0c\u5b83\u4eec\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6b64\u547d\u4ee4\u3002\u5178\u578b\u7684\u503c\u662f<code class=\"literal\">more</code>\u6216<code class=\"literal\">less</code>\u3002\u53ef\u4ee5\u901a\u8fc7\u5c06<code class=\"envar\">PSQL_PAGER</code>\u6216<code class=\"envar\">PAGER</code>\u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u6216\u901a\u8fc7\u8c03\u6574<code class=\"command\">\\pset</code>\u547d\u4ee4\u7684\u4e0e\u5206\u9875\u76f8\u5173\u7684\u9009\u9879\u6765\u7981\u7528\u5206\u9875\u5668\u3002\u8fd9\u4e9b\u53d8\u91cf\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u8fdb\u884c\u68c0\u67e5\uff1b\u4f7f\u7528\u6309\u8be5\u987a\u5e8f\u627e\u5230\u7684\u7b2c\u4e00\u4e2a\u5df2\u8bbe\u7f6e\u7684\u53d8\u91cf\u3002\u5982\u679c\u5b83\u4eec\u90fd\u6ca1\u6709\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5728\u5927\u591a\u6570\u5e73\u53f0\u4e0a\u4f7f\u7528<code class=\"literal\">more</code>\uff0c\u4f46\u5728Cygwin\u4e0a\u4f7f\u7528<code class=\"literal\">less</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PSQL-WATCH-PAGER\"><span class=\"term\"><code class=\"envar\">PSQL_WATCH_PAGER</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528 \\watch \u547d\u4ee4\u53cd\u590d\u6267\u884c\u67e5\u8be2\u65f6\uff0c\u9ed8\u8ba4\u4e0d\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\u3002\u5728 Unix \u7cfb\u7edf\u4e0a\uff0c\u53ef\u4ee5\u5c06 PSQL_WATCH_PAGER \u8bbe\u4e3a\u5206\u9875\u7a0b\u5e8f\u547d\u4ee4\u6765\u6539\u53d8\u6b64\u884c\u4e3a\u3002pspg \u5206\u9875\u7a0b\u5e8f\uff08\u4e0d\u5c5e\u4e8e PostgreSQL\uff0c\u4f46\u8bb8\u591a\u5f00\u6e90\u8f6f\u4ef6\u53d1\u884c\u7248\u90fd\u63d0\u4f9b\u5b83\uff09\u4ee5 --stream \u9009\u9879\u542f\u52a8\u65f6\uff0c\u53ef\u4ee5\u663e\u793a \\watch \u7684\u8f93\u51fa\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PSQLRC\"><span class=\"term\"><code class=\"envar\">PSQLRC</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7528\u6237\u7684<code class=\"filename\">.psqlrc</code>\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08<code class=\"literal\">~</code>\uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-SHELL\"><span class=\"term\"><code class=\"envar\">SHELL</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u88ab<code class=\"command\">\\!</code>\u547d\u4ee4\u6267\u884c\u7684\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-TMPDIR\"><span class=\"term\"><code class=\"envar\">TMPDIR</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b58\u50a8\u4e34\u65f6\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u662f<code class=\"filename\">/tmp</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6 <span class=\"productname\">PostgreSQL</span> \u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528 <span class=\"application\">libpq</span> \u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/devel/libpq-envars.html\" title=\"32.14.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a032.14\u00a0\u8282</a>\uff09\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.21.10\">\n<h2 lang=\"zh\">\u6587\u4ef6</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-FILES-PSQLRC\" lang=\"zh\"><span class=\"term\"><code class=\"filename\">psqlrc</code> \u548c <code class=\"filename\">~/.psqlrc</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u6ca1\u6709<code class=\"option\">-X</code>\u9009\u9879\uff0c\u5728\u8fde\u63a5\u5230\u6570\u636e\u5e93\u540e\u4f46\u5728\u63a5\u6536\u6b63\u5e38\u7684\u547d\u4ee4\u4e4b\u524d\uff0c<span class=\"application\">psql</span>\u4f1a\u5c1d\u8bd5\u4f9d\u6b21\u4ece\u7cfb\u7edf\u7ea7\u7684\u542f\u52a8\u6587\u4ef6\uff08<code class=\"filename\">psqlrc</code>\uff09\u548c\u7528\u6237\u7684\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\uff08<code class=\"filename\">~/.psqlrc</code>\uff09\u4e2d\u8bfb\u53d6\u5e76\u4e14\u6267\u884c\u547d\u4ee4\u3002\u8fd9\u4e9b\u6587\u4ef6\u53ef\u4ee5\u88ab\u7528\u6765\u8bbe\u7f6e\u5ba2\u6237\u7aef\u6216\u8005\u670d\u52a1\u5668\uff0c\u901a\u5e38\u662f\u4e00\u4e9b<code class=\"command\">\\set</code>\u548c<code class=\"command\">SET</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u7cfb\u7edf\u8303\u56f4\u7684\u542f\u52a8\u6587\u4ef6\u540d\u4e3a <code class=\"filename\">psqlrc</code>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4f1a\u5728\u5b89\u88c5\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u7cfb\u7edf\u914d\u7f6e</span>\u201d</span>\u76ee\u5f55\u4e2d\u67e5\u627e\u5b83\uff0c\u6700\u53ef\u9760\u7684\u8bc6\u522b\u65b9\u5f0f\u662f\u8fd0\u884c <code class=\"literal\">pg_config --sysconfdir</code>\u3002\u901a\u5e38\u8fd9\u4e2a\u76ee\u5f55\u662f\u76f8\u5bf9\u4e8e\u5305\u542b <span class=\"productname\">PostgreSQL</span> \u53ef\u6267\u884c\u6587\u4ef6\u7684\u76ee\u5f55\u7684 <code class=\"filename\">../etc/</code>\u3002\u4e5f\u53ef\u4ee5\u901a\u8fc7 <code class=\"envar\">PGSYSCONFDIR</code> \u73af\u5883\u53d8\u91cf\u663e\u5f0f\u6307\u5b9a\u67e5\u627e\u76ee\u5f55\u3002</p>\n<p lang=\"zh\">\u7528\u6237\u7684\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\u540d\u4e3a<code class=\"filename\">.psqlrc</code>\uff0c\u5e76\u4e14\u5728\u8c03\u7528\u7528\u6237\u7684\u4e3b\u76ee\u5f55\u4e2d\u5bfb\u627e\u3002\u5728Windows\u4e0a\uff0c\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\u7684\u540d\u79f0\u6539\u4e3a<code class=\"filename\">%APPDATA%\\postgresql\\psqlrc.conf</code>\u3002\u5728\u4efb\u4f55\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e<code class=\"envar\">PSQLRC</code>\u73af\u5883\u53d8\u91cf\u6765\u8986\u76d6\u6b64\u9ed8\u8ba4\u6587\u4ef6\u8def\u5f84\u3002</p>\n<p lang=\"zh\">\u7cfb\u7edf\u8303\u56f4\u7684\u542f\u52a8\u6587\u4ef6\u548c\u7528\u6237\u4e2a\u4eba\u7684\u542f\u52a8\u6587\u4ef6\u90fd\u53ef\u4ee5\u901a\u8fc7\u5728\u6587\u4ef6\u540d\u540e\u9644\u52a0\u8fde\u5b57\u7b26\u548c<span class=\"productname\">PostgreSQL</span>\u7684\u5927\u7248\u672c\u6216\u5c0f\u7248\u672c\u6807\u8bc6\u7b26\u6765\u4f7f\u5176\u4e0e<span class=\"application\">psql</span>\u7248\u672c\u76f8\u5173\uff0c\u4f8b\u5982<code class=\"filename\">~/.psqlrc-20</code>\u6216<code class=\"filename\">~/.psqlrc-20devel</code>\u3002\u6700\u5177\u4f53\u7248\u672c\u5339\u914d\u7684\u6587\u4ef6\u5c06\u4f18\u5148\u8bfb\u53d6\uff0c\u800c\u4e0d\u662f\u975e\u7279\u5b9a\u7248\u672c\u7684\u6587\u4ef6\u3002\u8fd9\u4e9b\u7248\u672c\u540e\u7f00\u662f\u5728\u786e\u5b9a\u6587\u4ef6\u8def\u5f84\u540e\u6dfb\u52a0\u7684\uff0c\u5982\u4e0a\u6240\u8ff0\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-FILES-PSQL-HISTORY\"><span class=\"term\"><code class=\"filename\">.psql_history</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u547d\u4ee4\u884c\u5386\u53f2\u88ab\u5b58\u50a8\u5728\u6587\u4ef6<code class=\"filename\">~/.psql_history</code>\u4e2d\uff0c\u5728 Windows \u4e0a\u5219\u5b58\u50a8\u5728\u6587\u4ef6<code class=\"filename\">%APPDATA%\\postgresql\\psql_history</code>\u4e2d\u3002</p>\n<p lang=\"zh\">\u5386\u53f2\u6587\u4ef6\u7684\u4f4d\u7f6e\u53ef\u4ee5\u901a\u8fc7<code class=\"varname\">HISTFILE</code> <span class=\"application\">psql</span>\u53d8\u91cf\u6216\u8005<code class=\"envar\">PSQL_HISTORY</code>\u73af\u5883\u53d8\u91cf\u663e\u5f0f\u8bbe\u7f6e\u3002</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.21.11\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">psql</span>\u6700\u9002\u5408\u4e0e\u76f8\u540c\u6216\u8f83\u65e7\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\u914d\u5408\u4f7f\u7528\u3002\u5982\u679c\u670d\u52a1\u5668\u7684\u7248\u672c\u6bd4<span class=\"application\">psql</span>\u672c\u8eab\u66f4\u65b0\uff0c\u53cd\u659c\u7ebf\u547d\u4ee4\u7279\u522b\u5bb9\u6613\u5931\u8d25\u3002\u7136\u800c\uff0c<code class=\"literal\">\\d</code>\u7cfb\u5217\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u5e94\u8be5\u53ef\u4ee5\u5728\u6700\u4f4e\u81f3 10 \u7248\u672c\u7684\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\uff0c\u4f46\u4e0d\u4e00\u5b9a\u9002\u7528\u4e8e\u6bd4<span class=\"application\">psql</span>\u672c\u8eab\u66f4\u65b0\u7684\u670d\u52a1\u5668\u3002\u8fd0\u884cSQL\u547d\u4ee4\u548c\u663e\u793a\u67e5\u8be2\u7ed3\u679c\u7684\u4e00\u822c\u529f\u80fd\u4e5f\u5e94\u8be5\u53ef\u4ee5\u5728\u66f4\u65b0\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\uff0c\u4f46\u4e0d\u80fd\u4fdd\u8bc1\u5728\u6240\u6709\u60c5\u51b5\u4e0b\u90fd\u80fd\u5b9e\u73b0\u3002</p>\n<p>\u5982\u679c\u4f60\u60f3\u7528<span class=\"application\">psql</span>\u8fde\u63a5\u5230\u591a\u4e2a\u5177\u6709\u4e0d\u540c\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\uff0c\u63a8\u8350\u4f7f\u7528\u6700\u65b0\u7248\u672c\u7684<span class=\"application\">psql</span>\u3002\u6216\u8005\uff0c\u4f60\u53ef\u4ee5\u4e3a\u6bcf\u4e00\u4e2a\u5927\u7248\u672c\u4fdd\u7559\u4e00\u4efd<span class=\"application\">psql</span>\u62f7\u8d1d\uff0c\u5e76\u4e14\u9488\u5bf9\u76f8\u5e94\u7684\u670d\u52a1\u5668\u4f7f\u7528\u5339\u914d\u7684\u7248\u672c\u3002\u4f46\u5b9e\u9645\u4e0a\uff0c\u8fd9\u79cd\u989d\u5916\u7684\u9ebb\u70e6\u662f\u4e0d\u5fc5\u8981\u7684\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5728 <span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\uff0c<code class=\"option\">-c</code> \u9009\u9879\u610f\u5473\u7740 <code class=\"option\">-X</code>\uff08<code class=\"option\">--no-psqlrc</code>\uff09\uff1b\u73b0\u5728\u5df2\u7ecf\u4e0d\u662f\u8fd9\u6837\u4e86\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5728<span class=\"productname\">PostgreSQL</span> 8.4 \u4e4b\u524d\uff0c<span class=\"application\">psql</span>\u5141\u8bb8\u4e00\u4e2a\u5355\u5b57\u6bcd\u53cd\u659c\u7ebf\u547d\u4ee4\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u76f4\u63a5\u5199\u5728\u8be5\u547d\u4ee4\u540e\u9762\uff0c\u4e2d\u95f4\u4e0d\u9700\u8981\u7a7a\u767d\u3002\u73b0\u5728\u5219\u8981\u6c42\u7528\u7a7a\u767d\u5206\u9694\u3002</p>\n</li>\n</ul>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.21.12\">\n<h2 lang=\"zh\">\u7ed9 Windows \u7528\u6237\u7684\u6ce8\u89e3</h2>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u662f\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u63a7\u5236\u53f0\u5e94\u7528</span>\u201d</span>\u3002\u7531\u4e8e Windows \u7684\u63a7\u5236\u53f0\u7a97\u53e3\u4f7f\u7528\u7684\u662f\u4e00\u79cd\u548c\u7cfb\u7edf\u5176\u4f59\u90e8\u5206\u4e0d\u540c\u7684\u7f16\u7801\uff0c\u5728<span class=\"application\">psql</span>\u4e2d\u4f7f\u7528 8 \u4f4d\u5b57\u7b26\u65f6\u8981\u7279\u522b\u6ce8\u610f\u3002\u5982\u679c<span class=\"application\">psql</span>\u68c0\u6d4b\u5230\u4e00\u4e2a\u6709\u95ee\u9898\u7684\u63a7\u5236\u53f0\u4ee3\u7801\u9875\uff0c\u5b83\u5c06\u4f1a\u5728\u542f\u52a8\u65f6\u8b66\u544a\u4f60\u3002\u8981\u66f4\u6539\u63a7\u5236\u53f0\u4ee3\u7801\u9875\uff0c\u6709\u4e24\u4ef6\u4e8b\u662f\u5fc5\u8981\u7684\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u8f93\u5165<strong class=\"userinput\"><code>cmd.exe /c chcp 1252</code></strong>\u53ef\u4ee5\u8bbe\u7f6e\u4ee3\u7801\u9875\uff081252 \u662f\u9002\u7528\u4e8e\u5fb7\u8bed\u7684\u4e00\u4e2a\u4ee3\u7801\u9875\uff0c\u8bf7\u5728\u8fd9\u91cc\u66ff\u6362\u6210\u4f60\u7684\u503c\uff09\u3002\u5982\u679c\u6b63\u5728\u4f7f\u7528 Cygwin\uff0c\u53ef\u4ee5\u628a\u8fd9\u4e2a\u547d\u4ee4\u653e\u5728<code class=\"filename\">/etc/profile</code>\u4e2d\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u628a\u63a7\u5236\u53f0\u5b57\u4f53\u8bbe\u7f6e\u4e3a<code class=\"literal\">Lucida Console</code>\uff0c\u56e0\u4e3a\u6805\u683c\u5b57\u4f53\u65e0\u6cd5\u4e0e ANSI \u4ee3\u7801\u9875\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</li>\n</ul>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PSQL-EXAMPLES\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u7b2c\u4e00\u4e2a\u793a\u4f8b\u5c55\u793a\u4e86\u5982\u4f55\u628a\u4e00\u6761\u547d\u4ee4\u5206\u6563\u5230\u591a\u884c\u8f93\u5165\u4e2d\u3002\u6ce8\u610f\u63d0\u793a\u7b26\u7684\u53d8\u5316\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>CREATE TABLE my_table (</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code> first integer NOT NULL DEFAULT 0,</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code> second text)</code></strong>\ntestdb-&gt; <strong class=\"userinput\"><code>;</code></strong>\nCREATE TABLE\n</pre>\n<p lang=\"zh\">\u73b0\u5728\u518d\u6765\u770b\u4e00\u4e0b\u8fd9\u4e2a\u8868\u7684\u5b9a\u4e49\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\d my_table</code></strong>\n              Table \"public.my_table\"\n Column |  Type   | Collation | Nullable | Default\n--------+---------+-----------+----------+---------\n first  | integer |           | not null | 0\n second | text    |           |          |\n</pre>\n<p lang=\"zh\">\u73b0\u5728\u6211\u4eec\u628a\u63d0\u793a\u7b26\u6539\u6210\u66f4\u6709\u8da3\u7684\u5f62\u5f0f\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set PROMPT1 '%n@%m %~%R%# '</code></strong>\npeter@localhost testdb=&gt;\n</pre>\n<p lang=\"zh\">\u5047\u8bbe\u4f60\u5df2\u7ecf\u5411\u8868\u4e2d\u586b\u5165\u6570\u636e\uff0c\u5e76\u60f3\u770b\u4e00\u770b\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; SELECT * FROM my_table;\n first | second\n-------+--------\n     1 | one\n     2 | two\n     3 | three\n     4 | four\n(4 rows)\n</pre>\n<p lang=\"zh\">\u4f60\u53ef\u4ee5\u4f7f\u7528 <code class=\"command\">\\pset</code> \u547d\u4ee4\u4ee5\u4e0d\u540c\u65b9\u5f0f\u663e\u793a\u8868\u683c\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 2</code></strong>\nBorder style is 2.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\n+-------+--------+\n| first | second |\n+-------+--------+\n|     1 | one    |\n|     2 | two    |\n|     3 | three  |\n|     4 | four   |\n+-------+--------+\n(4 rows)\n\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 0</code></strong>\nBorder style is 0.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\nfirst second\n----- ------\n    1 one\n    2 two\n    3 three\n    4 four\n(4 rows)\n\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 1</code></strong>\nBorder style is 1.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset format csv</code></strong>\nOutput format is csv.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset tuples_only</code></strong>\nTuples only is on.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT second, first FROM my_table;</code></strong>\none,1\ntwo,2\nthree,3\nfour,4\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset format unaligned</code></strong>\nOutput format is unaligned.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset fieldsep '\\t'</code></strong>\nField separator is \"    \".\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT second, first FROM my_table;</code></strong>\none     1\ntwo     2\nthree   3\nfour    4\n</pre>\n<p lang=\"zh\">\u6216\u8005\u4f7f\u7528\u77ed\u547d\u4ee4\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\a \\t \\x</code></strong>\nOutput format is aligned.\nTuples only is off.\nExpanded display is on.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\n-[ RECORD 1 ]-\nfirst  | 1\nsecond | one\n-[ RECORD 2 ]-\nfirst  | 2\nsecond | two\n-[ RECORD 3 ]-\nfirst  | 3\nsecond | three\n-[ RECORD 4 ]-\nfirst  | 4\nsecond | four\n</pre>\n<p lang=\"zh\">\u6b64\u5916\uff0c\u53ef\u4ee5\u4f7f\u7528<code class=\"literal\">\\g</code>\u4e3a\u4e00\u4e2a\u67e5\u8be2\u8bbe\u7f6e\u8fd9\u4e9b\u8f93\u51fa\u683c\u5f0f\u9009\u9879\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table</code></strong>\npeter@localhost testdb-&gt; <strong class=\"userinput\"><code>\\g (format=aligned tuples_only=off expanded=on)</code></strong>\n-[ RECORD 1 ]-\nfirst  | 1\nsecond | one\n-[ RECORD 2 ]-\nfirst  | 2\nsecond | two\n-[ RECORD 3 ]-\nfirst  | 3\nsecond | three\n-[ RECORD 4 ]-\nfirst  | 4\nsecond | four\n</pre>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4e00\u4e2a\u4f7f\u7528 <code class=\"command\">\\df</code> \u547d\u4ee4\u53ea\u67e5\u627e\u540d\u79f0\u5339\u914d <code class=\"literal\">int*pl</code> \u4e14\u7b2c\u4e8c\u4e2a\u53c2\u6570\u7c7b\u578b\u4e3a <code class=\"type\">bigint</code> \u7684\u51fd\u6570\u7684\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\df int*pl * bigint</code></strong>\n                          List of functions\n   Schema   |  Name   | Result data type | Argument data types | Type\n------------+---------+------------------+---------------------+------\n pg_catalog | int28pl | bigint           | smallint, bigint    | func\n pg_catalog | int48pl | bigint           | integer, bigint     | func\n pg_catalog | int8pl  | bigint           | bigint, bigint      | func\n(3 rows)\n</pre>\n<p lang=\"zh\">\u8fd9\u91cc\uff0c<code class=\"literal\">+</code> \u9009\u9879\u7528\u4e8e\u663e\u793a\u5176\u4e2d\u4e00\u4e2a\u51fd\u6570\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u800c <code class=\"literal\">x</code> \u7528\u4e8e\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u7ed3\u679c\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\df+x int*pl integer bigint</code></strong>\nList of functions\n-[ RECORD 1 ]-------+-----------------------------\nSchema              | pg_catalog\nName                | int48pl\nResult data type    | bigint\nArgument data types | integer, bigint\nType                | func\nVolatility          | immutable\nParallel            | safe\nOwner               | postgres\nSecurity            | invoker\nLeakproof?          | no\nAccess privileges   |\nLanguage            | internal\nInternal name       | int48pl\nDescription         | implementation of + operator\n</pre>\n<p lang=\"zh\">\u5728\u9002\u5408\u7684\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u4f7f\u7528 <code class=\"command\">\\crosstabview</code> \u547d\u4ee4\u5c06\u67e5\u8be2\u7ed3\u679c\u663e\u793a\u4e3a\u4ea4\u53c9\u8868\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>SELECT first, second, first &gt; 2 AS gt2 FROM my_table;</code></strong>\n first | second | gt2\n-------+--------+-----\n     1 | one    | f\n     2 | two    | f\n     3 | three  | t\n     4 | four   | t\n(4 rows)\n\ntestdb=&gt; <strong class=\"userinput\"><code>\\crosstabview first second</code></strong>\n first | one | two | three | four\n-------+-----+-----+-------+------\n     1 | f   |     |       |\n     2 |     | f   |       |\n     3 |     |     | t     |\n     4 |     |     |       | t\n(4 rows)\n</pre>\n<p lang=\"zh\">\u7b2c\u4e8c\u4e2a\u793a\u4f8b\u5c55\u793a\u4e86\u4e00\u4e2a\u4e58\u6cd5\u8868\uff0c\u5176\u4e2d\u884c\u6309\u6570\u5b57\u5012\u5e8f\u6392\u5217\uff0c\u800c\u5217\u6309\u72ec\u7acb\u7684\u5347\u5e8f\u6570\u5b57\u6392\u5217\u3002</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>SELECT t1.first AS \"A\", t2.first+100 AS \"B\", t1.first*(t2.first+100) AS \"AxB\",</code></strong>\ntestdb-&gt; <strong class=\"userinput\"><code>row_number() OVER (ORDER BY t2.first) AS ord</code></strong>\ntestdb-&gt; <strong class=\"userinput\"><code>FROM my_table t1 CROSS JOIN my_table t2 ORDER BY 1 DESC</code></strong>\ntestdb-&gt; <strong class=\"userinput\"><code>\\crosstabview \"A\" \"B\" \"AxB\" ord</code></strong>\n A | 101 | 102 | 103 | 104\n---+-----+-----+-----+-----\n 4 | 404 | 408 | 412 | 416\n 3 | 303 | 306 | 309 | 312\n 2 | 202 | 204 | 206 | 208\n 1 | 101 | 102 | 103 | 104\n(4 rows)\n</pre>\n</div>\n</div></div>", "manual_path": "app-psql.html", "localization": {"status": "complete", "sources": [{"url": "/docs/devel/app-psql.html", "method": "same-major semantic node", "sha256": "1590b6e290ad21fe3ac1c1549628841ae426d1cd07a8f808789207878dbee5ab", "language": "zh", "matched_nodes": ["#APP-PSQL/div[10]/div[1]/ul[0]/li[0]", "#APP-PSQL/div[10]/div[1]/ul[0]/li[1]", "#APP-PSQL/div[10]/div[1]/ul[0]/li[2]", "#APP-PSQL/div[10]/h2[0]", "#APP-PSQL/div[11]/div[2]/ul[0]/li[0]", "#APP-PSQL/div[11]/div[2]/ul[0]/li[1]", "#APP-PSQL/div[11]/h2[0]", "#APP-PSQL/div[11]/p[1]", "#APP-PSQL/div[12]/p[11]", "#APP-PSQL/div[12]/p[13]", "#APP-PSQL/div[12]/p[15]", "#APP-PSQL/div[12]/p[17]", "#APP-PSQL/div[12]/p[19]", "#APP-PSQL/div[12]/p[1]", "#APP-PSQL/div[12]/p[21]", "#APP-PSQL/div[12]/p[3]", "#APP-PSQL/div[12]/p[5]", "#APP-PSQL/div[12]/p[7]", "#APP-PSQL/div[12]/p[9]", "#APP-PSQL/div[2]/p[1]", "#APP-PSQL/div[3]/h2[0]", "#APP-PSQL/div[4]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[11]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[13]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[15]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]/p[2]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[19]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[21]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[23]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[25]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[25]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[27]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[29]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[31]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[35]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[37]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[39]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[3]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[41]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]/div[1]/h3[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]/div[1]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[45]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[47]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[49]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[51]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[53]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[55]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[55]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[57]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[57]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[59]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[5]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[61]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[63]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[65]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[67]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[67]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[69]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[3]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[5]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[6]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[7]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[9]", "#APP-PSQL/div[6]/h2[0]", "#APP-PSQL/div[6]/p[1]", "#APP-PSQL/div[7]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[1]/p[1]", "#APP-PSQL/div[7]/div[1]/p[2]", "#APP-PSQL/div[7]/div[1]/p[5]", "#APP-PSQL/div[7]/div[1]/p[6]", "#APP-PSQL/div[7]/div[1]/p[7]", "#APP-PSQL/div[7]/div[2]/h3[0]", "#APP-PSQL/div[7]/div[2]/p[1]", "#APP-PSQL/div[7]/div[2]/p[3]", "#APP-PSQL/div[7]/div[2]/p[4]", "#APP-PSQL/div[7]/div[2]/p[5]", "#APP-PSQL/div[7]/div[2]/p[6]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[101]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[103]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[105]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[105]/div[4]/p[1]/a[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[105]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[105]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[105]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[105]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[107]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[107]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[107]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[109]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[109]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[109]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[109]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[111]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[113]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[115]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[115]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[115]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[115]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[117]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[119]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[119]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[119]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[119]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[119]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[11]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[11]/div[1]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[11]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[121]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[121]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[123]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[125]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[127]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[127]/p[0]/a[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[127]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[127]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[127]/p[5]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[131]/div[2]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[131]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[131]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[133]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[135]/div[2]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[135]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[135]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[137]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[137]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[137]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[137]/p[5]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[137]/p[6]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[139]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[13]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[13]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[141]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[143]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[145]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[145]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[145]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[147]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[149]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[151]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[151]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[151]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[151]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[153]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[155]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[155]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[157]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[159]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[159]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[15]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[15]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[17]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[19]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[19]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[19]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[19]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[19]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[21]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[21]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[21]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[21]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[21]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[23]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[25]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[27]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[27]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[31]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[35]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[35]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[37]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[41]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[43]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[45]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[47]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[47]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[47]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dt[10]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dt[34]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dt[36]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dt[38]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[5]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/p[4]/a[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[163]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[165]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[167]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[169]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[171]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[173]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[173]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[173]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[173]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[173]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[175]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[177]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[177]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[179]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[179]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[179]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[17]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[17]/div[5]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[17]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[17]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[181]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[181]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[181]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[181]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[181]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[181]/p[5]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[183]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[185]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[187]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[189]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[189]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[191]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[191]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[193]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[195]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[197]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[199]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[201]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[201]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[203]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[203]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[205]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[207]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[207]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[207]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[207]/p[5]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[21]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[21]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[21]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[23]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[23]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[23]/p[0]/a[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[23]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[23]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[23]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[25]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[29]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[31]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[37]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[3]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[3]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[3]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[41]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[43]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[45]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[45]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[45]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[47]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[49]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[49]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[51]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[53]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[55]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[57]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[57]/div[1]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[57]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[59]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[5]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[5]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[61]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[63]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[65]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[67]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[69]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[71]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[73]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[75]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[77]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[79]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[7]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[7]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[7]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[7]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[7]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[81]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[83]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[83]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[85]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[85]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[85]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[87]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[87]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[89]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[89]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[91]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[93]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[95]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[97]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[99]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[104]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[130]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[132]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[134]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[138]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[140]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[150]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[152]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[162]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[166]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[192]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[6]", "#APP-PSQL/div[7]/div[3]/div[12]/p[2]", "#APP-PSQL/div[7]/div[3]/div[12]/p[3]", "#APP-PSQL/div[7]/div[3]/div[12]/p[4]", "#APP-PSQL/div[7]/div[3]/div[12]/p[6]", "#APP-PSQL/div[7]/div[3]/div[12]/p[7]", "#APP-PSQL/div[7]/div[3]/h3[0]", "#APP-PSQL/div[7]/div[3]/p[10]", "#APP-PSQL/div[7]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/p[2]", "#APP-PSQL/div[7]/div[3]/p[3]", "#APP-PSQL/div[7]/div[3]/p[4]", "#APP-PSQL/div[7]/div[3]/p[4]/a[2]", "#APP-PSQL/div[7]/div[3]/p[5]", "#APP-PSQL/div[7]/div[3]/p[7]", "#APP-PSQL/div[7]/div[3]/p[8]", "#APP-PSQL/div[7]/div[3]/p[9]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[15]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[17]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/div[2]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[21]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[21]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[23]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[23]/p[2]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[41]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[43]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[45]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[47]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[47]/p[0]/a[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[49]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[53]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[55]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[57]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[59]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[61]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[63]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[65]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[67]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[69]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[71]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[73]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[75]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[77]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[79]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[4]/div[1]/div[8]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/p[10]", "#APP-PSQL/div[7]/div[4]/div[1]/p[11]", "#APP-PSQL/div[7]/div[4]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/p[2]", "#APP-PSQL/div[7]/div[4]/div[1]/p[4]", "#APP-PSQL/div[7]/div[4]/div[1]/p[6]", "#APP-PSQL/div[7]/div[4]/div[1]/p[7]", "#APP-PSQL/div[7]/div[4]/div[1]/p[9]", "#APP-PSQL/div[7]/div[4]/div[2]/p[10]", "#APP-PSQL/div[7]/div[4]/div[2]/p[11]", "#APP-PSQL/div[7]/div[4]/div[2]/p[12]", "#APP-PSQL/div[7]/div[4]/div[2]/p[1]", "#APP-PSQL/div[7]/div[4]/div[2]/p[3]", "#APP-PSQL/div[7]/div[4]/div[2]/p[4]", "#APP-PSQL/div[7]/div[4]/div[2]/p[6]", "#APP-PSQL/div[7]/div[4]/div[2]/p[7]", "#APP-PSQL/div[7]/div[4]/div[2]/p[9]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[15]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[17]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[21]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[29]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[31]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[37]/p[0]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[37]/p[2]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[4]/div[3]/div[5]/p[1]", "#APP-PSQL/div[7]/div[4]/div[3]/p[1]", "#APP-PSQL/div[7]/div[4]/div[3]/p[2]", "#APP-PSQL/div[7]/div[4]/div[4]/h4[0]", "#APP-PSQL/div[7]/div[4]/div[4]/p[3]", "#APP-PSQL/div[7]/div[4]/div[4]/p[4]", "#APP-PSQL/div[7]/div[4]/div[4]/p[5]", "#APP-PSQL/div[7]/div[4]/div[4]/p[7]", "#APP-PSQL/div[7]/div[4]/div[4]/p[8]", "#APP-PSQL/div[7]/div[4]/h3[0]", "#APP-PSQL/div[7]/h2[0]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[11]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[13]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[17]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[19]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[1]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[21]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[3]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[5]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[7]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]/p[0]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]/p[2]", "#APP-PSQL/div[8]/p[2]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[0]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[1]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[2]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[3]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[3]/p[0]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[3]/p[1]", "#APP-PSQL/div[9]/div[1]/dl[0]/dt[0]", "#APP-PSQL/div[9]/h2[0]"]}, {"url": "/docs/devel/indexes-index-only-scans.html", "method": "same-major semantic node", "sha256": "84b5978193e00840b0c7af93e7c58bc9ca3e5d6a2290de39d150e4b9c726903d", "language": "zh", "matched_nodes": ["#INDEXES-INDEX-ONLY-SCANS/p[25]/span[2]"]}], "language": "zh", "original_text": {"/summary": "psql \u2014 PostgreSQL interactive terminal", "/category": "Client applications", "/versions/20/description/0": "psql \u2014 PostgreSQL interactive terminal", "/versions/20/facts/0/label": "Documented executable", "/versions/20/facts/1/label": "Executable version", "/versions/20/facts/2/label": "Reference inventory", "/versions/20/facts/2/value": "Client applications", "/versions/20/facts/3/label": "Option definition groups", "/versions/20/tables/0/title": "Documented options", "/versions/20/tables/1/title": "Environment variables", "/versions/20/related/0/label": "psql meta-commands", "/versions/20/related/1/label": "libpq connection parameters", "/versions/20/tables/0/rows/0/summary": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all .", "/versions/20/tables/0/rows/1/summary": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned .", "/versions/20/tables/0/rows/2/summary": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors .", "/versions/20/tables/0/rows/3/summary": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence.", "/versions/20/tables/0/rows/4/summary": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv .", "/versions/20/tables/0/rows/5/summary": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "/versions/20/tables/0/rows/6/summary": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries .", "/versions/20/tables/0/rows/7/summary": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on .", "/versions/20/tables/0/rows/8/summary": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i .", "/versions/20/tables/0/rows/9/summary": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f .", "/versions/20/tables/0/columns/0/label": "Option and arguments", "/versions/20/tables/0/columns/1/label": "Description", "/versions/20/tables/0/rows/10/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket.", "/versions/20/tables/0/rows/11/summary": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command.", "/versions/20/tables/0/rows/12/summary": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list .", "/versions/20/tables/0/rows/13/summary": "Write all query output into file filename , in addition to the normal output destination.", "/versions/20/tables/0/rows/14/summary": "Do not use Readline for line editing and do not use the command history (see the section called \u201cCommand-Line Editing\u201d below).", "/versions/20/tables/0/rows/15/summary": "Put all query output into file filename . This is equivalent to the command \\o .", "/versions/20/tables/0/rows/16/summary": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432.", "/versions/20/tables/0/rows/17/summary": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex .", "/versions/20/tables/0/rows/18/summary": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on .", "/versions/20/tables/0/rows/19/summary": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep .", "/versions/20/tables/0/rows/20/summary": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts.", "/versions/20/tables/0/rows/21/summary": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does.", "/versions/20/tables/0/rows/22/summary": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only .", "/versions/20/tables/0/rows/23/summary": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details.", "/versions/20/tables/0/rows/24/summary": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)", "/versions/20/tables/0/rows/25/summary": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later.", "/versions/20/tables/0/rows/26/summary": "Print the psql version and exit.", "/versions/20/tables/0/rows/27/summary": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/20/tables/0/rows/28/summary": "Force psql to prompt for a password before connecting to a database, even if the password will not be used.", "/versions/20/tables/0/rows/29/summary": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded .", "/versions/20/tables/0/rows/30/summary": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file).", "/versions/20/tables/0/rows/31/summary": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero .", "/versions/20/tables/0/rows/32/summary": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero .", "/versions/20/tables/0/rows/33/summary": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied.", "/versions/20/tables/0/rows/34/summary": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables.", "/versions/20/tables/1/columns/0/label": "Variable", "/versions/20/tables/1/columns/1/label": "Meaning", "/versions/20/tables/1/rows/0/description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode.", "/versions/20/tables/1/rows/1/description": "Default connection parameters (see Section 32.14 ).", "/versions/20/tables/1/rows/2/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .", "/versions/20/tables/1/rows/3/description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems.", "/versions/20/tables/1/rows/4/description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems.", "/versions/20/tables/1/rows/5/description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed.", "/versions/20/tables/1/rows/6/description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If neither of them is set, the default is to use more on most platforms, but less on Cygwin.", "/versions/20/tables/1/rows/7/description": "When a query is executed repeatedly with the \\watch command, a pager is not used by default. This behavior can be changed by setting PSQL_WATCH_PAGER to a pager command, on Unix systems. The pspg pager (not part of PostgreSQL but available in many open source software distributions) can display the output of \\watch if started with the option --stream .", "/versions/20/tables/1/rows/8/description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed.", "/versions/20/tables/1/rows/9/description": "Command executed by the \\! command.", "/versions/20/tables/1/rows/10/description": "Directory for storing temporary files. The default is /tmp ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "ec3f81fff2302d02f8b183f5f507dcfdf263bc44e0a33c4916f5e5071e2b9a4e"}, "comparison_data": {"options": [{"names": ["-a", "--echo-all"], "signature": "-a --echo-all", "description": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all ."}, {"names": ["-A", "--no-align"], "signature": "-A --no-align", "description": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned ."}, {"names": ["-b", "--echo-errors"], "signature": "-b --echo-errors", "description": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors ."}, {"names": ["-c command", "--command= command"], "signature": "-c command --command= command", "description": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. command must be either a command string that is completely parsable by the server (i.e., it contains no psql -specific features), or a single backslash command. Thus you cannot mix SQL and psql meta-commands within a -c option. To achieve that, you could use repeated -c options or pipe the string into psql , for example: psql -c '\\x' -c 'SELECT * FROM foo;' or echo '\\x \\\\ SELECT * FROM foo;' | psql ( \\\\ is the separator meta-command.) Each SQL command string passed to -c is sent to the server as a single request. Because of this, the server executes it as a single transaction even if the string contains multiple SQL commands, unless there are explicit BEGIN / COMMIT commands included in the string to divide it into multiple transactions. (See Section 54.2.2.1 for more details about how the server handles multi-query strings.) If having several commands executed in one transaction is not desired, use repeated -c commands or feed multiple commands to psql 's standard input, either using echo as illustrated above, or via a shell here-document, for example: psql <<EOF \\x SELECT * FROM foo; EOF"}, {"names": ["--csv"], "signature": "--csv", "description": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv ."}, {"names": ["-d dbname", "--dbname= dbname"], "signature": "-d dbname --dbname= dbname", "description": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--echo-queries"], "signature": "-e --echo-queries", "description": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries ."}, {"names": ["-E", "--echo-hidden"], "signature": "-E --echo-hidden", "description": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on ."}, {"names": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i . If filename is - (hyphen), then standard input is read until an EOF indication or \\q meta-command. This can be used to intersperse interactive input with input from files. Note however that Readline is not used in this case (much as if -n had been specified). Using this option is subtly different from writing psql < filename . In general, both will do what you expect, but using -f enables some nice features such as error messages with line numbers. There is also a slight chance that using this option will reduce the start-up overhead. On the other hand, the variant using the shell's input redirection is (in theory) guaranteed to yield exactly the same output you would have received had you entered everything by hand."}, {"names": ["-F separator", "--field-separator= separator"], "signature": "-F separator --field-separator= separator", "description": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f ."}, {"names": ["-h hostname", "--host= hostname"], "signature": "-h hostname --host= hostname", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket."}, {"names": ["-H", "--html"], "signature": "-H --html", "description": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command."}, {"names": ["-l", "--list"], "signature": "-l --list", "description": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list . When this option is used, psql will connect to the database postgres , unless a different database is named on the command line (option -d or non-option argument, possibly via a service entry, but not via an environment variable)."}, {"names": ["-L filename", "--log-file= filename"], "signature": "-L filename --log-file= filename", "description": "Write all query output into file filename , in addition to the normal output destination."}, {"names": ["-n", "--no-readline"], "signature": "-n --no-readline", "description": "Do not use Readline for line editing and do not use the command history (see the section called \u201cCommand-Line Editing\u201d below)."}, {"names": ["-o filename", "--output= filename"], "signature": "-o filename --output= filename", "description": "Put all query output into file filename . This is equivalent to the command \\o ."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432."}, {"names": ["-P assignment", "--pset= assignment"], "signature": "-P assignment --pset= assignment", "description": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex ."}, {"names": ["-q", "--quiet"], "signature": "-q --quiet", "description": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on ."}, {"names": ["-R separator", "--record-separator= separator"], "signature": "-R separator --record-separator= separator", "description": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep ."}, {"names": ["-s", "--single-step"], "signature": "-s --single-step", "description": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts."}, {"names": ["-S", "--single-line"], "signature": "-S --single-line", "description": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does. Note This mode is provided for those who insist on it, but you are not necessarily encouraged to use it. In particular, if you mix SQL and meta-commands on a line the order of execution might not always be clear to the inexperienced user."}, {"names": ["-t", "--tuples-only"], "signature": "-t --tuples-only", "description": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only ."}, {"names": ["-T table_options", "--table-attr= table_options"], "signature": "-T table_options --table-attr= table_options", "description": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)"}, {"names": ["-v assignment", "--set= assignment", "--variable= assignment"], "signature": "-v assignment --set= assignment --variable= assignment", "description": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the psql version and exit."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Force psql to prompt for a password before connecting to a database, even if the password will not be used. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, psql will prompt for a password in any case. However, psql will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-x", "--expanded"], "signature": "-x --expanded", "description": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded ."}, {"names": ["-X", "--no-psqlrc"], "signature": "-X --no-psqlrc", "description": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file)."}, {"names": ["-z", "--field-separator-zero"], "signature": "-z --field-separator-zero", "description": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero ."}, {"names": ["-0", "--record-separator-zero"], "signature": "-0 --record-separator-zero", "description": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero ."}, {"names": ["-1", "--single-transaction"], "signature": "-1 --single-transaction", "description": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied. If the commands themselves contain BEGIN , COMMIT , or ROLLBACK , this option will not have the desired effects. Also, if an individual command cannot be executed inside a transaction block, specifying this option will cause the whole transaction to fail."}, {"names": ["-?", "--help[= topic ]"], "signature": "-? --help[= topic ]", "description": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables."}], "synopsis": ["psql [ option ...] [ dbname [ username ]]"], "environment": [{"name": "COLUMNS", "description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode."}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters (see Section 32.14 )."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems."}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems."}, {"name": "PSQL_HISTORY", "description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed."}, {"name": "PSQL_PAGER PAGER", "description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If neither of them is set, the default is to use more on most platforms, but less on Cygwin."}, {"name": "PSQL_WATCH_PAGER", "description": "When a query is executed repeatedly with the \\watch command, a pager is not used by default. This behavior can be changed by setting PSQL_WATCH_PAGER to a pager command, on Unix systems. The pspg pager (not part of PostgreSQL but available in many open source software distributions) can display the output of \\watch if started with the option --stream ."}, {"name": "PSQLRC", "description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed."}, {"name": "SHELL", "description": "Command executed by the \\! command."}, {"name": "TMPDIR", "description": "Directory for storing temporary files. The default is /tmp ."}]}, "comparison_hash": "e20cf23672989bae36dc0e153040062af2d80e0543a49dc2ce0fd1e99ff042ba", "manual_language": "zh"}}}, "snapshot": {"facts": [{"label": "\u624b\u518c\u4e2d\u7684\u53ef\u6267\u884c\u7a0b\u5e8f", "value": "psql"}, {"label": "\u7a0b\u5e8f\u7248\u672c", "value": "18.6"}, {"label": "\u53c2\u8003\u6e05\u5355", "value": "\u5ba2\u6237\u7aef\u7a0b\u5e8f"}, {"label": "\u9009\u9879\u5b9a\u4e49\u7ec4", "value": "35"}], "tables": [{"key": "options", "rows": [{"summary": "\u5728\u8bfb\u5165\u65f6\u5c06\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u884c\u8bfb\u53d6\uff09\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a all \u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-ALL", "text": "-a --echo-all"}}, {"summary": "\u5207\u6362\u5230\u975e\u5bf9\u9f50\u8f93\u51fa\u6a21\u5f0f\uff08\u9ed8\u8ba4\u8f93\u51fa\u6a21\u5f0f\u662f aligned \uff09\u3002\u8fd9\u7b49\u6548\u4e8e \\pset format unaligned \u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-NO-ALIGN", "text": "-A --no-align"}}, {"summary": "\u628a\u5931\u8d25\u7684 SQL \u547d\u4ee4\u6253\u5370\u5230\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a errors \u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-ERRORS", "text": "-b --echo-errors"}}, {"summary": "\u6307\u5b9a psql \u6267\u884c\u4e00\u4e2a\u7ed9\u5b9a\u7684\u547d\u4ee4\u5b57\u7b26\u4e32 command \u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u591a\u6b21\u5e76\u4e14\u4ee5\u4efb\u4f55\u987a\u5e8f\u4e0e -f \u9009\u9879\u7ec4\u5408\u5728\u4e00\u8d77\u3002\u5f53 -c \u6216\u8005 -f \u88ab\u6307\u5b9a\u65f6\uff0c psql \u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709 -c \u548c -f \u9009\u9879\u540e\u7ec8\u6b62\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-COMMAND", "text": "-c command --command= command"}}, {"summary": "\u5207\u6362\u5230 CSV \uff08\u9017\u53f7\u5206\u9694\u503c\uff09\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u76f8\u5f53\u4e8e \\pset format csv \u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-CSV", "text": "--csv"}}, {"summary": "\u6307\u5b9a\u8981\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002\u8fd9\u7b49\u6548\u4e8e\u6307\u5b9a dbname \u4e3a\u547d\u4ee4\u884c\u4e0a\u7684\u7b2c\u4e00\u4e2a\u975e\u9009\u9879\u53c2\u6570\u3002 dbname \u53ef\u4ee5\u662f \u8fde\u63a5\u5b57\u7b26\u4e32 \u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u5c06\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-DBNAME", "text": "-d dbname --dbname= dbname"}}, {"summary": "\u4e5f\u628a\u53d1\u9001\u5230\u670d\u52a1\u5668\u7684\u6240\u6709 SQL \u547d\u4ee4\u590d\u5236\u5230\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO \u8bbe\u7f6e\u4e3a queries \u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-QUERIES", "text": "-e --echo-queries"}}, {"summary": "\u56de\u663e \\d \u4ee5\u53ca\u5176\u4ed6\u53cd\u659c\u7ebf\u547d\u4ee4\u751f\u6210\u7684\u5b9e\u9645\u67e5\u8be2\u3002\u53ef\u4ee5\u7528\u5b83\u6765\u5b66\u4e60 psql \u7684\u5185\u90e8\u64cd\u4f5c\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf ECHO_HIDDEN \u8bbe\u7f6e\u4e3a on \u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-HIDDEN", "text": "-E --echo-hidden"}}, {"summary": "\u4ece\u6587\u4ef6 filename \u800c\u4e0d\u662f\u6807\u51c6\u8f93\u5165\u4e2d\u8bfb\u53d6\u547d\u4ee4\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u6307\u5b9a\uff0c\u4e5f\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u4e0e -c \u9009\u9879\u7ec4\u5408\u4f7f\u7528\u3002\u5f53\u6307\u5b9a\u4e86 -c \u6216 -f \u65f6\uff0c psql \u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709 -c \u548c -f \u9009\u9879\u540e\u7ec8\u6b62\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u7b49\u4ef7\u4e8e\u5143\u547d\u4ee4 \\i \u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-FILE", "text": "-f filename --file= filename"}}, {"summary": "\u4f7f\u7528 separator \u4f5c\u4e3a\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e \\pset fieldsep \u6216\u8005 \\f \u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR", "text": "-F separator --field-separator= separator"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-FIELD-HOST", "text": "-h hostname --host= hostname"}}, {"summary": "\u5207\u6362\u5230 HTML \u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e \\pset format html \u6216\u8005 \\H \u547d\u4ee4\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-HTML", "text": "-H --html"}}, {"summary": "\u5217\u51fa\u6240\u6709\u53ef\u7528\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u9000\u51fa\u3002\u5176\u4ed6\u975e\u8fde\u63a5\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002\u8fd9\u4e0e\u5143\u547d\u4ee4 \\list \u7c7b\u4f3c\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-LIST", "text": "-l --list"}}, {"summary": "\u9664\u4e86\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u5199\u5230\u666e\u901a\u8f93\u51fa\u76ee\u6807\u4e4b\u5916\uff0c\u8fd8\u5199\u5230\u6587\u4ef6 filename \u4e2d\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-LOG-FILE", "text": "-L filename --log-file= filename"}}, {"summary": "\u4e0d\u8981\u4f7f\u7528 Readline \u8fdb\u884c\u884c\u7f16\u8f91\uff0c\u4e5f\u4e0d\u8981\u4f7f\u7528\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\uff08\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684 \u201c\u547d\u4ee4\u884c\u7f16\u8f91\u201d\u4e00\u8282 \uff09\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-NO-READLINE", "text": "-n --no-readline"}}, {"summary": "\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u653e\u5230\u6587\u4ef6 filename \u4e2d\u3002\u8fd9\u7b49\u6548\u4e8e\u547d\u4ee4 \\o \u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-OUTPUT", "text": "-o filename --output= filename"}}, {"summary": "\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u7684\u6587\u4ef6\u540d\u540e\u7f00\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u7684\u503c\uff1b\u672a\u8bbe\u7f6e\u65f6\uff0c\u4f7f\u7528\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u7aef\u53e3\uff0c\u901a\u5e38\u4e3a 5432\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-PORT", "text": "-p port --port= port"}}, {"summary": "\u4ee5 \\pset \u7684\u5f62\u5f0f\u6307\u5b9a\u6253\u5370\u9009\u9879\u3002\u6ce8\u610f\uff0c\u8fd9\u91cc\u4f60\u5fc5\u987b\u7528\u4e00\u4e2a\u7b49\u53f7\u800c\u4e0d\u662f\u7a7a\u683c\u6765\u5206\u9694\u540d\u79f0\u548c\u503c\u3002\u4f8b\u5982\uff0c\u8981\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a LaTeX \uff0c\u5e94\u8be5\u5199\u6210 -P format=latex \u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-PSET", "text": "-P assignment --pset= assignment"}}, {"summary": "\u6307\u5b9a psql \u5e94\u8be5\u5b89\u9759\u5730\u5de5\u4f5c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4f1a\u6253\u5370\u51fa\u6b22\u8fce\u6d88\u606f\u548c\u5404\u79cd\u63d0\u793a\u4fe1\u606f\u3002\u5982\u679c\u4f7f\u7528\u4e86\u8fd9\u4e2a\u9009\u9879\uff0c\u4ee5\u4e0a\u90a3\u4e9b\u5c31\u90fd\u4e0d\u4f1a\u8f93\u51fa\u3002\u5728\u4f7f\u7528 -c \u9009\u9879\u65f6\uff0c\u914d\u5408\u8fd9\u4e2a\u9009\u9879\u5f88\u6709\u7528\u3002\u8fd9\u7b49\u6548\u4e8e\u8bbe\u7f6e\u53d8\u91cf QUIET \u4e3a on \u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-QUIET", "text": "-q --quiet"}}, {"summary": "\u628a separator \u7528\u4f5c\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e \\pset recordsep \u547d\u4ee4\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR", "text": "-R separator --record-separator= separator"}}, {"summary": "\u8fd0\u884c\u5728\u5355\u6b65\u6a21\u5f0f\u4e2d\u3002\u8fd9\u610f\u5473\u7740\u5728\u6bcf\u4e2a\u547d\u4ee4\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u4e4b\u524d\u90fd\u4f1a\u63d0\u793a\u7528\u6237\uff0c\u5e76\u5141\u8bb8\u53d6\u6d88\u6267\u884c\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u8c03\u8bd5\u811a\u672c\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-SINGLE-STEP", "text": "-s --single-step"}}, {"summary": "\u8fd0\u884c\u5728\u5355\u884c\u6a21\u5f0f\u4e2d\uff0c\u5176\u4e2d\u6362\u884c\u7b26\u4f1a\u7ec8\u6b62\u4e00\u4e2a SQL \u547d\u4ee4\uff0c\u5c31\u50cf\u5206\u53f7\u7684\u4f5c\u7528\u4e00\u6837\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-SINGLE-LINE", "text": "-S --single-line"}}, {"summary": "\u5173\u95ed\u6253\u5370\u5217\u540d\u548c\u7ed3\u679c\u884c\u8ba1\u6570\u9875\u811a\u7b49\u3002\u8fd9\u7b49\u6548\u4e8e \\t \u6216\u8005 \\pset tuples_only \u547d\u4ee4\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-TUPLES-ONLY", "text": "-t --tuples-only"}}, {"summary": "\u6307\u5b9a\u8981\u653e\u5728 HTML table \u6807\u7b7e\u5185\u7684\u9009\u9879\u3002\u8be6\u89c1 \\pset tableattr \u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-TABLE-ATTR", "text": "-T table_options --table-attr= table_options"}}, {"summary": "\u4f5c\u4e3a\u7528\u6237 username \u800c\u4e0d\u662f\u9ed8\u8ba4\u7528\u6237\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff08\u5f53\u7136\uff0c\u4f60\u5fc5\u987b\u5177\u6709\u8fd9\u6837\u505a\u7684\u6743\u9650\uff09\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-USERNAME", "text": "-U username --username= username"}}, {"summary": "\u6267\u884c\u4e00\u6b21\u53d8\u91cf\u8d4b\u503c\uff0c\u548c \\set \u5143\u547d\u4ee4\u76f8\u4f3c\u3002\u6ce8\u610f\u4f60\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u7528\u7b49\u53f7\u5206\u9694\u540d\u5b57\u548c\u503c\uff08\u5982\u679c\u6709\uff09\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u7684\u8bbe\u7f6e\uff0c\u53bb\u6389\u7b49\u53f7\u5c31\u884c\u3002\u8981\u628a\u4e00\u4e2a\u53d8\u91cf\u8bbe\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u4f7f\u7528\u7b49\u53f7\u4f46\u662f\u53bb\u6389\u503c\u3002\u8fd9\u4e9b\u8d4b\u503c\u5728\u547d\u4ee4\u884c\u5904\u7406\u671f\u95f4\u88ab\u5b8c\u6210\uff0c\u56e0\u6b64\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u7684\u53d8\u91cf\u5c06\u5728\u7a0d\u540e\u88ab\u8986\u76d6\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-VARIABLE", "text": "-v assignment --set= assignment --variable= assignment"}}, {"summary": "\u6253\u5370 psql \u7248\u672c\u5e76\u4e14\u9000\u51fa\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-VERSION", "text": "-V --version"}}, {"summary": "\u6c38\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982 .pgpass \u6587\u4ef6\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u8fd9\u4e2a\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4efb\u52a1\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u65f6\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-NO-PASSWORD", "text": "-w --no-password"}}, {"summary": "\u5f3a\u5236 psql \u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\uff0c\u5373\u4f7f\u8be5\u5bc6\u7801\u5b9e\u9645\u4e0a\u4e0d\u4f1a\u88ab\u4f7f\u7528\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-PASSWORD", "text": "-W --password"}}, {"summary": "\u6253\u5f00\u6269\u5c55\u8868\u683c\u5f0f\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e \\x \u6216\u8005 \\pset expanded \u547d\u4ee4\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-EXPANDED", "text": "-x --expanded"}}, {"summary": "\u4e0d\u8bfb\u53d6\u542f\u52a8\u6587\u4ef6\uff08\u65e2\u4e0d\u8bfb\u53d6\u7cfb\u7edf\u8303\u56f4\u7684 psqlrc \u6587\u4ef6\uff0c\u4e5f\u4e0d\u8bfb\u53d6\u7528\u6237\u7684 ~/.psqlrc \u6587\u4ef6\uff09\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-NO-PSQLRC", "text": "-X --no-psqlrc"}}, {"summary": "\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u8fd9\u7b49\u6548\u4e8e \\pset fieldsep_zero \u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR-ZERO", "text": "-z --field-separator-zero"}}, {"summary": "\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u4f8b\u5982\uff0c\u8fd9\u6709\u52a9\u4e8e\u4e0e xargs -0 \u914d\u5408\u4f7f\u7528\u3002\u8fd9\u7b49\u6548\u4e8e \\pset recordsep_zero \u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR-ZERO", "text": "-0 --record-separator-zero"}}, {"summary": "\u8fd9\u4e2a\u9009\u9879\u53ea\u80fd\u4e0e\u4e00\u4e2a\u6216\u591a\u4e2a -c \u548c/\u6216 -f \u9009\u9879\u7ed3\u5408\u4f7f\u7528\u3002\u5b83\u4f1a\u5bfc\u81f4 psql \u5728\u7b2c\u4e00\u4e2a\u8fd9\u6837\u7684\u9009\u9879\u4e4b\u524d\u53d1\u51fa\u4e00\u4e2a BEGIN \u547d\u4ee4\uff0c\u5e76\u5728\u6700\u540e\u4e00\u4e2a\u9009\u9879\u4e4b\u540e\u53d1\u51fa\u4e00\u4e2a COMMIT \u547d\u4ee4\uff0c\u4ece\u800c\u5c06\u6240\u6709\u547d\u4ee4\u5305\u88c5\u6210\u4e00\u4e2a\u5355\u72ec\u7684\u4e8b\u52a1\u3002\u5982\u679c\u4efb\u4f55\u547d\u4ee4\u5931\u8d25\u4e14\u53d8\u91cf ON_ERROR_STOP \u88ab\u8bbe\u7f6e\uff0c\u5219\u4f1a\u6539\u4e3a\u53d1\u9001\u4e00\u4e2a ROLLBACK \u547d\u4ee4\u3002\u8fd9\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-SINGLE-TRANSACTION", "text": "-1 --single-transaction"}}, {"summary": "\u663e\u793a\u6709\u5173 psql \u7684\u5e2e\u52a9\u5e76\u4e14\u9000\u51fa\u3002\u53ef\u9009\u7684 topic \u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a options \uff09\u9009\u62e9\u8981\u89e3\u91ca psql \u7684\u54ea\u4e00\u90e8\u5206\uff1a commands \u63cf\u8ff0 psql \u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b options \u63cf\u8ff0\u53ef\u4ee5\u88ab\u4f20\u9012\u7ed9 psql \u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c variables \u5219\u663e\u793a\u6709\u5173 psql \u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002", "signature": {"url": "/docs/18/app-psql.html#APP-PSQL-OPTION-HELP", "text": "-? --help[= topic ]"}}], "title": "\u624b\u518c\u4e2d\u7684\u9009\u9879", "columns": [{"key": "signature", "label": "\u9009\u9879\u4e0e\u53c2\u6570"}, {"key": "summary", "label": "\u8bf4\u660e"}]}, {"key": "environment", "rows": [{"name": "COLUMNS", "description": "\u5982\u679c \\pset columns \u4e3a\u96f6\uff0c\u8fd9\u4e2a\u73af\u5883\u53d8\u91cf\u63a7\u5236\u7528\u4e8e wrapped \u683c\u5f0f\u7684\u5bbd\u5ea6\u4ee5\u53ca\u7528\u6765\u786e\u5b9a\u8f83\u5bbd\u7684\u8f93\u51fa\u662f\u5426\u9700\u8981\u5206\u9875\u5668\uff0c\u6216\u8005\u662f\u5426\u5e94\u5207\u6362\u5230\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e2d\u7684\u5782\u76f4\u683c\u5f0f\u7684\u5bbd\u5ea6\u3002"}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\uff08\u89c1 \u7b2c 32.15 \u8282 \uff09\u3002"}, {"name": "PG_COLOR", "description": "\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a always \u3001 auto \u548c never \u3002"}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "\\e \u3001 \\ef \u4ee5\u53ca \\ev \u547d\u4ee4\u6240\u4f7f\u7528\u7684\u7f16\u8f91\u5668\u3002\u4f1a\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u68c0\u67e5\u8fd9\u4e9b\u53d8\u91cf\uff0c\u7b2c\u4e00\u4e2a\u88ab\u8bbe\u7f6e\u7684\u5c06\u88ab\u4f7f\u7528\u3002\u5982\u679c\u90fd\u6ca1\u6709\u88ab\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u662f\u4f7f\u7528Unix\u7cfb\u7edf\u4e0a\u7684 vi \u6216\u8005Windows\u7cfb\u7edf\u4e0a\u7684 notepad.exe \u3002"}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "\u5f53 \\e \u3001 \\ef \u6216 \\ev \u5e26\u6709\u884c\u53f7\u53c2\u6570\u4f7f\u7528\u65f6\uff0c\u6b64\u53d8\u91cf\u6307\u5b9a\u5c06\u8d77\u59cb\u884c\u53f7\u4f20\u7ed9\u7528\u6237\u7f16\u8f91\u5668\u65f6\u6240\u7528\u7684\u547d\u4ee4\u884c\u53c2\u6570\u3002\u5bf9\u4e8e Emacs \u6216 vi \u4e4b\u7c7b\u7684\u7f16\u8f91\u5668\uff0c\u8fd9\u4e2a\u53c2\u6570\u662f\u4e00\u4e2a\u52a0\u53f7\u3002\u5982\u679c\u9009\u9879\u540d\u548c\u884c\u53f7\u4e4b\u95f4\u9700\u8981\u7a7a\u683c\uff0c\u8bf7\u5728\u53d8\u91cf\u503c\u4e2d\u5305\u542b\u672b\u5c3e\u7a7a\u683c\u3002\u4f8b\u5982\uff1a PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' \u5728 Unix \u7cfb\u7edf\u4e0a\u9ed8\u8ba4\u662f + \uff08\u5bf9\u5e94\u4e8e\u9ed8\u8ba4\u7f16\u8f91\u5668 vi \uff0c\u4e14\u5bf9\u5f88\u591a\u5176\u4ed6\u5e38\u89c1\u7f16\u8f91\u5668\u53ef\u7528\uff09\u3002\u5728 Windows \u7cfb\u7edf\u4e0a\u6ca1\u6709\u9ed8\u8ba4\u503c\u3002"}, {"name": "PSQL_HISTORY", "description": "\u547d\u4ee4\u5386\u53f2\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08 ~ \uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002"}, {"name": "PSQL_PAGER PAGER", "description": "\u5982\u679c\u67e5\u8be2\u7ed3\u679c\u65e0\u6cd5\u5728\u5c4f\u5e55\u4e0a\u663e\u793a\u5b8c\u6574\uff0c\u5b83\u4eec\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6b64\u547d\u4ee4\u3002\u5178\u578b\u7684\u503c\u662f more \u6216 less \u3002\u53ef\u4ee5\u901a\u8fc7\u5c06 PSQL_PAGER \u6216 PAGER \u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u6216\u901a\u8fc7\u8c03\u6574 \\pset \u547d\u4ee4\u7684\u4e0e\u5206\u9875\u76f8\u5173\u7684\u9009\u9879\u6765\u7981\u7528\u5206\u9875\u5668\u3002\u8fd9\u4e9b\u53d8\u91cf\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u8fdb\u884c\u68c0\u67e5\uff1b\u4f7f\u7528\u6309\u8be5\u987a\u5e8f\u627e\u5230\u7684\u7b2c\u4e00\u4e2a\u5df2\u8bbe\u7f6e\u7684\u53d8\u91cf\u3002\u5982\u679c\u5b83\u4eec\u90fd\u6ca1\u6709\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5728\u5927\u591a\u6570\u5e73\u53f0\u4e0a\u4f7f\u7528 more \uff0c\u4f46\u5728Cygwin\u4e0a\u4f7f\u7528 less \u3002"}, {"name": "PSQL_WATCH_PAGER", "description": "\u4f7f\u7528 \\watch \u547d\u4ee4\u53cd\u590d\u6267\u884c\u67e5\u8be2\u65f6\uff0c\u9ed8\u8ba4\u4e0d\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\u3002\u5728 Unix \u7cfb\u7edf\u4e0a\uff0c\u53ef\u4ee5\u5c06 PSQL_WATCH_PAGER \u8bbe\u4e3a\u5206\u9875\u7a0b\u5e8f\u547d\u4ee4\u6765\u6539\u53d8\u6b64\u884c\u4e3a\u3002pspg \u5206\u9875\u7a0b\u5e8f\uff08\u4e0d\u5c5e\u4e8e PostgreSQL\uff0c\u4f46\u8bb8\u591a\u5f00\u6e90\u8f6f\u4ef6\u53d1\u884c\u7248\u90fd\u63d0\u4f9b\u5b83\uff09\u4ee5 --stream \u9009\u9879\u542f\u52a8\u65f6\uff0c\u53ef\u4ee5\u663e\u793a \\watch \u7684\u8f93\u51fa\u3002"}, {"name": "PSQLRC", "description": "\u7528\u6237\u7684 .psqlrc \u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08 ~ \uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002"}, {"name": "SHELL", "description": "\u88ab \\! \u547d\u4ee4\u6267\u884c\u7684\u547d\u4ee4\u3002"}, {"name": "TMPDIR", "description": "\u5b58\u50a8\u4e34\u65f6\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u662f /tmp \u3002"}], "title": "\u73af\u5883\u53d8\u91cf", "columns": [{"key": "name", "label": "\u53d8\u91cf"}, {"key": "description", "label": "\u542b\u4e49"}]}], "options": [{"names": ["-a", "--echo-all"], "summary": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all .", "signature": "-a --echo-all", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-ALL", "description": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all ."}, {"names": ["-A", "--no-align"], "summary": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned .", "signature": "-A --no-align", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-NO-ALIGN", "description": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned ."}, {"names": ["-b", "--echo-errors"], "summary": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors .", "signature": "-b --echo-errors", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-ERRORS", "description": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors ."}, {"names": ["-c command", "--command= command"], "summary": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence.", "signature": "-c command --command= command", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-COMMAND", "description": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. command must be either a command string that is completely parsable by the server (i.e., it contains no psql -specific features), or a single backslash command. Thus you cannot mix SQL and psql meta-commands within a -c option. To achieve that, you could use repeated -c options or pipe the string into psql , for example: psql -c '\\x' -c 'SELECT * FROM foo;' or echo '\\x \\\\ SELECT * FROM foo;' | psql ( \\\\ is the separator meta-command.) Each SQL command string passed to -c is sent to the server as a single request. Because of this, the server executes it as a single transaction even if the string contains multiple SQL commands, unless there are explicit BEGIN / COMMIT commands included in the string to divide it into multiple transactions. (See Section 54.2.2.1 for more details about how the server handles multi-query strings.) If having several commands executed in one transaction is not desired, use repeated -c commands or feed multiple commands to psql 's standard input, either using echo as illustrated above, or via a shell here-document, for example: psql <<EOF \\x SELECT * FROM foo; EOF"}, {"names": ["--csv"], "summary": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv .", "signature": "--csv", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-CSV", "description": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv ."}, {"names": ["-d dbname", "--dbname= dbname"], "summary": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "signature": "-d dbname --dbname= dbname", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-DBNAME", "description": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--echo-queries"], "summary": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries .", "signature": "-e --echo-queries", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-QUERIES", "description": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries ."}, {"names": ["-E", "--echo-hidden"], "summary": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on .", "signature": "-E --echo-hidden", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-ECHO-HIDDEN", "description": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on ."}, {"names": ["-f filename", "--file= filename"], "summary": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i .", "signature": "-f filename --file= filename", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-FILE", "description": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i . If filename is - (hyphen), then standard input is read until an EOF indication or \\q meta-command. This can be used to intersperse interactive input with input from files. Note however that Readline is not used in this case (much as if -n had been specified). Using this option is subtly different from writing psql < filename . In general, both will do what you expect, but using -f enables some nice features such as error messages with line numbers. There is also a slight chance that using this option will reduce the start-up overhead. On the other hand, the variant using the shell's input redirection is (in theory) guaranteed to yield exactly the same output you would have received had you entered everything by hand."}, {"names": ["-F separator", "--field-separator= separator"], "summary": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f .", "signature": "-F separator --field-separator= separator", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR", "description": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f ."}, {"names": ["-h hostname", "--host= hostname"], "summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket.", "signature": "-h hostname --host= hostname", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-FIELD-HOST", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket."}, {"names": ["-H", "--html"], "summary": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command.", "signature": "-H --html", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-HTML", "description": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command."}, {"names": ["-l", "--list"], "summary": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list .", "signature": "-l --list", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-LIST", "description": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list . When this option is used, psql will connect to the database postgres , unless a different database is named on the command line (option -d or non-option argument, possibly via a service entry, but not via an environment variable)."}, {"names": ["-L filename", "--log-file= filename"], "summary": "Write all query output into file filename , in addition to the normal output destination.", "signature": "-L filename --log-file= filename", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-LOG-FILE", "description": "Write all query output into file filename , in addition to the normal output destination."}, {"names": ["-n", "--no-readline"], "summary": "Do not use Readline for line editing and do not use the command history (see the section called \u201cCommand-Line Editing\u201d below).", "signature": "-n --no-readline", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-NO-READLINE", "description": "Do not use Readline for line editing and do not use the command history (see the section called \u201cCommand-Line Editing\u201d below)."}, {"names": ["-o filename", "--output= filename"], "summary": "Put all query output into file filename . This is equivalent to the command \\o .", "signature": "-o filename --output= filename", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-OUTPUT", "description": "Put all query output into file filename . This is equivalent to the command \\o ."}, {"names": ["-p port", "--port= port"], "summary": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432.", "signature": "-p port --port= port", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-PORT", "description": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432."}, {"names": ["-P assignment", "--pset= assignment"], "summary": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex .", "signature": "-P assignment --pset= assignment", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-PSET", "description": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex ."}, {"names": ["-q", "--quiet"], "summary": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on .", "signature": "-q --quiet", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-QUIET", "description": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on ."}, {"names": ["-R separator", "--record-separator= separator"], "summary": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep .", "signature": "-R separator --record-separator= separator", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR", "description": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep ."}, {"names": ["-s", "--single-step"], "summary": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts.", "signature": "-s --single-step", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-SINGLE-STEP", "description": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts."}, {"names": ["-S", "--single-line"], "summary": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does.", "signature": "-S --single-line", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-SINGLE-LINE", "description": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does. Note This mode is provided for those who insist on it, but you are not necessarily encouraged to use it. In particular, if you mix SQL and meta-commands on a line the order of execution might not always be clear to the inexperienced user."}, {"names": ["-t", "--tuples-only"], "summary": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only .", "signature": "-t --tuples-only", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-TUPLES-ONLY", "description": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only ."}, {"names": ["-T table_options", "--table-attr= table_options"], "summary": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details.", "signature": "-T table_options --table-attr= table_options", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-TABLE-ATTR", "description": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details."}, {"names": ["-U username", "--username= username"], "summary": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)", "signature": "-U username --username= username", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-USERNAME", "description": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)"}, {"names": ["-v assignment", "--set= assignment", "--variable= assignment"], "summary": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later.", "signature": "-v assignment --set= assignment --variable= assignment", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-VARIABLE", "description": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later."}, {"names": ["-V", "--version"], "summary": "Print the psql version and exit.", "signature": "-V --version", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-VERSION", "description": "Print the psql version and exit."}, {"names": ["-w", "--no-password"], "summary": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "signature": "-w --no-password", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-NO-PASSWORD", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-W", "--password"], "summary": "Force psql to prompt for a password before connecting to a database, even if the password will not be used.", "signature": "-W --password", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-PASSWORD", "description": "Force psql to prompt for a password before connecting to a database, even if the password will not be used. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, psql will prompt for a password in any case. However, psql will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-x", "--expanded"], "summary": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded .", "signature": "-x --expanded", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-EXPANDED", "description": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded ."}, {"names": ["-X", "--no-psqlrc"], "summary": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file).", "signature": "-X --no-psqlrc", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-NO-PSQLRC", "description": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file)."}, {"names": ["-z", "--field-separator-zero"], "summary": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero .", "signature": "-z --field-separator-zero", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-FIELD-SEPARATOR-ZERO", "description": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero ."}, {"names": ["-0", "--record-separator-zero"], "summary": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero .", "signature": "-0 --record-separator-zero", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-RECORD-SEPARATOR-ZERO", "description": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero ."}, {"names": ["-1", "--single-transaction"], "summary": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied.", "signature": "-1 --single-transaction", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-SINGLE-TRANSACTION", "description": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied. If the commands themselves contain BEGIN , COMMIT , or ROLLBACK , this option will not have the desired effects. Also, if an individual command cannot be executed inside a transaction block, specifying this option will cause the whole transaction to fail."}, {"names": ["-?", "--help[= topic ]"], "summary": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables.", "signature": "-? --help[= topic ]", "source_url": "/docs/18/app-psql.html#APP-PSQL-OPTION-HELP", "description": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables."}], "related": [{"url": "/wiki/psql/?v=18", "label": "psql \u5143\u547d\u4ee4"}, {"url": "/wiki/conn/?v=18", "label": "libpq \u8fde\u63a5\u53c2\u6570"}], "release": {"ref": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "label": "18.6", "major": "18", "channel": "stable", "manifest": {"pdf": {"A4": {"url": "/files/documentation/pdf/18/postgresql-18-A4.pdf", "bytes": 15865106, "pages": 3154, "sha256": "19512c405da53f9f7fcf0abba359223aa65f021be025bf3411381918f92e3190", "built_at": "2026-09-26"}, "US": {"url": "/files/documentation/pdf/18/postgresql-18-US.pdf", "bytes": 15748059, "pages": 3328, "sha256": "facbe6c229e598b872d3d98bef53308f46e06746006fa4590de9a7de9dd46319", "built_at": "2026-09-26"}}, "tree": "18", "index": "index.html", "major": "18", "pages": 1148, "release": "18.6", "source_url": "https://ftp.postgresql.org/pub/source/v18.6/postgresql-18.6.tar.bz2", "svg_assets": 3, "source_mode": "en SGML built with pinned official archive", "source_sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}, "revision": "ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8", "evidence_kind": "English manual and source declarations", "source_sha256": "555610c24d53e4316da5b7d3fc25c279d96856d5e0e23ee308c328c5fa881d9f"}, "sources": [{"url": "https://pg.center/docs/18/app-psql.html", "file": "app-psql.html", "label": "18.6 English manual \u00b7 app-psql.html", "anchor": "", "sha256": "fa2a1d39294b8854318e82e93f71272c645ed88150ecc2786c28902c3f32782c", "language": "en", "original_url": "/docs/18/app-psql.html"}, {"url": "https://pg.center/docs/18/reference-client.html", "file": "reference-client.html", "label": "Client applications inventory", "anchor": "", "sha256": "68f726af77272fe73a827be2b7b5958d0f2239a6f8ed44264e9d42496bfa4fd0", "language": "en", "original_url": "/docs/18/reference-client.html"}], "sections": [], "synopsis": ["psql [ option ...] [ dbname [ username ]]"], "signature": "psql [ option ...] [ dbname [ username ]]", "description": ["psql \u2014 PostgreSQL \u7684\u4ea4\u4e92\u5f0f\u7ec8\u7aef"], "environment": [{"name": "COLUMNS", "description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode."}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters (see Section 32.15 )."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems."}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems."}, {"name": "PSQL_HISTORY", "description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed."}, {"name": "PSQL_PAGER PAGER", "description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If neither of them is set, the default is to use more on most platforms, but less on Cygwin."}, {"name": "PSQL_WATCH_PAGER", "description": "When a query is executed repeatedly with the \\watch command, a pager is not used by default. This behavior can be changed by setting PSQL_WATCH_PAGER to a pager command, on Unix systems. The pspg pager (not part of PostgreSQL but available in many open source software distributions) can display the output of \\watch if started with the option --stream ."}, {"name": "PSQLRC", "description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed."}, {"name": "SHELL", "description": "Command executed by the \\! command."}, {"name": "TMPDIR", "description": "Directory for storing temporary files. The default is /tmp ."}], "manual_html": "<div><div class=\"refentry\" id=\"APP-PSQL\">\n<div class=\"titlepage\"></div>\n<div class=\"refnamediv\">\n<h2><span class=\"refentrytitle\"><span class=\"application\">psql</span></span></h2>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u2014 <span class=\"productname\">PostgreSQL</span>\u7684\u4ea4\u4e92\u5f0f\u7ec8\u7aef</p>\n</div>\n<div class=\"refsynopsisdiv\">\n<h2 lang=\"zh\">\u5927\u7eb2</h2>\n<div class=\"cmdsynopsis\">\n<p id=\"id-1.9.4.21.4.1\"><code class=\"command\">psql</code> [<em class=\"replaceable\"><code>option</code></em>...] [<em class=\"replaceable\"><code>dbname</code></em> [<em class=\"replaceable\"><code>username</code></em>]]</p>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.21.5\">\n<h2 lang=\"zh\">\u8bf4\u660e</h2>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u662f<span class=\"productname\">PostgreSQL</span>\u7684\u4e00\u4e2a\u57fa\u4e8e\u7ec8\u7aef\u7684\u524d\u7aef\u3002\u5b83\u4f7f\u4f60\u80fd\u591f\u4ea4\u4e92\u5f0f\u5730\u8f93\u5165\u67e5\u8be2\uff0c\u5c06\u5176\u53d1\u9001\u7ed9<span class=\"productname\">PostgreSQL</span>\uff0c\u5e76\u67e5\u770b\u67e5\u8be2\u7ed3\u679c\u3002\u4e5f\u53ef\u4ee5\u4ece\u6587\u4ef6\u6216\u547d\u4ee4\u884c\u53c2\u6570\u63d0\u4f9b\u8f93\u5165\u3002\u6b64\u5916\uff0c<span class=\"application\">psql</span>\u8fd8\u63d0\u4f9b\u4e86\u82e5\u5e72\u5143\u547d\u4ee4\u548c\u591a\u79cd\u7c7b\u4f3c shell \u7684\u7279\u6027\uff0c\u4ee5\u4fbf\u4e8e\u7f16\u5199\u811a\u672c\u548c\u81ea\u52a8\u5316\u6267\u884c\u5404\u79cd\u4efb\u52a1\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"R1-APP-PSQL-3\">\n<h2 lang=\"zh\">\u9009\u9879</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-OPTION-ECHO-ALL\"><span class=\"term\"><code class=\"option\">-a</code><br/></span><span class=\"term\"><code class=\"option\">--echo-all</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8bfb\u5165\u65f6\u5c06\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u884c\u8bfb\u53d6\uff09\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a <code class=\"literal\">all</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-NO-ALIGN\"><span class=\"term\"><code class=\"option\">-A</code><br/></span><span class=\"term\"><code class=\"option\">--no-align</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230\u975e\u5bf9\u9f50\u8f93\u51fa\u6a21\u5f0f\uff08\u9ed8\u8ba4\u8f93\u51fa\u6a21\u5f0f\u662f<code class=\"literal\">aligned</code>\uff09\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset format unaligned</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-ECHO-ERRORS\"><span class=\"term\"><code class=\"option\">-b</code><br/></span><span class=\"term\"><code class=\"option\">--echo-errors</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u5931\u8d25\u7684 SQL \u547d\u4ee4\u6253\u5370\u5230\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">errors</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-COMMAND\"><span class=\"term\"><code class=\"option\">-c <em class=\"replaceable\"><code>command</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--command=<em class=\"replaceable\"><code>command</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a<span class=\"application\">psql</span>\u6267\u884c\u4e00\u4e2a\u7ed9\u5b9a\u7684\u547d\u4ee4\u5b57\u7b26\u4e32<em class=\"replaceable\"><code>command</code></em>\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u591a\u6b21\u5e76\u4e14\u4ee5\u4efb\u4f55\u987a\u5e8f\u4e0e<code class=\"option\">-f</code>\u9009\u9879\u7ec4\u5408\u5728\u4e00\u8d77\u3002\u5f53<code class=\"option\">-c</code>\u6216\u8005<code class=\"option\">-f</code>\u88ab\u6307\u5b9a\u65f6\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709<code class=\"option\">-c</code>\u548c<code class=\"option\">-f</code>\u9009\u9879\u540e\u7ec8\u6b62\u3002</p>\n<p lang=\"zh\"><em class=\"replaceable\"><code>command</code></em>\u5fc5\u987b\u662f\u4e00\u4e2a\u670d\u52a1\u5668\u5b8c\u5168\u53ef\u89e3\u6790\u7684\u547d\u4ee4\u5b57\u7b26\u4e32\uff08\u5373\u4e0d\u5305\u542b<span class=\"application\">psql</span>\u4e13\u6709\u7684\u7279\u6027\uff09\u6216\u8005\u5355\u4e2a\u53cd\u659c\u7ebf\u547d\u4ee4\u3002\u56e0\u6b64\u4e0d\u80fd\u5728\u4e00\u4e2a<code class=\"option\">-c</code>\u9009\u9879\u4e2d\u6df7\u5408<acronym class=\"acronym\">SQL</acronym>\u548c<span class=\"application\">psql</span>\u5143\u547d\u4ee4\u3002\u8981\u90a3\u6837\u505a\uff0c\u53ef\u4ee5\u4f7f\u7528\u591a\u4e2a<code class=\"option\">-c</code>\u9009\u9879\u6216\u8005\u628a\u5b57\u7b26\u4e32\u7528\u7ba1\u9053\u8f93\u9001\u5230<span class=\"application\">psql</span>\u4e2d\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">psql -c '\\x' -c 'SELECT * FROM foo;'\n</pre>\n<p lang=\"zh\">\u6216\u8005</p>\n<pre class=\"programlisting\">echo '\\x \\\\ SELECT * FROM foo;' | psql\n</pre>\n<p lang=\"zh\">\uff08<code class=\"literal\">\\\\</code>\u662f\u5206\u9694\u7b26\u5143\u547d\u4ee4\uff09\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u5b57\u7b26\u4e32\u4f20\u9012\u7ed9<code class=\"option\">-c</code>\u90fd\u4f5c\u4e3a\u4e00\u4e2a\u5355\u72ec\u7684\u8bf7\u6c42\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u56e0\u6b64\uff0c\u5373\u4f7f\u5b57\u7b26\u4e32\u5305\u542b\u591a\u4e2a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\uff0c\u670d\u52a1\u5668\u4e5f\u4f1a\u5c06\u5176\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff0c\u9664\u975e\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u660e\u786e\u7684<code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code>\u547d\u4ee4\u5c06\u5176\u5206\u6210\u591a\u4e2a\u4e8b\u52a1\u3002\uff08\u6709\u5173\u670d\u52a1\u5668\u5982\u4f55\u5904\u7406\u591a\u67e5\u8be2\u5b57\u7b26\u4e32\u7684\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/18/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT\" title=\"54.2.2.1.\u00a0\u4e00\u4e2a\u7b80\u5355\u67e5\u8be2\u4e2d\u7684\u591a\u6761\u8bed\u53e5\">\u7b2c\u00a054.2.2.1\u00a0\u8282</a>\u3002\uff09</p>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u5e0c\u671b\u5728\u4e00\u4e2a\u4e8b\u52a1\u4e2d\u6267\u884c\u591a\u4e2a\u547d\u4ee4\uff0c\u53ef\u4ee5\u4f7f\u7528\u91cd\u590d\u7684<code class=\"option\">-c</code>\u547d\u4ee4\uff0c\u6216\u5c06\u591a\u4e2a\u547d\u4ee4\u8f93\u5165\u5230<span class=\"application\">psql</span>\u7684\u6807\u51c6\u8f93\u5165\uff0c\u53ef\u4ee5\u50cf\u4e0a\u9762\u793a\u4f8b\u4e2d\u4f7f\u7528<span class=\"application\">echo</span>\uff0c\u4e5f\u53ef\u4ee5\u901a\u8fc7shell\u7684here-document\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">psql &lt;&lt;EOF\n\\x\nSELECT * FROM foo;\nEOF\n</pre>\n</dd>\n<dt id=\"APP-PSQL-OPTION-CSV\"><span class=\"term\"><code class=\"option\">--csv</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230<acronym class=\"acronym\">CSV</acronym>\uff08\u9017\u53f7\u5206\u9694\u503c\uff09\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u76f8\u5f53\u4e8e<code class=\"command\">\\pset format csv</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-DBNAME\"><span class=\"term\"><code class=\"option\">-d <em class=\"replaceable\"><code>dbname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--dbname=<em class=\"replaceable\"><code>dbname</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002\u8fd9\u7b49\u6548\u4e8e\u6307\u5b9a<em class=\"replaceable\"><code>dbname</code></em>\u4e3a\u547d\u4ee4\u884c\u4e0a\u7684\u7b2c\u4e00\u4e2a\u975e\u9009\u9879\u53c2\u6570\u3002<em class=\"replaceable\"><code>dbname</code></em> \u53ef\u4ee5\u662f<a class=\"link\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u8fde\u63a5\u5b57\u7b26\u4e32</a>\u3002\u5982\u679c\u662f\u8fd9\u6837\uff0c\u8fde\u63a5\u5b57\u7b26\u4e32\u53c2\u6570\u5c06\u8986\u76d6\u4efb\u4f55\u51b2\u7a81\u7684\u547d\u4ee4\u884c\u9009\u9879\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-ECHO-QUERIES\"><span class=\"term\"><code class=\"option\">-e</code><br/></span><span class=\"term\"><code class=\"option\">--echo-queries</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e5f\u628a\u53d1\u9001\u5230\u670d\u52a1\u5668\u7684\u6240\u6709 SQL \u547d\u4ee4\u590d\u5236\u5230\u6807\u51c6\u8f93\u51fa\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">queries</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-ECHO-HIDDEN\"><span class=\"term\"><code class=\"option\">-E</code><br/></span><span class=\"term\"><code class=\"option\">--echo-hidden</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u56de\u663e<code class=\"command\">\\d</code>\u4ee5\u53ca\u5176\u4ed6\u53cd\u659c\u7ebf\u547d\u4ee4\u751f\u6210\u7684\u5b9e\u9645\u67e5\u8be2\u3002\u53ef\u4ee5\u7528\u5b83\u6765\u5b66\u4e60<span class=\"application\">psql</span>\u7684\u5185\u90e8\u64cd\u4f5c\u3002\u8fd9\u7b49\u6548\u4e8e\u628a\u53d8\u91cf<code class=\"varname\">ECHO_HIDDEN</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-FILE\"><span class=\"term\"><code class=\"option\">-f <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--file=<em class=\"replaceable\"><code>filename</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u800c\u4e0d\u662f\u6807\u51c6\u8f93\u5165\u4e2d\u8bfb\u53d6\u547d\u4ee4\u3002\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u91cd\u590d\u6307\u5b9a\uff0c\u4e5f\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u4e0e<code class=\"option\">-c</code>\u9009\u9879\u7ec4\u5408\u4f7f\u7528\u3002\u5f53\u6307\u5b9a\u4e86<code class=\"option\">-c</code>\u6216<code class=\"option\">-f</code>\u65f6\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\u547d\u4ee4\uff0c\u800c\u662f\u5728\u6309\u987a\u5e8f\u5904\u7406\u5b8c\u6240\u6709<code class=\"option\">-c</code>\u548c<code class=\"option\">-f</code>\u9009\u9879\u540e\u7ec8\u6b62\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u5f88\u5927\u7a0b\u5ea6\u4e0a\u7b49\u4ef7\u4e8e\u5143\u547d\u4ee4<code class=\"command\">\\i</code>\u3002</p>\n<p lang=\"zh\">\u5982\u679c<em class=\"replaceable\"><code>filename</code></em>\u662f<code class=\"literal\">-</code>\uff08\u8fde\u5b57\u7b26\uff09\uff0c\u5219\u4f1a\u8bfb\u53d6\u6807\u51c6\u8f93\u5165\uff0c\u76f4\u5230\u9047\u5230 <acronym class=\"acronym\">EOF</acronym> \u6307\u793a\u6216<code class=\"command\">\\q</code>\u5143\u547d\u4ee4\u3002\u8fd9\u53ef\u7528\u4e8e\u5c06\u4ea4\u4e92\u5f0f\u8f93\u5165\u4e0e\u6587\u4ef6\u8f93\u5165\u4ea4\u9519\u4f7f\u7528\u3002\u4e0d\u8fc7\u8bf7\u6ce8\u610f\uff0c\u8fd9\u79cd\u60c5\u51b5\u4e0b\u4e0d\u4f1a\u4f7f\u7528 <span class=\"application\">Readline</span>\uff08\u5f88\u50cf\u6307\u5b9a\u4e86<code class=\"option\">-n</code>\u65f6\u7684\u60c5\u51b5\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u4e0e\u5199\u6210<code class=\"literal\">psql &lt; <em class=\"replaceable\"><code>filename</code></em></code>\u6709\u7ec6\u5fae\u5dee\u522b\u3002\u901a\u5e38\u4e24\u79cd\u5f62\u5f0f\u90fd\u4f1a\u5f97\u5230\u4f60\u671f\u671b\u7684\u7ed3\u679c\uff0c\u4f46\u4f7f\u7528<code class=\"literal\">-f</code>\u53ef\u4ee5\u542f\u7528\u4e00\u4e9b\u6709\u7528\u7684\u7279\u6027\uff0c\u4f8b\u5982\u5e26\u884c\u53f7\u7684\u9519\u8bef\u6d88\u606f\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u4e5f\u8fd8\u6709\u4e00\u70b9\u673a\u4f1a\u964d\u4f4e\u542f\u52a8\u5f00\u9500\u3002\u53e6\u4e00\u65b9\u9762\uff0c\u4f7f\u7528 shell \u8f93\u5165\u91cd\u5b9a\u5411\u7684\u5f62\u5f0f\u5728\u7406\u8bba\u4e0a\u80fd\u4fdd\u8bc1\u5f97\u5230\u4e0e\u4f60\u624b\u5de5\u9010\u884c\u8f93\u5165\u65f6\u5b8c\u5168\u76f8\u540c\u7684\u8f93\u51fa\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-FIELD-SEPARATOR\"><span class=\"term\"><code class=\"option\">-F <em class=\"replaceable\"><code>separator</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--field-separator=<em class=\"replaceable\"><code>separator</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f7f\u7528<em class=\"replaceable\"><code>separator</code></em>\u4f5c\u4e3a\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset fieldsep</code>\u6216\u8005<code class=\"command\">\\f</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-FIELD-HOST\"><span class=\"term\"><code class=\"option\">-h <em class=\"replaceable\"><code>hostname</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--host=<em class=\"replaceable\"><code>hostname</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u670d\u52a1\u5668\u6240\u5728\u673a\u5668\u7684\u4e3b\u673a\u540d\u3002\u5982\u679c\u503c\u4ee5\u659c\u6760\u5f00\u5934\uff0c\u5219\u88ab\u7528\u4f5c Unix \u57df\u5957\u63a5\u5b57\u7684\u76ee\u5f55\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-HTML\"><span class=\"term\"><code class=\"option\">-H</code><br/></span><span class=\"term\"><code class=\"option\">--html</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u5230<acronym class=\"acronym\">HTML</acronym>\u8f93\u51fa\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset format html</code>\u6216\u8005<code class=\"command\">\\H</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-LIST\"><span class=\"term\"><code class=\"option\">-l</code><br/></span><span class=\"term\"><code class=\"option\">--list</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u6240\u6709\u53ef\u7528\u7684\u6570\u636e\u5e93\uff0c\u7136\u540e\u9000\u51fa\u3002\u5176\u4ed6\u975e\u8fde\u63a5\u9009\u9879\u4f1a\u88ab\u5ffd\u7565\u3002\u8fd9\u4e0e\u5143\u547d\u4ee4<code class=\"command\">\\list</code>\u7c7b\u4f3c\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8be5\u9009\u9879\u65f6\uff0c<span class=\"application\">psql</span>\u5c06\u8fde\u63a5\u5230\u6570\u636e\u5e93<code class=\"literal\">postgres</code>\uff0c\u9664\u975e\u547d\u4ee4\u884c\u4e0a\u6307\u5b9a\u4e86\u5176\u4ed6\u6570\u636e\u5e93\uff08\u901a\u8fc7<code class=\"option\">-d</code>\u9009\u9879\u6216\u975e\u9009\u9879\u53c2\u6570\uff0c\u4e5f\u53ef\u80fd\u901a\u8fc7\u670d\u52a1\u9879\uff0c\u4f46\u4e0d\u80fd\u901a\u8fc7\u73af\u5883\u53d8\u91cf\uff09\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-LOG-FILE\"><span class=\"term\"><code class=\"option\">-L <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--log-file=<em class=\"replaceable\"><code>filename</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9664\u4e86\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u5199\u5230\u666e\u901a\u8f93\u51fa\u76ee\u6807\u4e4b\u5916\uff0c\u8fd8\u5199\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-NO-READLINE\"><span class=\"term\"><code class=\"option\">-n</code><br/></span><span class=\"term\"><code class=\"option\">--no-readline</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8981\u4f7f\u7528<span class=\"application\">Readline</span>\u8fdb\u884c\u884c\u7f16\u8f91\uff0c\u4e5f\u4e0d\u8981\u4f7f\u7528\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\uff08\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-READLINE\" title=\"\u547d\u4ee4\u884c\u7f16\u8f91\">\u201c\u547d\u4ee4\u884c\u7f16\u8f91\u201d\u4e00\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-OUTPUT\"><span class=\"term\"><code class=\"option\">-o <em class=\"replaceable\"><code>filename</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--output=<em class=\"replaceable\"><code>filename</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u6240\u6709\u67e5\u8be2\u8f93\u51fa\u653e\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u3002\u8fd9\u7b49\u6548\u4e8e\u547d\u4ee4<code class=\"command\">\\o</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-PORT\"><span class=\"term\"><code class=\"option\">-p <em class=\"replaceable\"><code>port</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--port=<em class=\"replaceable\"><code>port</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6307\u5b9a\u670d\u52a1\u5668\u76d1\u542c\u8fde\u63a5\u7684 TCP \u7aef\u53e3\uff0c\u6216\u672c\u5730 Unix \u57df\u5957\u63a5\u5b57\u7684\u6587\u4ef6\u540d\u540e\u7f00\u3002\u9ed8\u8ba4\u4f7f\u7528 PGPORT \u73af\u5883\u53d8\u91cf\u7684\u503c\uff1b\u672a\u8bbe\u7f6e\u65f6\uff0c\u4f7f\u7528\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u7aef\u53e3\uff0c\u901a\u5e38\u4e3a 5432\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-PSET\"><span class=\"term\"><code class=\"option\">-P <em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--pset=<em class=\"replaceable\"><code>assignment</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ee5<code class=\"command\">\\pset</code>\u7684\u5f62\u5f0f\u6307\u5b9a\u6253\u5370\u9009\u9879\u3002\u6ce8\u610f\uff0c\u8fd9\u91cc\u4f60\u5fc5\u987b\u7528\u4e00\u4e2a\u7b49\u53f7\u800c\u4e0d\u662f\u7a7a\u683c\u6765\u5206\u9694\u540d\u79f0\u548c\u503c\u3002\u4f8b\u5982\uff0c\u8981\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a<span class=\"application\">LaTeX</span>\uff0c\u5e94\u8be5\u5199\u6210<code class=\"literal\">-P format=latex</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-QUIET\"><span class=\"term\"><code class=\"option\">-q</code><br/></span><span class=\"term\"><code class=\"option\">--quiet</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a<span class=\"application\">psql</span>\u5e94\u8be5\u5b89\u9759\u5730\u5de5\u4f5c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4f1a\u6253\u5370\u51fa\u6b22\u8fce\u6d88\u606f\u548c\u5404\u79cd\u63d0\u793a\u4fe1\u606f\u3002\u5982\u679c\u4f7f\u7528\u4e86\u8fd9\u4e2a\u9009\u9879\uff0c\u4ee5\u4e0a\u90a3\u4e9b\u5c31\u90fd\u4e0d\u4f1a\u8f93\u51fa\u3002\u5728\u4f7f\u7528<code class=\"option\">-c</code>\u9009\u9879\u65f6\uff0c\u914d\u5408\u8fd9\u4e2a\u9009\u9879\u5f88\u6709\u7528\u3002\u8fd9\u7b49\u6548\u4e8e\u8bbe\u7f6e\u53d8\u91cf<code class=\"varname\">QUIET</code>\u4e3a<code class=\"literal\">on</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-RECORD-SEPARATOR\"><span class=\"term\"><code class=\"option\">-R <em class=\"replaceable\"><code>separator</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--record-separator=<em class=\"replaceable\"><code>separator</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a<em class=\"replaceable\"><code>separator</code></em>\u7528\u4f5c\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset recordsep</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-SINGLE-STEP\"><span class=\"term\"><code class=\"option\">-s</code><br/></span><span class=\"term\"><code class=\"option\">--single-step</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd0\u884c\u5728\u5355\u6b65\u6a21\u5f0f\u4e2d\u3002\u8fd9\u610f\u5473\u7740\u5728\u6bcf\u4e2a\u547d\u4ee4\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u4e4b\u524d\u90fd\u4f1a\u63d0\u793a\u7528\u6237\uff0c\u5e76\u5141\u8bb8\u53d6\u6d88\u6267\u884c\u3002\u4f7f\u7528\u8fd9\u4e2a\u9009\u9879\u53ef\u4ee5\u8c03\u8bd5\u811a\u672c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-SINGLE-LINE\"><span class=\"term\"><code class=\"option\">-S</code><br/></span><span class=\"term\"><code class=\"option\">--single-line</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd0\u884c\u5728\u5355\u884c\u6a21\u5f0f\u4e2d\uff0c\u5176\u4e2d\u6362\u884c\u7b26\u4f1a\u7ec8\u6b62\u4e00\u4e2a SQL \u547d\u4ee4\uff0c\u5c31\u50cf\u5206\u53f7\u7684\u4f5c\u7528\u4e00\u6837\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u79cd\u6a21\u5f0f\u662f\u4e3a\u575a\u6301\u4f7f\u7528\u5b83\u7684\u7528\u6237\u63d0\u4f9b\u7684\uff0c\u4f46\u5e76\u4e0d\u4e00\u5b9a\u503c\u5f97\u63a8\u8350\u3002\u7279\u522b\u662f\uff0c\u5982\u679c\u5728\u4e00\u884c\u4e2d\u6df7\u5408\u4e86<acronym class=\"acronym\">SQL</acronym>\u548c\u5143\u547d\u4ee4\uff0c\u5bf9\u4e8e\u6ca1\u6709\u7ecf\u9a8c\u7684\u7528\u6237\u6765\u8bf4\uff0c\u5b83\u4eec\u7684\u6267\u884c\u987a\u5e8f\u672a\u5fc5\u603b\u662f\u6e05\u695a\u7684\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-OPTION-TUPLES-ONLY\"><span class=\"term\"><code class=\"option\">-t</code><br/></span><span class=\"term\"><code class=\"option\">--tuples-only</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5173\u95ed\u6253\u5370\u5217\u540d\u548c\u7ed3\u679c\u884c\u8ba1\u6570\u9875\u811a\u7b49\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\t</code>\u6216\u8005<code class=\"command\">\\pset tuples_only</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-TABLE-ATTR\"><span class=\"term\"><code class=\"option\">-T <em class=\"replaceable\"><code>table_options</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--table-attr=<em class=\"replaceable\"><code>table_options</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8981\u653e\u5728<acronym class=\"acronym\">HTML</acronym> <code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u9009\u9879\u3002\u8be6\u89c1<code class=\"command\">\\pset tableattr</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-USERNAME\"><span class=\"term\"><code class=\"option\">-U <em class=\"replaceable\"><code>username</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--username=<em class=\"replaceable\"><code>username</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4f5c\u4e3a\u7528\u6237<em class=\"replaceable\"><code>username</code></em>\u800c\u4e0d\u662f\u9ed8\u8ba4\u7528\u6237\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff08\u5f53\u7136\uff0c\u4f60\u5fc5\u987b\u5177\u6709\u8fd9\u6837\u505a\u7684\u6743\u9650\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-VARIABLE\"><span class=\"term\"><code class=\"option\">-v <em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--set=<em class=\"replaceable\"><code>assignment</code></em></code><br/></span><span class=\"term\"><code class=\"option\">--variable=<em class=\"replaceable\"><code>assignment</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6267\u884c\u4e00\u6b21\u53d8\u91cf\u8d4b\u503c\uff0c\u548c<code class=\"command\">\\set</code>\u5143\u547d\u4ee4\u76f8\u4f3c\u3002\u6ce8\u610f\u4f60\u5fc5\u987b\u5728\u547d\u4ee4\u884c\u4e0a\u7528\u7b49\u53f7\u5206\u9694\u540d\u5b57\u548c\u503c\uff08\u5982\u679c\u6709\uff09\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u7684\u8bbe\u7f6e\uff0c\u53bb\u6389\u7b49\u53f7\u5c31\u884c\u3002\u8981\u628a\u4e00\u4e2a\u53d8\u91cf\u8bbe\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u4f7f\u7528\u7b49\u53f7\u4f46\u662f\u53bb\u6389\u503c\u3002\u8fd9\u4e9b\u8d4b\u503c\u5728\u547d\u4ee4\u884c\u5904\u7406\u671f\u95f4\u88ab\u5b8c\u6210\uff0c\u56e0\u6b64\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u7684\u53d8\u91cf\u5c06\u5728\u7a0d\u540e\u88ab\u8986\u76d6\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-VERSION\"><span class=\"term\"><code class=\"option\">-V</code><br/></span><span class=\"term\"><code class=\"option\">--version</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">psql</span>\u7248\u672c\u5e76\u4e14\u9000\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-NO-PASSWORD\"><span class=\"term\"><code class=\"option\">-w</code><br/></span><span class=\"term\"><code class=\"option\">--no-password</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6c38\u4e0d\u53d1\u51fa\u5bc6\u7801\u63d0\u793a\u3002\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff0c\u5219\u8fde\u63a5\u5c1d\u8bd5\u5c06\u5931\u8d25\u3002\u8fd9\u4e2a\u9009\u9879\u5bf9\u4e8e\u6279\u5904\u7406\u4efb\u52a1\u548c\u811a\u672c\u5f88\u6709\u7528\uff0c\u56e0\u4e3a\u90a3\u65f6\u901a\u5e38\u6ca1\u6709\u7528\u6237\u5728\u573a\u8f93\u5165\u5bc6\u7801\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u6574\u4e2a\u4f1a\u8bdd\u671f\u95f4\u90fd\u4f1a\u4fdd\u6301\u751f\u6548\uff0c\u56e0\u6b64\u5b83\u4e0d\u4ec5\u5f71\u54cd\u521d\u59cb\u8fde\u63a5\u5c1d\u8bd5\uff0c\u4e5f\u4f1a\u5f71\u54cd\u5143\u547d\u4ee4<code class=\"command\">\\connect</code>\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-PASSWORD\"><span class=\"term\"><code class=\"option\">-W</code><br/></span><span class=\"term\"><code class=\"option\">--password</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5f3a\u5236<span class=\"application\">psql</span>\u5728\u8fde\u63a5\u6570\u636e\u5e93\u4e4b\u524d\u63d0\u793a\u8f93\u5165\u5bc6\u7801\uff0c\u5373\u4f7f\u8be5\u5bc6\u7801\u5b9e\u9645\u4e0a\u4e0d\u4f1a\u88ab\u4f7f\u7528\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u8ba4\u8bc1\uff0c\u800c\u5bc6\u7801\u53c8\u65e0\u6cd5\u4ece\u5176\u4ed6\u6765\u6e90\u83b7\u5f97\uff0c\u4f8b\u5982<code class=\"filename\">.pgpass</code>\u6587\u4ef6\uff0c\u5219<span class=\"application\">psql</span>\u65e0\u8bba\u5982\u4f55\u90fd\u4f1a\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u3002\u4e0d\u8fc7\uff0c<span class=\"application\">psql</span>\u9700\u8981\u5148\u6d6a\u8d39\u4e00\u6b21\u8fde\u63a5\u5c1d\u8bd5\uff0c\u624d\u80fd\u77e5\u9053\u670d\u52a1\u5668\u8981\u6c42\u5bc6\u7801\u3002\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u663e\u5f0f\u6307\u5b9a<code class=\"option\">-W</code>\u503c\u5f97\u7528\u6765\u907f\u514d\u8fd9\u6b21\u989d\u5916\u7684\u8fde\u63a5\u5c1d\u8bd5\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e2a\u9009\u9879\u5728\u6574\u4e2a\u4f1a\u8bdd\u671f\u95f4\u90fd\u4f1a\u4fdd\u6301\u751f\u6548\uff0c\u56e0\u6b64\u5b83\u4e0d\u4ec5\u5f71\u54cd\u521d\u59cb\u8fde\u63a5\u5c1d\u8bd5\uff0c\u4e5f\u4f1a\u5f71\u54cd\u5143\u547d\u4ee4<code class=\"command\">\\connect</code>\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-EXPANDED\"><span class=\"term\"><code class=\"option\">-x</code><br/></span><span class=\"term\"><code class=\"option\">--expanded</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5f00\u6269\u5c55\u8868\u683c\u5f0f\u6a21\u5f0f\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\x</code>\u6216\u8005<code class=\"command\">\\pset expanded</code>\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-NO-PSQLRC\"><span class=\"term\"><code class=\"option\">-X</code><br/></span><span class=\"term\"><code class=\"option\">--no-psqlrc</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0d\u8bfb\u53d6\u542f\u52a8\u6587\u4ef6\uff08\u65e2\u4e0d\u8bfb\u53d6\u7cfb\u7edf\u8303\u56f4\u7684<code class=\"filename\">psqlrc</code>\u6587\u4ef6\uff0c\u4e5f\u4e0d\u8bfb\u53d6\u7528\u6237\u7684<code class=\"filename\">~/.psqlrc</code>\u6587\u4ef6\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-FIELD-SEPARATOR-ZERO\"><span class=\"term\"><code class=\"option\">-z</code><br/></span><span class=\"term\"><code class=\"option\">--field-separator-zero</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset fieldsep_zero</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-RECORD-SEPARATOR-ZERO\"><span class=\"term\"><code class=\"option\">-0</code><br/></span><span class=\"term\"><code class=\"option\">--record-separator-zero</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u8f93\u51fa\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u4e3a\u96f6\u5b57\u8282\u3002\u4f8b\u5982\uff0c\u8fd9\u6709\u52a9\u4e8e\u4e0e<code class=\"literal\">xargs -0</code>\u914d\u5408\u4f7f\u7528\u3002\u8fd9\u7b49\u6548\u4e8e<code class=\"command\">\\pset recordsep_zero</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-SINGLE-TRANSACTION\"><span class=\"term\"><code class=\"option\">-1</code><br/></span><span class=\"term\"><code class=\"option\">--single-transaction</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u9009\u9879\u53ea\u80fd\u4e0e\u4e00\u4e2a\u6216\u591a\u4e2a<code class=\"option\">-c</code>\u548c/\u6216<code class=\"option\">-f</code>\u9009\u9879\u7ed3\u5408\u4f7f\u7528\u3002\u5b83\u4f1a\u5bfc\u81f4<span class=\"application\">psql</span>\u5728\u7b2c\u4e00\u4e2a\u8fd9\u6837\u7684\u9009\u9879\u4e4b\u524d\u53d1\u51fa\u4e00\u4e2a<code class=\"command\">BEGIN</code>\u547d\u4ee4\uff0c\u5e76\u5728\u6700\u540e\u4e00\u4e2a\u9009\u9879\u4e4b\u540e\u53d1\u51fa\u4e00\u4e2a<code class=\"command\">COMMIT</code>\u547d\u4ee4\uff0c\u4ece\u800c\u5c06\u6240\u6709\u547d\u4ee4\u5305\u88c5\u6210\u4e00\u4e2a\u5355\u72ec\u7684\u4e8b\u52a1\u3002\u5982\u679c\u4efb\u4f55\u547d\u4ee4\u5931\u8d25\u4e14\u53d8\u91cf<code class=\"varname\">ON_ERROR_STOP</code>\u88ab\u8bbe\u7f6e\uff0c\u5219\u4f1a\u6539\u4e3a\u53d1\u9001\u4e00\u4e2a<code class=\"command\">ROLLBACK</code>\u547d\u4ee4\u3002\u8fd9\u786e\u4fdd\u8981\u4e48\u6240\u6709\u547d\u4ee4\u90fd\u6210\u529f\u5b8c\u6210\uff0c\u8981\u4e48\u4e0d\u5e94\u7528\u4efb\u4f55\u66f4\u6539\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u547d\u4ee4\u672c\u8eab\u5305\u542b<code class=\"command\">BEGIN</code>\u3001<code class=\"command\">COMMIT</code>\u6216<code class=\"command\">ROLLBACK</code>\uff0c\u8fd9\u4e2a\u9009\u9879\u5c31\u4e0d\u4f1a\u4ea7\u751f\u671f\u671b\u7684\u6548\u679c\u3002\u53e6\u5916\uff0c\u5982\u679c\u67d0\u4e2a\u5355\u72ec\u547d\u4ee4\u4e0d\u80fd\u5728\u4e8b\u52a1\u5757\u4e2d\u6267\u884c\uff0c\u6307\u5b9a\u8fd9\u4e2a\u9009\u9879\u5c06\u5bfc\u81f4\u6574\u4e2a\u4e8b\u52a1\u5931\u8d25\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-OPTION-HELP\"><span class=\"term\"><code class=\"option\">-?</code><br/></span><span class=\"term\"><code class=\"option\">--help[=<em class=\"replaceable\"><code>topic</code></em>]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u6709\u5173<span class=\"application\">psql</span>\u7684\u5e2e\u52a9\u5e76\u4e14\u9000\u51fa\u3002\u53ef\u9009\u7684<em class=\"replaceable\"><code>topic</code></em>\u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a<code class=\"literal\">options</code>\uff09\u9009\u62e9\u8981\u89e3\u91ca<span class=\"application\">psql</span>\u7684\u54ea\u4e00\u90e8\u5206\uff1a<code class=\"literal\">commands</code>\u63cf\u8ff0<span class=\"application\">psql</span>\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b<code class=\"literal\">options</code>\u63cf\u8ff0\u53ef\u4ee5\u88ab\u4f20\u9012\u7ed9<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c<code class=\"literal\">variables</code>\u5219\u663e\u793a\u6709\u5173<span class=\"application\">psql</span>\u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.21.7\">\n<h2 lang=\"zh\">\u9000\u51fa\u72b6\u6001</h2>\n<p lang=\"zh\">\u5982\u679c<span class=\"application\">psql</span>\u6b63\u5e38\u7ed3\u675f\uff0c\u5b83\u4f1a\u5411 shell \u8fd4\u56de 0\uff1b\u5982\u679c\u5b83\u81ea\u8eab\u53d1\u751f\u81f4\u547d\u9519\u8bef\uff08\u4f8b\u5982\u5185\u5b58\u8017\u5c3d\u3001\u627e\u4e0d\u5230\u6587\u4ef6\uff09\uff0c\u5219\u8fd4\u56de 1\uff1b\u5982\u679c\u5230\u670d\u52a1\u5668\u7684\u8fde\u63a5\u53d1\u751f\u6545\u969c\u4e14\u8be5\u4f1a\u8bdd\u4e0d\u662f\u4ea4\u4e92\u5f0f\u7684\uff0c\u5219\u8fd4\u56de 2\uff1b\u5982\u679c\u811a\u672c\u4e2d\u53d1\u751f\u9519\u8bef\u4e14\u53d8\u91cf<code class=\"varname\">ON_ERROR_STOP</code>\u5df2\u8bbe\u7f6e\uff0c\u5219\u8fd4\u56de 3\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.21.8\">\n<h2 lang=\"zh\">\u7528\u6cd5</h2>\n<div class=\"refsect2\" id=\"R2-APP-PSQL-CONNECTING\">\n<h3 lang=\"zh\">\u8fde\u63a5\u5230\u6570\u636e\u5e93</h3>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u662f\u5e38\u89c4\u7684 <span class=\"productname\">PostgreSQL</span> \u5ba2\u6237\u7aef\u5e94\u7528\u7a0b\u5e8f\u3002\u8981\u8fde\u63a5\u5230\u6570\u636e\u5e93\uff0c\u4f60\u9700\u8981\u77e5\u9053\u76ee\u6807\u6570\u636e\u5e93\u540d\u79f0\u3001\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\u548c\u7aef\u53e3\u53f7\uff0c\u4ee5\u53ca\u8981\u4ee5\u54ea\u4e2a\u6570\u636e\u5e93\u7528\u6237\u540d\u8fde\u63a5\u3002<span class=\"application\">psql</span> \u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u9009\u9879 <code class=\"option\">-d</code>\u3001<code class=\"option\">-h</code>\u3001<code class=\"option\">-p</code> \u548c <code class=\"option\">-U</code> \u5206\u522b\u6307\u5b9a\u8fd9\u4e9b\u53c2\u6570\u3002\u5982\u679c\u9047\u5230\u4e00\u4e2a\u4e0d\u5c5e\u4e8e\u4efb\u4f55\u9009\u9879\u7684\u53c2\u6570\uff0c\u5b83\u5c06\u88ab\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u540d\uff08\u5982\u679c\u6570\u636e\u5e93\u540d\u5df2\u7ecf\u7ed9\u51fa\uff0c\u5219\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u7528\u6237\u540d\uff09\u3002\u5e76\u975e\u6240\u6709\u8fd9\u4e9b\u9009\u9879\u90fd\u662f\u5fc5\u9700\u7684\uff1b\u5b83\u4eec\u90fd\u6709\u6709\u7528\u7684\u9ed8\u8ba4\u503c\u3002\u5982\u679c\u7701\u7565\u4e3b\u673a\u540d\uff0c<span class=\"application\">psql</span> \u5728 Unix \u4e0a\u5c06\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\u5230\u672c\u5730\u4e3b\u673a\u4e0a\u7684\u670d\u52a1\u5668\uff0c\u5728 Windows \u4e0a\u5219\u901a\u8fc7 TCP/IP \u8fde\u63a5\u5230 <code class=\"literal\">localhost</code>\u3002\u9ed8\u8ba4\u7aef\u53e3\u53f7\u5728\u7f16\u8bd1\u65f6\u786e\u5b9a\u3002\u7531\u4e8e\u6570\u636e\u5e93\u670d\u52a1\u5668\u4f7f\u7528\u76f8\u540c\u7684\u9ed8\u8ba4\u503c\uff0c\u56e0\u6b64\u5728\u5927\u591a\u6570\u60c5\u51b5\u4e0b\u4e0d\u5fc5\u6307\u5b9a\u7aef\u53e3\u3002\u9ed8\u8ba4\u6570\u636e\u5e93\u7528\u6237\u540d\u662f\u4f60\u7684\u64cd\u4f5c\u7cfb\u7edf\u7528\u6237\u540d\u3002\u6570\u636e\u5e93\u7528\u6237\u540d\u786e\u5b9a\u540e\uff0c\u5b83\u4e5f\u4f1a\u88ab\u7528\u4f5c\u9ed8\u8ba4\u6570\u636e\u5e93\u540d\u3002\u8bf7\u6ce8\u610f\uff0c\u4f60\u4e0d\u80fd\u968f\u610f\u4ee5\u4efb\u610f\u6570\u636e\u5e93\u7528\u6237\u540d\u8fde\u63a5\u5230\u4efb\u610f\u6570\u636e\u5e93\u3002\u6570\u636e\u5e93\u7ba1\u7406\u5458\u5e94\u5f53\u5df2\u7ecf\u544a\u77e5\u4f60\u62e5\u6709\u7684\u8bbf\u95ee\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5f53\u9ed8\u8ba4\u503c\u4e0d\u5b8c\u5168\u5408\u9002\u65f6\uff0c\u53ef\u4ee5\u901a\u8fc7\u628a\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGDATABASE</code>\u3001<code class=\"envar\">PGHOST</code>\u3001<code class=\"envar\">PGPORT</code>\u548c<code class=\"envar\">PGUSER</code>\u8bbe\u7f6e\u4e3a\u9002\u5f53\u7684\u503c\u6765\u5c11\u6572\u4e00\u4e9b\u952e\u76d8\uff08\u989d\u5916\u7684\u73af\u5883\u53d8\u91cf\u89c1<a class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a032.15\u00a0\u8282</a>\uff09\u3002\u53e6\u5916\uff0c\u51c6\u5907\u4e00\u4e2a<code class=\"filename\">~/.pgpass</code>\u6587\u4ef6\u4e5f\u5f88\u65b9\u4fbf\uff0c\u8fd9\u6837\u5c31\u4e0d\u5fc5\u7ecf\u5e38\u624b\u5de5\u8f93\u5165\u5bc6\u7801\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/18/libpq-pgpass.html\" title=\"32.16.\u00a0\u5bc6\u7801\u6587\u4ef6\">\u7b2c\u00a032.16\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u53e6\u4e00\u79cd\u6307\u5b9a\u8fde\u63a5\u53c2\u6570\u7684\u65b9\u6cd5\u662f\u4f7f\u7528 conninfo \u5b57\u7b26\u4e32\u6216 URI \u6765\u4ee3\u66ff\u6570\u636e\u5e93\u540d\u3002\u6b64\u673a\u5236\u5141\u8bb8\u5bf9\u8fde\u63a5\u8fdb\u884c\u975e\u5e38\u5e7f\u6cdb\u7684\u63a7\u5236\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">$ <strong class=\"userinput\"><code>psql \"service=myservice sslmode=require\"</code></strong>\n$ <strong class=\"userinput\"><code>psql postgresql://dbmaster:5433/mydb?sslmode=require</code></strong>\n</pre>\n<p lang=\"zh\">\u7528\u8fd9\u79cd\u65b9\u5f0f\uff0c\u4f60\u4e5f\u53ef\u4ee5\u628a<acronym class=\"acronym\">LDAP</acronym>\u7528\u4e8e<a class=\"xref\" href=\"/docs/18/libpq-ldap.html\" title=\"32.18.\u00a0\u8fde\u63a5\u53c2\u6570\u7684 LDAP \u67e5\u627e\">\u7b2c\u00a032.18\u00a0\u8282</a>\u4e2d\u63cf\u8ff0\u7684\u8fde\u63a5\u53c2\u6570\u67e5\u627e\u3002\u53ef\u7528\u8fde\u63a5\u9009\u9879\u7684\u66f4\u591a\u4fe1\u606f\u8bf7\u89c1<a class=\"xref\" href=\"/docs/18/libpq-connect.html#LIBPQ-PARAMKEYWORDS\" title=\"32.1.2.\u00a0\u53c2\u6570\u5173\u952e\u8bcd\">\u7b2c\u00a032.1.2\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7531\u4e8e\u4efb\u4f55\u539f\u56e0\uff08\u4f8b\u5982\u6743\u9650\u4e0d\u8db3\u3001\u670d\u52a1\u5668\u6ca1\u6709\u5728\u76ee\u6807\u4e3b\u673a\u4e0a\u8fd0\u884c\u7b49\uff09\u5bfc\u81f4\u8fde\u63a5\u65e0\u6cd5\u5efa\u7acb\uff0c<span class=\"application\">psql</span>\u5c06\u8fd4\u56de\u4e00\u4e2a\u9519\u8bef\u5e76\u4e14\u7ec8\u6b62\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6807\u51c6\u8f93\u5165\u548c\u6807\u51c6\u8f93\u51fa\u90fd\u662f\u7ec8\u7aef\uff0c\u90a3\u4e48<span class=\"application\">psql</span>\u4f1a\u628a\u5ba2\u6237\u7aef\u7f16\u7801\u8bbe\u7f6e\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">auto</span>\u201d</span>\uff0c\u4ece\u533a\u57df\u8bbe\u7f6e\u4e2d\u68c0\u6d4b\u5408\u9002\u7684\u5ba2\u6237\u7aef\u7f16\u7801\uff08\u5728 Unix \u7cfb\u7edf\u4e0a\u662f<code class=\"envar\">LC_CTYPE</code>\u73af\u5883\u53d8\u91cf\uff09\u3002\u5982\u679c\u7ed3\u679c\u4e0d\u7b26\u5408\u9884\u671f\uff0c\u53ef\u4ee5\u4f7f\u7528\u73af\u5883\u53d8\u91cf<code class=\"envar\">PGCLIENTENCODING</code>\u8986\u76d6\u5ba2\u6237\u7aef\u7f16\u7801\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"R2-APP-PSQL-4\">\n<h3 lang=\"zh\">\u8f93\u5165 SQL \u547d\u4ee4</h3>\n<p lang=\"zh\">\u5728\u6b63\u5e38\u64cd\u4f5c\u65f6\uff0c<span class=\"application\">psql</span>\u4f1a\u63d0\u4f9b\u4e00\u4e2a\u63d0\u793a\u7b26\uff0c\u8be5\u63d0\u793a\u7b26\u662f<span class=\"application\">psql</span>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u540d\u79f0\u540e\u9762\u8ddf\u4e0a\u5b57\u7b26\u4e32<code class=\"literal\">=&gt;</code>\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">$ <strong class=\"userinput\"><code>psql testdb</code></strong>\npsql (18.6)\nType \"help\" for help.\n\ntestdb=&gt;\n</pre>\n<p lang=\"zh\">\u5728\u63d0\u793a\u7b26\u4e0b\uff0c\u7528\u6237\u53ef\u4ee5\u8f93\u5165<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u3002\u901a\u5e38\uff0c\u5f53\u9047\u5230\u8868\u793a\u547d\u4ee4\u7ed3\u675f\u7684\u5206\u53f7\u65f6\uff0c\u8f93\u5165\u7684\u5185\u5bb9\u5c31\u4f1a\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u3002\u884c\u7ed3\u675f\u5e76\u4e0d\u4f1a\u7ec8\u6b62\u4e00\u6761\u547d\u4ee4\uff0c\u56e0\u6b64\u4e3a\u4e86\u63d0\u9ad8\u6e05\u6670\u5ea6\uff0c\u547d\u4ee4\u53ef\u4ee5\u5206\u5e03\u5728\u591a\u884c\u4e0a\u3002\u5982\u679c\u547d\u4ee4\u88ab\u53d1\u9001\u5e76\u6210\u529f\u6267\u884c\uff0c\u5176\u7ed3\u679c\u5c31\u4f1a\u663e\u793a\u5728\u5c4f\u5e55\u4e0a\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4e0d\u53d7\u4fe1\u4efb\u7684\u7528\u6237\u80fd\u591f\u8bbf\u95ee\u5c1a\u672a\u91c7\u7528<a class=\"link\" href=\"/docs/18/ddl-schemas.html#DDL-SCHEMAS-PATTERNS\" title=\"5.10.6.\u00a0\u4f7f\u7528\u65b9\u5f0f\">\u6a21\u5f0f\u7684\u5b89\u5168\u4f7f\u7528\u65b9\u5f0f</a>\u7684\u6570\u636e\u5e93\uff0c\u8bf7\u5728\u4f1a\u8bdd\u5f00\u59cb\u65f6\u4ece<code class=\"varname\">search_path</code>\u4e2d\u79fb\u9664\u6240\u6709\u516c\u4f17\u53ef\u5199\u7684\u6a21\u5f0f\u3002\u53ef\u4ee5\u5728\u8fde\u63a5\u5b57\u7b26\u4e32\u4e2d\u52a0\u5165<code class=\"literal\">options=-csearch_path=</code>\uff0c\u6216\u8005\u5728\u6267\u884c\u5176\u4ed6 SQL \u547d\u4ee4\u4e4b\u524d\u53d1\u51fa<code class=\"literal\">SELECT pg_catalog.set_config('search_path', '', false)</code>\u3002\u8fd9\u79cd\u8003\u8651\u5e76\u975e<span class=\"application\">psql</span>\u7279\u6709\uff1b\u5b83\u9002\u7528\u4e8e\u4efb\u4f55\u6267\u884c\u4efb\u610f SQL \u547d\u4ee4\u7684\u63a5\u53e3\u3002</p>\n<p lang=\"zh\">\u6bcf\u5f53\u6267\u884c\u547d\u4ee4\u65f6\uff0c<span class=\"application\">psql</span>\u4e5f\u4f1a\u8f6e\u8be2\u7531<a class=\"link\" href=\"/docs/18/sql-listen.html\" title=\"LISTEN\"><code class=\"command\">LISTEN</code></a>\u548c<a class=\"link\" href=\"/docs/18/sql-notify.html\" title=\"NOTIFY\"><code class=\"command\">NOTIFY</code></a>\u751f\u6210\u7684\u5f02\u6b65\u901a\u77e5\u4e8b\u4ef6\u3002</p>\n<p lang=\"zh\">\u867d\u7136 C \u98ce\u683c\u7684\u5757\u6ce8\u91ca\u4f1a\u88ab\u4f20\u7ed9\u670d\u52a1\u5668\u5904\u7406\u5e76\u79fb\u9664\uff0c\u4f46 SQL \u6807\u51c6\u6ce8\u91ca\u4f1a\u7531<span class=\"application\">psql</span>\u81ea\u884c\u79fb\u9664\u3002</p>\n</div>\n<div class=\"refsect2\" id=\"APP-PSQL-META-COMMANDS\">\n<h3 lang=\"zh\">\u5143\u547d\u4ee4</h3>\n<p lang=\"zh\">\u4f60\u8f93\u5165\u5230<span class=\"application\">psql</span>\u4e2d\u7684\u4efb\u4f55\u4ee5\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u5f00\u59cb\u7684\u4e1c\u897f\u90fd\u662f\u4e00\u4e2a<span class=\"application\">psql</span>\u5143\u547d\u4ee4\uff0c\u5b83\u4eec\u7531<span class=\"application\">psql</span>\u81ea\u884c\u5904\u7406\u3002\u8fd9\u4e9b\u547d\u4ee4\u8ba9<span class=\"application\">psql</span>\u5bf9\u7ba1\u7406\u548c\u7f16\u5199\u811a\u672c\u66f4\u6709\u7528\u3002\u5143\u547d\u4ee4\u5e38\u5e38\u88ab\u79f0\u4f5c\u659c\u7ebf\u6216\u8005\u53cd\u659c\u7ebf\u547d\u4ee4\u3002</p>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u547d\u4ee4\u7684\u683c\u5f0f\u662f\u7528\u53cd\u659c\u7ebf\u540e\u9762\u76f4\u63a5\u8ddf\u4e0a\u4e00\u4e2a\u547d\u4ee4\u52a8\u8bcd\uff0c\u7136\u540e\u662f\u4e00\u4e9b\u53c2\u6570\u3002\u53c2\u6570\u4e0e\u547d\u4ee4\u52a8\u8bcd\u548c\u5176\u4ed6\u53c2\u6570\u4e4b\u95f4\u7528\u4efb\u610f\u591a\u4e2a\u7a7a\u767d\u5b57\u7b26\u5206\u9694\u5f00\u3002</p>\n<p lang=\"zh\">\u8981\u5728\u53c2\u6570\u4e2d\u5305\u542b\u7a7a\u767d\uff0c\u53ef\u4ee5\u7528\u5355\u5f15\u53f7\u5c06\u5b83\u62ec\u8d77\u6765\u3002\u8981\u5728\u53c2\u6570\u4e2d\u5305\u542b\u4e00\u4e2a\u5355\u5f15\u53f7\uff0c\u53ef\u4ee5\u5728\u5355\u5f15\u53f7\u6587\u672c\u5185\u5199\u4e24\u4e2a\u5355\u5f15\u53f7\u3002\u5355\u5f15\u53f7\u4e2d\u7684\u5185\u5bb9\u8fd8\u4f1a\u63a5\u53d7\u7c7b\u4f3c C \u8bed\u8a00\u7684\u66ff\u6362\uff1a<code class=\"literal\">\\n</code>\uff08\u6362\u884c\uff09\u3001<code class=\"literal\">\\t</code>\uff08\u5236\u8868\u7b26\uff09\u3001<code class=\"literal\">\\b</code>\uff08\u9000\u683c\uff09\u3001<code class=\"literal\">\\r</code>\uff08\u56de\u8f66\uff09\u3001<code class=\"literal\">\\f</code>\uff08\u6362\u9875\uff09\u3001<code class=\"literal\">\\</code><em class=\"replaceable\"><code>digits</code></em>\uff08\u516b\u8fdb\u5236\uff09\u4ee5\u53ca<code class=\"literal\">\\x</code><em class=\"replaceable\"><code>digits</code></em>\uff08\u5341\u516d\u8fdb\u5236\uff09\u3002\u5728\u5355\u5f15\u53f7\u6587\u672c\u5185\uff0c\u53cd\u659c\u7ebf\u51fa\u73b0\u5728\u4efb\u4f55\u5176\u4ed6\u5b57\u7b26\u524d\u9762\u65f6\uff0c\u53ea\u662f\u5bf9\u8be5\u5355\u4e2a\u5b57\u7b26\u8fdb\u884c\u8f6c\u4e49\uff0c\u4e0d\u8bba\u5b83\u662f\u4ec0\u4e48\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u53c2\u6570\u4e2d\u51fa\u73b0\u4e00\u4e2a\u672a\u52a0\u5f15\u53f7\u7684\u5192\u53f7\uff08<code class=\"literal\">:</code>\uff09\uff0c\u540e\u9762\u7d27\u8ddf\u4e00\u4e2a<span class=\"application\">psql</span>\u53d8\u91cf\u540d\uff0c\u5b83\u5c31\u4f1a\u88ab\u8be5\u53d8\u91cf\u7684\u503c\u66ff\u6362\uff0c\u5982\u4e0b\u9762<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL \u63d2\u503c\">SQL \u63d2\u503c</a>\u6240\u8ff0\u3002\u5176\u4e2d\u4ecb\u7ecd\u7684<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u548c<code class=\"literal\">:\"<em class=\"replaceable\"><code>variable_name</code></em>\"</code>\u5f62\u5f0f\u4e5f\u540c\u6837\u9002\u7528\u3002<code class=\"literal\">:{?<em class=\"replaceable\"><code>variable_name</code></em>}</code>\u8bed\u6cd5\u5141\u8bb8\u6d4b\u8bd5\u53d8\u91cf\u662f\u5426\u5df2\u5b9a\u4e49\uff1b\u5b83\u4f1a\u88ab TRUE \u6216 FALSE \u66ff\u6362\u3002\u7528\u53cd\u659c\u7ebf\u8f6c\u4e49\u8be5\u5192\u53f7\u53ef\u4ee5\u9632\u6b62\u66ff\u6362\u53d1\u751f\u3002</p>\n<p lang=\"zh\">\u5728\u53c2\u6570\u4e2d\uff0c\u7528\u53cd\u5f15\u53f7\uff08<code class=\"literal\">`</code>\uff09\u5305\u56f4\u7684\u6587\u672c\u4f1a\u88ab\u89c6\u4e3a\u4f20\u7ed9 shell \u7684\u547d\u4ee4\u884c\u3002\u8be5\u547d\u4ee4\u7684\u8f93\u51fa\uff08\u53bb\u6389\u672b\u5c3e\u7684\u6362\u884c\u7b26\uff09\u4f1a\u66ff\u6362\u53cd\u5f15\u53f7\u4e2d\u7684\u6587\u672c\u3002\u5728\u53cd\u5f15\u53f7\u5305\u56f4\u7684\u6587\u672c\u5185\u90e8\uff0c\u4e0d\u4f1a\u8fdb\u884c\u7279\u6b8a\u7684\u5f15\u53f7\u5904\u7406\u6216\u5176\u4ed6\u5904\u7406\uff0c\u4f46\u51fa\u73b0<code class=\"literal\">:<em class=\"replaceable\"><code>variable_name</code></em></code>\u65f6\uff0c\u5982\u679c<em class=\"replaceable\"><code>variable_name</code></em>\u662f<span class=\"application\">psql</span>\u53d8\u91cf\u540d\uff0c\u5c31\u4f1a\u88ab\u66ff\u6362\u4e3a\u8be5\u53d8\u91cf\u7684\u503c\u3002\u6b64\u5916\uff0c<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u4e5f\u4f1a\u88ab\u66ff\u6362\u4e3a\u8be5\u53d8\u91cf\u7684\u503c\uff0c\u5e76\u4f1a\u9002\u5f53\u5730\u52a0\u4e0a\u5f15\u53f7\uff0c\u4f7f\u5176\u6210\u4e3a\u5355\u4e2a shell \u547d\u4ee4\u53c2\u6570\u3002\uff08\u540e\u4e00\u79cd\u5f62\u5f0f\u51e0\u4e4e\u603b\u662f\u66f4\u53ef\u53d6\uff0c\u9664\u975e\u4f60\u975e\u5e38\u786e\u5b9a\u53d8\u91cf\u4e2d\u5305\u542b\u4ec0\u4e48\u3002\uff09\u7531\u4e8e\u65e0\u6cd5\u4fdd\u8bc1\u5728\u6240\u6709\u5e73\u53f0\u4e0a\u90fd\u80fd\u5bf9\u56de\u8f66\u548c\u6362\u884c\u5b57\u7b26\u5b89\u5168\u5730\u52a0\u5f15\u53f7\uff0c\u5f53\u53d8\u91cf\u503c\u4e2d\u51fa\u73b0\u8fd9\u7c7b\u5b57\u7b26\u65f6\uff0c<code class=\"literal\">:'<em class=\"replaceable\"><code>variable_name</code></em>'</code>\u5f62\u5f0f\u4f1a\u6253\u5370\u9519\u8bef\u6d88\u606f\uff0c\u5e76\u4e14\u4e0d\u4f1a\u66ff\u6362\u53d8\u91cf\u503c\u3002</p>\n<p lang=\"zh\">\u4e00\u4e9b\u547d\u4ee4\u63a5\u53d7 SQL \u6807\u8bc6\u7b26\uff08\u4f8b\u5982\u8868\u540d\uff09\u4f5c\u4e3a\u53c2\u6570\u3002\u8fd9\u4e9b\u53c2\u6570\u9075\u5faa SQL \u8bed\u6cd5\u89c4\u5219\uff1a\u672a\u52a0\u5f15\u53f7\u7684\u5b57\u6bcd\u4f1a\u5f3a\u5236\u8f6c\u6362\u4e3a\u5c0f\u5199\uff0c\u800c\u53cc\u5f15\u53f7\uff08\"\uff09\u4f1a\u4fdd\u62a4\u5b57\u6bcd\u4e0d\u88ab\u8f6c\u6362\u5927\u5c0f\u5199\uff0c\u5e76\u5141\u8bb8\u6807\u8bc6\u7b26\u5305\u542b\u7a7a\u767d\u5b57\u7b26\u3002\u5728\u53cc\u5f15\u53f7\u5185\u90e8\uff0c\u8fde\u7eed\u4e24\u4e2a\u53cc\u5f15\u53f7\u4f1a\u5728\u6700\u7ec8\u540d\u79f0\u4e2d\u53d8\u4e3a\u4e00\u4e2a\u53cc\u5f15\u53f7\u3002\u4f8b\u5982\uff0cFOO\"BAR\"BAZ \u4f1a\u88ab\u89e3\u91ca\u4e3a fooBARbaz\uff0c\u800c \"A weird\"\" name\" \u4f1a\u53d8\u4e3a A weird\" name\u3002</p>\n<p lang=\"zh\">\u53c2\u6570\u89e3\u6790\u4f1a\u5728\u884c\u5c3e\u6216\u9047\u5230\u53e6\u4e00\u4e2a\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u65f6\u505c\u6b62\u3002\u672a\u52a0\u5f15\u53f7\u7684\u53cd\u659c\u7ebf\u4f1a\u88ab\u89c6\u4e3a\u65b0\u5143\u547d\u4ee4\u7684\u5f00\u59cb\u3002\u7279\u6b8a\u5e8f\u5217<code class=\"literal\">\\\\</code>\uff08\u4e24\u4e2a\u53cd\u659c\u7ebf\uff09\u8868\u793a\u53c2\u6570\u7ed3\u675f\uff0c\u5e76\u7ee7\u7eed\u89e3\u6790<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\uff08\u5982\u679c\u8fd8\u6709\uff09\u3002\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u548c<span class=\"application\">psql</span>\u547d\u4ee4\u53ef\u4ee5\u81ea\u7531\u5730\u6df7\u5408\u5728\u540c\u4e00\u884c\u4e2d\u3002\u4f46\u65e0\u8bba\u5982\u4f55\uff0c\u5143\u547d\u4ee4\u7684\u53c2\u6570\u90fd\u4e0d\u80fd\u5ef6\u7eed\u5230\u4e0b\u4e00\u884c\u3002</p>\n<p lang=\"zh\">\u8bb8\u591a\u5143\u547d\u4ee4\u4f5c\u7528\u4e8e<em class=\"firstterm\">\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a</em>\u3002\u8fd9\u53ea\u662f\u4e00\u4e2a\u4fdd\u5b58\u5df2\u8f93\u5165\u4f46\u5c1a\u672a\u53d1\u9001\u5230\u670d\u52a1\u5668\u6267\u884c\u7684 SQL \u547d\u4ee4\u6587\u672c\u7684\u7f13\u51b2\u533a\u3002\u5176\u4e2d\u65e2\u5305\u62ec\u5148\u524d\u8f93\u5165\u7684\u884c\uff0c\u4e5f\u5305\u62ec\u540c\u4e00\u884c\u4e0a\u4f4d\u4e8e\u5143\u547d\u4ee4\u4e4b\u524d\u7684\u6587\u672c\u3002</p>\n<p lang=\"zh\">\u8bb8\u591a\u5143\u547d\u4ee4\u8fd8\u5141\u8bb8\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code> \u4f5c\u4e3a\u9009\u9879\u3002\u8fd9\u4f1a\u4f7f\u7ed3\u679c\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\uff0c\u5c31\u50cf\u4f7f\u7528\u4e86 <code class=\"command\">\\x</code> \u6216 <code class=\"command\">\\pset expanded</code> \u4e00\u6837\u3002</p>\n<p lang=\"zh\">\u5b9a\u4e49\u4e86\u4ee5\u4e0b\u5143\u547d\u4ee4\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-META-COMMAND-A\"><span class=\"term\"><code class=\"literal\">\\a</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u5f53\u524d\u8868\u683c\u8f93\u51fa\u683c\u5f0f\u662f\u975e\u5bf9\u9f50\uff0c\u5219\u5207\u6362\u4e3a\u5bf9\u9f50\uff1b\u5426\u5219\u5207\u6362\u4e3a\u975e\u5bf9\u9f50\u3002\u4fdd\u7559\u6b64\u547d\u4ee4\u662f\u4e3a\u4e86\u5411\u540e\u517c\u5bb9\u3002\u66f4\u901a\u7528\u7684\u89e3\u51b3\u65b9\u6848\u8bf7\u53c2\u89c1<code class=\"command\">\\pset</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-BIND\"><span class=\"term\"><code class=\"literal\">\\bind</code> [ <em class=\"replaceable\"><code>parameter</code></em> ] ...</span> </dt>\n<dd>\n<p lang=\"zh\">\u4e3a\u4e0b\u4e00\u6b21\u67e5\u8be2\u6267\u884c\u8bbe\u7f6e\u67e5\u8be2\u53c2\u6570\uff0c\u5e76\u5c06\u6307\u5b9a\u53c2\u6570\u4f20\u7ed9\u4efb\u610f\u53c2\u6570\u5360\u4f4d\u7b26\uff08<code class=\"literal\">$1</code> \u7b49\uff09\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">INSERT INTO tbl1 VALUES ($1, $2) \\bind 'first value' 'second value' \\g\n</pre>\n<p lang=\"zh\">\u8fd9\u5bf9\u9664 <code class=\"literal\">\\g</code> \u4e4b\u5916\u7684\u67e5\u8be2\u6267\u884c\u547d\u4ee4\u4e5f\u6709\u6548\uff0c\u4f8b\u5982 <code class=\"literal\">\\gx</code> \u548c <code class=\"literal\">\\gset</code>\u3002</p>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4f1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/18/protocol-overview.html#PROTOCOL-QUERY-CONCEPTS\" title=\"54.1.2.\u00a0\u6269\u5c55\u67e5\u8be2\u6982\u8ff0\">\u7b2c\u00a054.1.2\u00a0\u8282</a>\uff09\uff0c\u4e0d\u540c\u4e8e<span class=\"application\">psql</span>\u901a\u5e38\u4f7f\u7528\u7684\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002\u56e0\u6b64\uff0c\u53ef\u4ee5\u7528\u5b83\u5728<span class=\"application\">psql</span>\u4e2d\u6d4b\u8bd5\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002\uff08\u5373\u4f7f\u67e5\u8be2\u6ca1\u6709\u53c2\u6570\uff0c\u800c\u4e14\u6b64\u547d\u4ee4\u6307\u5b9a\u4e86\u96f6\u4e2a\u53c2\u6570\uff0c\u4e5f\u4f1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002\uff09\u6b64\u547d\u4ee4\u53ea\u5f71\u54cd\u4e0b\u4e00\u6761\u88ab\u6267\u884c\u7684\u67e5\u8be2\uff1b\u4e4b\u540e\u7684\u6240\u6709\u67e5\u8be2\u9ed8\u8ba4\u4ecd\u4f1a\u4f7f\u7528\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-BIND-NAMED\"><span class=\"term\"><code class=\"literal\">\\bind_named</code> <em class=\"replaceable\"><code>statement_name</code></em> [ <em class=\"replaceable\"><code>parameter</code></em> ] ...</span> </dt>\n<dd>\n<p lang=\"zh\"><code class=\"literal\">\\bind_named</code> \u7b49\u540c\u4e8e <code class=\"literal\">\\bind</code>\uff0c\u4e0d\u540c\u4e4b\u5904\u5728\u4e8e\u5b83\u628a\u73b0\u6709\u9884\u5907\u8bed\u53e5\u7684\u540d\u79f0\u4f5c\u4e3a\u7b2c\u4e00\u4e2a\u53c2\u6570\u3002\u7a7a\u5b57\u7b26\u4e32\u8868\u793a\u672a\u547d\u540d\u7684\u9884\u5907\u8bed\u53e5\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">INSERT INTO tbls1 VALUES ($1, $2) \\parse stmt1\n\\bind_named stmt1 'first value' 'second value' \\g\n</pre>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4f1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/18/protocol-overview.html#PROTOCOL-QUERY-CONCEPTS\" title=\"54.1.2.\u00a0\u6269\u5c55\u67e5\u8be2\u6982\u8ff0\">\u7b2c\u00a054.1.2\u00a0\u8282</a>\uff09\uff0c\u4e0d\u540c\u4e8e<span class=\"application\">psql</span>\u901a\u5e38\u4f7f\u7528\u7684\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002\u56e0\u6b64\uff0c\u53ef\u4ee5\u7528\u5b83\u5728<span class=\"application\">psql</span>\u4e2d\u6d4b\u8bd5\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-C-LC\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\c</code> \u6216 <code class=\"literal\">\\connect [ -reuse-previous=<em class=\"replaceable\"><code>on|off</code></em> ] [ <em class=\"replaceable\"><code>dbname</code></em> [ <em class=\"replaceable\"><code>username</code></em> ] [ <em class=\"replaceable\"><code>host</code></em> ] [ <em class=\"replaceable\"><code>port</code></em> ] | <em class=\"replaceable\"><code>conninfo</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5efa\u7acb\u5230<span class=\"productname\">PostgreSQL</span>\u670d\u52a1\u5668\u7684\u65b0\u8fde\u63a5\u3002\u53ef\u4ee5\u4f7f\u7528\u4f4d\u7f6e\u8bed\u6cd5\uff08\u6570\u636e\u5e93\u540d\u79f0\u3001\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\u4e2d\u7684\u4e00\u4e2a\u6216\u591a\u4e2a\uff09\u6307\u5b9a\u8981\u4f7f\u7528\u7684\u8fde\u63a5\u53c2\u6570\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528<em class=\"replaceable\"><code>conninfo</code></em>\u8fde\u63a5\u5b57\u7b26\u4e32\uff0c\u8be6\u89c1<a class=\"xref\" href=\"/docs/18/libpq-connect.html#LIBPQ-CONNSTRING\" title=\"32.1.1.\u00a0\u8fde\u63a5\u5b57\u7b26\u4e32\">\u7b2c\u00a032.1.1\u00a0\u8282</a>\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa\u53c2\u6570\uff0c\u5219\u4f7f\u7528\u4e0e\u4e4b\u524d\u76f8\u540c\u7684\u53c2\u6570\u5efa\u7acb\u65b0\u8fde\u63a5\u3002</p>\n<p lang=\"zh\">\u5c06<em class=\"replaceable\"><code>dbname</code></em>\u3001<em class=\"replaceable\"><code>username</code></em>\u3001<em class=\"replaceable\"><code>host</code></em>\u6216 <em class=\"replaceable\"><code>port</code></em>\u4e2d\u7684\u4efb\u610f\u4e00\u4e2a\u6307\u5b9a\u4e3a <code class=\"literal\">-</code>\uff0c\u7b49\u540c\u4e8e\u7701\u7565\u8be5\u53c2\u6570\u3002</p>\n<p lang=\"zh\">\u65b0\u8fde\u63a5\u53ef\u4ee5\u91cd\u7528\u524d\u4e00\u4e2a\u8fde\u63a5\u7684\u8fde\u63a5\u53c2\u6570\uff1b\u4e0d\u4ec5\u5305\u62ec\u6570\u636e\u5e93\u540d\u79f0\u3001\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\uff0c\u8fd8\u5305\u62ec\u5176\u4ed6\u8bbe\u7f6e\uff0c\u5982<em class=\"replaceable\"><code>sslmode</code></em>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53c2\u6570\u5728\u4f4d\u7f6e\u8bed\u6cd5\u4e2d\u88ab\u91cd\u7528\uff0c\u4f46\u5728\u7ed9\u5b9a<em class=\"replaceable\"><code>conninfo</code></em>\u5b57\u7b26\u4e32\u65f6\u4e0d\u4f1a\u88ab\u91cd\u7528\u3002\u4f20\u9012<code class=\"literal\">-reuse-previous=on</code>\u6216<code class=\"literal\">-reuse-previous=off</code>\u4f5c\u4e3a\u7b2c\u4e00\u4e2a\u53c2\u6570\u5c06\u8986\u76d6\u8be5\u9ed8\u8ba4\u8bbe\u7f6e\u3002\u5982\u679c\u53c2\u6570\u88ab\u91cd\u7528\uff0c\u5219\u4efb\u4f55\u672a\u660e\u786e\u6307\u5b9a\u4e3a\u4f4d\u7f6e\u53c2\u6570\u6216\u5728<em class=\"replaceable\"><code>conninfo</code></em>\u5b57\u7b26\u4e32\u4e2d\u7684\u53c2\u6570\u5c06\u4ece\u73b0\u6709\u8fde\u63a5\u7684\u53c2\u6570\u4e2d\u83b7\u53d6\u3002\u4e00\u4e2a\u4f8b\u5916\u662f\uff0c\u5982\u679c\u4f7f\u7528\u4f4d\u7f6e\u8bed\u6cd5\u66f4\u6539<em class=\"replaceable\"><code>host</code></em>\u8bbe\u7f6e\uff0c\u4f7f\u5176\u4e0d\u540c\u4e8e\u5148\u524d\u7684\u503c\uff0c\u5219\u73b0\u6709\u8fde\u63a5\u53c2\u6570\u4e2d\u5b58\u5728\u7684\u4efb\u4f55<em class=\"replaceable\"><code>hostaddr</code></em>\u8bbe\u7f6e\u5c06\u88ab\u5220\u9664\u3002\u6b64\u5916\uff0c\u4ec5\u5f53\u7528\u6237\u3001\u4e3b\u673a\u548c\u7aef\u53e3\u8bbe\u7f6e\u672a\u66f4\u6539\u65f6\uff0c\u624d\u4f1a\u91cd\u7528\u73b0\u6709\u8fde\u63a5\u4f7f\u7528\u7684\u4efb\u4f55\u5bc6\u7801\u3002\u5f53\u547d\u4ee4\u65e2\u4e0d\u6307\u5b9a\u4e5f\u4e0d\u91cd\u7528\u7279\u5b9a\u53c2\u6570\u65f6\uff0c\u5c06\u4f7f\u7528<span class=\"application\">libpq</span>\u7684\u9ed8\u8ba4\u503c\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u65b0\u8fde\u63a5\u6210\u529f\u5efa\u7acb\uff0c\u5219\u5173\u95ed\u5148\u524d\u7684\u8fde\u63a5\u3002\u5982\u679c\u8fde\u63a5\u5c1d\u8bd5\u5931\u8d25\uff08\u7528\u6237\u540d\u9519\u8bef\uff0c\u8bbf\u95ee\u88ab\u62d2\u7edd\u7b49\uff09\uff0c\u4e14<span class=\"application\">psql</span>\u5904\u4e8e\u4ea4\u4e92\u6a21\u5f0f\uff0c\u5219\u4fdd\u7559\u5148\u524d\u7684\u8fde\u63a5\u3002\u4f46\u5728\u6267\u884c\u975e\u4ea4\u4e92\u811a\u672c\u65f6\uff0c\u65e7\u8fde\u63a5\u5c06\u88ab\u5173\u95ed\u5e76\u62a5\u544a\u9519\u8bef\u3002\u8fd9\u53ef\u80fd\u4f1a\u6216\u53ef\u80fd\u4e0d\u4f1a\u7ec8\u6b62\u811a\u672c\uff1b\u5982\u679c\u6ca1\u6709\u7ec8\u6b62\uff0c\u76f4\u5230\u6210\u529f\u6267\u884c\u53e6\u4e00\u4e2a<code class=\"literal\">\\connect</code>\u547d\u4ee4\u4e4b\u524d\uff0c\u6240\u6709\u8bbf\u95ee\u6570\u636e\u5e93\u7684\u547d\u4ee4\u90fd\u5c06\u5931\u8d25\u3002\u91c7\u7528\u8fd9\u79cd\u533a\u522b\uff0c\u4e00\u65b9\u9762\u662f\u4e3a\u4e86\u65b9\u4fbf\u7528\u6237\u5e94\u5bf9\u8f93\u5165\u7b14\u8bef\uff0c\u53e6\u4e00\u65b9\u9762\u662f\u4e3a\u4e86\u9632\u6b62\u811a\u672c\u610f\u5916\u64cd\u4f5c\u9519\u8bef\u7684\u6570\u636e\u5e93\u3002\u8bf7\u6ce8\u610f\uff0c\u6bcf\u5f53<code class=\"literal\">\\connect</code>\u547d\u4ee4\u5c1d\u8bd5\u91cd\u65b0\u4f7f\u7528\u53c2\u6570\u65f6\uff0c\u91cd\u65b0\u4f7f\u7528\u7684\u503c\u662f\u6700\u540e\u4e00\u4e2a\u6210\u529f\u8fde\u63a5\u7684\u503c\uff0c\u800c\u4e0d\u662f\u968f\u540e\u7684\u4efb\u4f55\u5931\u8d25\u5c1d\u8bd5\u7684\u503c\u3002\u4f46\u662f\uff0c\u5728\u975e\u4ea4\u4e92<code class=\"literal\">\\connect</code>\u5931\u8d25\u7684\u60c5\u51b5\u4e0b\uff0c\u4e0d\u5141\u8bb8\u7a0d\u540e\u91cd\u65b0\u4f7f\u7528\u53c2\u6570\uff0c\u56e0\u4e3a\u811a\u672c\u53ef\u80fd\u671f\u671b\u4ece\u5931\u8d25\u7684<code class=\"literal\">\\connect</code>\u4e2d\u91cd\u65b0\u4f7f\u7528\u503c\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">=&gt; \\c mydb myuser host.dom 6432\n=&gt; \\c service=foo\n=&gt; \\c \"host=localhost port=5432 dbname=mydb connect_timeout=10 sslmode=disable\"\n=&gt; \\c -reuse-previous=on sslmode=require    -- changes only sslmode\n=&gt; \\c postgresql://tom@localhost/mydb?application_name=myapp\n</pre>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-C-UC\"><span class=\"term\"><code class=\"literal\">\\C [ <em class=\"replaceable\"><code>title</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u4f5c\u4e3a\u67e5\u8be2\u7ed3\u679c\u6253\u5370\u7684\u8868\u7684\u6807\u9898\uff0c\u6216\u53d6\u6d88\u6b64\u7c7b\u6807\u9898\u3002\u8be5\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset title <em class=\"replaceable\"><code>title</code></em></code>\u3002\uff08\u6b64\u547d\u4ee4\u7684\u540d\u79f0\u6e90\u81ea<span class=\"quote\">\u201c<span class=\"quote\">caption</span>\u201d</span>\uff0c\u56e0\u4e3a\u5b83\u8fc7\u53bb\u53ea\u7528\u4e8e\u8bbe\u7f6e<acronym class=\"acronym\">HTML</acronym>\u8868\u7684\u6807\u9898\u3002\uff09</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-CD\"><span class=\"term\"><code class=\"literal\">\\cd [ <em class=\"replaceable\"><code>directory</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u66f4\u6539\u4e3a <em class=\"replaceable\"><code>directory</code></em>\u3002\u5982\u679c\u6ca1\u6709\u53c2\u6570\uff0c\u5219\u5207\u6362\u5230\u5f53\u524d\u7528\u6237\u7684\u4e3b\u76ee\u5f55\u3002\u5173\u4e8e\u5982\u4f55\u786e\u5b9a\u4e3b\u76ee\u5f55\uff0c\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/18/libpq-pgpass.html\" title=\"32.16.\u00a0\u5bc6\u7801\u6587\u4ef6\">\u7b2c\u00a032.16\u00a0\u8282</a>\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8981\u6253\u5370\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\uff0c\u8bf7\u4f7f\u7528<code class=\"literal\">\\! pwd</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-CLOSE-PREPARED\"><span class=\"term\"><code class=\"literal\">\\close_prepared</code> <em class=\"replaceable\"><code>prepared_statement_name</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u5173\u95ed\u6307\u5b9a\u7684\u9884\u5907\u8bed\u53e5\u3002\u7a7a\u5b57\u7b26\u4e32\u8868\u793a\u672a\u547d\u540d\u7684\u9884\u5907\u8bed\u53e5\u3002\u5982\u679c\u4e0d\u5b58\u5728\u8be5\u540d\u79f0\u7684\u9884\u5907\u8bed\u53e5\uff0c\u5219\u4e0d\u6267\u884c\u4efb\u4f55\u64cd\u4f5c\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">SELECT $1 \\parse stmt1\n\\close_prepared stmt1\n</pre>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4f1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\uff0c\u4e0d\u540c\u4e8e<span class=\"application\">psql</span>\u901a\u5e38\u4f7f\u7528\u7684\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002\u56e0\u6b64\uff0c\u53ef\u4ee5\u7528\u5b83\u5728<span class=\"application\">psql</span>\u4e2d\u6d4b\u8bd5\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-CONNINFO\"><span class=\"term\"><code class=\"literal\">\\conninfo</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8f93\u51fa\u5f53\u524d\u6570\u636e\u5e93\u8fde\u63a5\u7684\u4fe1\u606f\uff1b\u5982\u679c\u6b63\u5728\u4f7f\u7528 SSL\uff0c\u4e5f\u5305\u62ec\u4e0e SSL \u76f8\u5173\u7684\u4fe1\u606f\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c<code class=\"structfield\">Client User</code> \u5b57\u6bb5\u663e\u793a\u7684\u662f\u8fde\u63a5\u5efa\u7acb\u65f6\u7684\u7528\u6237\uff0c\u800c <code class=\"structfield\">Superuser</code> \u5b57\u6bb5\u8868\u793a\u5f53\u524d\u7528\u6237\uff08\u5728\u5f53\u524d\u6267\u884c\u4e0a\u4e0b\u6587\u4e2d\uff09\u662f\u5426\u5177\u6709\u8d85\u7ea7\u7528\u6237\u6743\u9650\u3002\u8fd9\u4e24\u4e2a\u7528\u6237\u901a\u5e38\u76f8\u540c\uff0c\u4f46\u4e5f\u53ef\u80fd\u4e0d\u540c\uff0c\u4f8b\u5982\u5f53\u524d\u7528\u6237\u66fe\u901a\u8fc7 <code class=\"command\">SET ROLE</code> \u547d\u4ee4\u88ab\u66f4\u6539\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMANDS-COPY\"><span class=\"term\"><code class=\"literal\">\\copy { <em class=\"replaceable\"><code>table</code></em> [ ( <em class=\"replaceable\"><code>column_list</code></em> ) ] } <code class=\"literal\">from</code> { <em class=\"replaceable\"><code>'filename'</code></em> | program <em class=\"replaceable\"><code>'command'</code></em> | stdin | pstdin } [ [ with ] ( <em class=\"replaceable\"><code>option</code></em> [, ...] ) ] [ where <em class=\"replaceable\"><code>condition</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\copy { <em class=\"replaceable\"><code>table</code></em> [ ( <em class=\"replaceable\"><code>column_list</code></em> ) ] | ( <em class=\"replaceable\"><code>query</code></em> ) } <code class=\"literal\">to</code> { <em class=\"replaceable\"><code>'filename'</code></em> | program <em class=\"replaceable\"><code>'command'</code></em> | stdout | pstdout } [ [ with ] ( <em class=\"replaceable\"><code>option</code></em> [, ...] ) ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6267\u884c\u524d\u7aef\uff08\u5ba2\u6237\u7aef\uff09\u590d\u5236\u3002\u8be5\u64cd\u4f5c\u4f1a\u8fd0\u884c\u4e00\u4e2a<acronym class=\"acronym\">SQL</acronym> <a class=\"link\" href=\"/docs/18/sql-copy.html\" title=\"COPY\"><code class=\"command\">COPY</code></a>\u547d\u4ee4\uff0c\u4f46\u5e76\u4e0d\u662f\u7531\u670d\u52a1\u5668\u8bfb\u53d6\u6216\u5199\u5165\u6307\u5b9a\u6587\u4ef6\uff0c\u800c\u662f\u7531<span class=\"application\">psql</span>\u8bfb\u53d6\u6216\u5199\u5165\u6587\u4ef6\uff0c\u5e76\u5728\u670d\u52a1\u5668\u4e0e\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e4b\u95f4\u8f6c\u9001\u6570\u636e\u3002\u8fd9\u610f\u5473\u7740\u6587\u4ef6\u53ef\u8bbf\u95ee\u6027\u548c\u6743\u9650\u53d6\u51b3\u4e8e\u672c\u5730\u7528\u6237\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\uff0c\u4e5f\u4e0d\u9700\u8981 SQL \u8d85\u7ea7\u7528\u6237\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5f53\u6307\u5b9a<code class=\"literal\">program</code>\u65f6\uff0c<em class=\"replaceable\"><code>command</code></em> \u7531<span class=\"application\">psql</span>\u6267\u884c\uff0c\u4f20\u7ed9<em class=\"replaceable\"><code>command</code></em>\u7684\u6570\u636e\u6216\u4ece\u5176\u4e2d\u8bfb\u51fa\u7684\u6570\u636e\u90fd\u4f1a\u5728\u670d\u52a1\u5668\u4e0e\u5ba2\u6237\u7aef\u4e4b\u95f4\u8f6c\u9001\u3002\u518d\u6b21\u5f3a\u8c03\uff0c\u6267\u884c\u6743\u9650\u5c5e\u4e8e\u672c\u5730\u7528\u6237\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\uff0c\u4e5f\u4e0d\u9700\u8981 SQL \u8d85\u7ea7\u7528\u6237\u6743\u9650\u3002</p>\n<p lang=\"zh\">\u5bf9\u4e8e \\copy ... from stdin\uff0c\u4ece\u53d1\u51fa\u547d\u4ee4\u7684\u540c\u4e00\u8f93\u5165\u6e90\u8bfb\u53d6\u6570\u636e\u884c\uff0c\u76f4\u5230\u8bfb\u53d6\u5230\u4ec5\u542b \\. \u7684\u4e00\u884c\u6216\u8f93\u5165\u6d41\u5230\u8fbe EOF\u3002\u8fd9\u9002\u5408\u5728 SQL \u811a\u672c\u4e2d\u5185\u8054\u586b\u5145\u8868\u3002\u5bf9\u4e8e \\copy ... to stdout\uff0c\u8f93\u51fa\u53d1\u5f80\u4e0e psql \u547d\u4ee4\u8f93\u51fa\u76f8\u540c\u7684\u4f4d\u7f6e\uff0c\u4e14\u4e0d\u6253\u5370 COPY count \u547d\u4ee4\u72b6\u6001\uff0c\u4ee5\u514d\u4e0e\u6570\u636e\u884c\u6df7\u6dc6\u3002\u82e5\u8981\u59cb\u7ec8\u8bfb\u5199 psql \u7684\u6807\u51c6\u8f93\u5165\u6216\u8f93\u51fa\uff0c\u800c\u4e0d\u53d7\u5f53\u524d\u547d\u4ee4\u6765\u6e90\u6216 \\o \u9009\u9879\u5f71\u54cd\uff0c\u8bf7\u4f7f\u7528 from pstdin \u6216 to pstdout\u3002</p>\n<p lang=\"zh\">\u8be5\u547d\u4ee4\u7684\u8bed\u6cd5\u4e0e<acronym class=\"acronym\">SQL</acronym> <a class=\"link\" href=\"/docs/18/sql-copy.html\" title=\"COPY\"><code class=\"command\">COPY</code></a>\u547d\u4ee4\u7c7b\u4f3c\u3002\u9664\u6570\u636e\u6e90\u6216\u76ee\u6807\u4e4b\u5916\uff0c\u5176\u4ed6\u6240\u6709\u9009\u9879\u90fd\u4e0e<code class=\"command\">COPY</code>\u547d\u4ee4\u4e2d\u7684\u6307\u5b9a\u76f8\u540c\u3002\u56e0\u6b64\uff0c\u7279\u6b8a\u7684\u89e3\u6790\u89c4\u5219\u9002\u7528\u4e8e<code class=\"command\">\\copy</code>\u5143\u547d\u4ee4\u3002\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u5269\u4f59\u884c\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\copy</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u6267\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u53e6\u4e00\u79cd\u83b7\u5f97\u4e0e<code class=\"literal\">\\copy ... to</code>\u76f8\u540c\u7ed3\u679c\u7684\u65b9\u6cd5\u662f\u4f7f\u7528<acronym class=\"acronym\">SQL</acronym> <code class=\"literal\">COPY ... TO STDOUT</code>\u547d\u4ee4\uff0c\u5e76\u4ee5<code class=\"literal\">\\g <em class=\"replaceable\"><code>filename</code></em></code> \u6216<code class=\"literal\">\\g |<em class=\"replaceable\"><code>program</code></em></code>\u7ed3\u675f\u3002\u4e0e<code class=\"literal\">\\copy</code>\u4e0d\u540c\uff0c\u8fd9\u79cd\u65b9\u6cd5\u5141\u8bb8\u547d\u4ee4\u8de8\u8d8a\u591a\u884c\uff1b\u6b64\u5916\uff0c\u53ef\u4ee5\u4f7f\u7528\u53d8\u91cf\u63d2\u503c\u548c\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</div>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8fd9\u4e9b\u64cd\u4f5c\u4e0d\u5982\u4ee5\u6587\u4ef6\u6216\u7a0b\u5e8f\u4f5c\u4e3a\u6570\u636e\u6e90\u6216\u76ee\u6807\u7684 <acronym class=\"acronym\">SQL</acronym> <code class=\"command\">COPY</code> \u547d\u4ee4\u9ad8\u6548\uff0c\u56e0\u4e3a\u6240\u6709\u6570\u636e\u90fd\u5fc5\u987b\u901a\u8fc7\u5ba2\u6237\u7aef/\u670d\u52a1\u5668\u8fde\u63a5\u4f20\u8f93\u3002\u5bf9\u4e8e\u5927\u91cf\u6570\u636e\uff0c\u4f7f\u7528 <acronym class=\"acronym\">SQL</acronym> \u547d\u4ee4\u53ef\u80fd\u66f4\u5408\u9002\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-COPYRIGHT\"><span class=\"term\"><code class=\"literal\">\\copyright</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a<span class=\"productname\">PostgreSQL</span>\u7684\u7248\u6743\u548c\u5206\u53d1\u6761\u6b3e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMANDS-CROSSTABVIEW\"><span class=\"term\"><code class=\"literal\">\\crosstabview [ <em class=\"replaceable\"><code>colV</code></em> [ <em class=\"replaceable\"><code>colH</code></em> [ <em class=\"replaceable\"><code>colD</code></em> [ <em class=\"replaceable\"><code>sortcolH</code></em> ] ] ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6267\u884c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\uff08\u4e0e<code class=\"literal\">\\g</code>\u7c7b\u4f3c\uff09\uff0c\u5e76\u4ee5\u4ea4\u53c9\u8868\u7f51\u683c\u663e\u793a\u7ed3\u679c\u3002\u67e5\u8be2\u5fc5\u987b\u8fd4\u56de\u81f3\u5c11\u4e09\u5217\u3002\u7531<em class=\"replaceable\"><code>colV</code></em>\u6807\u8bc6\u7684\u8f93\u51fa\u5217\u6210\u4e3a\u7eb5\u5411\u8868\u5934\uff0c\u7531<em class=\"replaceable\"><code>colH</code></em>\u6807\u8bc6\u7684\u8f93\u51fa\u5217\u6210\u4e3a\u6a2a\u5411\u8868\u5934\u3002<em class=\"replaceable\"><code>colD</code></em>\u6807\u8bc6\u8981\u5728\u7f51\u683c\u4e2d\u663e\u793a\u7684\u8f93\u51fa\u5217\u3002<em class=\"replaceable\"><code>sortcolH</code></em>\u6807\u8bc6\u6a2a\u5411\u8868\u5934\u7684\u53ef\u9009\u6392\u5e8f\u5217\u3002</p>\n<p lang=\"zh\">\u6bcf\u4e2a\u5217\u6307\u5b9a\u9879\u53ef\u4ee5\u662f\u4ece 1 \u5f00\u59cb\u7684\u5217\u53f7\uff0c\u4e5f\u53ef\u4ee5\u662f\u5217\u540d\uff1b\u5217\u540d\u9075\u5faa\u5e38\u89c4 SQL \u5927\u5c0f\u5199\u6298\u53e0\u548c\u5f15\u53f7\u89c4\u5219\u3002\u7701\u7565\u65f6\uff0ccolV \u9ed8\u8ba4\u4e3a\u7b2c 1 \u5217\uff0ccolH \u9ed8\u8ba4\u4e3a\u7b2c 2 \u5217\u3002colH \u5fc5\u987b\u4e0e colV \u4e0d\u540c\u3002\u82e5\u4e0d\u6307\u5b9a colD\uff0c\u67e5\u8be2\u7ed3\u679c\u5fc5\u987b\u6070\u6709\u4e09\u5217\uff0c\u65e2\u975e colV \u4e5f\u975e colH \u7684\u90a3\u4e00\u5217\u4f5c\u4e3a colD\u3002</p>\n<p lang=\"zh\">\u7eb5\u5411\u8868\u5934\u663e\u793a\u4e3a\u6700\u5de6\u5217\uff0c\u5305\u542b<em class=\"replaceable\"><code>colV</code></em>\u5217\u4e2d\u7684\u503c\uff0c\u5176\u987a\u5e8f\u4e0e\u67e5\u8be2\u7ed3\u679c\u4e2d\u76f8\u540c\uff0c\u4f46\u4f1a\u79fb\u9664\u91cd\u590d\u503c\u3002</p>\n<p lang=\"zh\">\u6a2a\u5411\u8868\u5934\u663e\u793a\u4e3a\u7b2c\u4e00\u884c\uff0c\u5305\u542b<em class=\"replaceable\"><code>colH</code></em>\u5217\u4e2d\u7684\u503c\uff0c\u5e76\u79fb\u9664\u91cd\u590d\u503c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5b83\u4eec\u6309\u67e5\u8be2\u7ed3\u679c\u4e2d\u7684\u76f8\u540c\u987a\u5e8f\u663e\u793a\u3002\u4f46\u5982\u679c\u7ed9\u51fa\u4e86\u53ef\u9009\u7684<em class=\"replaceable\"><code>sortcolH</code></em>\u53c2\u6570\uff0c\u5b83\u6240\u6807\u8bc6\u7684\u5217\u7684\u503c\u5fc5\u987b\u662f\u6574\u6570\uff0c\u800c<em class=\"replaceable\"><code>colH</code></em>\u4e2d\u7684\u503c\u4f1a\u6309\u7167\u5bf9\u5e94\u7684<em class=\"replaceable\"><code>sortcolH</code></em>\u503c\u6392\u5e8f\u540e\u663e\u793a\u5728\u6a2a\u5411\u8868\u5934\u4e2d\u3002</p>\n<p lang=\"zh\">\u4ea4\u53c9\u8868\u4e2d\uff0c\u5bf9\u4e8e colH \u7684\u6bcf\u4e2a\u4e0d\u540c\u503c x \u548c colV \u7684\u6bcf\u4e2a\u4e0d\u540c\u503c y\uff0c\u4ea4\u70b9 (x,y) \u7684\u5355\u5143\u683c\u4fdd\u5b58\u67e5\u8be2\u7ed3\u679c\u4e2d colH=x \u4e14 colV=y \u90a3\u4e00\u884c\u7684 colD \u503c\u3002\u6ca1\u6709\u5339\u914d\u884c\u65f6\u5355\u5143\u683c\u4e3a\u7a7a\uff1b\u5b58\u5728\u591a\u884c\u65f6\u4f1a\u62a5\u9519\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-D\"><span class=\"term\"><code class=\"literal\">\\d[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5bf9\u4e8e\u6bcf\u4e2a\u4e0e<em class=\"replaceable\"><code>pattern</code></em>\u5339\u914d\u7684\u5173\u7cfb\uff08\u8868\u3001\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u7d22\u5f15\u3001\u5e8f\u5217\u6216\u5916\u90e8\u8868\uff09\u6216\u590d\u5408\u7c7b\u578b\uff0c\u663e\u793a\u6240\u6709\u5217\u3001\u5b83\u4eec\u7684\u7c7b\u578b\u3001\u8868\u7a7a\u95f4\uff08\u5982\u679c\u4e0d\u662f\u9ed8\u8ba4\u7684\uff09\u4ee5\u53ca\u4efb\u4f55\u7279\u6b8a\u5c5e\u6027\uff0c\u5982<code class=\"literal\">NOT NULL</code>\u6216\u9ed8\u8ba4\u503c\u3002\u8fd8\u663e\u793a\u76f8\u5173\u7684\u7d22\u5f15\u3001\u7ea6\u675f\u3001\u89c4\u5219\u548c\u89e6\u53d1\u5668\u3002\u5bf9\u4e8e\u5916\u90e8\u8868\uff0c\u8fd8\u663e\u793a\u5173\u8054\u7684\u5916\u90e8\u670d\u52a1\u5668\u3002\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u5339\u914d\u6a21\u5f0f</span>\u201d</span>\u7684\u5b9a\u4e49\u5728\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"\u6a21\u5f0f\">\u6a21\u5f0f</a>\u4e2d\u3002\uff09</p>\n<p lang=\"zh\">\u5bf9\u4e8e\u67d0\u4e9b\u7c7b\u578b\u7684\u5173\u7cfb\uff0c<code class=\"literal\">\\d</code>\u663e\u793a\u6bcf\u5217\u7684\u9644\u52a0\u4fe1\u606f\uff1a\u5e8f\u5217\u7684\u5217\u503c\uff0c\u7d22\u5f15\u7684\u7d22\u5f15\u8868\u8fbe\u5f0f\uff0c\u5916\u90e8\u8868\u7684\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u547d\u4ee4\u5f62\u5f0f<code class=\"literal\">\\d+</code>\u4e0e\u524d\u8005\u76f8\u540c\uff0c\u4f46\u4f1a\u663e\u793a\u66f4\u591a\u4fe1\u606f\uff1a\u8868\u5217\u5173\u8054\u7684\u6ce8\u91ca\u3001\u8868\u662f\u5426\u5305\u542b OID\u3001\u5f53\u5173\u7cfb\u4e3a\u89c6\u56fe\u65f6\u7684\u89c6\u56fe\u5b9a\u4e49\u3001\u975e\u9ed8\u8ba4\u7684<a class=\"link\" href=\"/docs/18/sql-altertable.html#SQL-ALTERTABLE-REPLICA-IDENTITY\">\u590d\u5236\u6807\u8bc6</a>\u8bbe\u7f6e\uff0c\u4ee5\u53ca\u5f53\u5173\u7cfb\u5177\u6709\u8bbf\u95ee\u65b9\u6cd5\u65f6\u7684<a class=\"link\" href=\"/docs/18/sql-create-access-method.html\" title=\"CREATE ACCESS METHOD\">\u8bbf\u95ee\u65b9\u6cd5</a>\u540d\u79f0\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u4e00\u4e2a\u6a21\u5f0f\u6216<code class=\"literal\">S</code>\u4fee\u9970\u7b26\u4ee5\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528<code class=\"command\">\\d</code>\u800c\u6ca1\u6709<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\uff0c\u5b83\u7b49\u540c\u4e8e<code class=\"command\">\\dtvmsE</code>\uff0c\u5b83\u5c06\u663e\u793a\u6240\u6709\u53ef\u89c1\u7684\u8868\u3001\u89c6\u56fe\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u548c\u5916\u90e8\u8868\u7684\u5217\u8868\u3002\u8fd9\u7eaf\u7cb9\u662f\u4e00\u79cd\u4fbf\u5229\u63aa\u65bd\u3002</p>\n<p lang=\"zh\">\u4e0e\u8bb8\u591a\u5176\u4ed6\u547d\u4ee4\u4e00\u6837\uff0c\u5728\u547d\u4ee4\u540d\u540e\u6dfb\u52a0 x \u4f1a\u4f7f\u7528\u6269\u5c55\u663e\u793a\u6a21\u5f0f\u3002\u4f46\u8fd9\u4ec5\u9002\u7528\u4e8e\u4e0d\u5e26 pattern \u53c2\u6570\u7684 \\d\uff0c\u4e14 x \u4e0d\u80fd\u7d27\u8ddf \\d\uff08\u56e0\u4e3a \\dx \u662f\u53e6\u4e00\u4e2a\u547d\u4ee4\uff09\uff0c\u53ea\u80fd\u4f4d\u4e8e S \u6216 + \u4fee\u9970\u7b26\u4e4b\u540e\u3002\u4f8b\u5982\uff0c\\d+x \u7b49\u4ef7\u4e8e \\dtvmsE+x\uff0c\u5c06\u4ee5\u6269\u5c55\u6a21\u5f0f\u5217\u51fa\u6240\u6709\u5173\u7cfb\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DA-LC\"><span class=\"term\"><code class=\"literal\">\\da[Sx] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u805a\u5408\u51fd\u6570\uff0c\u4ee5\u53ca\u5b83\u4eec\u7684\u8fd4\u56de\u7c7b\u578b\u548c\u6240\u4f5c\u7528\u7684\u6570\u636e\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u805a\u5408\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DA-UC\"><span class=\"term\"><code class=\"literal\">\\dA[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8bbf\u95ee\u65b9\u6cd5\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bbf\u95ee\u65b9\u6cd5\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u8bbf\u95ee\u65b9\u6cd5\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u7684\u5904\u7406\u5668\u51fd\u6570\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DAC\"><span class=\"term\"><code class=\"literal\">\\dAc[x+] [<a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>input-type-pattern</code></em></a>]]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u64cd\u4f5c\u7b26\u7c7b\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/18/xindex.html#XINDEX-OPCLASS\" title=\"36.16.1.\u00a0\u7d22\u5f15\u65b9\u6cd5\u548c\u64cd\u4f5c\u7b26\u7c7b\">\u7b2c\u00a036.16.1\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u7c7b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>input-type-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8f93\u5165\u7c7b\u578b\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u7c7b\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u7c7b\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u548c\u6240\u6709\u8005\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DAF\"><span class=\"term\"><code class=\"literal\">\\dAf[x+] [<a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>input-type-pattern</code></em></a>]]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u64cd\u4f5c\u7b26\u65cf\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/18/xindex.html#XINDEX-OPFAMILY\" title=\"36.16.5.\u00a0\u64cd\u4f5c\u7b26\u7c7b\u548c\u64cd\u4f5c\u7b26\u65cf\">\u7b2c\u00a036.16.5\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>input-type-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8f93\u5165\u7c7b\u578b\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u65cf\u90fd\u4f1a\u8fde\u540c\u5176\u6240\u6709\u8005\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DAO\"><span class=\"term\"><code class=\"literal\">\\dAo[x+] [<a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>operator-family-pattern</code></em></a>]]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u4e0e\u64cd\u4f5c\u7b26\u65cf\u5173\u8054\u7684\u64cd\u4f5c\u7b26\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/18/xindex.html#XINDEX-STRATEGIES\" title=\"36.16.2.\u00a0\u7d22\u5f15\u65b9\u6cd5\u7b56\u7565\">\u7b2c\u00a036.16.2\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u6240\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u6210\u5458\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>operator-family-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u8be5\u6a21\u5f0f\u5339\u914d\u7684\u64cd\u4f5c\u7b26\u65cf\u6210\u5458\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u90fd\u4f1a\u8fde\u540c\u5176\u6392\u5e8f\u64cd\u4f5c\u7b26\u65cf\uff08\u5982\u679c\u5b83\u662f\u6392\u5e8f\u64cd\u4f5c\u7b26\uff09\u4ee5\u53ca\u5176\u5e95\u5c42\u51fd\u6570\u662f\u5426\u9632\u6f0f\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DAP\"><span class=\"term\"><code class=\"literal\">\\dAp[x+] [<a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>access-method-pattern</code></em></a> [<a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>operator-family-pattern</code></em></a>]]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u4e0e\u64cd\u4f5c\u7b26\u65cf\u5173\u8054\u7684\u652f\u6301\u51fd\u6570\uff08\u53c2\u89c1<a class=\"xref\" href=\"/docs/18/xindex.html#XINDEX-SUPPORT\" title=\"36.16.3.\u00a0\u7d22\u5f15\u65b9\u6cd5\u652f\u6301\u4f8b\u7a0b\">\u7b2c\u00a036.16.3\u00a0\u8282</a>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>access-method-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u4e0e\u540d\u79f0\u5339\u914d\u8be5\u6a21\u5f0f\u7684\u8bbf\u95ee\u65b9\u6cd5\u6240\u5173\u8054\u7684\u64cd\u4f5c\u7b26\u65cf\u51fd\u6570\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>operator-family-pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u8be5\u6a21\u5f0f\u5339\u914d\u7684\u64cd\u4f5c\u7b26\u65cf\u51fd\u6570\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u51fd\u6570\u4f1a\u4ee5\u8be6\u7ec6\u5f62\u5f0f\u663e\u793a\uff0c\u5e76\u5e26\u6709\u5176\u5b9e\u9645\u53c2\u6570\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DB\"><span class=\"term\"><code class=\"literal\">\\db[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8868\u7a7a\u95f4\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8868\u7a7a\u95f4\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u8868\u7a7a\u95f4\u90fd\u4f1a\u8fde\u540c\u5176\u5173\u8054\u9009\u9879\u3001\u78c1\u76d8\u5927\u5c0f\u3001\u6743\u9650\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DC-LC\"><span class=\"term\"><code class=\"literal\">\\dc[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5b57\u7b26\u96c6\u7f16\u7801\u4e4b\u95f4\u7684\u8f6c\u6362\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8f6c\u6362\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DCONFIG\"><span class=\"term\"><code class=\"literal\">\\dconfig[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u670d\u52a1\u5668\u914d\u7f6e\u53c2\u6570\u53ca\u5176\u503c\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u53c2\u6570\u3002\u4e0d\u5e26 <em class=\"replaceable\"><code>pattern</code></em> \u65f6\uff0c\u53ea\u5217\u51fa\u88ab\u8bbe\u7f6e\u4e3a\u975e\u9ed8\u8ba4\u503c\u7684\u53c2\u6570\u3002\uff08\u4f7f\u7528 <code class=\"literal\">\\dconfig *</code> \u53ef\u67e5\u770b\u6240\u6709\u53c2\u6570\u3002\uff09\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u53c2\u6570\u90fd\u4f1a\u8fde\u540c\u5176\u6570\u636e\u7c7b\u578b\u3001\u8be5\u53c2\u6570\u53ef\u8bbe\u7f6e\u7684\u4e0a\u4e0b\u6587\u4ee5\u53ca\u8bbf\u95ee\u6743\u9650\uff08\u5982\u679c\u5df2\u6388\u4e88\u975e\u9ed8\u8ba4\u8bbf\u95ee\u6743\u9650\uff09\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DC-UC\"><span class=\"term\"><code class=\"literal\">\\dC[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u7c7b\u578b\u8f6c\u6362\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u5176\u6e90\u7c7b\u578b\u6216\u76ee\u6807\u7c7b\u578b\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u7c7b\u578b\u8f6c\u6362\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u7c7b\u578b\u8f6c\u6362\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5176\u5e95\u5c42\u51fd\u6570\u662f\u5426\u9632\u6f0f\uff0c\u4ee5\u53ca\u8be5\u7c7b\u578b\u8f6c\u6362\u7684\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DD-LC\"><span class=\"term\"><code class=\"literal\">\\dd[Sx] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u663e\u793a<code class=\"literal\">constraint</code>\u3001<code class=\"literal\">operator class</code>\u3001<code class=\"literal\">operator family</code>\u3001<code class=\"literal\">rule</code>\u548c <code class=\"literal\">trigger</code>\u7c7b\u578b\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002\u5176\u4ed6\u6ce8\u91ca\u53ef\u901a\u8fc7\u5bf9\u5e94\u5bf9\u8c61\u7c7b\u578b\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u67e5\u770b\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">\\dd</code> \u663e\u793a\u4e0e <em class=\"replaceable\"><code>pattern</code></em> \u5339\u914d\u7684\u5bf9\u8c61\u63cf\u8ff0\uff1b\u5982\u679c\u6ca1\u6709\u7ed9\u51fa\u53c2\u6570\uff0c\u5219\u663e\u793a\u76f8\u5e94\u7c7b\u578b\u7684\u53ef\u89c1\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002\u4f46\u65e0\u8bba\u54ea\u79cd\u60c5\u51b5\uff0c\u53ea\u5217\u51fa\u90a3\u4e9b\u5df2\u6709\u63cf\u8ff0\u7684\u5bf9\u8c61\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002</p>\n<p lang=\"zh\">\u53ef\u4ee5\u4f7f\u7528 <a class=\"link\" href=\"/docs/18/sql-comment.html\" title=\"COMMENT\"><code class=\"command\">COMMENT</code></a> <acronym class=\"acronym\">SQL</acronym> \u547d\u4ee4\u521b\u5efa\u5bf9\u8c61\u7684\u63cf\u8ff0\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DD-UC\"><span class=\"term\"><code class=\"literal\">\\dD[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u57df\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u57df\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u6743\u9650\u548c\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DDP\"><span class=\"term\"><code class=\"literal\">\\ddp[x] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u9ed8\u8ba4\u8bbf\u95ee\u6743\u9650\u8bbe\u7f6e\u3002\u5bf9\u4e8e\u6bcf\u4e2a\u9ed8\u8ba4\u6743\u9650\u8bbe\u7f6e\u5df2\u504f\u79bb\u5185\u7f6e\u9ed8\u8ba4\u503c\u7684\u89d2\u8272\uff08\u4ee5\u53ca\u9002\u7528\u65f6\u7684\u6a21\u5f0f\uff09\uff0c\u90fd\u4f1a\u663e\u793a\u4e00\u6761\u8bb0\u5f55\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u89d2\u8272\u540d\u6216\u6a21\u5f0f\u540d\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bb0\u5f55\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002</p>\n<p lang=\"zh\"><a class=\"link\" href=\"/docs/18/sql-alterdefaultprivileges.html\" title=\"ALTER DEFAULT PRIVILEGES\"><code class=\"command\">ALTER DEFAULT PRIVILEGES</code></a>\u547d\u4ee4\u7528\u4e8e\u8bbe\u7f6e\u9ed8\u8ba4\u8bbf\u95ee\u6743\u9650\u3002\u6743\u9650\u663e\u793a\u7684\u542b\u4e49\u5728<a class=\"xref\" href=\"/docs/18/ddl-priv.html\" title=\"5.8.\u00a0\u6743\u9650\">\u7b2c\u00a05.8\u00a0\u8282</a>\u4e2d\u6709\u89e3\u91ca\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DE\"><span class=\"term\"><code class=\"literal\">\\dE[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\di[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dm[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\ds[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dt[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\dv[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5728\u8fd9\u7ec4\u547d\u4ee4\u4e2d\uff0c\u5b57\u6bcd <code class=\"literal\">E</code>\u3001<code class=\"literal\">i</code>\u3001<code class=\"literal\">m</code>\u3001<code class=\"literal\">s</code>\u3001<code class=\"literal\">t</code> \u548c <code class=\"literal\">v</code> \u5206\u522b\u8868\u793a\u5916\u90e8\u8868\u3001\u7d22\u5f15\u3001\u7269\u5316\u89c6\u56fe\u3001\u5e8f\u5217\u3001\u8868\u548c\u89c6\u56fe\u3002\u4f60\u53ef\u4ee5\u6309\u4efb\u610f\u987a\u5e8f\u6307\u5b9a\u5176\u4e2d\u4efb\u610f\u4e00\u4e2a\u6216\u591a\u4e2a\u5b57\u6bcd\uff0c\u4ee5\u83b7\u53d6\u8fd9\u4e9b\u7c7b\u578b\u5bf9\u8c61\u7684\u5217\u8868\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dti</code> \u4f1a\u5217\u51fa\u8868\u548c\u7d22\u5f15\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u6301\u4e45\u6027\u72b6\u6001\uff08\u6c38\u4e45\u3001\u4e34\u65f6\u6216\u4e0d\u8bb0\u5f55 WAL\uff09\u3001\u78c1\u76d8\u4e0a\u7684\u7269\u7406\u5927\u5c0f\u4ee5\u53ca\u76f8\u5173\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u4e00\u8d77\u5217\u51fa\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u5bf9\u8c61\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DES\"><span class=\"term\"><code class=\"literal\">\\des[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u670d\u52a1\u5668\uff08\u52a9\u8bb0\u7b26\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external servers</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u670d\u52a1\u5668\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u670d\u52a1\u5668\u7684\u5b8c\u6574\u63cf\u8ff0\uff0c\u5305\u62ec\u670d\u52a1\u5668\u7684\u8bbf\u95ee\u6743\u9650\u3001\u7c7b\u578b\u3001\u7248\u672c\u3001\u9009\u9879\u548c\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DET\"><span class=\"term\"><code class=\"literal\">\\det[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u8868\uff08\u52a9\u8bb0\u7b26\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external tables</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u8868\u540d\u6216\u6a21\u5f0f\u540d\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6761\u76ee\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u8fd8\u4f1a\u663e\u793a\u901a\u7528\u9009\u9879\u4ee5\u53ca\u5916\u90e8\u8868\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DEU\"><span class=\"term\"><code class=\"literal\">\\deu[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u7528\u6237\u6620\u5c04\uff08\u52a9\u8bb0\u7b26\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external users</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u7528\u6237\u540d\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6620\u5c04\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u6620\u5c04\u7684\u9644\u52a0\u4fe1\u606f\u3002</p>\n<div class=\"caution\">\n<h3 class=\"title\" lang=\"zh\">\u5c0f\u5fc3</h3>\n<p lang=\"zh\"><code class=\"literal\">\\deu+</code>\u53ef\u80fd\u8fd8\u4f1a\u663e\u793a\u8fdc\u7a0b\u7528\u6237\u7684\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u56e0\u6b64\u5e94\u6ce8\u610f\u4e0d\u8981\u6cc4\u9732\u5b83\u4eec\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DEW\"><span class=\"term\"><code class=\"literal\">\\dew[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\uff08\u52a9\u8bb0\u7b26\uff1a<span class=\"quote\">\u201c<span class=\"quote\">external wrappers</span>\u201d</span>\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u8fd8\u4f1a\u663e\u793a\u5916\u90e8\u6570\u636e\u5305\u88c5\u5668\u7684\u8bbf\u95ee\u6743\u9650\u3001\u9009\u9879\u548c\u63cf\u8ff0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DF-LC\"><span class=\"term\"><code class=\"literal\">\\df[anptwSx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> [ <em class=\"replaceable\"><code>arg_pattern</code></em> ... ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u51fd\u6570\uff0c\u4ee5\u53ca\u5b83\u4eec\u7684\u7ed3\u679c\u6570\u636e\u7c7b\u578b\u3001\u53c2\u6570\u6570\u636e\u7c7b\u578b\u548c\u51fd\u6570\u7c7b\u578b\uff0c\u51fd\u6570\u7c7b\u578b\u5206\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">agg</span>\u201d</span>\uff08\u805a\u5408\uff09\u3001<span class=\"quote\">\u201c<span class=\"quote\">normal</span>\u201d</span>\u3001<span class=\"quote\">\u201c<span class=\"quote\">procedure</span>\u201d</span>\u3001<span class=\"quote\">\u201c<span class=\"quote\">trigger</span>\u201d</span>\u6216<span class=\"quote\">\u201c<span class=\"quote\">window</span>\u201d</span>\u3002\u8981\u53ea\u663e\u793a\u7279\u5b9a\u7c7b\u578b\u7684\u51fd\u6570\uff0c\u8bf7\u5728\u547d\u4ee4\u540e\u6dfb\u52a0\u76f8\u5e94\u7684\u5b57\u6bcd <code class=\"literal\">a</code>\u3001<code class=\"literal\">n</code>\u3001<code class=\"literal\">p</code>\u3001<code class=\"literal\">t</code> \u6216 <code class=\"literal\">w</code>\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u51fd\u6570\u3002\u4efb\u4f55\u9644\u52a0\u53c2\u6570\u90fd\u662f\u7c7b\u578b\u540d\u6a21\u5f0f\uff0c\u5206\u522b\u4e0e\u51fd\u6570\u7b2c\u4e00\u3001\u7b2c\u4e8c\u7b49\u53c2\u6570\u7684\u7c7b\u578b\u540d\u5339\u914d\u3002\uff08\u5339\u914d\u5230\u7684\u51fd\u6570\u53ef\u4ee5\u6bd4\u4f60\u6307\u5b9a\u7684\u53c2\u6570\u66f4\u591a\uff1b\u82e5\u8981\u9632\u6b62\u8fd9\u79cd\u60c5\u51b5\uff0c\u53ef\u5c06\u8fde\u5b57\u7b26 <code class=\"literal\">-</code> \u5199\u6210\u6700\u540e\u4e00\u4e2a <em class=\"replaceable\"><code>arg_pattern</code></em>\u3002\uff09\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u51fd\u6570\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u6613\u53d8\u6027\u3001\u5e76\u884c\u5b89\u5168\u6027\u3001\u6240\u6709\u8005\u3001\u5b89\u5168\u5206\u7c7b\u3001\u662f\u5426\u9632\u6f0f\u3001\u8bbf\u95ee\u6743\u9650\u3001\u8bed\u8a00\u3001\u5185\u90e8\u540d\u79f0\uff08\u4ec5\u9002\u7528\u4e8e C \u548c internal \u51fd\u6570\uff09\u4ee5\u53ca\u63cf\u8ff0\u3002\u7279\u5b9a\u51fd\u6570\u7684\u6e90\u4ee3\u7801\u53ef\u901a\u8fc7 <code class=\"literal\">\\sf</code> \u67e5\u770b\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DF-UC\"><span class=\"term\"><code class=\"literal\">\\dF[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u914d\u7f6e\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u914d\u7f6e\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u914d\u7f6e\u7684\u5b8c\u6574\u63cf\u8ff0\uff0c\u5305\u62ec\u5e95\u5c42\u5168\u6587\u68c0\u7d22\u89e3\u6790\u5668\u4ee5\u53ca\u6bcf\u79cd\u89e3\u6790\u5668\u8bcd\u5143\u7c7b\u578b\u5bf9\u5e94\u7684\u8bcd\u5178\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DFD\"><span class=\"term\"><code class=\"literal\">\\dFd[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u8bcd\u5178\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bcd\u5178\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u6240\u9009\u8bcd\u5178\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5e95\u5c42\u5168\u6587\u68c0\u7d22\u6a21\u677f\u548c\u9009\u9879\u503c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DFP\"><span class=\"term\"><code class=\"literal\">\\dFp[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u89e3\u6790\u5668\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u89e3\u6790\u5668\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u89e3\u6790\u5668\u7684\u5b8c\u6574\u63cf\u8ff0\uff0c\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u548c\u53ef\u8bc6\u522b\u7684\u8bcd\u5143\u7c7b\u578b\u5217\u8868\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DFT\"><span class=\"term\"><code class=\"literal\">\\dFt[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5168\u6587\u68c0\u7d22\u6a21\u677f\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u663e\u793a\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6a21\u677f\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u6a21\u677f\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u540d\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DG\"><span class=\"term\"><code class=\"literal\">\\dg[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u5e93\u89d2\u8272\u3002\uff08\u7531\u4e8e<span class=\"quote\">\u201c<span class=\"quote\">\u7528\u6237</span>\u201d</span>\u548c<span class=\"quote\">\u201c<span class=\"quote\">\u7ec4</span>\u201d</span>\u7684\u6982\u5ff5\u5df2\u7ecf\u7edf\u4e00\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">\u89d2\u8272</span>\u201d</span>\uff0c\u6b64\u547d\u4ee4\u73b0\u5728\u7b49\u540c\u4e8e <code class=\"literal\">\\du</code>\u3002\uff09\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u89d2\u8272\uff1b\u63d0\u4f9b <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u89d2\u8272\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u89d2\u8272\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u89d2\u8272\u7684\u9644\u52a0\u4fe1\u606f\uff1b\u76ee\u524d\u8fd9\u4f1a\u589e\u52a0\u6bcf\u4e2a\u89d2\u8272\u7684\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DL-LC\"><span class=\"term\"><code class=\"literal\">\\dl[x+]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u662f <code class=\"command\">\\lo_list</code> \u7684\u522b\u540d\uff0c\u540e\u8005\u4f1a\u663e\u793a\u5927\u5bf9\u8c61\u5217\u8868\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u5217\u51fa\u6bcf\u4e2a\u5927\u5bf9\u8c61\u7684\u76f8\u5173\u6743\u9650\uff08\u5982\u679c\u6709\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DL-UC\"><span class=\"term\"><code class=\"literal\">\\dL[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u8fc7\u7a0b\u8bed\u8a00\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8bed\u8a00\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u8bed\u8a00\uff1b\u63d0\u4f9b <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u79cd\u8bed\u8a00\u90fd\u4f1a\u8fde\u540c\u5176\u8c03\u7528\u5904\u7406\u5668\u3001\u9a8c\u8bc1\u5668\u3001\u8bbf\u95ee\u6743\u9650\u4ee5\u53ca\u5b83\u662f\u5426\u4e3a\u7cfb\u7edf\u5bf9\u8c61\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DN\"><span class=\"term\"><code class=\"literal\">\\dn[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6a21\u5f0f\uff08\u547d\u540d\u7a7a\u95f4\uff09\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6a21\u5f0f\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u6743\u9650\u548c\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DO-LC\"><span class=\"term\"><code class=\"literal\">\\do[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> [ <em class=\"replaceable\"><code>arg_pattern</code></em> [ <em class=\"replaceable\"><code>arg_pattern</code></em> ] ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u64cd\u4f5c\u7b26\u53ca\u5176\u64cd\u4f5c\u6570\u7c7b\u578b\u548c\u7ed3\u679c\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u64cd\u4f5c\u7b26\u3002\u5982\u679c\u6307\u5b9a\u4e86\u4e00\u4e2a <em class=\"replaceable\"><code>arg_pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u5176\u53f3\u53c2\u6570\u7c7b\u578b\u540d\u79f0\u4e0e\u8be5\u6a21\u5f0f\u5339\u914d\u7684\u524d\u7f00\u64cd\u4f5c\u7b26\u3002\u5982\u679c\u6307\u5b9a\u4e86\u4e24\u4e2a <em class=\"replaceable\"><code>arg_pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u53c2\u6570\u7c7b\u578b\u540d\u79f0\u4e0e\u8fd9\u4e9b\u6a21\u5f0f\u5339\u914d\u7684\u4e8c\u5143\u64cd\u4f5c\u7b26\u3002\uff08\u5bf9\u4e8e\u4e00\u5143\u64cd\u4f5c\u7b26\u672a\u4f7f\u7528\u7684\u53c2\u6570\uff0c\u4e5f\u53ef\u4ee5\u5199\u6210 <code class=\"literal\">-</code>\u3002\uff09\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u64cd\u4f5c\u7b26\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u5305\u62ec\u5e95\u5c42\u51fd\u6570\u540d\u4ee5\u53ca\u5b83\u662f\u5426\u9632\u6f0f\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DO-UC\"><span class=\"term\"><code class=\"literal\">\\dO[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6392\u5e8f\u89c4\u5219\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6392\u5e8f\u89c4\u5219\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u6392\u5e8f\u89c4\u5219\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\uff08\u5982\u679c\u6709\uff09\u4e00\u8d77\u5217\u51fa\u3002\u8bf7\u6ce8\u610f\uff0c\u53ea\u4f1a\u663e\u793a\u4e0e\u5f53\u524d\u6570\u636e\u5e93\u7f16\u7801\u517c\u5bb9\u7684\u6392\u5e8f\u89c4\u5219\uff0c\u56e0\u6b64\u5728\u540c\u4e00\u5b89\u88c5\u4e2d\u7684\u4e0d\u540c\u6570\u636e\u5e93\u91cc\u7ed3\u679c\u53ef\u80fd\u4e0d\u540c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DP-LC\"><span class=\"term\"><code class=\"literal\">\\dp[Sx] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u53ca\u5176\u76f8\u5173\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002</p>\n<p lang=\"zh\"><a class=\"link\" href=\"/docs/18/sql-grant.html\" title=\"GRANT\"><code class=\"command\">GRANT</code></a>\u548c <a class=\"link\" href=\"/docs/18/sql-revoke.html\" title=\"REVOKE\"><code class=\"command\">REVOKE</code></a> \u547d\u4ee4\u7528\u4e8e\u8bbe\u7f6e\u8bbf\u95ee\u6743\u9650\u3002\u6743\u9650\u663e\u793a\u7684\u542b\u4e49\u5728<a class=\"xref\" href=\"/docs/18/ddl-priv.html\" title=\"5.8.\u00a0\u6743\u9650\">\u7b2c\u00a05.8\u00a0\u8282</a>\u4e2d\u6709\u89e3\u91ca\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DP-UC\"><span class=\"term\"><code class=\"literal\">\\dP[itnx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5206\u533a\u5173\u7cfb\u3002\u5982\u679c<em class=\"replaceable\"><code>pattern</code></em>\u88ab\u6307\u5b9a\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6761\u76ee\u3002\u4fee\u9970\u7b26<code class=\"literal\">t</code>\uff08\u8868\uff09\u548c<code class=\"literal\">i</code>\uff08\u7d22\u5f15\uff09\u53ef\u4ee5\u9644\u52a0\u5230\u547d\u4ee4\uff0c\u8fc7\u6ee4\u8981\u5217\u51fa\u7684\u5173\u7cfb\u7c7b\u578b\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u5217\u51fa\u5206\u533a\u8868\u548c\u7d22\u5f15\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528\u4fee\u9970\u7b26<code class=\"literal\">n</code>\uff08<span class=\"quote\">\u201c<span class=\"quote\">nested</span>\u201d</span>\uff09\uff0c\u6216\u6307\u5b9a\u4e86\u6a21\u5f0f\uff0c\u5219\u5c06\u5305\u62ec\u975e\u6839\u5206\u533a\u5173\u7cfb\uff0c\u5e76\u663e\u793a\u4e00\u5217\uff0c\u7ed9\u51fa\u6bcf\u4e2a\u5206\u533a\u5173\u7cfb\u7684\u7236\u7ea7\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u8fd8\u4f1a\u663e\u793a\u6bcf\u4e2a\u5173\u7cfb\u5206\u533a\u5927\u5c0f\u7684\u603b\u548c\u4ee5\u53ca\u5173\u7cfb\u63cf\u8ff0\u3002\u5982\u679c <code class=\"literal\">n</code> \u4e0e <code class=\"literal\">+</code> \u7ec4\u5408\u4f7f\u7528\uff0c\u5219\u4f1a\u663e\u793a\u4e24\u4e2a\u5927\u5c0f\uff1a\u4e00\u4e2a\u5305\u62ec\u76f4\u63a5\u9644\u52a0\u7684\u53f6\u5206\u533a\u7684\u603b\u5927\u5c0f\uff0c\u53e6\u4e00\u4e2a\u663e\u793a\u5305\u62ec\u95f4\u63a5\u9644\u52a0\u5b50\u5206\u533a\u5728\u5185\u7684\u6240\u6709\u5206\u533a\u603b\u5927\u5c0f\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DRDS\"><span class=\"term\"><code class=\"literal\">\\drds[x] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>role-pattern</code></em></a> [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>database-pattern</code></em></a> ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u5df2\u5b9a\u4e49\u7684\u914d\u7f6e\u8bbe\u7f6e\u3002\u8fd9\u4e9b\u8bbe\u7f6e\u53ef\u4ee5\u7279\u5b9a\u4e8e\u89d2\u8272\u3001\u7279\u5b9a\u4e8e\u6570\u636e\u5e93\uff0c\u6216\u540c\u65f6\u7279\u5b9a\u4e8e\u4e24\u8005\u3002<em class=\"replaceable\"><code>role-pattern</code></em>\u548c<em class=\"replaceable\"><code>database-pattern</code></em>\u5206\u522b\u7528\u4e8e\u9009\u62e9\u8981\u5217\u51fa\u7684\u89d2\u8272\u548c\u6570\u636e\u5e93\u3002\u7701\u7565\u67d0\u4e2a\u6a21\u5f0f\u53c2\u6570\u6216\u5c06\u5176\u6307\u5b9a\u4e3a<code class=\"literal\">*</code>\u65f6\uff0c\u4e0d\u4f1a\u6309\u8be5\u53c2\u6570\u7b5b\u9009\uff0c\u8fd8\u4f1a\u5206\u522b\u5305\u542b\u4e0d\u7279\u5b9a\u4e8e\u89d2\u8272\u6216\u4e0d\u7279\u5b9a\u4e8e\u6570\u636e\u5e93\u7684\u8bbe\u7f6e\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0<code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002</p>\n<p lang=\"zh\"><a class=\"link\" href=\"/docs/18/sql-alterrole.html\" title=\"ALTER ROLE\"><code class=\"command\">ALTER ROLE</code></a>\u548c <a class=\"link\" href=\"/docs/18/sql-alterdatabase.html\" title=\"ALTER DATABASE\"><code class=\"command\">ALTER DATABASE</code></a> \u547d\u4ee4\u7528\u4e8e\u5b9a\u4e49\u6bcf\u4e2a\u89d2\u8272\u548c\u6bcf\u4e2a\u6570\u636e\u5e93\u7684\u914d\u7f6e\u8bbe\u7f6e\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DRG\"><span class=\"term\"><code class=\"literal\">\\drg[Sx] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u6bcf\u4e2a\u88ab\u6388\u4e88\u89d2\u8272\u6210\u5458\u8eab\u4efd\u7684\u4fe1\u606f\uff0c\u5305\u62ec\u88ab\u6388\u4e88\u7684\u9009\u9879\uff08<code class=\"literal\">ADMIN</code>\u3001<code class=\"literal\">INHERIT</code> \u548c/\u6216 <code class=\"literal\">SET</code>\uff09\u4ee5\u53ca\u6388\u4e88\u8005\u3002\u5173\u4e8e\u89d2\u8272\u6210\u5458\u8eab\u4efd\uff0c\u53c2\u89c1 <a class=\"link\" href=\"/docs/18/sql-grant.html\" title=\"GRANT\"><code class=\"command\">GRANT</code></a> \u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u6388\u4e88\u7528\u6237\u521b\u5efa\u89d2\u8272\u7684\u6210\u5458\u8eab\u4efd\uff1b\u63d0\u4f9b <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u89d2\u8272\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u6388\u4e88\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u89d2\u8272\u7684\u6210\u5458\u8eab\u4efd\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DRP\"><span class=\"term\"><code class=\"literal\">\\dRp[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u903b\u8f91\u590d\u5236\u53d1\u5e03\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u53d1\u5e03\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u8fd8\u4f1a\u663e\u793a\u4e0e\u6bcf\u4e2a\u53d1\u5e03\u5173\u8054\u7684\u8868\u548c\u6a21\u5f0f\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DRS\"><span class=\"term\"><code class=\"literal\">\\dRs[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u903b\u8f91\u590d\u5236\u8ba2\u9605\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8ba2\u9605\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u8ba2\u9605\u7684\u5176\u4ed6\u5c5e\u6027\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DT\"><span class=\"term\"><code class=\"literal\">\\dT[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u7c7b\u578b\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u7c7b\u578b\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u7c7b\u578b\u90fd\u4f1a\u8fde\u540c\u5176\u5185\u90e8\u540d\u79f0\u3001\u5927\u5c0f\u548c\u76f8\u5173\u6743\u9650\u4e00\u8d77\u5217\u51fa\uff1b\u5bf9\u4e8e <code class=\"type\">enum</code> \u7c7b\u578b\uff0c\u8fd8\u4f1a\u663e\u793a\u5176\u5141\u8bb8\u503c\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DU\"><span class=\"term\"><code class=\"literal\">\\du[Sx+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u6570\u636e\u5e93\u89d2\u8272\u3002\uff08\u7531\u4e8e<span class=\"quote\">\u201c<span class=\"quote\">\u7528\u6237</span>\u201d</span>\u548c<span class=\"quote\">\u201c<span class=\"quote\">\u7ec4</span>\u201d</span>\u7684\u6982\u5ff5\u5df2\u7ecf\u7edf\u4e00\u4e3a<span class=\"quote\">\u201c<span class=\"quote\">\u89d2\u8272</span>\u201d</span>\uff0c\u6b64\u547d\u4ee4\u73b0\u5728\u7b49\u540c\u4e8e <code class=\"literal\">\\dg</code>\u3002\uff09\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u89d2\u8272\uff1b\u63d0\u4f9b <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u89d2\u8272\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u89d2\u8272\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u663e\u793a\u6bcf\u4e2a\u89d2\u8272\u7684\u9644\u52a0\u4fe1\u606f\uff1b\u76ee\u524d\u8fd9\u4f1a\u589e\u52a0\u6bcf\u4e2a\u89d2\u8272\u7684\u6ce8\u91ca\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DX-LC\"><span class=\"term\"><code class=\"literal\">\\dx[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u5df2\u5b89\u88c5\u7684\u6269\u5c55\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6269\u5c55\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u5217\u51fa\u5c5e\u4e8e\u6bcf\u4e2a\u5339\u914d\u6269\u5c55\u7684\u5168\u90e8\u5bf9\u8c61\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DX-UC\"><span class=\"term\"><code class=\"literal\">\\dX[x] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u6269\u5c55\u7edf\u8ba1\u4fe1\u606f\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6269\u5c55\u7edf\u8ba1\u4fe1\u606f\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002</p>\n<p lang=\"zh\">\u6bcf\u79cd\u6269\u5c55\u7edf\u8ba1\u7684\u72b6\u6001\u663e\u793a\u5728\u4ee5\u7edf\u8ba1\u79cd\u7c7b\u547d\u540d\u7684\u5217\u4e2d\uff0c\u4f8b\u5982 Ndistinct\u3002defined \u8868\u793a\u521b\u5efa\u7edf\u8ba1\u65f6\u8bf7\u6c42\u4e86\u8be5\u7edf\u8ba1\uff0cNULL \u8868\u793a\u672a\u8bf7\u6c42\u3002\u82e5\u8981\u5224\u65ad ANALYZE \u662f\u5426\u8fd0\u884c\u8fc7\u3001\u7edf\u8ba1\u662f\u5426\u53ef\u4f9b\u89c4\u5212\u5668\u4f7f\u7528\uff0c\u53ef\u67e5\u8be2 pg_stats_ext\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-DY\"><span class=\"term\"><code class=\"literal\">\\dy[x+] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u4e8b\u4ef6\u89e6\u53d1\u5668\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u4e8b\u4ef6\u89e6\u53d1\u5668\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u6bcf\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u8fde\u540c\u5176\u76f8\u5173\u63cf\u8ff0\u4e00\u8d77\u5217\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-EDIT\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\e</code> \u6216 <code class=\"literal\">\\edit</code> <code class=\"literal\">[ <span class=\"optional\"><em class=\"replaceable\"><code>filename</code></em></span> ] [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5219\u7f16\u8f91\u8be5\u6587\u4ef6\uff1b\u7f16\u8f91\u5668\u9000\u51fa\u540e\uff0c\u6587\u4ef6\u5185\u5bb9\u5c06\u88ab\u590d\u5236\u5230\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5219\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u590d\u5236\u5230\u4e34\u65f6\u6587\u4ef6\u4e2d\uff0c\u7136\u540e\u4ee5\u76f8\u540c\u65b9\u5f0f\u8fdb\u884c\u7f16\u8f91\u3002\u6216\u8005\uff0c\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u5c06\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u590d\u5236\u5230\u4e34\u65f6\u6587\u4ef6\u4e2d\uff0c\u5e76\u4ee5\u76f8\u540c\u65b9\u5f0f\u8fdb\u884c\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7f16\u8f91\u6587\u4ef6\u6216\u4e0a\u4e00\u4e2a\u67e5\u8be2\u540e\u5728\u672a\u4fee\u6539\u6587\u4ef6\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5219\u67e5\u8be2\u7f13\u51b2\u533a\u5c06\u88ab\u6e05\u9664\u3002\u5426\u5219\uff0c\u67e5\u8be2\u7f13\u51b2\u533a\u7684\u65b0\u5185\u5bb9\u5c06\u6839\u636e<span class=\"application\">psql</span>\u7684\u6b63\u5e38\u89c4\u5219\u91cd\u65b0\u89e3\u6790\uff0c\u5c06\u6574\u4e2a\u7f13\u51b2\u533a\u89c6\u4e3a\u5355\u884c\u3002\u4efb\u4f55\u5b8c\u6574\u7684\u67e5\u8be2\u5c06\u7acb\u5373\u6267\u884c\uff1b\u4e5f\u5c31\u662f\u8bf4\uff0c\u5982\u679c\u67e5\u8be2\u7f13\u51b2\u533a\u5305\u542b\u5206\u53f7\u6216\u4ee5\u5206\u53f7\u7ed3\u5c3e\uff0c\u5219\u6267\u884c\u5e76\u4ece\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u5220\u9664\u5230\u8be5\u70b9\u7684\u6240\u6709\u5185\u5bb9\u3002\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u5269\u4f59\u7684\u5185\u5bb9\u5c06\u91cd\u65b0\u663e\u793a\u3002\u8f93\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u8f93\u5165<code class=\"literal\">\\r</code>\u901a\u8fc7\u6e05\u9664\u67e5\u8be2\u7f13\u51b2\u533a\u6765\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u5c06\u7f13\u51b2\u533a\u89c6\u4e3a\u5355\u884c\u4e3b\u8981\u5f71\u54cd\u5143\u547d\u4ee4\uff1a\u5728\u5143\u547d\u4ee4\u540e\u7684\u7f13\u51b2\u533a\u5c06\u88ab\u89c6\u4e3a\u5143\u547d\u4ee4\u7684\u53c2\u6570\uff0c\u5373\u4f7f\u5b83\u8de8\u8d8a\u591a\u884c\u3002\uff08\u56e0\u6b64\uff0c\u4e0d\u80fd\u7528\u8fd9\u79cd\u65b9\u5f0f\u521b\u5efa\u4f7f\u7528\u5143\u547d\u4ee4\u7684\u811a\u672c\u3002\u8bf7\u4f7f\u7528<code class=\"command\">\\i</code>\u3002\uff09</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u5c06\u5149\u6807\u5b9a\u4f4d\u5728\u6587\u4ef6\u6216\u67e5\u8be2\u7f13\u51b2\u533a\u7684\u6307\u5b9a\u884c\u4e0a\u3002\u8bf7\u6ce8\u610f\uff0c\u5982\u679c\u53ea\u7ed9\u51fa\u4e00\u4e2a\u5168\u662f\u6570\u5b57\u7684\u53c2\u6570\uff0c<span class=\"application\">psql</span>\u4f1a\u5047\u5b9a\u5b83\u662f\u4e00\u4e2a\u884c\u53f7\uff0c\u800c\u4e0d\u662f\u6587\u4ef6\u540d\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5173\u4e8e\u5982\u4f55\u914d\u7f6e\u548c\u81ea\u5b9a\u4e49\u7f16\u8f91\u5668\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"\u73af\u5883\">\u73af\u5883</a>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-ECHO\"><span class=\"term\"><code class=\"literal\">\\echo <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6c42\u503c\u540e\u7684\u53c2\u6570\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff0c\u7528\u7a7a\u683c\u5206\u9694\uff0c\u5e76\u5728\u672b\u5c3e\u52a0\u4e0a\u6362\u884c\u7b26\u3002\u8fd9\u5bf9\u4e8e\u5728\u811a\u672c\u8f93\u51fa\u4e2d\u7a7f\u63d2\u4fe1\u606f\u5f88\u6709\u7528\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>\\echo `date`</code></strong>\nTue Oct 26 21:40:57 CEST 1999\n</pre>\n<p lang=\"zh\">\u5982\u679c\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f\u672a\u52a0\u5f15\u53f7\u7684<code class=\"literal\">-n</code>\uff0c\u5219\u4e0d\u4f1a\u5199\u5165\u5c3e\u968f\u7684\u6362\u884c\u7b26\uff08\u4e5f\u4e0d\u4f1a\u5199\u5165\u7b2c\u4e00\u4e2a\u53c2\u6570\uff09\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5982\u679c\u4f7f\u7528<code class=\"command\">\\o</code>\u547d\u4ee4\u91cd\u5b9a\u5411\u67e5\u8be2\u8f93\u51fa\uff0c\u53ef\u80fd\u4f1a\u60f3\u7528<code class=\"command\">\\qecho</code>\u4ee3\u66ff\u8fd9\u4e2a\u547d\u4ee4\u3002\u53e6\u8bf7\u53c2\u9605<code class=\"command\">\\warn</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-EF\"><span class=\"term\"><code class=\"literal\">\\ef [ <span class=\"optional\"><em class=\"replaceable\"><code>function_description</code></em> [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</span> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u7f16\u8f91\u6307\u5b9a\u51fd\u6570\u6216\u8fc7\u7a0b\u7684\u5b9a\u4e49\uff0c\u5f62\u5f0f\u4e3a<code class=\"command\">CREATE OR REPLACE FUNCTION</code>\u6216 <code class=\"command\">CREATE OR REPLACE PROCEDURE</code>\u547d\u4ee4\u3002\u7f16\u8f91\u65b9\u5f0f\u4e0e<code class=\"literal\">\\edit</code>\u76f8\u540c\u3002\u5982\u679c\u5728\u4e0d\u4fdd\u5b58\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5219\u8be5\u8bed\u53e5\u4f1a\u88ab\u4e22\u5f03\u3002\u5982\u679c\u4fdd\u5b58\u5e76\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5e76\u5728\u5176\u4e2d\u6dfb\u52a0\u4e86\u5206\u53f7\uff0c\u5219\u66f4\u65b0\u540e\u7684\u547d\u4ee4\u4f1a\u7acb\u5373\u6267\u884c\u3002\u5426\u5219\u5b83\u4f1a\u91cd\u65b0\u663e\u793a\uff1b\u952e\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u7528<code class=\"literal\">\\r</code>\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u76ee\u6807\u51fd\u6570\u53ef\u4ec5\u7528\u540d\u79f0\u6307\u5b9a\uff0c\u4e5f\u53ef\u7528\u540d\u79f0\u548c\u53c2\u6570\u6307\u5b9a\uff0c\u4f8b\u5982 foo(integer, text)\u3002\u82e5\u6709\u591a\u4e2a\u540c\u540d\u51fd\u6570\uff0c\u5219\u5fc5\u987b\u63d0\u4f9b\u53c2\u6570\u7c7b\u578b\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u51fd\u6570\uff0c\u5219\u4f1a\u5448\u73b0\u4e00\u4e2a\u7a7a\u7684<code class=\"command\">CREATE FUNCTION</code>\u6a21\u677f\u4f9b\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u5c06\u5149\u6807\u5b9a\u4f4d\u5728\u51fd\u6570\u4f53\u7684\u6307\u5b9a\u884c\u4e0a\u3002\uff08\u8bf7\u6ce8\u610f\uff0c\u51fd\u6570\u4f53\u901a\u5e38\u4e0d\u4f1a\u4ece\u6587\u4ef6\u7684\u7b2c\u4e00\u884c\u5f00\u59cb\u3002\uff09</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\ef</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5173\u4e8e\u5982\u4f55\u914d\u7f6e\u548c\u81ea\u5b9a\u4e49\u7f16\u8f91\u5668\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-ENVIRONMENT\" title=\"\u73af\u5883\">\u73af\u5883</a>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-ENCODING\"><span class=\"term\"><code class=\"literal\">\\encoding [ <em class=\"replaceable\"><code>encoding</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u5ba2\u6237\u7aef\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u6ca1\u6709\u53c2\u6570\u65f6\uff0c\u6b64\u547d\u4ee4\u663e\u793a\u5f53\u524d\u7f16\u7801\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-ERRVERBOSE\"><span class=\"term\"><code class=\"literal\">\\errverbose</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4ee5\u6700\u5927\u7684\u8be6\u7ec6\u7a0b\u5ea6\u91cd\u590d\u6700\u8fd1\u7684\u670d\u52a1\u5668\u9519\u8bef\u6d88\u606f\uff0c\u5c31\u597d\u50cf<code class=\"varname\">VERBOSITY</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">verbose</code>\uff0c<code class=\"varname\">SHOW_CONTEXT</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">always</code>\u4e00\u6837\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-EV\"><span class=\"term\"><code class=\"literal\">\\ev [ <span class=\"optional\"><em class=\"replaceable\"><code>view_name</code></em> [ <span class=\"optional\"><em class=\"replaceable\"><code>line_number</code></em></span> ]</span> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u7f16\u8f91\u6307\u5b9a\u89c6\u56fe\u7684\u5b9a\u4e49\uff0c\u5f62\u5f0f\u4e3a<code class=\"command\">CREATE OR REPLACE VIEW</code>\u547d\u4ee4\u3002\u7f16\u8f91\u65b9\u5f0f\u4e0e<code class=\"literal\">\\edit</code>\u76f8\u540c\u3002\u5982\u679c\u5728\u4e0d\u4fdd\u5b58\u7684\u60c5\u51b5\u4e0b\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5219\u8be5\u8bed\u53e5\u4f1a\u88ab\u4e22\u5f03\u3002\u5982\u679c\u4fdd\u5b58\u5e76\u9000\u51fa\u7f16\u8f91\u5668\uff0c\u5e76\u5728\u5176\u4e2d\u6dfb\u52a0\u4e86\u5206\u53f7\uff0c\u5219\u66f4\u65b0\u540e\u7684\u547d\u4ee4\u4f1a\u7acb\u5373\u6267\u884c\uff1b\u5426\u5219\u5c06\u91cd\u65b0\u663e\u793a\uff1b\u8f93\u5165\u5206\u53f7\u6216<code class=\"literal\">\\g</code>\u53d1\u9001\u5b83\uff0c\u6216\u7528<code class=\"literal\">\\r</code>\u53d6\u6d88\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u672a\u6307\u5b9a\u89c6\u56fe\uff0c\u5219\u4f1a\u5448\u73b0\u4e00\u4e2a\u7a7a\u7684<code class=\"command\">CREATE VIEW</code>\u6a21\u677f\u4f9b\u7f16\u8f91\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86\u884c\u53f7\uff0c<span class=\"application\">psql</span>\u5c06\u5149\u6807\u5b9a\u4f4d\u5728\u89c6\u56fe\u5b9a\u4e49\u7684\u6307\u5b9a\u884c\u4e0a\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\ev</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-F\"><span class=\"term\"><code class=\"literal\">\\f [ <em class=\"replaceable\"><code>string</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u975e\u5bf9\u9f50\u67e5\u8be2\u8f93\u51fa\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u9ed8\u8ba4\u503c\u662f\u7ad6\u7ebf\uff08<code class=\"literal\">|</code>\uff09\u3002\u5b83\u7b49\u540c\u4e8e<code class=\"command\">\\pset fieldsep</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-G\"><span class=\"term\"><code class=\"literal\">\\g [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\g [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u6267\u884c\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728<code class=\"literal\">\\g</code>\u540e\u9762\u51fa\u73b0\u62ec\u53f7\uff0c\u5219\u62ec\u53f7\u4e2d\u662f\u7528\u7a7a\u683c\u5206\u9694\u7684<em class=\"replaceable\"><code>option</code></em><code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em>\u683c\u5f0f\u9009\u9879\u5b50\u53e5\u5217\u8868\u3002\u8fd9\u4e9b\u5b50\u53e5\u7684\u89e3\u91ca\u65b9\u5f0f\u4e0e<code class=\"literal\">\\pset</code> <em class=\"replaceable\"><code>option</code></em> <em class=\"replaceable\"><code>value</code></em>\u547d\u4ee4\u76f8\u540c\uff0c\u4f46\u4ec5\u5728\u6b64\u67e5\u8be2\u6267\u884c\u671f\u95f4\u751f\u6548\u3002\u5728\u6b64\u5217\u8868\u4e2d\uff0c<code class=\"literal\">=</code>\u7b26\u53f7\u5468\u56f4\u4e0d\u5141\u8bb8\u6709\u7a7a\u683c\uff0c\u4f46\u9009\u9879\u5b50\u53e5\u4e4b\u95f4\u5fc5\u987b\u6709\u7a7a\u683c\u3002\u5982\u679c<code class=\"literal\">=</code><em class=\"replaceable\"><code>value</code></em>\u88ab\u7701\u7565\uff0c\u5219\u6307\u5b9a\u7684<em class=\"replaceable\"><code>option</code></em>\u4f1a\u6309\u4ee5\u4e0b\u547d\u4ee4\u7684\u65b9\u5f0f\u66f4\u6539\uff1a<code class=\"literal\">\\pset</code> <em class=\"replaceable\"><code>option</code></em>\uff0c\u5176\u4e2d\u4e0d\u663e\u5f0f\u6307\u5b9a<em class=\"replaceable\"><code>value</code></em>\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7ed9\u51fa\u4e86<em class=\"replaceable\"><code>filename</code></em>\u6216<code class=\"literal\">|</code><em class=\"replaceable\"><code>command</code></em>\u53c2\u6570\uff0c\u67e5\u8be2\u8f93\u51fa\u5c31\u4f1a\u5199\u5165\u6307\u5b9a\u6587\u4ef6\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6307\u5b9a\u7684 shell \u547d\u4ee4\uff0c\u800c\u4e0d\u662f\u7167\u5e38\u663e\u793a\u3002\u53ea\u6709\u5f53\u67e5\u8be2\u6210\u529f\u8fd4\u56de\u96f6\u4e2a\u6216\u591a\u4e2a\u5143\u7ec4\u65f6\uff0c\u624d\u4f1a\u5411\u6587\u4ef6\u6216\u547d\u4ee4\u5199\u5165\uff1b\u5982\u679c\u67e5\u8be2\u5931\u8d25\uff0c\u6216\u6267\u884c\u7684\u662f\u4e0d\u8fd4\u56de\u6570\u636e\u7684 SQL \u547d\u4ee4\uff0c\u5219\u4e0d\u4f1a\u5199\u5165\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u5c06\u88ab\u91cd\u65b0\u6267\u884c\u3002\u9664\u6b64\u4e4b\u5916\uff0c\u6ca1\u6709\u4efb\u4f55\u53c2\u6570\u7684<code class=\"literal\">\\g</code>\u57fa\u672c\u4e0a\u7b49\u540c\u4e8e\u4e00\u4e2a\u5206\u53f7\u3002\u5e26\u6709\u53c2\u6570\u7684<code class=\"literal\">\\g</code>\u63d0\u4f9b\u4e86\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u4e00\u6b21\u6027</span>\u201d</span>\u66ff\u4ee3<code class=\"command\">\\o</code>\u547d\u4ee4\u7684\u9009\u62e9\uff0c\u5e76\u4e14\u8fd8\u5141\u8bb8\u4e00\u6b21\u6027\u8c03\u6574\u901a\u5e38\u7531<code class=\"literal\">\\pset</code>\u8bbe\u7f6e\u7684\u8f93\u51fa\u683c\u5f0f\u9009\u9879\u3002</p>\n<p lang=\"zh\">\u5f53\u6700\u540e\u4e00\u4e2a\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\u65f6\uff0c\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u90fd\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u65e2\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\uff0c\u4e5f\u4e0d\u8fdb\u884c\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u90e8\u5206\u4f1a\u76f4\u63a5\u6309\u5b57\u9762\u4f20\u7ed9 shell\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-GDESC\"><span class=\"term\"><code class=\"literal\">\\gdesc</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u663e\u793a\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u67e5\u8be2\u7ed3\u679c\u7684\u63cf\u8ff0\uff08\u5373\u5217\u540d\u548c\u6570\u636e\u7c7b\u578b\uff09\u3002\u67e5\u8be2\u5e76\u4e0d\u4f1a\u5b9e\u9645\u6267\u884c\uff1b\u4e0d\u8fc7\uff0c\u5982\u679c\u5176\u4e2d\u5b58\u5728\u8bed\u6cd5\u9519\u8bef\uff0c\u4f1a\u6309\u901a\u5e38\u7684\u65b9\u5f0f\u62a5\u544a\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6539\u4e3a\u63cf\u8ff0\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-GETENV\"><span class=\"term\"><code class=\"literal\">\\getenv <em class=\"replaceable\"><code>psql_var</code></em> <em class=\"replaceable\"><code>env_var</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u83b7\u53d6\u73af\u5883\u53d8\u91cf<em class=\"replaceable\"><code>env_var</code></em>\u7684\u503c\uff0c\u5e76\u5c06\u5176\u8d4b\u7ed9<span class=\"application\">psql</span>\u53d8\u91cf<em class=\"replaceable\"><code>psql_var</code></em>\u3002\u5982\u679c<em class=\"replaceable\"><code>env_var</code></em>\u5728<span class=\"application\">psql</span>\u8fdb\u7a0b\u7684\u73af\u5883\u4e2d\u672a\u5b9a\u4e49\uff0c<em class=\"replaceable\"><code>psql_var</code></em>\u4e0d\u4f1a\u88ab\u6539\u53d8\u3002\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>\\getenv home HOME</code></strong>\n=&gt; <strong class=\"userinput\"><code>\\echo :home</code></strong>\n/home/postgres\n</pre>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-GEXEC\"><span class=\"term\"><code class=\"literal\">\\gexec</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u7136\u540e\u5c06\u67e5\u8be2\u8f93\u51fa\u7684\u6bcf\u884c\u6bcf\u5217\u89c6\u4e3a\u8981\u6267\u884c\u7684SQL\u8bed\u53e5\u3002\u4f8b\u5982\uff0c\u8981\u5728<code class=\"structname\">my_table</code>\u7684\u6bcf\u4e00\u5217\u4e0a\u521b\u5efa\u7d22\u5f15\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT format('create index on my_table(%I)', attname)</code></strong>\n-&gt; <strong class=\"userinput\"><code>FROM pg_attribute</code></strong>\n-&gt; <strong class=\"userinput\"><code>WHERE attrelid = 'my_table'::regclass AND attnum &gt; 0</code></strong>\n-&gt; <strong class=\"userinput\"><code>ORDER BY attnum</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gexec</code></strong>\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\nCREATE INDEX\n</pre>\n<p lang=\"zh\">\u751f\u6210\u7684\u67e5\u8be2\u6309\u8fd4\u56de\u884c\u7684\u987a\u5e8f\u6267\u884c\uff1b\u540c\u4e00\u884c\u6709\u591a\u5217\u65f6\u4ece\u5de6\u5230\u53f3\u6267\u884c\uff0c\u5ffd\u7565 NULL \u5b57\u6bb5\u3002\u67e5\u8be2\u539f\u6837\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u56e0\u6b64\u4e0d\u80fd\u662f psql \u5143\u547d\u4ee4\uff0c\u4e5f\u4e0d\u80fd\u5305\u542b psql \u53d8\u91cf\u5f15\u7528\u3002\u9664\u975e\u8bbe\u7f6e ON_ERROR_STOP\uff0c\u67d0\u6761\u67e5\u8be2\u5931\u8d25\u540e\u4ecd\u7ee7\u7eed\u6267\u884c\u5176\u4f59\u67e5\u8be2\u3002\u6bcf\u6761\u67e5\u8be2\u5747\u9075\u5faa ECHO \u8bbe\u7f6e\uff08\u4f7f\u7528 \\gexec \u65f6\uff0c\u901a\u5e38\u5efa\u8bae\u5c06 ECHO \u8bbe\u4e3a all \u6216 queries\uff09\uff0c\u67e5\u8be2\u65e5\u5fd7\u3001\u5355\u6b65\u6a21\u5f0f\u3001\u8ba1\u65f6\u7b49\u6267\u884c\u529f\u80fd\u4e5f\u5206\u522b\u5e94\u7528\u4e8e\u6bcf\u6761\u751f\u6210\u7684\u67e5\u8be2\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-GSET\"><span class=\"term\"><code class=\"literal\">\\gset [ <em class=\"replaceable\"><code>prefix</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u53d1\u9001\u7ed9\u670d\u52a1\u5668\uff0c\u5e76\u5c06\u67e5\u8be2\u8f93\u51fa\u5b58\u5165 <span class=\"application\">psql</span> \u53d8\u91cf\uff08\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\uff09\u3002\u8981\u6267\u884c\u7684\u67e5\u8be2\u5fc5\u987b\u6070\u597d\u8fd4\u56de\u4e00\u884c\u3002\u8be5\u884c\u7684\u6bcf\u4e00\u5217\u5206\u522b\u5b58\u5165\u4e00\u4e2a\u53d8\u91cf\uff0c\u53d8\u91cf\u540d\u4e0e\u5217\u540d\u76f8\u540c\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT 'hello' AS var1, 10 AS var2</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gset</code></strong>\n=&gt; <strong class=\"userinput\"><code>\\echo :var1 :var2</code></strong>\nhello 10\n</pre>\n<p lang=\"zh\">\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>prefix</code></em>\uff0c\u5219\u4f1a\u5c06\u8be5\u5b57\u7b26\u4e32\u52a0\u5230\u67e5\u8be2\u7684\u5217\u540d\u524d\u9762\uff0c\u4ee5\u6784\u6210\u8981\u4f7f\u7528\u7684\u53d8\u91cf\u540d\uff1a</p>\n<pre class=\"programlisting\">=&gt; <strong class=\"userinput\"><code>SELECT 'hello' AS var1, 10 AS var2</code></strong>\n-&gt; <strong class=\"userinput\"><code>\\gset result_</code></strong>\n=&gt; <strong class=\"userinput\"><code>\\echo :result_var1 :result_var2</code></strong>\nhello 10\n</pre>\n<p lang=\"zh\">\u5982\u679c\u67d0\u4e00\u5217\u7684\u7ed3\u679c\u4e3a NULL\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u5bf9\u5e94\u7684\u53d8\u91cf\uff0c\u800c\u4e0d\u662f\u8bbe\u7f6e\u5b83\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u67e5\u8be2\u5931\u8d25\u6216\u6ca1\u6709\u6070\u597d\u8fd4\u56de\u4e00\u884c\uff0c\u5219\u4e0d\u4f1a\u66f4\u6539\u4efb\u4f55\u53d8\u91cf\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-GX\"><span class=\"term\"><code class=\"literal\">\\gx [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\gx [ (<em class=\"replaceable\"><code>option</code></em>=<em class=\"replaceable\"><code>value</code></em> [...]) ] [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\\gx \u4e0e \\g \u7b49\u4ef7\uff0c\u4f46\u4f1a\u5f3a\u5236\u6b64\u67e5\u8be2\u4f7f\u7528\u6269\u5c55\u8f93\u51fa\u6a21\u5f0f\uff0c\u76f8\u5f53\u4e8e\u5728 \\pset \u9009\u9879\u5217\u8868\u4e2d\u6307\u5b9a expanded=on\u3002\u53e6\u89c1 \\x\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-HELP\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\h</code>\u6216<code class=\"literal\">\\help</code> <code class=\"literal\">[ <em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u7ed9\u51fa\u6307\u5b9a<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u7684\u8bed\u6cd5\u5e2e\u52a9\u3002\u5982\u679c\u672a\u6307\u5b9a<em class=\"replaceable\"><code>command</code></em>\uff0c\u5219<span class=\"application\">psql</span>\u5c06\u5217\u51fa\u6240\u6709\u53ef\u7528\u8bed\u6cd5\u5e2e\u52a9\u7684\u547d\u4ee4\u3002\u5982\u679c<em class=\"replaceable\"><code>command</code></em>\u662f\u661f\u53f7\uff08<code class=\"literal\">*</code>\uff09\uff0c\u5219\u663e\u793a\u6240\u6709<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4\u7684\u8bed\u6cd5\u5e2e\u52a9\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\help</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u4e3a\u4e86\u7b80\u5316\u8f93\u5165\uff0c\u7531\u591a\u4e2a\u5355\u8bcd\u7ec4\u6210\u7684\u547d\u4ee4\u4e0d\u9700\u8981\u52a0\u5f15\u53f7\u3002\u56e0\u6b64\uff0c\u53ef\u4ee5\u76f4\u63a5\u8f93\u5165<strong class=\"userinput\"><code>\\help alter table</code></strong>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-HTML\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\H</code> \u6216 <code class=\"literal\">\\html</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5f00<acronym class=\"acronym\">HTML</acronym>\u67e5\u8be2\u8f93\u51fa\u683c\u5f0f\u3002\u5982\u679c<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u5df2\u7ecf\u6253\u5f00\uff0c\u5219\u5207\u6362\u56de\u9ed8\u8ba4\u7684\u5bf9\u9f50\u6587\u672c\u683c\u5f0f\u3002\u6b64\u547d\u4ee4\u662f\u4e3a\u517c\u5bb9\u6027\u548c\u4fbf\u5229\u6027\u800c\u4fdd\u7559\u7684\uff1b\u8bbe\u7f6e\u5176\u4ed6\u8f93\u51fa\u9009\u9879\u7684\u65b9\u6cd5\u89c1<code class=\"command\">\\pset</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-INCLUDE\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\i</code> \u6216 <code class=\"literal\">\\include</code> <em class=\"replaceable\"><code>filename</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\u4e2d\u8bfb\u53d6\u8f93\u5165\uff0c\u5e76\u50cf\u5728\u952e\u76d8\u4e0a\u8f93\u5165\u4e00\u6837\u6267\u884c\u5b83\u3002</p>\n<p lang=\"zh\">\u5982\u679c<em class=\"replaceable\"><code>filename</code></em>\u662f<code class=\"literal\">-</code>\uff08\u8fde\u5b57\u7b26\uff09\uff0c\u5219\u4ece\u6807\u51c6\u8f93\u5165\u8bfb\u53d6\uff0c\u76f4\u5230\u9047\u5230 EOF \u6307\u793a\u6216<code class=\"command\">\\q</code>\u5143\u547d\u4ee4\u3002\u8fd9\u53ef\u7528\u4e8e\u5c06\u4ea4\u4e92\u5f0f\u8f93\u5165\u4e0e\u6587\u4ef6\u8f93\u5165\u4ea4\u9519\u4f7f\u7528\u3002\u8bf7\u6ce8\u610f\uff0c\u53ea\u6709\u5728\u6700\u5916\u5c42\u542f\u7528\u4e86 Readline\uff0c\u6b64\u5904\u624d\u4f1a\u4f7f\u7528 Readline \u529f\u80fd\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5982\u679c\u60f3\u5728\u5c4f\u5e55\u4e0a\u770b\u5230\u88ab\u8bfb\u5165\u7684\u5404\u884c\uff0c\u8bf7\u5c06\u53d8\u91cf<code class=\"varname\">ECHO</code>\u8bbe\u7f6e\u4e3a<code class=\"literal\">all</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"PSQL-METACOMMAND-IF\"><span class=\"term\"><code class=\"literal\">\\if</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\elif</code> <em class=\"replaceable\"><code>expression</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\else</code><br/></span><span class=\"term\"><code class=\"literal\">\\endif</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u7ec4\u547d\u4ee4\u5b9e\u73b0\u4e86\u53ef\u5d4c\u5957\u7684\u6761\u4ef6\u5757\u3002\u6761\u4ef6\u5757\u5fc5\u987b\u4ee5<code class=\"command\">\\if</code>\u5f00\u59cb\uff0c\u5e76\u4ee5<code class=\"command\">\\endif</code>\u7ed3\u675f\u3002\u5728\u4e24\u8005\u4e4b\u95f4\u53ef\u4ee5\u6709\u4efb\u610f\u6570\u91cf\u7684<code class=\"command\">\\elif</code>\u5b50\u53e5\uff0c\u540e\u9762\u53ef\u4ee5\u9009\u62e9\u6027\u5730\u8ddf\u7740\u4e00\u4e2a<code class=\"command\">\\else</code>\u5b50\u53e5\u3002\u5728\u5f62\u6210\u6761\u4ef6\u5757\u7684\u547d\u4ee4\u4e4b\u95f4\u901a\u5e38\u4f1a\u51fa\u73b0\u666e\u901a\u67e5\u8be2\u548c\u5176\u4ed6\u7c7b\u578b\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\\if \u548c \\elif \u8bfb\u53d6\u53c2\u6570\u5e76\u5c06\u5176\u4f5c\u4e3a\u5e03\u5c14\u8868\u8fbe\u5f0f\u6c42\u503c\u3002\u7ed3\u679c\u4e3a\u771f\u65f6\u7ee7\u7eed\u6b63\u5e38\u5904\u7406\uff0c\u5426\u5219\u8df3\u8fc7\u540e\u7eed\u884c\uff0c\u76f4\u5230\u9047\u5230\u5339\u914d\u7684 \\elif\u3001\\else \u6216 \\endif\u3002\u67d0\u4e2a \\if \u6216 \\elif \u6761\u4ef6\u6210\u7acb\u540e\uff0c\u540c\u4e00\u5757\u4e2d\u540e\u7eed \\elif \u7684\u53c2\u6570\u4e0d\u518d\u6c42\u503c\uff0c\u76f4\u63a5\u89c6\u4e3a\u5047\u3002\u53ea\u6709\u4e4b\u524d\u5339\u914d\u7684 \\if \u548c \\elif \u5747\u672a\u6210\u7acb\uff0c\u624d\u5904\u7406 \\else \u540e\u7684\u884c\u3002</p>\n<p lang=\"zh\">\u4e0e\u5176\u4ed6\u53cd\u659c\u6760\u547d\u4ee4\u53c2\u6570\u4e00\u6837\uff0c\\if \u6216 \\elif \u7684\u8868\u8fbe\u5f0f\u53c2\u6570\u5148\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u548c\u53cd\u5f15\u53f7\u5c55\u5f00\uff0c\u7136\u540e\u50cf\u5f00\u5173\u9009\u9879\u53d8\u91cf\u4e00\u6837\u6c42\u503c\u3002\u6709\u6548\u503c\u4e3a true\u3001false\u30011\u30010\u3001on\u3001off\u3001yes\u3001no \u7684\u4efb\u610f\u65e0\u6b67\u4e49\u3001\u4e0d\u533a\u5206\u5927\u5c0f\u5199\u7684\u5339\u914d\u3002\u4f8b\u5982 t\u3001T \u548c tR \u90fd\u4f1a\u89c6\u4e3a\u771f\u3002</p>\n<p lang=\"zh\">\u4e0d\u80fd\u6b63\u786e\u6c42\u503c\u4e3a\u771f\u6216\u5047\u7684\u8868\u8fbe\u5f0f\u4f1a\u4ea7\u751f\u8b66\u544a\uff0c\u5e76\u88ab\u89c6\u4e3a\u5047\u3002</p>\n<p lang=\"zh\">\u88ab\u8df3\u8fc7\u7684\u884c\u4f1a\u88ab\u6b63\u5e38\u89e3\u6790\u4ee5\u8bc6\u522b\u67e5\u8be2\u548c\u53cd\u659c\u7ebf\u547d\u4ee4\uff0c\u4f46\u67e5\u8be2\u4e0d\u4f1a\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u4e14\u9664\u4e86\u6761\u4ef6\u547d\u4ee4\uff08<code class=\"command\">\\if</code>\u3001<code class=\"command\">\\elif</code>\u3001<code class=\"command\">\\else</code>\u3001<code class=\"command\">\\endif</code>\uff09\u4e4b\u5916\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u4f1a\u88ab\u5ffd\u7565\u3002\u4ec5\u68c0\u67e5\u8df3\u8fc7\u884c\u4e2d\u6761\u4ef6\u547d\u4ee4\u7684\u6709\u6548\u5d4c\u5957\u3002\u8df3\u8fc7\u884c\u4e2d\u7684\u53d8\u91cf\u5f15\u7528\u4e0d\u4f1a\u88ab\u5c55\u5f00\uff0c\u4e5f\u4e0d\u4f1a\u6267\u884c\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n<p lang=\"zh\">\u540c\u4e00\u4e2a\u6761\u4ef6\u5757\u7684\u6240\u6709\u53cd\u659c\u7ebf\u547d\u4ee4\u5fc5\u987b\u51fa\u73b0\u5728\u540c\u4e00\u4e2a\u6e90\u6587\u4ef6\u4e2d\u3002\u5982\u679c\u4e3b\u8f93\u5165\u6587\u4ef6\u6216\u901a\u8fc7<code class=\"command\">\\include</code>\u5f15\u5165\u7684\u6587\u4ef6\u5230\u8fbe EOF \u65f6\uff0c\u4ecd\u6709\u672c\u5730<code class=\"command\">\\if</code>\u5757\u672a\u5173\u95ed\uff0c<span class=\"application\">psql</span>\u5c31\u4f1a\u62a5\u9519\u3002</p>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4e00\u4e2a\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">-- check for the existence of two separate records in the database and store\n-- the results in separate psql variables\nSELECT\n    EXISTS(SELECT 1 FROM customer WHERE customer_id = 123) as is_customer,\n    EXISTS(SELECT 1 FROM employee WHERE employee_id = 456) as is_employee\n\\gset\n\\if :is_customer\n    SELECT * FROM customer WHERE customer_id = 123;\n\\elif :is_employee\n    \\echo 'is not a customer but is an employee'\n    SELECT * FROM employee WHERE employee_id = 456;\n\\else\n    \\if yes\n        \\echo 'not a customer or employee'\n    \\else\n        \\echo 'this will never print'\n    \\endif\n\\endif\n</pre>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-INCLUDE-RELATIVE\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\ir</code> \u6216 <code class=\"literal\">\\include_relative</code> <em class=\"replaceable\"><code>filename</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"literal\">\\ir</code>\u547d\u4ee4\u4e0e<code class=\"literal\">\\i</code>\u76f8\u4f3c\uff0c\u4f46\u89e3\u6790\u76f8\u5bf9\u6587\u4ef6\u540d\u7684\u65b9\u5f0f\u4e0d\u540c\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\u6267\u884c\u65f6\uff0c\u8fd9\u4e24\u4e2a\u547d\u4ee4\u7684\u884c\u4e3a\u76f8\u540c\u3002\u4e0d\u8fc7\uff0c\u5728\u811a\u672c\u4e2d\u8c03\u7528\u65f6\uff0c<code class=\"literal\">\\ir</code>\u4f1a\u76f8\u5bf9\u4e8e\u811a\u672c\u6240\u5728\u7684\u76ee\u5f55\u6765\u89e3\u91ca\u6587\u4ef6\u540d\uff0c\u800c\u4e0d\u662f\u76f8\u5bf9\u4e8e\u5f53\u524d\u5de5\u4f5c\u76ee\u5f55\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-LIST\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\l[x+]</code>\u6216<code class=\"literal\">\\list[x+] [ <a class=\"link\" href=\"/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"\u6a21\u5f0f\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5217\u51fa\u670d\u52a1\u5668\u4e2d\u7684\u6570\u636e\u5e93\uff0c\u5e76\u663e\u793a\u5176\u540d\u79f0\u3001\u6240\u6709\u8005\u3001\u5b57\u7b26\u96c6\u7f16\u7801\u548c\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u6570\u636e\u5e93\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u8fd8\u4f1a\u663e\u793a\u6570\u636e\u5e93\u5927\u5c0f\u3001\u9ed8\u8ba4\u8868\u7a7a\u95f4\u548c\u63cf\u8ff0\u3002\u5f53\u524d\u7528\u6237\u5bf9\u5176\u62e5\u6709 <code class=\"literal\">CONNECT</code> \u6743\u9650\u7684\u6570\u636e\u5e93\u53ef\u4ee5\u663e\u793a\u5927\u5c0f\u4fe1\u606f\uff1b\u5982\u679c\u5f53\u524d\u7528\u6237\u662f\u8d85\u7ea7\u7528\u6237\u6216\u5177\u6709 <code class=\"literal\">pg_read_all_stats</code> \u89d2\u8272\u7684\u6743\u9650\uff0c\u4e5f\u53ef\u4ee5\u663e\u793a\u5927\u5c0f\u4fe1\u606f\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-LO-EXPORT\"><span class=\"term\"><code class=\"literal\">\\lo_export <em class=\"replaceable\"><code>loid</code></em> <em class=\"replaceable\"><code>filename</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6570\u636e\u5e93\u4e2d\u8bfb\u53d6\u5177\u6709<acronym class=\"acronym\">OID</acronym><em class=\"replaceable\"><code>loid</code></em>\u7684\u5927\u5bf9\u8c61\uff0c\u5e76\u5c06\u5176\u5199\u5165<em class=\"replaceable\"><code>filename</code></em>\u3002\u8bf7\u6ce8\u610f\uff0c\u8fd9\u4e0e\u670d\u52a1\u5668\u51fd\u6570 <code class=\"function\">lo_export</code>\u7565\u6709\u4e0d\u540c\uff0c\u540e\u8005\u4f7f\u7528\u8fd0\u884c\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u7528\u6237\u7684\u6743\u9650\uff0c\u5e76\u5728\u670d\u52a1\u5668\u7684\u6587\u4ef6\u7cfb\u7edf\u4e0a\u64cd\u4f5c\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u4f7f\u7528 \\lo_list \u67e5\u627e\u5927\u5bf9\u8c61\u7684 OID\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-LO-IMPORT\"><span class=\"term\"><code class=\"literal\">\\lo_import <em class=\"replaceable\"><code>filename</code></em> [ <em class=\"replaceable\"><code>comment</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6587\u4ef6\u5b58\u50a8\u5230\u4e00\u4e2a<span class=\"productname\">PostgreSQL</span>\u5927\u5bf9\u8c61\u4e2d\u3002\u53ef\u9009\u5730\uff0c\u5b83\u5c06\u7ed9\u5b9a\u7684\u6ce8\u91ca\u4e0e\u5bf9\u8c61\u5173\u8054\u8d77\u6765\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">foo=&gt; <strong class=\"userinput\"><code>\\lo_import '/home/peter/pictures/photo.xcf' 'a picture of me'</code></strong>\nlo_import 152801\n</pre>\n<p lang=\"zh\">\u54cd\u5e94\u8868\u660e\u5927\u5bf9\u8c61\u83b7\u5f97\u4e86\u5bf9\u8c61 ID 152801\uff0c\u8fd9\u4e2a ID \u53ef\u4ee5\u7528\u6765\u5728\u5c06\u6765\u8bbf\u95ee\u65b0\u521b\u5efa\u7684\u5927\u5bf9\u8c61\u3002\u4e3a\u4fbf\u4e8e\u9605\u8bfb\uff0c\u5efa\u8bae\u59cb\u7ec8\u4e3a\u6bcf\u4e2a\u5bf9\u8c61\u5173\u8054\u4e00\u6761\u4fbf\u4e8e\u4eba\u9605\u8bfb\u7684\u6ce8\u91ca\u3002\u67e5\u770b OID \u548c\u6ce8\u91ca\u65f6\uff0c\u53ef\u4ee5\u4f7f\u7528<code class=\"command\">\\lo_list</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u8bf7\u6ce8\u610f\uff0c\u6b64\u547d\u4ee4\u4e0e\u670d\u52a1\u5668\u7aef\u7684<code class=\"function\">lo_import</code>\u7565\u6709\u4e0d\u540c\uff0c\u56e0\u4e3a\u5b83\u4f5c\u4e3a\u672c\u5730\u7528\u6237\u5728\u672c\u5730\u6587\u4ef6\u7cfb\u7edf\u4e0a\u64cd\u4f5c\uff0c\u800c\u4e0d\u662f\u670d\u52a1\u5668\u7684\u7528\u6237\u548c\u6587\u4ef6\u7cfb\u7edf\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-LO-LIST\"><span class=\"term\"><code class=\"literal\">\\lo_list[x+]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5f53\u524d\u5b58\u50a8\u5728\u6570\u636e\u5e93\u4e2d\u7684\u5168\u90e8 <span class=\"productname\">PostgreSQL</span> \u5927\u5bf9\u8c61\u5217\u8868\uff0c\u4ee5\u53ca\u4e3a\u5b83\u4eec\u63d0\u4f9b\u7684\u4efb\u4f55\u6ce8\u91ca\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">+</code>\uff0c\u5219\u4f1a\u5217\u51fa\u6bcf\u4e2a\u5927\u5bf9\u8c61\u7684\u76f8\u5173\u6743\u9650\uff08\u5982\u679c\u6709\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-LO-UNLINK\"><span class=\"term\"><code class=\"literal\">\\lo_unlink <em class=\"replaceable\"><code>loid</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4ece\u6570\u636e\u5e93\u4e2d\u5220\u9664<acronym class=\"acronym\">OID</acronym> \u4e3a <em class=\"replaceable\"><code>loid</code></em>\u7684\u5927\u5bf9\u8c61\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u4f7f\u7528 \\lo_list \u67e5\u627e\u5927\u5bf9\u8c61\u7684 OID\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-OUT\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\o</code> \u6216 <code class=\"literal\">\\out [ <em class=\"replaceable\"><code>filename</code></em> ]</code><br/></span><span class=\"term\"><code class=\"literal\">\\o</code> \u6216 <code class=\"literal\">\\out [ |<em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u540e\u7eed\u67e5\u8be2\u7ed3\u679c\u4fdd\u5b58\u5230\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9 shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002\u5982\u679c\u6ca1\u6709\u6307\u5b9a\u53c2\u6570\uff0c\u67e5\u8be2\u8f93\u51fa\u5c06\u6062\u590d\u4e3a\u6807\u51c6\u8f93\u51fa\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\uff0c\u5219\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u7684\u5185\u5bb9\u53ea\u4f1a\u539f\u6837\u4f20\u9012\u7ed9 shell\u3002</p>\n<p lang=\"zh\"><span class=\"quote\">\u201c<span class=\"quote\">\u67e5\u8be2\u7ed3\u679c</span>\u201d</span>\u5305\u62ec\u4ece\u6570\u636e\u5e93\u670d\u52a1\u5668\u83b7\u53d6\u7684\u6240\u6709\u8868\u683c\u3001\u547d\u4ee4\u54cd\u5e94\u548c\u901a\u77e5\uff0c\u4ee5\u53ca\u67e5\u8be2\u6570\u636e\u5e93\u7684\u5404\u79cd\u53cd\u659c\u6760\u547d\u4ee4\u7684\u8f93\u51fa\uff08\u4f8b\u5982<code class=\"command\">\\d</code>\uff09\uff1b\u4f46\u4e0d\u5305\u62ec\u9519\u8bef\u6d88\u606f\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u8981\u5728\u67e5\u8be2\u7ed3\u679c\u4e4b\u95f4\u63d2\u5165\u6587\u672c\u8f93\u51fa\uff0c\u4f7f\u7528<code class=\"command\">\\qecho</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PRINT\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\p</code>\u6216<code class=\"literal\">\\print</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\u3002\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6253\u5370\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PARSE\"><span class=\"term\"><code class=\"literal\">\\parse <em class=\"replaceable\"><code>statement_name</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u57fa\u4e8e\u76ee\u6807\u9884\u5907\u8bed\u53e5\u5bf9\u8c61\u7684\u540d\u79f0\uff0c\u4ece\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u521b\u5efa\u4e00\u4e2a\u9884\u5907\u8bed\u53e5\u3002\u7a7a\u5b57\u7b26\u4e32\u8868\u793a\u672a\u547d\u540d\u7684\u9884\u5907\u8bed\u53e5\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">SELECT $1 \\parse stmt1\n</pre>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4f1a\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\uff0c\u4e0d\u540c\u4e8e<span class=\"application\">psql</span>\u901a\u5e38\u4f7f\u7528\u7684\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002\u8be5\u547d\u4ee4\u4f1a\u53d1\u51fa\u4e00\u6761<a class=\"xref\" href=\"/docs/18/protocol-message-formats.html#PROTOCOL-MESSAGE-FORMATS-PARSE\">Parse (F)</a>\u6d88\u606f\uff0c\u56e0\u6b64\u53ef\u7528\u4e8e\u5728<span class=\"application\">psql</span>\u4e2d\u6d4b\u8bd5\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002\u6b64\u547d\u4ee4\u53ea\u5f71\u54cd\u4e0b\u4e00\u6761\u88ab\u6267\u884c\u7684\u67e5\u8be2\uff1b\u4e4b\u540e\u7684\u6240\u6709\u67e5\u8be2\u9ed8\u8ba4\u4ecd\u4f1a\u4f7f\u7528\u7b80\u5355\u67e5\u8be2\u534f\u8bae\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PASSWORD\"><span class=\"term\"><code class=\"literal\">\\password [ <em class=\"replaceable\"><code>username</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u66f4\u6539\u6307\u5b9a\u7528\u6237\uff08\u9ed8\u8ba4\u4e3a\u5f53\u524d\u7528\u6237\uff09\u7684\u5bc6\u7801\u3002\u6b64\u547d\u4ee4\u63d0\u793a\u8f93\u5165\u65b0\u5bc6\u7801\uff0c\u5bf9\u5176\u8fdb\u884c\u52a0\u5bc6\uff0c\u5e76\u5c06\u5176\u4f5c\u4e3a<code class=\"command\">ALTER ROLE</code>\u547d\u4ee4\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u8fd9\u6837\u53ef\u4ee5\u786e\u4fdd\u65b0\u5bc6\u7801\u4e0d\u4f1a\u4ee5\u660e\u6587\u5f62\u5f0f\u51fa\u73b0\u5728\u547d\u4ee4\u5386\u53f2\u8bb0\u5f55\u3001\u670d\u52a1\u5668\u65e5\u5fd7\u6216\u5176\u4ed6\u5730\u65b9\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PROMPT\"><span class=\"term\"><code class=\"literal\">\\prompt [ <em class=\"replaceable\"><code>text</code></em> ] <em class=\"replaceable\"><code>name</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u63d0\u793a\u7528\u6237\u63d0\u4f9b\u6587\u672c\uff0c\u5c06\u5176\u8d4b\u503c\u7ed9\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u3002\u53ef\u4ee5\u6307\u5b9a\u4e00\u4e2a\u53ef\u9009\u7684\u63d0\u793a\u5b57\u7b26\u4e32<em class=\"replaceable\"><code>text</code></em>\u3002\uff08\u5bf9\u4e8e\u591a\u4e2a\u5355\u8bcd\u7684\u63d0\u793a\uff0c\u7528\u5355\u5f15\u53f7\u62ec\u8d77\u6587\u672c\u3002\uff09</p>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code class=\"literal\">\\prompt</code> \u4f7f\u7528\u7ec8\u7aef\u8fdb\u884c\u8f93\u5165\u548c\u8f93\u51fa\u3002\u7136\u800c\uff0c\u5982\u679c\u4f7f\u7528\u4e86 <code class=\"option\">-f</code> \u547d\u4ee4\u884c\u5f00\u5173\uff0c<code class=\"literal\">\\prompt</code> \u5c06\u4f7f\u7528\u6807\u51c6\u8f93\u5165\u548c\u6807\u51c6\u8f93\u51fa\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET\"><span class=\"term\"><code class=\"literal\">\\pset [ <em class=\"replaceable\"><code>option</code></em> [ <em class=\"replaceable\"><code>value</code></em> ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u8bbe\u7f6e\u5f71\u54cd\u67e5\u8be2\u7ed3\u679c\u8868\u8f93\u51fa\u7684\u9009\u9879\u3002<em class=\"replaceable\"><code>option</code></em>\u6307\u5b9a\u8981\u8bbe\u7f6e\u54ea\u4e2a\u9009\u9879\u3002<em class=\"replaceable\"><code>value</code></em>\u7684\u542b\u4e49\u53d6\u51b3\u4e8e\u6240\u9009\u7684\u9009\u9879\u3002\u5bf9\u4e8e\u67d0\u4e9b\u9009\u9879\uff0c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\u4f1a\u5207\u6362\u6216\u53d6\u6d88\u8bbe\u7f6e\u8be5\u9009\u9879\uff0c\u5177\u4f53\u89c1\u5404\u9009\u9879\u7684\u8bf4\u660e\u3002\u5982\u679c\u6ca1\u6709\u63d0\u53ca\u8fd9\u7c7b\u884c\u4e3a\uff0c\u90a3\u4e48\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\u53ea\u4f1a\u663e\u793a\u5f53\u524d\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\">\u4e0d\u5e26\u4efb\u4f55\u53c2\u6570\u7684<code class=\"command\">\\pset</code>\u4f1a\u663e\u793a\u6240\u6709\u6253\u5370\u9009\u9879\u7684\u5f53\u524d\u72b6\u6001\u3002</p>\n<p lang=\"zh\">\u53ef\u8c03\u6574\u6253\u5370\u9009\u9879\u6709\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-META-COMMAND-PSET-BORDER\"><span class=\"term\"><code class=\"literal\">border</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><em class=\"replaceable\"><code>value</code></em>\u5fc5\u987b\u662f\u6570\u5b57\u3002\u4e00\u822c\u6765\u8bf4\uff0c\u6570\u5b57\u8d8a\u5927\uff0c\u8868\u683c\u7684\u8fb9\u6846\u548c\u5206\u9694\u7ebf\u5c31\u8d8a\u591a\uff0c\u4f46\u7ec6\u8282\u53d6\u51b3\u4e8e\u5177\u4f53\u683c\u5f0f\u3002\u5728<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u4e2d\uff0c\u5b83\u4f1a\u76f4\u63a5\u8f6c\u6362\u4e3a<code class=\"literal\">border=...</code>\u5c5e\u6027\u3002\u5728\u5927\u591a\u6570\u5176\u4ed6\u683c\u5f0f\u4e2d\uff0c\u53ea\u6709\u503c 0\uff08\u65e0\u8fb9\u6846\uff09\u30011\uff08\u5185\u90e8\u5206\u9694\u7ebf\uff09\u548c 2\uff08\u8868\u683c\u5916\u6846\uff09\u6709\u610f\u4e49\uff0c\u5927\u4e8e 2 \u7684\u503c\u4f1a\u4e0e<code class=\"literal\">border = 2</code>\u4f5c\u76f8\u540c\u5904\u7406\u3002<code class=\"literal\">latex</code>\u548c<code class=\"literal\">latex-longtable</code>\u683c\u5f0f\u8fd8\u5141\u8bb8\u4f7f\u7528\u503c 3\uff0c\u4ee5\u5728\u6570\u636e\u884c\u4e4b\u95f4\u6dfb\u52a0\u5206\u9694\u7ebf\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-COLUMNS\" lang=\"zh\"><em>\u5217</em></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u76ee\u6807\u5bbd\u5ea6\uff0c\u540c\u65f6\u4e5f\u662f\u786e\u5b9a\u8f93\u51fa\u662f\u5426\u8db3\u591f\u5bbd\u4ee5\u9700\u8981\u5206\u9875\u5668\u6216\u5728\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e0b\u5207\u6362\u5230\u5782\u76f4\u663e\u793a\u7684\u5bbd\u5ea6\u9650\u5236\u3002\u96f6\uff08\u9ed8\u8ba4\u503c\uff09\u4f1a\u5bfc\u81f4\u76ee\u6807\u5bbd\u5ea6\u7531\u73af\u5883\u53d8\u91cf<code class=\"envar\">COLUMNS</code>\u63a7\u5236\uff0c\u6216\u8005\u5982\u679c\u672a\u8bbe\u7f6e <code class=\"envar\">COLUMNS</code>\u5219\u7531\u68c0\u6d4b\u5230\u7684\u5c4f\u5e55\u5bbd\u5ea6\u63a7\u5236\u3002\u53e6\u5916\uff0c\u5982\u679c<code class=\"literal\">columns</code>\u4e3a\u96f6\uff0c\u5219<code class=\"literal\">wrapped</code>\u683c\u5f0f\u4ec5\u5f71\u54cd\u5c4f\u5e55\u8f93\u51fa\u3002\u5982\u679c<code class=\"literal\">columns</code>\u4e3a\u975e\u96f6\uff0c\u5219\u6587\u4ef6\u548c\u7ba1\u9053\u8f93\u51fa\u4e5f\u4f1a\u6309\u8be5\u5bbd\u5ea6\u6298\u884c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-CSV-FIELDSEP\"><span class=\"term\"><code class=\"literal\">csv_fieldsep</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728<acronym class=\"acronym\">CSV</acronym>\u8f93\u51fa\u683c\u5f0f\u4e2d\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u5982\u679c\u5206\u9694\u7b26\u5b57\u7b26\u51fa\u73b0\u5728\u5b57\u6bb5\u7684\u503c\u4e2d\uff0c\u5219\u8be5\u5b57\u6bb5\u5c06\u6839\u636e\u6807\u51c6<acronym class=\"acronym\">CSV</acronym>\u89c4\u5219\u5728\u53cc\u5f15\u53f7\u5185\u8f93\u51fa\u3002\u9ed8\u8ba4\u503c\u662f\u9017\u53f7\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-EXPANDED\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">expanded</code>\uff08\u6216<code class=\"literal\">x</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff08\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u6269\u5c55\u6a21\u5f0f\uff09\uff0c\u6216\u8005\u662f<code class=\"literal\">auto</code>\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5f00\u542f\u548c\u5173\u95ed\u8bbe\u7f6e\u4e4b\u95f4\u5207\u6362\u3002\u542f\u7528\u6269\u5c55\u6a21\u5f0f\u65f6\uff0c\u67e5\u8be2\u7ed3\u679c\u4ee5\u4e24\u5217\u663e\u793a\uff0c\u5de6\u4fa7\u4e3a\u5217\u540d\uff0c\u53f3\u4fa7\u4e3a\u6570\u636e\u3002\u5982\u679c\u6570\u636e\u5728\u901a\u5e38\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u6a2a\u5411</span>\u201d</span>\u6a21\u5f0f\u4e0b\u65e0\u6cd5\u9002\u5e94\u5c4f\u5e55\uff0c\u8fd9\u79cd\u6a21\u5f0f\u5c31\u5f88\u6709\u7528\u3002\u5728\u81ea\u52a8\u8bbe\u7f6e\u4e0b\uff0c\u5f53\u67e5\u8be2\u8f93\u51fa\u5305\u542b\u591a\u5217\u4e14\u5bbd\u5ea6\u8d85\u8fc7\u5c4f\u5e55\u65f6\uff0c\u4f1a\u4f7f\u7528\u6269\u5c55\u6a21\u5f0f\uff1b\u5426\u5219\u4f7f\u7528\u5e38\u89c4\u6a21\u5f0f\u3002\u81ea\u52a8\u8bbe\u7f6e\u53ea\u5728\u5bf9\u9f50\u548c\u6298\u884c\u683c\u5f0f\u4e2d\u6709\u6548\u3002\u5728\u5176\u4ed6\u683c\u5f0f\u4e2d\uff0c\u5b83\u7684\u884c\u4e3a\u59cb\u7ec8\u4e0e\u5173\u95ed\u6269\u5c55\u6a21\u5f0f\u76f8\u540c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-FIELDSEP\"><span class=\"term\"><code class=\"literal\">fieldsep</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u3002\u8fd9\u6837\u53ef\u4ee5\u521b\u5efa\u4f8b\u5982\u5236\u8868\u7b26\u5206\u9694\u7684\u8f93\u51fa\uff0c\u8fd9\u53ef\u80fd\u66f4\u7b26\u5408\u5176\u4ed6\u7a0b\u5e8f\u7684\u9700\u8981\u3002\u8981\u5c06\u5236\u8868\u7b26\u8bbe\u7f6e\u4e3a\u5b57\u6bb5\u5206\u9694\u7b26\uff0c\u8bf7\u8f93\u5165<code class=\"literal\">\\pset fieldsep '\\t'</code>\u3002\u9ed8\u8ba4\u5b57\u6bb5\u5206\u9694\u7b26\u662f<code class=\"literal\">'|'</code>\uff08\u7ad6\u7ebf\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-FIELDSEP-ZERO\"><span class=\"term\"><code class=\"literal\">fieldsep_zero</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u8bbe\u7f6e\u4e3a\u96f6\u5b57\u8282\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-FOOTER\"><span class=\"term\"><code class=\"literal\">footer</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u8868\u683c\u9875\u811a\uff08<code class=\"literal\">(<em class=\"replaceable\"><code>n</code></em> rows)</code>\u8ba1\u6570\uff09\u7684\u663e\u793a\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5207\u6362\u9875\u811a\u663e\u793a\u7684\u5f00\u5173\u72b6\u6001\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-FORMAT\"><span class=\"term\"><code class=\"literal\">format</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u8f93\u51fa\u683c\u5f0f\u4e3a<code class=\"literal\">aligned</code>\u3001<code class=\"literal\">asciidoc</code>\u3001<code class=\"literal\">csv</code>\u3001<code class=\"literal\">html</code>\u3001<code class=\"literal\">latex</code>\u3001<code class=\"literal\">latex-longtable</code>\u3001<code class=\"literal\">troff-ms</code>\u3001<code class=\"literal\">unaligned</code>\u6216<code class=\"literal\">wrapped</code>\u3002\u5141\u8bb8\u4f7f\u7528\u552f\u4e00\u7f29\u5199\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">aligned</code>\u683c\u5f0f\u662f\u6807\u51c6\u7684\u3001\u9002\u5408\u4eba\u9605\u8bfb\u4e14\u6392\u7248\u6574\u9f50\u7684\u6587\u672c\u8f93\u51fa\uff1b\u8fd9\u662f\u9ed8\u8ba4\u683c\u5f0f\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">unaligned</code>\u683c\u5f0f\u5c06\u4e00\u884c\u4e2d\u7684\u6240\u6709\u5217\u5199\u5728\u4e00\u884c\u4e0a\uff0c\u7531\u5f53\u524d\u6d3b\u52a8\u7684\u5b57\u6bb5\u5206\u9694\u7b26\u5206\u9694\u3002\u8fd9\u5bf9\u4e8e\u521b\u5efa\u53ef\u80fd\u88ab\u5176\u4ed6\u7a0b\u5e8f\u8bfb\u53d6\u7684\u8f93\u51fa\u5f88\u6709\u7528\uff0c\u4f8b\u5982\uff0c\u5236\u8868\u7b26\u5206\u9694\u6216\u9017\u53f7\u5206\u9694\u683c\u5f0f\u3002\u7136\u800c\uff0c\u5982\u679c\u5b57\u6bb5\u5206\u9694\u7b26\u5b57\u7b26\u51fa\u73b0\u5728\u5217\u7684\u503c\u4e2d\uff0c\u5219\u4e0d\u4f1a\u88ab\u7279\u6b8a\u5904\u7406\uff1b\u56e0\u6b64\uff0c<acronym class=\"acronym\">CSV</acronym>\u683c\u5f0f\u53ef\u80fd\u66f4\u9002\u5408\u8fd9\u4e9b\u76ee\u7684\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">csv</code>\u683c\u5f0f<a class=\"indexterm\" id=\"id-1.9.4.21.8.4.11.1.81.2.3.1.8.2.4.2\" name=\"id-1.9.4.21.8.4.11.1.81.2.3.1.8.2.4.2\"></a>\u6309\u9017\u53f7\u5206\u9694\u7684\u5217\u503c\u8f93\u51fa\uff0c\u5e76\u5e94\u7528 <a class=\"ulink\" href=\"https://datatracker.ietf.org/doc/html/rfc4180\" target=\"_top\">RFC 4180</a> \u4e2d\u63cf\u8ff0\u7684\u52a0\u5f15\u53f7\u89c4\u5219\u3002\u6b64\u8f93\u51fa\u4e0e\u670d\u52a1\u5668\u7684CSV\u683c\u5f0f\u7684 <code class=\"command\">COPY</code>\u547d\u4ee4\u517c\u5bb9\u3002\u751f\u6210\u5305\u542b\u5217\u540d\u7684\u8868\u5934\u884c\uff0c\u9664\u975e <code class=\"literal\">tuples_only</code>\u53c2\u6570\u8bbe\u7f6e\u4e3a <code class=\"literal\">on</code>\u3002\u4e0d\u6253\u5370\u8868\u683c\u6807\u9898\u548c\u9875\u811a\u3002\u6bcf\u884c\u4ee5\u7cfb\u7edf\u76f8\u5173\u7684\u884c\u7ed3\u675f\u5b57\u7b26\u7ed3\u675f\uff0c\u5bf9\u4e8e\u7c7bUnix\u7cfb\u7edf\u901a\u5e38\u662f\u5355\u4e2a\u6362\u884c\u7b26\uff08<code class=\"literal\">\\n</code>\uff09\uff0c\u5bf9\u4e8eMicrosoft Windows\u5219\u662f\u56de\u8f66\u548c\u6362\u884c\u5e8f\u5217\uff08<code class=\"literal\">\\r\\n</code>\uff09\u3002\u53ef\u4ee5\u7528<code class=\"command\">\\pset csv_fieldsep</code>\u9009\u62e9\u9017\u53f7\u4ee5\u5916\u7684\u5b57\u6bb5\u5206\u9694\u5b57\u7b26\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">wrapped</code>\u683c\u5f0f\u4e0e<code class=\"literal\">aligned</code>\u76f8\u4f3c\uff0c\u4f46\u4f1a\u5c06\u8f83\u5bbd\u7684\u6570\u636e\u503c\u6298\u6210\u591a\u884c\uff0c\u4f7f\u8f93\u51fa\u9002\u5e94\u76ee\u6807\u5217\u5bbd\u3002\u76ee\u6807\u5bbd\u5ea6\u7684\u786e\u5b9a\u65b9\u5f0f\u89c1<code class=\"literal\">columns</code>\u9009\u9879\u7684\u8bf4\u660e\u3002\u8bf7\u6ce8\u610f\uff0c<span class=\"application\">psql</span>\u4e0d\u4f1a\u5c1d\u8bd5\u5bf9\u5217\u6807\u9898\u6298\u884c\uff1b\u56e0\u6b64\uff0c\u5982\u679c\u5217\u6807\u9898\u6240\u9700\u7684\u603b\u5bbd\u5ea6\u8d85\u8fc7\u76ee\u6807\u5bbd\u5ea6\uff0c<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u884c\u4e3a\u5c31\u4e0e<code class=\"literal\">aligned</code>\u76f8\u540c\u3002</p>\n<p lang=\"zh\">asciidoc\u3001html\u3001latex\u3001latex-longtable \u548c troff-ms \u683c\u5f0f\u8f93\u51fa\u7684\u662f\u53ef\u5d4c\u5165\u76f8\u5e94\u6807\u8bb0\u8bed\u8a00\u6587\u6863\u7684\u8868\u683c\uff0c\u5e76\u975e\u5b8c\u6574\u6587\u6863\u3002HTML \u53ef\u80fd\u4e0d\u8981\u6c42\u5b8c\u6574\u5c01\u88c5\uff0c\u4f46 LaTeX \u5fc5\u987b\u6709\u5b8c\u6574\u6587\u6863\u7ed3\u6784\u3002latex \u4f7f\u7528 LaTeX \u7684 tabular \u73af\u5883\uff1blatex-longtable \u9700\u8981 LaTeX \u7684 longtable \u548c booktabs \u5b8f\u5305\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-LINESTYLE\"><span class=\"term\"><code class=\"literal\">linestyle</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u8fb9\u6846\u7ebf\u7ed8\u5236\u6837\u5f0f\u4e3a<code class=\"literal\">ascii</code>\u3001<code class=\"literal\">old-ascii</code>\u6216<code class=\"literal\">unicode</code>\u4e4b\u4e00\u3002\u5141\u8bb8\u4f7f\u7528\u552f\u4e00\u7f29\u5199\u3002\uff08\u8fd9\u610f\u5473\u7740\u4e00\u4e2a\u5b57\u6bcd\u5c31\u8db3\u591f\u4e86\u3002\uff09\u9ed8\u8ba4\u8bbe\u7f6e\u4e3a<code class=\"literal\">ascii</code>\u3002\u6b64\u9009\u9879\u4ec5\u5f71\u54cd<code class=\"literal\">aligned</code>\u548c<code class=\"literal\">wrapped</code>\u8f93\u51fa\u683c\u5f0f\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">ascii</code>\u6837\u5f0f\u4f7f\u7528\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u53f3\u8fb9\u7f18\u7684<code class=\"literal\">+</code>\u7b26\u53f7\u8868\u793a\u3002\u5f53<code class=\"literal\">wrapped</code>\u683c\u5f0f\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u628a\u6570\u636e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u4f1a\u5728\u7b2c\u4e00\u884c\u7684\u53f3\u8fb9\u7f18\u663e\u793a\u4e00\u4e2a\u70b9\uff08<code class=\"literal\">.</code>\uff09\uff0c\u5e76\u5728\u4e0b\u4e00\u884c\u7684\u5de6\u8fb9\u7f18\u518d\u6b21\u663e\u793a\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">old-ascii</code>\u6837\u5f0f\u4f7f\u7528\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\uff0c\u91c7\u7528<span class=\"productname\">PostgreSQL</span> 8.4 \u53ca\u66f4\u65e9\u7248\u672c\u7684\u683c\u5f0f\u6837\u5f0f\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u66ff\u4ee3\u5de6\u4fa7\u5217\u5206\u9694\u7b26\u7684<code class=\"literal\">:</code>\u7b26\u53f7\u8868\u793a\u3002\u5f53\u6570\u636e\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u5219\u7528<code class=\"literal\">;</code>\u7b26\u53f7\u66ff\u4ee3\u5de6\u4fa7\u5217\u5206\u9694\u7b26\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">unicode</code>\u6837\u5f0f\u4f7f\u7528 Unicode \u6846\u7ebf\u7ed8\u5236\u5b57\u7b26\u3002\u6570\u636e\u4e2d\u7684\u6362\u884c\u7b26\u4ee5\u53f3\u8fb9\u7f18\u7684\u56de\u8f66\u7b26\u53f7\u8868\u793a\u3002\u5f53\u6570\u636e\u5728\u6ca1\u6709\u6362\u884c\u7b26\u7684\u4f4d\u7f6e\u6298\u5230\u4e0b\u4e00\u884c\u65f6\uff0c\u4f1a\u5728\u7b2c\u4e00\u884c\u7684\u53f3\u8fb9\u7f18\u663e\u793a\u7701\u7565\u53f7\u7b26\u53f7\uff0c\u5e76\u5728\u4e0b\u4e00\u884c\u7684\u5de6\u8fb9\u7f18\u518d\u6b21\u663e\u793a\u3002</p>\n<p lang=\"zh\">\u5f53<code class=\"literal\">border</code>\u8bbe\u7f6e\u5927\u4e8e\u96f6\u65f6\uff0c<code class=\"literal\">linestyle</code>\u9009\u9879\u8fd8\u51b3\u5b9a\u7528\u54ea\u4e9b\u5b57\u7b26\u7ed8\u5236\u8fb9\u6846\u7ebf\u3002\u666e\u901a\u7684<acronym class=\"acronym\">ASCII</acronym>\u5b57\u7b26\u5728\u4efb\u4f55\u73af\u5883\u4e2d\u90fd\u53ef\u7528\uff0c\u4f46\u5728\u652f\u6301 Unicode \u7684\u663e\u793a\u8bbe\u5907\u4e0a\uff0cUnicode \u5b57\u7b26\u66f4\u7f8e\u89c2\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-NULL\"><span class=\"term\"><code class=\"literal\">null</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u7528\u4e8e\u4ee3\u66ff\u7a7a\u503c\u6253\u5370\u7684\u5b57\u7b26\u4e32\u3002\u9ed8\u8ba4\u4e0d\u6253\u5370\u4efb\u4f55\u5185\u5bb9\uff0c\u8fd9\u5f88\u5bb9\u6613\u88ab\u8bef\u8ba4\u4e3a\u7a7a\u5b57\u7b26\u4e32\u3002\u4f8b\u5982\uff0c\u4f60\u53ef\u80fd\u66f4\u559c\u6b22\u4f7f\u7528<code class=\"literal\">\\pset null '(null)'</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-NUMERICLOCALE\"><span class=\"term\"><code class=\"literal\">numericlocale</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u4f7f\u7528\u533a\u57df\u8bbe\u7f6e\u7279\u5b9a\u7684\u5b57\u7b26\u6765\u5206\u9694\u5c0f\u6570\u70b9\u5de6\u4fa7\u7684\u6570\u5b57\u7ec4\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5e38\u89c4\u6570\u5b57\u8f93\u51fa\u548c\u533a\u57df\u8bbe\u7f6e\u7279\u5b9a\u7684\u6570\u5b57\u8f93\u51fa\u4e4b\u95f4\u5207\u6362\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-PAGER\"><span class=\"term\"><code class=\"literal\">pager</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u63a7\u5236\u67e5\u8be2\u7ed3\u679c\u4e0e psql \u5e2e\u52a9\u8f93\u51fa\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\u7684\u65b9\u5f0f\u3002\u5f53 pager \u4e3a off \u65f6\uff0c\u4e0d\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\uff1b\u4e3a on \u65f6\uff0c\u5728\u9002\u5f53\u60c5\u51b5\u4e0b\u4f7f\u7528\uff0c\u5373\u8f93\u51fa\u76ee\u6807\u662f\u7ec8\u7aef\u4e14\u5185\u5bb9\u65e0\u6cd5\u5728\u5c4f\u5e55\u5185\u663e\u793a\u5b8c\u3002\u8bbe\u4e3a always \u65f6\uff0c\u6240\u6709\u7ec8\u7aef\u8f93\u51fa\u5747\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\uff0c\u65e0\u8bba\u662f\u5426\u80fd\u5728\u5c4f\u5e55\u5185\u663e\u793a\u5b8c\u3002\u4e0d\u5e26\u503c\u7684 \\pset pager \u4f1a\u5207\u6362\u5206\u9875\u7684\u5f00\u5173\u72b6\u6001\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u8bbe\u7f6e\u4e86\u73af\u5883\u53d8\u91cf<code class=\"envar\">PSQL_PAGER</code>\u6216<code class=\"envar\">PAGER</code>\uff0c\u9700\u8981\u5206\u9875\u7684\u8f93\u51fa\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6307\u5b9a\u7a0b\u5e8f\u3002\u5426\u5219\uff0c\u4f7f\u7528\u4e0e\u5e73\u53f0\u6709\u5173\u7684\u9ed8\u8ba4\u7a0b\u5e8f\uff08\u5982<code class=\"filename\">more</code>\uff09\u3002</p>\n<p lang=\"zh\">\u5f53\u4f7f\u7528 <code class=\"literal\">\\watch</code> \u547d\u4ee4\u91cd\u590d\u6267\u884c\u67e5\u8be2\u65f6\uff0c\u5728 Unix \u7cfb\u7edf\u4e0a\u4f1a\u6539\u7528\u73af\u5883\u53d8\u91cf <code class=\"envar\">PSQL_WATCH_PAGER</code> \u6765\u67e5\u627e\u5206\u9875\u5668\u7a0b\u5e8f\u3002\u4e4b\u6240\u4ee5\u5355\u72ec\u914d\u7f6e\u5b83\uff0c\u662f\u56e0\u4e3a\u8fd9\u79cd\u7528\u6cd5\u53ef\u80fd\u4f1a\u8ba9\u4f20\u7edf\u5206\u9875\u5668\u65e0\u6cd5\u6b63\u5e38\u5de5\u4f5c\uff1b\u4f46\u5b83\u53ef\u7528\u4e8e\u628a\u8f93\u51fa\u53d1\u9001\u7ed9\u80fd\u591f\u7406\u89e3 <span class=\"application\">psql</span> \u8f93\u51fa\u683c\u5f0f\u7684\u5de5\u5177\uff08\u4f8b\u5982 <code class=\"filename\">pspg --stream</code>\uff09\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-PAGER-MIN-LINES\"><span class=\"term\"><code class=\"literal\">pager_min_lines</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u82e5 pager_min_lines \u5927\u4e8e\u5c4f\u5e55\u9875\u9ad8\uff0c\u53ea\u6709\u8f93\u51fa\u884c\u6570\u8fbe\u5230\u8be5\u503c\u65f6\u624d\u8c03\u7528\u5206\u9875\u7a0b\u5e8f\u3002\u9ed8\u8ba4\u503c\u4e3a 0\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-RECORDSEP\"><span class=\"term\"><code class=\"literal\">recordsep</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u8bb0\u5f55\uff08\u884c\uff09\u5206\u9694\u7b26\u3002\u9ed8\u8ba4\u4e3a\u6362\u884c\u7b26\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-RECORDSEP-ZERO\"><span class=\"term\"><code class=\"literal\">recordsep_zero</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06\u975e\u5bf9\u9f50\u8f93\u51fa\u683c\u5f0f\u4f7f\u7528\u7684\u8bb0\u5f55\u5206\u9694\u7b26\u8bbe\u7f6e\u4e3a\u96f6\u5b57\u8282\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-TABLEATTR\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">tableattr</code>\uff08\u6216<code class=\"literal\">T</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\u5728<acronym class=\"acronym\">HTML</acronym>\u683c\u5f0f\u4e2d\uff0c\u8fd9\u6307\u5b9a\u8981\u653e\u5728<code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u5c5e\u6027\uff0c\u4f8b\u5982<code class=\"literal\">cellpadding</code>\u6216<code class=\"literal\">bgcolor</code>\u3002\u8bf7\u6ce8\u610f\uff0c\u4f60\u53ef\u80fd\u4e0d\u9700\u8981\u5728\u8fd9\u91cc\u6307\u5b9a<code class=\"literal\">border</code>\uff0c\u56e0\u4e3a<code class=\"literal\">\\pset border</code>\u5df2\u7ecf\u8d1f\u8d23\u5904\u7406\u5b83\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u8868\u683c\u5c5e\u6027\u3002</p>\n<p lang=\"zh\">\u5728<code class=\"literal\">latex-longtable</code>\u683c\u5f0f\u4e2d\uff0c\u8fd9\u63a7\u5236\u6bcf\u4e2a\u5305\u542b\u5de6\u5bf9\u9f50\u6570\u636e\u7c7b\u578b\u7684\u5217\u7684\u5bbd\u5ea6\u6bd4\u4f8b\u3002\u5b83\u4ee5\u7a7a\u767d\u5206\u9694\u7684\u503c\u5217\u8868\u6307\u5b9a\uff0c\u4f8b\u5982<code class=\"literal\">'0.2 0.2 0.6'</code>\u3002\u672a\u6307\u5b9a\u7684\u8f93\u51fa\u5217\u4f7f\u7528\u6700\u540e\u6307\u5b9a\u7684\u503c\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-TITLE\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">title</code>\uff08\u6216<code class=\"literal\">C</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u968f\u540e\u6253\u5370\u7684\u6240\u6709\u8868\u683c\u7684\u6807\u9898\u3002\u8fd9\u53ef\u4ee5\u4e3a\u8f93\u51fa\u63d0\u4f9b\u63cf\u8ff0\u6027\u6807\u7b7e\u3002\u5982\u679c\u6ca1\u6709\u7ed9\u51fa<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u6807\u9898\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-TUPLES-ONLY\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">tuples_only</code>\uff08\u6216<code class=\"literal\">t</code>\uff09</span></dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6307\u5b9a\u4e86<em class=\"replaceable\"><code>value</code></em>\uff0c\u5b83\u5fc5\u987b\u662f<code class=\"literal\">on</code>\u6216<code class=\"literal\">off</code>\uff0c\u5206\u522b\u542f\u7528\u6216\u7981\u7528\u4ec5\u5143\u7ec4\u6a21\u5f0f\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>value</code></em>\uff0c\u8be5\u547d\u4ee4\u4f1a\u5728\u5e38\u89c4\u8f93\u51fa\u548c\u4ec5\u5143\u7ec4\u8f93\u51fa\u4e4b\u95f4\u5207\u6362\u3002\u5e38\u89c4\u8f93\u51fa\u5305\u542b\u5217\u6807\u9898\u3001\u8868\u683c\u6807\u9898\u548c\u5404\u79cd\u9875\u811a\u7b49\u9644\u52a0\u4fe1\u606f\u3002\u5728\u4ec5\u5143\u7ec4\u6a21\u5f0f\u4e0b\uff0c\u53ea\u663e\u793a\u5b9e\u9645\u7684\u8868\u683c\u6570\u636e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-UNICODE-BORDER-LINESTYLE\"><span class=\"term\"><code class=\"literal\">unicode_border_linestyle</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u8fb9\u6846\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-UNICODE-COLUMN-LINESTYLE\"><span class=\"term\"><code class=\"literal\">unicode_column_linestyle</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u5217\u5206\u9694\u7ebf\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-UNICODE-HEADER-LINESTYLE\"><span class=\"term\"><code class=\"literal\">unicode_header_linestyle</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5c06<code class=\"literal\">unicode</code>\u7ebf\u6761\u6837\u5f0f\u7684\u8868\u5934\u5206\u9694\u7ebf\u7ed8\u5236\u6837\u5f0f\u8bbe\u7f6e\u4e3a<code class=\"literal\">single</code>\u6216<code class=\"literal\">double</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PSET-XHEADER-WIDTH\"><span class=\"term\"><code class=\"literal\">xheader_width</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u6269\u5c55\u8f93\u51fa\u6807\u9898\u7684\u6700\u5927\u5bbd\u5ea6\u8bbe\u4e3a full\uff08\u9ed8\u8ba4\u503c\uff09\u3001column\u3001page \u6216\u4e00\u4e2a\u6574\u6570\u503c\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">full</code>\uff1a\u6269\u5c55\u8868\u5934\u4e0d\u622a\u65ad\uff0c\u5176\u5bbd\u5ea6\u4e0e\u6700\u5bbd\u7684\u8f93\u51fa\u884c\u76f8\u540c\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">column</code>\uff1a\u5c06\u8868\u5934\u884c\u622a\u65ad\u4e3a\u7b2c\u4e00\u5217\u7684\u5bbd\u5ea6\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">page</code>\uff1a\u5c06\u8868\u5934\u884c\u622a\u65ad\u4e3a\u7ec8\u7aef\u5bbd\u5ea6\u3002</p>\n<p lang=\"zh\">\u6574\u6570\u503c\uff1a\u7cbe\u786e\u6307\u5b9a\u6807\u9898\u884c\u7684\u6700\u5927\u5bbd\u5ea6\u3002</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8fd9\u4e9b\u4e0d\u540c\u683c\u5f0f\u7684\u5916\u89c2\u793a\u4f8b\u53ef\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-EXAMPLES\" title=\"\u793a\u4f8b\">\u793a\u4f8b</a>\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u6709\u5404\u79cd\u5feb\u6377\u547d\u4ee4\u7528\u4e8e<code class=\"command\">\\pset</code>\u3002\u8bf7\u53c2\u89c1<code class=\"command\">\\a</code>\u3001<code class=\"command\">\\C</code>\u3001<code class=\"command\">\\f</code>\u3001<code class=\"command\">\\H</code>\u3001<code class=\"command\">\\t</code>\u3001<code class=\"command\">\\T</code>\u548c<code class=\"command\">\\x</code>\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-QUIT\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\q</code>\u6216<code class=\"literal\">\\quit</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9000\u51fa<span class=\"application\">psql</span>\u7a0b\u5e8f\u3002\u5728\u811a\u672c\u6587\u4ef6\u4e2d\uff0c\u53ea\u4f1a\u7ec8\u6b62\u8be5\u811a\u672c\u7684\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-QECHO\"><span class=\"term\"><code class=\"literal\">\\qecho <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u547d\u4ee4\u4e0e<code class=\"command\">\\echo</code>\u76f8\u540c\uff0c\u53ea\u662f\u8f93\u51fa\u4f1a\u5199\u5165\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u7684\u67e5\u8be2\u8f93\u51fa\u901a\u9053\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-RESET\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\r</code>\u6216<code class=\"literal\">\\reset</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u91cd\u7f6e\uff08\u6e05\u7a7a\uff09\u67e5\u8be2\u7f13\u51b2\u533a\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-RESTRICT\"><span class=\"term\"><code class=\"literal\">\\restrict <em class=\"replaceable\"><code>restrict_key</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528\u7ed9\u5b9a\u7684\u5bc6\u94a5\u8fdb\u5165<span class=\"quote\">\u201c<span class=\"quote\">\u53d7\u9650</span>\u201d</span>\u6a21\u5f0f\u3002\u5728\u8be5\u6a21\u5f0f\u4e0b\uff0c\u552f\u4e00\u5141\u8bb8\u7684\u5143\u547d\u4ee4\u662f\u7528\u4e8e\u9000\u51fa\u53d7\u9650\u6a21\u5f0f\u7684<code class=\"command\">\\unrestrict</code>\u3002\u5bc6\u94a5\u53ea\u80fd\u5305\u542b\u5b57\u6bcd\u6570\u5b57\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4e3b\u8981\u7528\u4e8e pg_dump\u3001pg_dumpall \u548c pg_restore \u751f\u6210\u7684\u7eaf\u6587\u672c\u8f6c\u50a8\uff0c\u4e5f\u53ef\u80fd\u9002\u7528\u4e8e\u5176\u4ed6\u573a\u666f\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-S\"><span class=\"term\"><code class=\"literal\">\\s [ <em class=\"replaceable\"><code>filename</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6253\u5370<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u5386\u53f2\u8bb0\u5f55\u5230<em class=\"replaceable\"><code>filename</code></em>\u3002\u5982\u679c\u7701\u7565<em class=\"replaceable\"><code>filename</code></em>\uff0c\u5386\u53f2\u8bb0\u5f55\u5c06\u88ab\u5199\u5165\u6807\u51c6\u8f93\u51fa\uff08\u5982\u679c\u9002\u7528\uff0c\u5c06\u4f7f\u7528\u5206\u9875\u5668\uff09\u3002\u5982\u679c<span class=\"application\">psql</span>\u5728\u6784\u5efa\u65f6\u6ca1\u6709\u4f7f\u7528<span class=\"application\">Readline</span>\u652f\u6301\uff0c\u5219\u6b64\u547d\u4ee4\u4e0d\u53ef\u7528\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-SET\"><span class=\"term\"><code class=\"literal\">\\set [ <em class=\"replaceable\"><code>name</code></em> [ <em class=\"replaceable\"><code>value</code></em> [ ... ] ] ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e<span class=\"application\">psql</span>\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u4e3a<em class=\"replaceable\"><code>value</code></em>\uff0c\u5982\u679c\u7ed9\u51fa\u591a\u4e2a\u503c\uff0c\u5219\u8bbe\u7f6e\u4e3a\u6240\u6709\u503c\u7684\u8fde\u63a5\u3002\u5982\u679c\u53ea\u7ed9\u51fa\u4e00\u4e2a\u53c2\u6570\uff0c\u5219\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\u503c\u3002\u8981\u53d6\u6d88\u53d8\u91cf\u8bbe\u7f6e\uff0c\u8bf7\u4f7f\u7528<code class=\"command\">\\unset</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\"><code class=\"command\">\\set</code>\u6ca1\u6709\u4efb\u4f55\u53c2\u6570\u65f6\uff0c\u663e\u793a\u5f53\u524d\u8bbe\u7f6e\u7684\u6240\u6709<span class=\"application\">psql</span>\u53d8\u91cf\u7684\u540d\u79f0\u548c\u503c\u3002</p>\n<p lang=\"zh\">\u6709\u6548\u7684\u53d8\u91cf\u540d\u53ef\u4ee5\u5305\u542b\u5b57\u6bcd\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u3002\u6709\u5173\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002\u53d8\u91cf\u540d\u533a\u5206\u5927\u5c0f\u5199\u3002</p>\n<p lang=\"zh\">\u67d0\u4e9b\u53d8\u91cf\u662f\u7279\u6b8a\u7684\uff0c\u5b83\u4eec\u63a7\u5236<span class=\"application\">psql</span>\u7684\u884c\u4e3a\u6216\u8005\u81ea\u52a8\u8bbe\u7f6e\u4ee5\u53cd\u6620\u8fde\u63a5\u72b6\u6001\u3002\u8fd9\u4e9b\u53d8\u91cf\u5728\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u4e2d\u6709\u6587\u6863\u8bb0\u5f55\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u4e0e<acronym class=\"acronym\">SQL</acronym>\u547d\u4ee4<a class=\"link\" href=\"/docs/18/sql-set.html\" title=\"SET\"><code class=\"command\">SET</code></a>\u65e0\u5173\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-SETENV\"><span class=\"term\"><code class=\"literal\">\\setenv <em class=\"replaceable\"><code>name</code></em> [ <em class=\"replaceable\"><code>value</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u4e3a<em class=\"replaceable\"><code>value</code></em>\uff0c\u6216\u8005\u5982\u679c\u672a\u63d0\u4f9b<em class=\"replaceable\"><code>value</code></em>\uff0c\u5219\u53d6\u6d88\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3002\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\setenv PAGER less</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>\\setenv LESS -imx4F</code></strong>\n</pre>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-SF\"><span class=\"term\"><code class=\"literal\">\\sf[+] <em class=\"replaceable\"><code>function_description</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u5e76\u663e\u793a\u6307\u5b9a\u51fd\u6570\u6216\u8fc7\u7a0b\u7684\u5b9a\u4e49\uff0c\u4ee5<code class=\"command\">CREATE OR REPLACE FUNCTION</code>\u6216 <code class=\"command\">CREATE OR REPLACE PROCEDURE</code>\u547d\u4ee4\u7684\u5f62\u5f0f\u5448\u73b0\u3002\u5b9a\u4e49\u5c06\u6253\u5370\u5230\u5f53\u524d\u67e5\u8be2\u8f93\u51fa\u901a\u9053\uff0c\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u3002</p>\n<p lang=\"zh\">\u76ee\u6807\u51fd\u6570\u53ef\u4ec5\u7528\u540d\u79f0\u6307\u5b9a\uff0c\u4e5f\u53ef\u7528\u540d\u79f0\u548c\u53c2\u6570\u6307\u5b9a\uff0c\u4f8b\u5982 foo(integer, text)\u3002\u82e5\u6709\u591a\u4e2a\u540c\u540d\u51fd\u6570\uff0c\u5219\u5fc5\u987b\u63d0\u4f9b\u53c2\u6570\u7c7b\u578b\u3002</p>\n<p lang=\"zh\">\u5728\u547d\u4ee4\u540d\u540e\u6dfb\u52a0 +\uff0c\u4f1a\u4e3a\u8f93\u51fa\u884c\u7f16\u53f7\uff0c\u51fd\u6570\u4f53\u7b2c\u4e00\u884c\u4e3a\u7b2c 1 \u884c\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\sf</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-SV\"><span class=\"term\"><code class=\"literal\">\\sv[+] <em class=\"replaceable\"><code>view_name</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u4e2a\u547d\u4ee4\u83b7\u53d6\u6307\u5b9a\u89c6\u56fe\u7684\u5b9a\u4e49\uff0c\u5e76\u4ee5<code class=\"command\">CREATE OR REPLACE VIEW</code>\u547d\u4ee4\u7684\u5f62\u5f0f\u663e\u793a\u3002\u5b9a\u4e49\u4f1a\u6253\u5370\u5230\u7531<code class=\"command\">\\o</code>\u8bbe\u7f6e\u7684\u5f53\u524d\u67e5\u8be2\u8f93\u51fa\u901a\u9053\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u5728\u547d\u4ee4\u540d\u79f0\u540e\u6dfb\u52a0<code class=\"literal\">+</code>\uff0c\u90a3\u4e48\u8f93\u51fa\u884c\u5c06\u4ece1\u5f00\u59cb\u7f16\u53f7\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u884c\u7684\u5269\u4f59\u90e8\u5206\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\sv</code>\u7684\u53c2\u6570\uff0c\u53c2\u6570\u4e2d\u4e0d\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-PIPELINE\"><span class=\"term\"><code class=\"literal\">\\startpipeline</code><br/></span><span class=\"term\"><code class=\"literal\">\\sendpipeline</code><br/></span><span class=\"term\"><code class=\"literal\">\\syncpipeline</code><br/></span><span class=\"term\"><code class=\"literal\">\\endpipeline</code><br/></span><span class=\"term\"><code class=\"literal\">\\flushrequest</code><br/></span><span class=\"term\"><code class=\"literal\">\\flush</code><br/></span><span class=\"term\"><code class=\"literal\">\\getresults [ <em class=\"replaceable\"><code>number_results</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8fd9\u7ec4\u547d\u4ee4\u5b9e\u73b0 SQL \u8bed\u53e5\u7684\u7ba1\u9053\u5316\u3002\u4e00\u4e2a\u7ba1\u9053\u5fc5\u987b\u4ee5 <code class=\"command\">\\startpipeline</code> \u5f00\u59cb\uff0c\u5e76\u4ee5 <code class=\"command\">\\endpipeline</code> \u7ed3\u675f\u3002\u5176\u95f4\u53ef\u4ee5\u51fa\u73b0\u4efb\u610f\u6570\u91cf\u7684 <code class=\"command\">\\syncpipeline</code> \u547d\u4ee4\uff0c\u5b83\u4f1a\u53d1\u9001\u4e00\u6761<a class=\"link\" href=\"/docs/18/protocol-flow.html#PROTOCOL-FLOW-EXT-QUERY\" title=\"54.2.3.\u00a0\u6269\u5c55\u67e5\u8be2\">\u540c\u6b65\u6d88\u606f</a>\uff0c\u800c\u4e0d\u4f1a\u7ed3\u675f\u5f53\u524d\u7ba1\u9053\uff0c\u4e5f\u4e0d\u4f1a\u5237\u65b0\u53d1\u9001\u7f13\u51b2\u533a\u3002\u5728\u7ba1\u9053\u6a21\u5f0f\u4e0b\uff0c\u8bed\u53e5\u4f1a\u88ab\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u800c\u4e0d\u7b49\u5f85\u524d\u9762\u8bed\u53e5\u7684\u7ed3\u679c\u3002\u66f4\u591a\u7ec6\u8282\u89c1<a class=\"xref\" href=\"/docs/18/libpq-pipeline-mode.html\" title=\"32.5.\u00a0\u7ba1\u9053\u6a21\u5f0f\">\u7b2c\u00a032.5\u00a0\u8282</a>\u3002</p>\n<p lang=\"zh\">\u7ba1\u9053\u8fdb\u884c\u671f\u95f4\u6267\u884c\u7684\u6240\u6709\u67e5\u8be2\u90fd\u4f7f\u7528\u6269\u5c55\u67e5\u8be2\u534f\u8bae\u3002\u4ee5\u5206\u53f7\u7ed3\u675f\u7684\u67e5\u8be2\u4f1a\u88ab\u8ffd\u52a0\u5230\u7ba1\u9053\u4e2d\u3002\u5143\u547d\u4ee4 <code class=\"literal\">\\bind</code>\u3001<code class=\"literal\">\\bind_named</code>\u3001<code class=\"literal\">\\close_prepared</code> \u548c <code class=\"literal\">\\parse</code> \u53ef\u4ee5\u5728\u8fdb\u884c\u4e2d\u7684\u7ba1\u9053\u91cc\u4f7f\u7528\u3002\u7ba1\u9053\u8fdb\u884c\u671f\u95f4\uff0c<code class=\"literal\">\\sendpipeline</code> \u4f1a\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u8ffd\u52a0\u5230\u7ba1\u9053\u4e2d\u3002\u5176\u4ed6\u5143\u547d\u4ee4\uff0c\u5982 <code class=\"literal\">\\g</code>\u3001<code class=\"literal\">\\gx</code> \u6216 <code class=\"literal\">\\gdesc</code>\uff0c\u5219\u4e0d\u5141\u8bb8\u5728\u7ba1\u9053\u6a21\u5f0f\u4e2d\u4f7f\u7528\u3002</p>\n<p lang=\"zh\"><code class=\"command\">\\flushrequest</code> \u4f1a\u5411\u7ba1\u9053\u8ffd\u52a0\u4e00\u6761 flush \u547d\u4ee4\uff0c\u4f7f\u5f97\u53ef\u4ee5\u5728\u4e0d\u53d1\u9001 sync \u6216\u7ed3\u675f\u7ba1\u9053\u7684\u60c5\u51b5\u4e0b\u901a\u8fc7 <code class=\"command\">\\getresults</code> \u8bfb\u53d6\u7ed3\u679c\u3002<code class=\"command\">\\getresults</code> \u4f1a\u81ea\u52a8\u5c06\u5c1a\u672a\u53d1\u9001\u7684\u6570\u636e\u63a8\u9001\u5230\u670d\u52a1\u5668\u3002<code class=\"command\">\\flush</code> \u53ef\u7528\u4e8e\u624b\u52a8\u63a8\u9001\u672a\u53d1\u9001\u7684\u6570\u636e\u3002</p>\n<p lang=\"zh\"><code class=\"command\">\\getresults</code> \u63a5\u53d7\u4e00\u4e2a\u53ef\u9009\u7684 <em class=\"replaceable\"><code>number_results</code></em> \u53c2\u6570\u3002\u5982\u679c\u63d0\u4f9b\uff0c\u5219\u53ea\u8bfb\u53d6\u524d <em class=\"replaceable\"><code>number_results</code></em> \u4e2a\u5f85\u5904\u7406\u7ed3\u679c\u3002\u82e5\u7701\u7565\u8be5\u53c2\u6570\u6216\u5176\u503c\u4e3a <code class=\"literal\">0</code>\uff0c\u5219\u8bfb\u53d6\u6240\u6709\u5f85\u5904\u7406\u7ed3\u679c\u3002</p>\n<p lang=\"zh\">\u5f53\u7ba1\u9053\u6a21\u5f0f\u5904\u4e8e\u6d3b\u52a8\u72b6\u6001\u65f6\uff0c\u53ef\u4f7f\u7528\u4e00\u4e2a\u4e13\u7528\u7684\u63d0\u793a\u7b26\u53d8\u91cf\u6765\u62a5\u544a\u7ba1\u9053\u72b6\u6001\u3002\u8be6\u89c1<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PROMPTING-P-UC\"><code class=\"literal\">%P</code></a>\u3002</p>\n<p lang=\"zh\"><code class=\"command\">COPY</code> \u5728\u7ba1\u9053\u6a21\u5f0f\u4e2d\u4e0d\u652f\u6301\u3002</p>\n<p lang=\"zh\">\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">\\startpipeline\nSELECT * FROM pg_class;\nSELECT 1 \\bind \\sendpipeline\n\\flushrequest\n\\getresults\n\\endpipeline\n</pre>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-T-LC\"><span class=\"term\"><code class=\"literal\">\\t</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5207\u6362\u8f93\u51fa\u4e2d\u7684\u5217\u540d\u6807\u9898\u548c\u884c\u6570\u9875\u811a\u7684\u663e\u793a\u72b6\u6001\u3002\u8fd9\u4e2a\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset tuples_only</code>\uff0c\u63d0\u4f9b\u5b83\u662f\u4e3a\u4e86\u4f7f\u7528\u65b9\u4fbf\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-T-UC\"><span class=\"term\"><code class=\"literal\">\\T <em class=\"replaceable\"><code>table_options</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u5728<acronym class=\"acronym\">HTML</acronym>\u8f93\u51fa\u683c\u5f0f\u4e2d\u653e\u5728<code class=\"sgmltag-element\">table</code>\u6807\u7b7e\u5185\u7684\u5c5e\u6027\u3002\u8fd9\u4e2a\u547d\u4ee4\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset tableattr <em class=\"replaceable\"><code>table_options</code></em></code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-TIMING\"><span class=\"term\"><code class=\"literal\">\\timing [ <em class=\"replaceable\"><code>on</code></em> | <em class=\"replaceable\"><code>off</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5e26\u53c2\u6570\u65f6\uff0c\u5f00\u542f\u6216\u5173\u95ed\u6bcf\u6761 SQL \u8bed\u53e5\u6267\u884c\u8017\u65f6\u7684\u663e\u793a\u3002\u4e0d\u5e26\u53c2\u6570\u65f6\uff0c\u5207\u6362\u663e\u793a\u7684\u5f00\u5173\u72b6\u6001\u3002\u8017\u65f6\u4ee5\u6beb\u79d2\u663e\u793a\uff1b\u8d85\u8fc7 1 \u79d2\u7684\u65f6\u95f4\u95f4\u9694\u8fd8\u4f1a\u4ee5\u5206\u949f:\u79d2\u7684\u683c\u5f0f\u663e\u793a\uff0c\u5fc5\u8981\u65f6\u6dfb\u52a0\u5c0f\u65f6\u548c\u5929\u5b57\u6bb5\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-UNRESTRICT\"><span class=\"term\"><code class=\"literal\">\\unrestrict <em class=\"replaceable\"><code>restrict_key</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u9000\u51fa<span class=\"quote\">\u201c<span class=\"quote\">\u53d7\u9650</span>\u201d</span>\u6a21\u5f0f\uff08\u5373\u6240\u6709\u5176\u4ed6\u5143\u547d\u4ee4\u90fd\u88ab\u963b\u6b62\u7684\u6a21\u5f0f\uff09\uff0c\u524d\u63d0\u662f\u6307\u5b9a\u7684\u5bc6\u94a5\u4e0e\u8fdb\u5165\u53d7\u9650\u6a21\u5f0f\u65f6\u4f20\u7ed9<code class=\"command\">\\restrict</code>\u7684\u5bc6\u94a5\u5339\u914d\u3002</p>\n<p lang=\"zh\">\u6b64\u547d\u4ee4\u4e3b\u8981\u7528\u4e8e pg_dump\u3001pg_dumpall \u548c pg_restore \u751f\u6210\u7684\u7eaf\u6587\u672c\u8f6c\u50a8\uff0c\u4e5f\u53ef\u80fd\u9002\u7528\u4e8e\u5176\u4ed6\u573a\u666f\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u6574\u4e2a\u5269\u4f59\u884c\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\unrestrict</code>\u7684\u53c2\u6570\uff0c\u5e76\u4e14\u4e0d\u4f1a\u6267\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-UNSET\"><span class=\"term\"><code class=\"literal\">\\unset <em class=\"replaceable\"><code>name</code></em></code></span> </dt>\n<dd>\n<p lang=\"zh\">\u53d6\u6d88\u8bbe\u7f6e\uff08\u5220\u9664\uff09<span class=\"application\">psql</span>\u53d8\u91cf<em class=\"replaceable\"><code>name</code></em>\u3002</p>\n<p lang=\"zh\">\u5927\u591a\u6570\u63a7\u5236<span class=\"application\">psql</span>\u884c\u4e3a\u7684\u53d8\u91cf\u4e0d\u80fd\u53d6\u6d88\u8bbe\u7f6e\uff1b\u5bf9\u4e8e\u8fd9\u4e9b\u53d8\u91cf\uff0c<code class=\"literal\">\\unset</code>\u547d\u4ee4\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u5176\u8bbe\u7f6e\u4e3a\u9ed8\u8ba4\u503c\u3002\u53c2\u89c1\u4e0b\u9762\u7684<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-WRITE\" lang=\"zh\"><span class=\"term\"><code class=\"literal\">\\w</code> \u6216 <code class=\"literal\">\\write</code> <em class=\"replaceable\"><code>filename</code></em><br/></span><span class=\"term\"><code class=\"literal\">\\w</code> \u6216 <code class=\"literal\">\\write</code> <code class=\"literal\">|</code><em class=\"replaceable\"><code>command</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\u5c06\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u5199\u5165\u6587\u4ef6<em class=\"replaceable\"><code>filename</code></em>\uff0c\u6216\u901a\u8fc7\u7ba1\u9053\u4f20\u9012\u7ed9 shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002\u5982\u679c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u6539\u4e3a\u5199\u5165\u6700\u8fd1\u6267\u884c\u7684\u67e5\u8be2\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u53c2\u6570\u4ee5<code class=\"literal\">|</code>\u5f00\u5934\uff0c\u5219\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u4f1a\u88ab\u89c6\u4e3a\u8981\u6267\u884c\u7684<em class=\"replaceable\"><code>command</code></em>\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u7684\u5185\u5bb9\u53ea\u4f1a\u539f\u6837\u4f20\u9012\u7ed9 shell\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-WARN\"><span class=\"term\"><code class=\"literal\">\\warn <em class=\"replaceable\"><code>text</code></em> [ ... ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u547d\u4ee4\u4e0e<code class=\"command\">\\echo</code>\u547d\u4ee4\u76f8\u540c\uff0c\u53ea\u662f\u8f93\u51fa\u5c06\u88ab\u5199\u5165<span class=\"application\">psql</span>\u7684\u6807\u51c6\u9519\u8bef\u901a\u9053\uff0c\u800c\u4e0d\u662f\u6807\u51c6\u8f93\u51fa\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-WATCH\"><span class=\"term\"><code class=\"literal\">\\watch [ i[nterval]=<em class=\"replaceable\"><code>seconds</code></em> ] [ c[ount]=<em class=\"replaceable\"><code>times</code></em> ] [ m[in_rows]=<em class=\"replaceable\"><code>rows</code></em> ] [ <em class=\"replaceable\"><code>seconds</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u91cd\u590d\u6267\u884c\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\uff08\u5982\u540c <code class=\"literal\">\\g</code> \u4e00\u6837\uff09\uff0c\u76f4\u5230\u88ab\u4e2d\u65ad\u3001\u67e5\u8be2\u5931\u8d25\u3001\u8fbe\u5230\u6267\u884c\u6b21\u6570\u4e0a\u9650\uff08\u5982\u679c\u7ed9\u5b9a\uff09\u6216\u67e5\u8be2\u8fd4\u56de\u7684\u884c\u6570\u4f4e\u4e8e\u6700\u5c0f\u8981\u6c42\u3002\u4e24\u6b21\u6267\u884c\u4e4b\u95f4\u7b49\u5f85\u6307\u5b9a\u7684\u79d2\u6570\uff08\u9ed8\u8ba4 2 \u79d2\uff09\u3002\u9ed8\u8ba4\u7b49\u5f85\u65f6\u95f4\u53ef\u901a\u8fc7\u53d8\u91cf<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-VARIABLES-WATCH-INTERVAL\"><code class=\"varname\">WATCH_INTERVAL</code></a>\u4fee\u6539\u3002\u4e3a\u4fdd\u6301\u5411\u540e\u517c\u5bb9\uff0c<em class=\"replaceable\"><code>seconds</code></em> \u53ef\u4ee5\u5e26\u6216\u4e0d\u5e26 <code class=\"literal\">interval=</code> \u524d\u7f00\u3002\u6bcf\u6b21\u67e5\u8be2\u7ed3\u679c\u90fd\u4f1a\u5e26\u6709\u4e00\u4e2a\u5934\u90e8\uff0c\u5176\u4e2d\u5305\u542b <code class=\"literal\">\\pset title</code> \u5b57\u7b26\u4e32\uff08\u5982\u679c\u6709\uff09\u3001\u67e5\u8be2\u5f00\u59cb\u65f6\u7684\u65f6\u95f4\u4ee5\u53ca\u5ef6\u8fdf\u95f4\u9694\u3002</p>\n<p lang=\"zh\">\u82e5\u5f53\u524d\u67e5\u8be2\u7f13\u51b2\u533a\u4e3a\u7a7a\uff0c\u5219\u91cd\u65b0\u6267\u884c\u6700\u8fd1\u53d1\u9001\u7684\u67e5\u8be2\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-X\"><span class=\"term\"><code class=\"literal\">\\x [ <em class=\"replaceable\"><code>on</code></em> | <em class=\"replaceable\"><code>off</code></em> | <em class=\"replaceable\"><code>auto</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u6216\u5207\u6362\u6269\u5c55\u8868\u683c\u683c\u5f0f\u6a21\u5f0f\u3002\u5b83\u7b49\u4ef7\u4e8e<code class=\"literal\">\\pset expanded</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-Z\"><span class=\"term\"><code class=\"literal\">\\z[Sx] [ <a class=\"link\" href=\"https://pg.center/docs/18/app-psql.html#APP-PSQL-PATTERNS\" title=\"Patterns\"><em class=\"replaceable\"><code>pattern</code></em></a> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5217\u51fa\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u53ca\u5176\u76f8\u5173\u8bbf\u95ee\u6743\u9650\u3002\u5982\u679c\u6307\u5b9a\u4e86 <em class=\"replaceable\"><code>pattern</code></em>\uff0c\u5219\u53ea\u5217\u51fa\u540d\u79f0\u4e0e\u6a21\u5f0f\u5339\u914d\u7684\u8868\u3001\u89c6\u56fe\u548c\u5e8f\u5217\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u53ea\u663e\u793a\u7528\u6237\u521b\u5efa\u7684\u5bf9\u8c61\uff1b\u63d0\u4f9b\u6a21\u5f0f\u6216 <code class=\"literal\">S</code> \u4fee\u9970\u7b26\u53ef\u5305\u62ec\u7cfb\u7edf\u5bf9\u8c61\u3002\u5982\u679c\u5728\u547d\u4ee4\u540d\u540e\u8ffd\u52a0 <code class=\"literal\">x</code>\uff0c\u7ed3\u679c\u4f1a\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u3002</p>\n<p lang=\"zh\">\u8fd9\u662f<code class=\"command\">\\dp</code>\u7684\u522b\u540d\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u663e\u793a\u6743\u9650</span>\u201d</span>\uff09\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-EXCLAMATION-MARK\"><span class=\"term\"><code class=\"literal\">\\! [ <em class=\"replaceable\"><code>command</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4e0d\u5e26\u53c2\u6570\u65f6\uff0c\u8fdb\u5165\u4e00\u4e2a\u5b50 shell\uff1b\u5b50 shell \u9000\u51fa\u540e\uff0c<span class=\"application\">psql</span>\u6062\u590d\u8fd0\u884c\u3002\u5e26\u53c2\u6570\u65f6\uff0c\u6267\u884c shell \u547d\u4ee4<em class=\"replaceable\"><code>command</code></em>\u3002</p>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6\u5143\u547d\u4ee4\u4e0d\u540c\uff0c\u8be5\u884c\u5269\u4f59\u7684\u5168\u90e8\u5185\u5bb9\u59cb\u7ec8\u88ab\u89c6\u4e3a<code class=\"command\">\\!</code>\u7684\u53c2\u6570\uff0c\u5176\u4e2d\u4e0d\u4f1a\u8fdb\u884c\u53d8\u91cf\u63d2\u503c\u6216\u53cd\u5f15\u53f7\u6269\u5c55\u3002\u8be5\u884c\u5269\u4f59\u5185\u5bb9\u4f1a\u539f\u6837\u4f20\u7ed9 shell\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-QUESTION-MARK\"><span class=\"term\"><code class=\"literal\">\\? [ <em class=\"replaceable\"><code>topic</code></em> ]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u663e\u793a\u5e2e\u52a9\u4fe1\u606f\u3002\u53ef\u9009\u7684<em class=\"replaceable\"><code>topic</code></em>\u53c2\u6570\uff08\u9ed8\u8ba4\u4e3a<code class=\"literal\">commands</code>\uff09\u9009\u62e9\u8981\u89e3\u91ca\u7684<span class=\"application\">psql</span>\u7684\u54ea\u4e2a\u90e8\u5206\uff1a<code class=\"literal\">commands</code>\u63cf\u8ff0<span class=\"application\">psql</span>\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\uff1b<code class=\"literal\">options</code>\u63cf\u8ff0\u53ef\u4ee5\u4f20\u9012\u7ed9<span class=\"application\">psql</span>\u7684\u547d\u4ee4\u884c\u9009\u9879\uff1b\u800c<code class=\"literal\">variables</code>\u663e\u793a\u5173\u4e8e<span class=\"application\">psql</span>\u914d\u7f6e\u53d8\u91cf\u7684\u5e2e\u52a9\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-META-COMMAND-SEMICOLON\"><span class=\"term\"><code class=\"literal\">\\;</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u53cd\u659c\u7ebf\u5206\u53f7\u4e0d\u50cf\u524d\u9762\u7684\u547d\u4ee4\u90a3\u6837\u662f\u4e00\u4e2a\u5143\u547d\u4ee4\uff1b\u76f8\u53cd\uff0c\u5b83\u53ea\u662f\u5728\u4e0d\u8fdb\u884c\u8fdb\u4e00\u6b65\u5904\u7406\u7684\u60c5\u51b5\u4e0b\u5c06\u4e00\u4e2a\u5206\u53f7\u6dfb\u52a0\u5230\u67e5\u8be2\u7f13\u51b2\u533a\u4e2d\u3002</p>\n<p lang=\"zh\">\u901a\u5e38\uff0c<span class=\"application\">psql</span>\u4f1a\u5728\u5230\u8fbe\u547d\u4ee4\u7ed3\u675f\u7684\u5206\u53f7\u65f6\u7acb\u5373\u5c06SQL\u547d\u4ee4\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u5373\u4f7f\u5f53\u524d\u884c\u8fd8\u6709\u66f4\u591a\u8f93\u5165\u3002\u56e0\u6b64\uff0c\u4f8b\u5982\u8f93\u5165</p>\n<pre class=\"programlisting\">select 1; select 2; select 3;\n</pre>\n<p lang=\"zh\">\u5c06\u5bfc\u81f4\u4e09\u4e2aSQL\u547d\u4ee4\u5206\u522b\u53d1\u9001\u5230\u670d\u52a1\u5668\uff0c\u6bcf\u4e2a\u547d\u4ee4\u7684\u7ed3\u679c\u5728\u7ee7\u7eed\u4e0b\u4e00\u4e2a\u547d\u4ee4\u4e4b\u524d\u663e\u793a\u3002\u7136\u800c\uff0c\u8f93\u5165\u4e3a<code class=\"literal\">\\;</code>\u7684\u5206\u53f7\u4e0d\u4f1a\u89e6\u53d1\u547d\u4ee4\u5904\u7406\uff0c\u56e0\u6b64\u5b83\u4e4b\u524d\u548c\u4e4b\u540e\u7684\u547d\u4ee4\u5b9e\u9645\u4e0a\u88ab\u5408\u5e76\u5e76\u4f5c\u4e3a\u4e00\u4e2a\u8bf7\u6c42\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u56e0\u6b64\uff0c\u4f8b\u5982</p>\n<pre class=\"programlisting\">select 1\\; select 2\\; select 3;\n</pre>\n<p lang=\"zh\">\u4f1a\u5728\u9047\u5230\u524d\u9762\u6ca1\u6709\u53cd\u659c\u7ebf\u7684\u5206\u53f7\u65f6\uff0c\u5c06\u8fd9\u4e09\u4e2a SQL \u547d\u4ee4\u4f5c\u4e3a\u5355\u4e2a\u8bf7\u6c42\u53d1\u9001\u5230\u670d\u52a1\u5668\u3002\u670d\u52a1\u5668\u4f1a\u5c06\u6b64\u7c7b\u8bf7\u6c42\u4f5c\u4e3a\u5355\u4e2a\u4e8b\u52a1\u6267\u884c\uff0c\u9664\u975e\u5b57\u7b26\u4e32\u4e2d\u5305\u542b\u663e\u5f0f\u7684<code class=\"command\">BEGIN</code>/<code class=\"command\">COMMIT</code>\u547d\u4ee4\u5c06\u5176\u5206\u6210\u591a\u4e2a\u4e8b\u52a1\u3002\uff08\u6709\u5173\u670d\u52a1\u5668\u5982\u4f55\u5904\u7406\u591a\u67e5\u8be2\u5b57\u7b26\u4e32\u7684\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u89c1<a class=\"xref\" href=\"/docs/18/protocol-flow.html#PROTOCOL-FLOW-MULTI-STATEMENT\" title=\"54.2.2.1.\u00a0\u4e00\u4e2a\u7b80\u5355\u67e5\u8be2\u4e2d\u7684\u591a\u6761\u8bed\u53e5\">\u7b2c\u00a054.2.2.1\u00a0\u8282</a>\u3002\uff09</p>\n</dd>\n</dl>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-PATTERNS\">\n<h4 lang=\"zh\">\u6a21\u5f0f</h4>\n<p lang=\"zh\">\u5f88\u591a<code class=\"literal\">\\d</code>\u547d\u4ee4\u90fd\u53ef\u4ee5\u7528\u4e00\u4e2a<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\u6765\u6307\u5b9a\u8981\u88ab\u663e\u793a\u7684\u5bf9\u8c61\u540d\u79f0\u3002\u5728\u6700\u7b80\u5355\u7684\u60c5\u51b5\u4e0b\uff0c\u6a21\u5f0f\u6b63\u597d\u5c31\u662f\u8be5\u5bf9\u8c61\u7684\u51c6\u786e\u540d\u79f0\u3002\u5728\u6a21\u5f0f\u4e2d\u7684\u5b57\u7b26\u901a\u5e38\u4f1a\u88ab\u53d8\u6210\u5c0f\u5199\u5f62\u5f0f\uff08\u5c31\u50cf\u5728 SQL \u540d\u79f0\u4e2d\u90a3\u6837\uff09\uff0c\u4f8b\u5982<code class=\"literal\">\\dt FOO</code>\u5c06\u4f1a\u663e\u793a\u540d\u4e3a<code class=\"literal\">foo</code>\u7684\u8868\u3002\u5c31\u50cf\u5728 SQL \u540d\u79f0\u4e2d\u90a3\u6837\uff0c\u628a\u6a21\u5f0f\u653e\u5728\u53cc\u5f15\u53f7\u4e2d\u53ef\u4ee5\u963b\u6b62\u5b83\u88ab\u8f6c\u6362\u6210\u5c0f\u5199\u5f62\u5f0f\u3002\u5982\u679c\u9700\u8981\u5728\u4e00\u4e2a\u6a21\u5f0f\u4e2d\u5305\u62ec\u4e00\u4e2a\u771f\u6b63\u7684\u53cc\u5f15\u53f7\u5b57\u7b26\uff0c\u5219\u9700\u8981\u5728\u53cc\u5f15\u53f7\u5305\u56f4\u7684\u6587\u672c\u5185\u628a\u5b83\u5199\u6210\u4e24\u4e2a\u76f8\u90bb\u7684\u53cc\u5f15\u53f7\uff0c\u8fd9\u540c\u6837\u662f\u7b26\u5408 SQL \u52a0\u5f15\u53f7\u6807\u8bc6\u7b26\u7684\u89c4\u5219\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dt \"FOO\"\"BAR\"</code>\u5c06\u663e\u793a\u540d\u4e3a<code class=\"literal\">FOO\"BAR</code>\uff08\u4e0d\u662f<code class=\"literal\">foo\"bar</code>\uff09\u7684\u8868\u3002\u548c\u666e\u901a\u7684 SQL \u540d\u79f0\u89c4\u5219\u4e0d\u540c\uff0c\u4f60\u53ef\u4ee5\u53ea\u5728\u6a21\u5f0f\u7684\u4e00\u90e8\u5206\u5468\u56f4\u653e\u4e0a\u53cc\u5f15\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">\\dt FOO\"FOO\"BAR</code>\u5c06\u4f1a\u663e\u793a\u540d\u4e3a<code class=\"literal\">fooFOObar</code>\u7684\u8868\u3002</p>\n<p lang=\"zh\">\u53ea\u8981\u5b8c\u5168\u7701\u7565<em class=\"replaceable\"><code>pattern</code></em>\u53c2\u6570\uff0c<code class=\"literal\">\\d</code>\u547d\u4ee4\u5c31\u4f1a\u663e\u793a\u5f53\u524d\u6a21\u5f0f\u641c\u7d22\u8def\u5f84\u4e2d\u53ef\u89c1\u7684\u5168\u90e8\u5bf9\u8c61 \u2014 \u8fd9\u7b49\u4ef7\u4e8e\u7528<code class=\"literal\">*</code>\u4f5c\u4e3a\u6a21\u5f0f\uff08\u5982\u679c\u4e00\u4e2a\u5bf9\u8c61\u6240\u5728\u7684\u6a21\u5f0f\u4f4d\u4e8e\u641c\u7d22\u8def\u5f84\u4e2d\uff0c\u5e76\u4e14\u5728\u641c\u7d22\u8def\u5f84\u4e2d\u8be5\u6a21\u5f0f\u4e4b\u524d\u6ca1\u6709\u540c\u7c7b\u4e14\u540c\u540d\u7684\u5bf9\u8c61\uff0c\u5219\u8be5\u5bf9\u8c61\u5c31\u662f<em class=\"firstterm\">\u53ef\u89c1</em>\u7684\u3002\u8fd9\u8868\u793a\u53ef\u4ee5\u76f4\u63a5\u7528\u540d\u79f0\u5f15\u7528\u8be5\u5bf9\u8c61\uff0c\u800c\u4e0d\u9700\u8981\u7528\u6a21\u5f0f\u6765\u9650\u5b9a\uff09\u3002\u8981\u67e5\u770b\u6570\u636e\u5e93\u4e2d\u6240\u6709\u5bf9\u8c61\u800c\u4e0d\u8003\u8651\u5176\u53ef\u89c1\u6027\uff0c\u53ef\u4ee5\u628a<code class=\"literal\">*.*</code>\u7528\u4f5c\u6a21\u5f0f\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u653e\u5728\u4e00\u4e2a\u6a21\u5f0f\u4e2d\uff0c<code class=\"literal\">*</code>\u5c06\u5339\u914d\u4efb\u610f\u5b57\u7b26\u5e8f\u5217\uff08\u5305\u62ec\u7a7a\u5e8f\u5217\uff09\uff0c\u800c<code class=\"literal\">?</code>\u4f1a\u5339\u914d\u4efb\u610f\u7684\u5355\u4e2a\u5b57\u7b26\uff08\u8fd9\u79cd\u8bb0\u53f7\u65b9\u6cd5\u5c31\u50cf Unix shell \u7684\u6587\u4ef6\u540d\u6a21\u5f0f\u4e00\u6837\uff09\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dt int*</code>\u4f1a\u663e\u793a\u540d\u79f0\u4ee5<code class=\"literal\">int</code>\u5f00\u59cb\u7684\u8868\u3002\u4f46\u662f\u5982\u679c\u88ab\u653e\u5728\u53cc\u5f15\u53f7\u5185\uff0c<code class=\"literal\">*</code>\u548c<code class=\"literal\">?</code>\u5c31\u4f1a\u5931\u53bb\u8fd9\u4e9b\u7279\u6b8a\u542b\u4e49\u800c\u53d8\u6210\u666e\u901a\u7684\u5b57\u7b26\u3002</p>\n<p lang=\"zh\">\u5305\u542b\u70b9\u53f7\uff08.\uff09\u7684\u5173\u7cfb\u540d\u6a21\u5f0f\u4f1a\u88ab\u89e3\u91ca\u4e3a\u6a21\u5f0f\u540d\u5339\u914d\u6a21\u5f0f\uff0c\u540e\u63a5\u5bf9\u8c61\u540d\u5339\u914d\u6a21\u5f0f\u3002\u4f8b\u5982\uff0c\\dt foo*.*bar* \u4f1a\u663e\u793a\u6240\u6709\u6a21\u5f0f\u540d\u4ee5 foo \u5f00\u5934\u3001\u8868\u540d\u5305\u542b bar \u7684\u8868\u3002\u6ca1\u6709\u70b9\u53f7\u65f6\uff0c\u53ea\u5339\u914d\u5f53\u524d\u6a21\u5f0f\u641c\u7d22\u8def\u5f84\u4e2d\u53ef\u89c1\u7684\u5bf9\u8c61\u3002\u540c\u6837\uff0c\u53cc\u5f15\u53f7\u5185\u7684\u70b9\u53f7\u4e0d\u5177\u6709\u7279\u6b8a\u542b\u4e49\uff0c\u6309\u5b57\u9762\u5339\u914d\u3002\u5305\u542b\u4e24\u4e2a\u70b9\u53f7\uff08.\uff09\u7684\u5173\u7cfb\u540d\u6a21\u5f0f\u4f1a\u88ab\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u540d\uff0c\u540e\u63a5\u6a21\u5f0f\u540d\u5339\u914d\u6a21\u5f0f\uff0c\u518d\u63a5\u5bf9\u8c61\u540d\u5339\u914d\u6a21\u5f0f\u3002\u6570\u636e\u5e93\u540d\u90e8\u5206\u4e0d\u4f5c\u4e3a\u5339\u914d\u6a21\u5f0f\uff0c\u5fc5\u987b\u4e0e\u5f53\u524d\u8fde\u63a5\u7684\u6570\u636e\u5e93\u540d\u79f0\u76f8\u540c\uff0c\u5426\u5219\u4f1a\u62a5\u9519\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u7528\u4e8e\u5339\u914d\u6a21\u5f0f\u540d\u7684\u6a21\u5f0f\u5305\u542b\u4e00\u4e2a\u70b9\uff08<code class=\"literal\">.</code>\uff09\uff0c\u5219\u4f1a\u88ab\u89e3\u91ca\u4e3a\u6570\u636e\u5e93\u540d\uff0c\u540e\u63a5\u6a21\u5f0f\u540d\u7684\u5339\u914d\u6a21\u5f0f\u3002\u4f8b\u5982\uff0c<code class=\"literal\">\\dn mydb.*foo*</code>\u4f1a\u663e\u793a\u540d\u79f0\u4e2d\u5305\u542b<code class=\"literal\">foo</code>\u7684\u6240\u6709\u6a21\u5f0f\u3002\u6570\u636e\u5e93\u540d\u90e8\u5206\u4e0d\u4f1a\u88ab\u5f53\u4f5c\u5339\u914d\u6a21\u5f0f\uff0c\u5fc5\u987b\u4e0e\u5f53\u524d\u8fde\u63a5\u7684\u6570\u636e\u5e93\u540d\u76f8\u540c\uff0c\u5426\u5219\u4f1a\u62a5\u9519\u3002</p>\n<p lang=\"zh\">\u9ad8\u7ea7\u7528\u6237\u53ef\u4ee5\u4f7f\u7528\u5b57\u7b26\u7c7b\u7b49\u6b63\u5219\u8868\u8fbe\u5f0f\u8bb0\u6cd5\uff0c\u5982<code class=\"literal\">[0-9]</code>\u53ef\u4ee5\u5339\u914d\u4efb\u610f\u6570\u5b57\u3002\u6240\u6709\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u90fd\u6309\u7167<a class=\"xref\" href=\"/docs/18/functions-matching.html#FUNCTIONS-POSIX-REGEXP\" title=\"9.7.3.\u00a0POSIX\u6b63\u5219\u8868\u8fbe\u5f0f\">\u7b2c\u00a09.7.3\u00a0\u8282</a>\u6240\u8bf4\u7684\u5de5\u4f5c\uff0c\u4ee5\u4e0b\u5b57\u7b26\u9664\u5916\uff1a<code class=\"literal\">.</code>\u4f1a\u6309\u7167\u4e0a\u9762\u6240\u8bf4\u7684\u4f5c\u4e3a\u4e00\u79cd\u5206\u9694\u7b26\uff0c<code class=\"literal\">*</code>\u4f1a\u88ab\u7ffb\u8bd1\u6210\u6b63\u5219\u8868\u8fbe\u5f0f\u8bb0\u53f7<code class=\"literal\">.*</code>\uff0c<code class=\"literal\">?</code>\u4f1a\u88ab\u7ffb\u8bd1\u6210<code class=\"literal\">.</code>\uff0c\u800c<code class=\"literal\">$</code>\u5219\u6309\u5b57\u9762\u610f\u601d\u5339\u914d\u3002\u6839\u636e\u9700\u8981\uff0c\u53ef\u4ee5\u7528<code class=\"literal\">?</code>\u6a21\u62df<code class=\"literal\">.</code>\uff0c\u7528<code class=\"literal\">(<em class=\"replaceable\"><code>R</code></em>+|)</code>\u6a21\u62df<code class=\"literal\"><em class=\"replaceable\"><code>R</code></em>*</code>\uff0c\u6216\u7528<code class=\"literal\">(<em class=\"replaceable\"><code>R</code></em>|)</code>\u6a21\u62df<code class=\"literal\"><em class=\"replaceable\"><code>R</code></em>?</code>\u3002<code class=\"literal\">$</code>\u4e0d\u9700\u8981\u4f5c\u4e3a\u4e00\u4e2a\u6b63\u5219\u8868\u8fbe\u5f0f\u5b57\u7b26\uff0c\u56e0\u4e3a\u6a21\u5f0f\u5fc5\u987b\u5339\u914d\u6574\u4e2a\u540d\u79f0\uff0c\u800c\u4e0d\u662f\u50cf\u6b63\u5219\u8868\u8fbe\u5f0f\u7684\u5e38\u89c4\u7528\u6cd5\u90a3\u6837\u89e3\u91ca\uff08\u6362\u53e5\u8bdd\u8bf4\uff0c<code class=\"literal\">$</code>\u4f1a\u88ab\u81ea\u52a8\u5730\u8ffd\u52a0\u5230\u6a21\u5f0f\u4e0a\uff09\u3002\u5982\u679c\u4e0d\u5e0c\u671b\u8be5\u6a21\u5f0f\u7684\u5339\u914d\u4f4d\u7f6e\u88ab\u56fa\u5b9a\uff0c\u53ef\u4ee5\u5728\u5f00\u5934\u6216\u8005\u7ed3\u5c3e\u5199\u4e0a<code class=\"literal\">*</code>\u3002\u6ce8\u610f\u5728\u53cc\u5f15\u53f7\u5185\uff0c\u6240\u6709\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u4f1a\u5931\u53bb\u5176\u7279\u6b8a\u542b\u4e49\u5e76\u4e14\u6309\u7167\u5176\u5b57\u9762\u610f\u601d\u8fdb\u884c\u5339\u914d\u3002\u8fd8\u6709\uff0c\u5728\u64cd\u4f5c\u7b26\u540d\u79f0\u6a21\u5f0f\u4e2d\uff08\u5373\u4f5c\u4e3a<code class=\"literal\">\\do</code>\u7684\u53c2\u6570\uff09\uff0c\u6b63\u5219\u8868\u8fbe\u5f0f\u7279\u6b8a\u5b57\u7b26\u4e5f\u6309\u7167\u5b57\u9762\u610f\u601d\u8fdb\u884c\u5339\u914d\u3002</p>\n</div>\n</div>\n<div class=\"refsect2\" id=\"id-1.9.4.21.8.5\">\n<h3 lang=\"zh\">\u9ad8\u7ea7\u7279\u6027</h3>\n<div class=\"refsect3\" id=\"APP-PSQL-VARIABLES\">\n<h4 lang=\"zh\">\u53d8\u91cf</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u63d0\u4f9b\u4e86\u548c\u666e\u901a Unix \u547d\u4ee4 shell \u76f8\u4f3c\u7684\u53d8\u91cf\u66ff\u6362\u7279\u6027\u3002\u53d8\u91cf\u7b80\u5355\u6765\u8bf4\u5c31\u662f\u4e00\u5bf9\u540d\u79f0/\u503c\uff0c\u5176\u4e2d\u503c\u53ef\u4ee5\u662f\u4efb\u610f\u957f\u5ea6\u7684\u4efb\u610f\u5b57\u7b26\u4e32\u3002\u540d\u79f0\u5fc5\u987b\u7531\u5b57\u6bcd\uff08\u5305\u62ec\u975e\u62c9\u4e01\u5b57\u6bcd\uff09\u3001\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\u6784\u6210\u3002</p>\n<p lang=\"zh\">\u8981\u8bbe\u7f6e\u4e00\u4e2a\u53d8\u91cf\uff0c\u53ef\u4ee5\u4f7f\u7528<span class=\"application\">psql</span>\u7684\u5143\u547d\u4ee4<code class=\"command\">\\set</code>\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo bar</code></strong>\n</pre>\n<p lang=\"zh\">\u4f1a\u5c06<code class=\"literal\">foo</code>\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">bar</code>\u3002\u8981\u68c0\u7d22\u8be5\u53d8\u91cf\u7684\u5185\u5bb9\uff0c\u53ef\u4ee5\u5728\u540d\u79f0\u524d\u653e\u4e00\u4e2a\u5192\u53f7\uff0c\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\echo :foo</code></strong>\nbar\n</pre>\n<p lang=\"zh\">\u8fd9\u5728\u5e38\u89c4 SQL \u547d\u4ee4\u548c\u5143\u547d\u4ee4\u4e2d\u5747\u6709\u6548\uff0c\u4e0b\u6587\u7684<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-INTERPOLATION\" title=\"SQL \u63d2\u503c\">SQL \u63d2\u503c</a>\u4e2d\u6709\u66f4\u591a\u7ec6\u8282\u3002</p>\n<p lang=\"zh\">\u5982\u679c\u8c03\u7528<code class=\"command\">\\set</code>\u65f6\u6ca1\u6709\u7b2c\u4e8c\u4e2a\u53c2\u6570\uff0c\u8be5\u53d8\u91cf\u4f1a\u88ab\u8bbe\u7f6e\u4e3a\u4e00\u4e2a\u7a7a\u5b57\u7b26\u4e32\u503c\u3002\u8981\u53d6\u6d88\u8bbe\u7f6e\uff08\u5373\u5220\u9664\uff09\u4e00\u4e2a\u53d8\u91cf\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4<code class=\"command\">\\unset</code>\u3002\u8981\u663e\u793a\u6240\u6709\u53d8\u91cf\u7684\u503c\uff0c\u5728\u8c03\u7528<code class=\"command\">\\set</code>\u65f6\u4e0d\u5e26\u4efb\u4f55\u53c2\u6570\u5373\u53ef\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\"><code class=\"command\">\\set</code>\u7684\u53c2\u6570\u670d\u4ece\u4e0e\u5176\u4ed6\u547d\u4ee4\u76f8\u540c\u7684\u66ff\u6362\u89c4\u5219\u3002\u56e0\u6b64\u53ef\u4ee5\u6784\u9020\u6709\u8da3\u7684\u5f15\u7528\uff0c\u4f8b\u5982<code class=\"literal\">\\set :foo 'something'</code>\u4ee5\u53ca\u5206\u522b\u5f97\u5230<span class=\"productname\">Perl</span>\u6216\u8005<span class=\"productname\"><acronym class=\"acronym\">PHP</acronym></span>\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u8f6f\u94fe\u63a5</span>\u201d</span>\u6216\u8005<span class=\"quote\">\u201c<span class=\"quote\">\u53ef\u53d8\u53d8\u91cf</span>\u201d</span>\u3002\u4e0d\u5e78\u7684\u662f\uff08\u6216\u8005\u5e78\u8fd0\u7684\u662f\uff1f\uff09\uff0c\u8fd9\u4e9b\u6784\u9020\u51fa\u6765\u7684\u4e1c\u897f\u5e76\u6ca1\u6709\u4ec0\u4e48\u7528\u5904\u3002\u5728\u53e6\u4e00\u65b9\u9762\uff0c<code class=\"literal\">\\set bar :foo</code>\u662f\u4e00\u79cd\u5f88\u597d\u7684\u62f7\u8d1d\u53d8\u91cf\u7684\u65b9\u6cd5\u3002</p>\n</div>\n<p lang=\"zh\">\u6709\u4e00\u4e9b\u53d8\u91cf\u4f1a\u88ab<span class=\"application\">psql</span>\u7279\u6b8a\u5bf9\u5f85\u3002\u5b83\u4eec\u8868\u793a\u7279\u5b9a\u7684\u9009\u9879\u8bbe\u7f6e\uff0c\u8fd0\u884c\u65f6\u8fd9\u7c7b\u9009\u9879\u8bbe\u7f6e\u53ef\u4ee5\u901a\u8fc7\u4fee\u6539\u8be5\u53d8\u91cf\u7684\u503c\u6765\u6539\u53d8\uff0c\u6216\u8005\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\u5b83\u4eec\u8868\u793a<span class=\"application\">psql</span>\u7684\u53ef\u66f4\u6539\u7684\u72b6\u6001\u3002\u6309\u7167\u60ef\u4f8b\uff0c\u6240\u6709\u88ab\u7279\u6b8a\u5bf9\u5f85\u7684\u53d8\u91cf\u7684\u540d\u79f0\u7531\u5168\u90e8\u5927\u5199\u5f62\u5f0f\u7684 ASCII \u5b57\u6bcd\uff08\u8fd8\u6709\u53ef\u80fd\u662f\u6570\u5b57\u548c\u4e0b\u5212\u7ebf\uff09\u7ec4\u6210\u3002\u4e3a\u4e86\u786e\u4fdd\u672a\u6765\u6700\u5927\u7684\u517c\u5bb9\u6027\uff0c\u6700\u597d\u907f\u514d\u628a\u8fd9\u7c7b\u53d8\u91cf\u540d\u7528\u4e8e\u81ea\u5df1\u7684\u76ee\u7684\u3002</p>\n<p lang=\"zh\">\u63a7\u5236<span class=\"application\">psql</span>\u884c\u4e3a\u7684\u53d8\u91cf\u901a\u5e38\u4e0d\u80fd\u88ab\u53d6\u6d88\u8bbe\u7f6e\u6216\u8005\u8bbe\u7f6e\u4e3a\u65e0\u6548\u503c\u3002\u5141\u8bb8<code class=\"literal\">\\unset</code>\u547d\u4ee4\uff0c\u4f46\u5b83\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u5b83\u7684\u9ed8\u8ba4\u503c\u3002\u6ca1\u6709\u7b2c\u4e8c\u53c2\u6570\u7684<code class=\"literal\">\\set</code>\u547d\u4ee4\u4f1a\u88ab\u89e3\u91ca\u4e3a\u5c06\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\uff08\u5bf9\u4e8e\u63a5\u53d7\u8be5\u503c\u7684\u63a7\u5236\u53d8\u91cf\uff09\uff0c\u5bf9\u4e0d\u63a5\u53d7\u8be5\u503c\u7684\u53d8\u91cf\u5219\u4f1a\u62d2\u7edd\u8fd9\u4e2a\u547d\u4ee4\u3002\u6b64\u5916\uff0c\u63a5\u53d7\u503c<code class=\"literal\">on</code>\u548c<code class=\"literal\">off</code>\u7684\u63a7\u5236\u53d8\u91cf\u4e5f\u80fd\u63a5\u53d7\u5176\u4ed6\u5e38\u89c1\u7684\u5e03\u5c14\u503c\u62fc\u5199\u65b9\u5f0f\uff0c\u4f8b\u5982<code class=\"literal\">true</code>\u548c<code class=\"literal\">false</code>\u3002</p>\n<p lang=\"zh\">\u88ab\u7279\u6b8a\u5bf9\u5f85\u7684\u53d8\u91cf\u662f\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-VARIABLES-AUTOCOMMIT\"><span class=\"term\"><code class=\"varname\">AUTOCOMMIT</code> </span> </dt>\n<dd>\n<p lang=\"zh\">\u5728\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\uff08\u9ed8\u8ba4\uff09\u65f6\uff0c\u6bcf\u4e00\u4e2a SQL \u547d\u4ee4\u5728\u6210\u529f\u5b8c\u6210\u65f6\u4f1a\u88ab\u81ea\u52a8\u63d0\u4ea4\u3002\u5728\u8fd9\u79cd\u6a21\u5f0f\u4e2d\u8981\u63a8\u8fdf\u63d0\u4ea4\uff0c\u5fc5\u987b\u8f93\u5165\u4e00\u4e2a<code class=\"command\">BEGIN</code>\u6216\u8005<code class=\"command\">START TRANSACTION</code> SQL \u547d\u4ee4\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">off</code>\u6216\u8005\u88ab\u53d6\u6d88\u8bbe\u7f6e\u65f6\uff0c\u5728\u663e\u5f0f\u53d1\u51fa<code class=\"command\">COMMIT</code>\u6216\u8005<code class=\"command\">END</code>\u4e4b\u524d\uff0cSQL \u547d\u4ee4\u4e0d\u4f1a\u88ab\u63d0\u4ea4\u3002\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u4f1a\u4e3a\u4f60\u53d1\u51fa\u4e00\u4e2a\u9690\u5f0f\u7684<code class=\"command\">BEGIN</code>\uff0c\u8fd9\u4f1a\u53d1\u751f\u5728\u547d\u4ee4\u6267\u884c\u4e4b\u524d\uff0c\u524d\u63d0\u662f\u8be5\u547d\u4ee4\u4e0d\u5728\u4e8b\u52a1\u5757\u4e2d\uff0c\u4e14\u5176\u672c\u8eab\u65e2\u4e0d\u662f<code class=\"command\">BEGIN</code>\u6216\u5176\u4ed6\u4e8b\u52a1\u63a7\u5236\u547d\u4ee4\uff0c\u4e5f\u4e0d\u662f\u65e0\u6cd5\u5728\u4e8b\u52a1\u5757\u4e2d\u6267\u884c\u7684\u547d\u4ee4\uff08\u4f8b\u5982<code class=\"command\">VACUUM</code>\uff09\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u5728\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u4e2d\uff0c\u5fc5\u987b\u901a\u8fc7<code class=\"command\">ABORT</code>\u6216\u8005<code class=\"command\">ROLLBACK</code>\u663e\u5f0f\u5730\u653e\u5f03\u4efb\u4f55\u5931\u8d25\u7684\u4e8b\u52a1\u3002\u8fd8\u8981\u8bb0\u4f4f\uff0c\u5982\u679c\u9000\u51fa\u4f1a\u8bdd\u65f6\u6ca1\u6709\u63d0\u4ea4\uff0c\u5219\u6240\u6709\u7684\u5de5\u4f5c\u90fd\u4f1a\u4e22\u5931\u3002</p>\n</div>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u81ea\u52a8\u63d0\u4ea4\u6253\u5f00\u6a21\u5f0f\u662f<span class=\"productname\">PostgreSQL</span>\u7684\u4f20\u7edf\u884c\u4e3a\uff0c\u4f46\u662f\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\u66f4\u63a5\u8fd1\u4e8e SQL \u7684\u89c4\u8303\u3002\u5982\u679c\u66f4\u559c\u6b22\u81ea\u52a8\u63d0\u4ea4\u5173\u95ed\u6a21\u5f0f\uff0c\u53ef\u4ee5\u5728\u7cfb\u7edf\u7ea7\u7684<code class=\"filename\">psqlrc</code>\u6587\u4ef6\u6216\u8005\u4e2a\u4eba\u7684<code class=\"filename\">~/.psqlrc</code>\u6587\u4ef6\u4e2d\u8bbe\u7f6e\u5b83\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-COMP-KEYWORD-CASE\"><span class=\"term\"><code class=\"varname\">COMP_KEYWORD_CASE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u786e\u5b9a\u5728\u8865\u5168\u4e00\u4e2a SQL \u5173\u952e\u8bcd\u65f6\u8981\u4f7f\u7528\u7684\u5927\u5c0f\u5199\u5f62\u5f0f\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">lower</code>\u6216\u8005<code class=\"literal\">upper</code>\uff0c\u8865\u5168\u540e\u7684\u8bcd\u5c06\u5206\u522b\u662f\u5c0f\u5199\u6216\u8005\u5927\u5199\u5f62\u5f0f\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">preserve-lower</code>\u6216\u8005<code class=\"literal\">preserve-upper</code>\uff08\u9ed8\u8ba4\uff09\uff0c\u8865\u5168\u540e\u7684\u8bcd\u5c06\u4f1a\u4fdd\u6301\u8be5\u8bcd\u5df2\u8f93\u5165\u90e8\u5206\u7684\u5927\u5c0f\u5199\u5f62\u5f0f\uff0c\u4f46\u662f\u5982\u679c\u88ab\u8865\u5168\u7684\u8bcd\u8fd8\u6ca1\u6709\u88ab\u8f93\u5165\uff0c\u5219\u5b83\u4f1a\u88ab\u5206\u522b\u8865\u5168\u6210\u5c0f\u5199\u6216\u8005\u5927\u5199\u5f62\u5f0f\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-DBNAME\"><span class=\"term\"><code class=\"varname\">DBNAME</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u5df2\u8fde\u63a5\u7684\u6570\u636e\u5e93\u540d\u79f0\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u662f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ECHO\"><span class=\"term\"><code class=\"varname\">ECHO</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">all</code>\uff0c\u6240\u6709\u975e\u7a7a\u8f93\u5165\u884c\u4f1a\u5728\u8bfb\u5165\u65f6\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\uff08\u4e0d\u9002\u7528\u4e8e\u4ea4\u4e92\u5f0f\u8bfb\u53d6\u7684\u884c\uff09\u3002\u8981\u5728\u7a0b\u5e8f\u5f00\u59cb\u65f6\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\uff0c\u53ef\u4ee5\u4f7f\u7528\u5f00\u5173<code class=\"option\">-a</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">queries</code>\uff0c<span class=\"application\">psql</span>\u4f1a\u5728\u53d1\u9001\u6bcf\u4e2a\u67e5\u8be2\u7ed9\u670d\u52a1\u5668\u65f6\u5c06\u5b83\u4eec\u6253\u5370\u5230\u6807\u51c6\u8f93\u51fa\u3002\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\u7684\u5f00\u5173\u662f<code class=\"option\">-e</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">errors</code>\uff0c\u90a3\u4e48\u53ea\u6709\u5931\u8d25\u7684\u67e5\u8be2\u4f1a\u88ab\u663e\u793a\u5728\u6807\u51c6\u9519\u8bef\u8f93\u51fa\u4e0a\u3002\u8fd9\u79cd\u884c\u4e3a\u7684\u5f00\u5173\u662f<code class=\"option\">-b</code>\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">none</code>\uff08\u9ed8\u8ba4\u503c\uff09\u5219\u4e0d\u4f1a\u663e\u793a\u4efb\u4f55\u67e5\u8be2\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ECHO-HIDDEN\"><span class=\"term\"><code class=\"varname\">ECHO_HIDDEN</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u4e14\u4e00\u4e2a\u53cd\u659c\u7ebf\u547d\u4ee4\u67e5\u8be2\u6570\u636e\u5e93\u65f6\uff0c\u76f8\u5e94\u7684\u67e5\u8be2\u4f1a\u88ab\u5148\u663e\u793a\u3002\u8fd9\u79cd\u7279\u6027\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u5b66\u4e60<span class=\"productname\">PostgreSQL</span>\u7684\u5185\u90e8\u5e76\u4e14\u5728\u81ea\u5df1\u7684\u7a0b\u5e8f\u4e2d\u63d0\u4f9b\u7c7b\u4f3c\u7684\u529f\u80fd\uff08\u8981\u5728\u7a0b\u5e8f\u5f00\u59cb\u65f6\u9009\u62e9\u8fd9\u79cd\u884c\u4e3a\uff0c\u53ef\u4ee5\u4f7f\u7528\u5f00\u5173<code class=\"option\">-E</code>\uff09\u3002\u5982\u679c\u628a\u8fd9\u4e2a\u53d8\u91cf\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">noexec</code>\uff0c\u5219\u5bf9\u5e94\u7684\u67e5\u8be2\u53ea\u4f1a\u88ab\u663e\u793a\u800c\u5e76\u4e0d\u771f\u6b63\u88ab\u53d1\u9001\u7ed9\u670d\u52a1\u5668\u6267\u884c\u3002\u9ed8\u8ba4\u503c\u662f<code class=\"literal\">off</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ENCODING\"><span class=\"term\"><code class=\"varname\">ENCODING</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u7684\u5ba2\u6237\u7aef\u5b57\u7b26\u96c6\u7f16\u7801\u3002\u6bcf\u4e00\u6b21\u4f60\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\uff09\u65f6\u4ee5\u53ca\u5f53\u4f60\u7528<code class=\"literal\">\\encoding</code>\u66f4\u6539\u7f16\u7801\u65f6\uff0c\u8fd9\u4e2a\u53d8\u91cf\u90fd\u4f1a\u88ab\u8bbe\u7f6e\uff0c\u4f46\u5b83\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ERROR\"><span class=\"term\"><code class=\"varname\">ERROR</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u4e0a\u4e00\u4e2aSQL\u67e5\u8be2\u5931\u8d25\u5219\u4e3a<code class=\"literal\">true</code>\uff0c\u5982\u679c\u6210\u529f\u5219\u662f<code class=\"literal\">false</code>\u3002\u53e6\u89c1<code class=\"varname\">SQLSTATE</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-FETCH-COUNT\"><span class=\"term\"><code class=\"varname\">FETCH_COUNT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a\u4e00\u4e2a\u5927\u4e8e\u96f6\u7684\u6574\u6570\u503c\uff0c<code class=\"command\">SELECT</code>\u67e5\u8be2\u7684\u7ed3\u679c\u4f1a\u4ee5\u4e00\u7ec4\u4e00\u7ec4\u7684\u65b9\u5f0f\u53d6\u51fa\u5e76\u4e14\u663e\u793a\uff08\u800c\u4e0d\u662f\u50cf\u9ed8\u8ba4\u7684\u90a3\u6837\u628a\u6574\u4e2a\u7ed3\u679c\u96c6\u62ff\u5230\u4ee5\u540e\u518d\u663e\u793a\uff09\uff0c\u6bcf\u7ec4\u5305\u542b\u7684\u884c\u6570\u7b49\u4e8e\u8be5\u6574\u6570\u503c\u3002\u56e0\u6b64\uff0c\u8fd9\u79cd\u65b9\u5f0f\u53ea\u4f1a\u4f7f\u7528\u6709\u9650\u7684\u5185\u5b58\u91cf\uff0c\u800c\u4e0d\u7ba1\u6574\u4e2a\u7ed3\u679c\u96c6\u7684\u5927\u5c0f\u3002\u5728\u542f\u7528\u8fd9\u4e2a\u7279\u6027\u65f6\uff0c\u901a\u5e38\u4f1a\u4f7f\u7528 100 \u5230 1000 \u7684\u8bbe\u7f6e\u3002\u8bb0\u4f4f\u5728\u4f7f\u7528\u8fd9\u79cd\u7279\u6027\u65f6\uff0c\u4e00\u4e2a\u67e5\u8be2\u53ef\u80fd\u4f1a\u5728\u5df2\u7ecf\u663e\u793a\u4e86\u4e00\u4e9b\u884c\u4e4b\u540e\u5931\u8d25\u3002</p>\n<div class=\"tip\">\n<h3 class=\"title\" lang=\"zh\">\u63d0\u793a</h3>\n<p lang=\"zh\">\u5c3d\u7ba1\u53ef\u4ee5\u628a\u8fd9\u79cd\u7279\u6027\u7528\u4e8e\u4efb\u4f55\u7684\u8f93\u51fa\u683c\u5f0f\uff0c\u4f46\u662f\u9ed8\u8ba4\u7684<code class=\"literal\">aligned</code>\u683c\u5f0f\u770b\u8d77\u6765\u4f1a\u6bd4\u8f83\u7cdf\u7cd5\uff0c\u56e0\u4e3a\u6bcf\u4e00\u7ec4\u7684<code class=\"varname\">FETCH_COUNT</code>\u884c\u5c06\u88ab\u5355\u72ec\u683c\u5f0f\u5316\uff0c\u8fd9\u5c31\u4f1a\u5bfc\u81f4\u4e0d\u540c\u7684\u884c\u7ec4\u7684\u5217\u5bbd\u4e0d\u540c\u3002\u5176\u4ed6\u7684\u8f93\u51fa\u683c\u5f0f\u4f1a\u66f4\u597d\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HIDE-TABLEAM\"><span class=\"term\"><code class=\"varname\">HIDE_TABLEAM</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6b64\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">true</code>\uff0c\u5219\u4e0d\u663e\u793a\u8868\u7684\u8bbf\u95ee\u65b9\u6cd5\u7684\u8be6\u7ec6\u4fe1\u606f\u3002\u8fd9\u4e3b\u8981\u7528\u4e8e\u56de\u5f52\u6d4b\u8bd5\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HIDE-TOAST-COMPRESSION\"><span class=\"term\"><code class=\"varname\">HIDE_TOAST_COMPRESSION</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">true</code>\uff0c\u4e0d\u663e\u793a\u5217\u538b\u7f29\u65b9\u6cd5\u7684\u7ec6\u8282\u3002\u8fd9\u4e3b\u8981\u7528\u4e8e\u56de\u5f52\u6d4b\u8bd5\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HISTCONTROL\"><span class=\"term\"><code class=\"varname\">HISTCONTROL</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8fd9\u4e2a\u53d8\u91cf\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">ignorespace</code>\uff0c\u5219\u4ee5\u4e00\u4e2a\u7a7a\u683c\u5f00\u59cb\u7684\u884c\u4e0d\u4f1a\u88ab\u653e\u5165\u5230\u5386\u53f2\u5217\u8868\u4e2d\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">ignoredups</code>\uff0c\u5219\u4e0e\u4e0a\u4e00\u6761\u5386\u53f2\u8bb0\u5f55\u76f8\u540c\u7684\u884c\u4e0d\u4f1a\u88ab\u653e\u5165\u3002\u503c<code class=\"literal\">ignoreboth</code>\u7ec4\u5408\u4e86\u4e0a\u8ff0\u4e24\u79cd\u503c\u3002\u5982\u679c\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">none</code>\uff08\u9ed8\u8ba4\u503c\uff09\uff0c\u6240\u6709\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e2d\u88ab\u8bfb\u5165\u7684\u884c\u90fd\u4f1a\u4fdd\u5b58\u5728\u5386\u53f2\u5217\u8868\u4e2d\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HISTFILE\"><span class=\"term\"><code class=\"varname\">HISTFILE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u8be5\u6587\u4ef6\u540d\u5c06\u88ab\u7528\u4e8e\u5b58\u50a8\u5386\u53f2\u5217\u8868\u3002\u5982\u679c\u672a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff0c\u6587\u4ef6\u540d\u5c06\u4ece<code class=\"envar\">PSQL_HISTORY</code>\u73af\u5883\u53d8\u91cf\u4e2d\u53d6\u5f97\u3002\u5982\u679c\u8be5\u73af\u5883\u53d8\u91cf\u4e5f\u6ca1\u6709\u88ab\u8bbe\u7f6e\uff0c\u5219\u9ed8\u8ba4\u503c\u662f<code class=\"filename\">~/.psql_history</code>\uff0c\u5728Windows\u4e0a\u662f<code class=\"filename\">%APPDATA%\\postgresql\\psql_history</code>\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">\\set HISTFILE ~/.psql_history-:DBNAME\n</pre>\n<p lang=\"zh\">\u653e\u5728<code class=\"filename\">~/.psqlrc</code>\u4e2d\u5c06\u4f1a\u5bfc\u81f4<span class=\"application\">psql</span>\u4e3a\u6bcf\u4e00\u4e2a\u6570\u636e\u5e93\u7ef4\u62a4\u4e00\u4e2a\u5355\u72ec\u7684\u5386\u53f2\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HISTSIZE\"><span class=\"term\"><code class=\"varname\">HISTSIZE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u547d\u4ee4\u5386\u53f2\u4e2d\u6700\u591a\u4fdd\u5b58\u7684\u547d\u4ee4\u6570\uff08\u9ed8\u8ba4 500\uff09\u3002\u8bbe\u4e3a\u8d1f\u503c\u65f6\uff0c\u4e0d\u8bbe\u4e0a\u9650\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-HOST\"><span class=\"term\"><code class=\"varname\">HOST</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e3b\u673a\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u4e5f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-IGNOREEOF\"><span class=\"term\"><code class=\"varname\">IGNOREEOF</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u8bbe\u4e3a 1 \u6216\u66f4\u5c0f\u7684\u503c\uff0c\u5411 psql \u4ea4\u4e92\u4f1a\u8bdd\u53d1\u9001 EOF \u5b57\u7b26\uff08\u901a\u5e38\u4e3a Control + D\uff09\u5c31\u4f1a\u7ec8\u6b62\u5e94\u7528\u3002\u5982\u679c\u8bbe\u4e3a\u66f4\u5927\u7684\u6570\u503c\uff0c\u5219\u5fc5\u987b\u8fde\u7eed\u8f93\u5165\u76f8\u5e94\u6b21\u6570\u7684 EOF \u5b57\u7b26\u624d\u4f1a\u7ec8\u6b62\u4ea4\u4e92\u4f1a\u8bdd\u3002\u5982\u679c\u53d8\u91cf\u8bbe\u4e3a\u975e\u6570\u503c\uff0c\u4f1a\u88ab\u89e3\u91ca\u4e3a 10\u3002\u9ed8\u8ba4\u503c\u4e3a 0\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">Bash</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-LASTOID\"><span class=\"term\"><code class=\"varname\">LASTOID</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6700\u8fd1\u4e00\u6b21\u53d7\u5f71\u54cd\u7684 OID \u503c\uff0c\u7531 INSERT \u6216 \\lo_import \u547d\u4ee4\u8fd4\u56de\u3002\u6b64\u53d8\u91cf\u4ec5\u4fdd\u8bc1\u5728\u4e0b\u4e00\u6761 SQL \u547d\u4ee4\u7684\u7ed3\u679c\u663e\u793a\u4e4b\u524d\u6709\u6548\u3002\u4ece\u7248\u672c 12 \u8d77\uff0cPostgreSQL \u670d\u52a1\u5668\u4e0d\u518d\u652f\u6301 OID \u7cfb\u7edf\u5217\uff0c\u56e0\u6b64\u8fde\u63a5\u5230\u8fd9\u4e9b\u670d\u52a1\u5668\u65f6\uff0c\u6267\u884c INSERT \u540e LASTOID \u59cb\u7ec8\u4e3a 0\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-LAST-ERROR-MESSAGE\"><span class=\"term\"><code class=\"varname\">LAST_ERROR_MESSAGE</code><br/></span><span class=\"term\"><code class=\"varname\">LAST_ERROR_SQLSTATE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d<span class=\"application\">psql</span>\u4f1a\u8bdd\u4e2d\u6700\u8fd1\u4e00\u4e2a\u5931\u8d25\u67e5\u8be2\u7684\u4e3b\u9519\u8bef\u6d88\u606f\u548c\u76f8\u5173\u7684SQLSTATE\u4ee3\u7801\uff0c\u5982\u679c\u5728\u5f53\u524d\u4f1a\u8bdd\u4e2d\u6ca1\u6709\u53d1\u751f\u9519\u8bef\uff0c\u5219\u662f\u4e00\u4e2a\u7a7a\u5b57\u7b26\u4e32\u548c<code class=\"literal\">00000</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ON-ERROR-ROLLBACK\"><span class=\"term\"><code class=\"varname\">ON_ERROR_ROLLBACK</code> </span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u65f6\uff0c\u5982\u679c\u4e8b\u52a1\u5757\u4e2d\u7684\u4e00\u4e2a\u8bed\u53e5\u4ea7\u751f\u4e00\u4e2a\u9519\u8bef\uff0c\u8be5\u9519\u8bef\u4f1a\u88ab\u5ffd\u7565\u5e76\u4e14\u8be5\u4e8b\u52a1\u4f1a\u7ee7\u7eed\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">interactive</code>\u65f6\uff0c\u53ea\u5728\u4ea4\u4e92\u5f0f\u4f1a\u8bdd\u4e2d\u5ffd\u7565\u8fd9\u7c7b\u9519\u8bef\uff0c\u800c\u8bfb\u53d6\u811a\u672c\u6587\u4ef6\u65f6\u5219\u4e0d\u4f1a\u5ffd\u7565\u9519\u8bef\u3002\u5f53\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">off</code>\uff08\u9ed8\u8ba4\u503c\uff09\u65f6\uff0c\u4e8b\u52a1\u5757\u4e2d\u4ea7\u751f\u9519\u8bef\u7684\u4e00\u4e2a\u8bed\u53e5\u4f1a\u4e2d\u6b62\u6574\u4e2a\u4e8b\u52a1\u3002\u9519\u8bef\u56de\u6eda\u6a21\u5f0f\u7684\u5de5\u4f5c\u539f\u7406\u662f\u5728\u4e8b\u52a1\u5757\u7684\u6bcf\u4e2a\u547d\u4ee4\u4e4b\u524d\u90fd\u4e3a\u4f60\u53d1\u51fa\u4e00\u4e2a\u9690\u5f0f\u7684<code class=\"command\">SAVEPOINT</code>\uff0c\u7136\u540e\u5728\u8be5\u547d\u4ee4\u5931\u8d25\u65f6\u56de\u6eda\u5230\u8be5\u4fdd\u5b58\u70b9\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ON-ERROR-STOP\"><span class=\"term\"><code class=\"varname\">ON_ERROR_STOP</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u51fa\u9519\u540e\u4ecd\u4f1a\u7ee7\u7eed\u5904\u7406\u547d\u4ee4\u3002\u5c06\u6b64\u53d8\u91cf\u8bbe\u4e3a on \u540e\uff0c\u5904\u7406\u4f1a\u7acb\u5373\u505c\u6b62\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\uff0cpsql \u4f1a\u8fd4\u56de\u547d\u4ee4\u63d0\u793a\u7b26\uff1b\u5426\u5219\uff0cpsql \u4f1a\u9000\u51fa\u5e76\u8fd4\u56de\u9519\u8bef\u7801 3\uff0c\u4ee5\u533a\u522b\u4e8e\u9519\u8bef\u7801 1 \u6240\u8868\u793a\u7684\u81f4\u547d\u9519\u8bef\u3002\u65e0\u8bba\u54ea\u79cd\u60c5\u51b5\uff0c\u5f53\u524d\u6b63\u5728\u8fd0\u884c\u7684\u6240\u6709\u811a\u672c\uff08\u5982\u679c\u5b58\u5728\u9876\u5c42\u811a\u672c\uff0c\u5219\u5305\u62ec\u8be5\u811a\u672c\u53ca\u5176\u8c03\u7528\u7684\u5176\u4ed6\u811a\u672c\uff09\u90fd\u4f1a\u7acb\u5373\u7ec8\u6b62\u3002\u5982\u679c\u9876\u5c42\u547d\u4ee4\u5b57\u7b26\u4e32\u5305\u542b\u591a\u6761 SQL \u547d\u4ee4\uff0c\u5219\u4f1a\u5728\u5f53\u524d\u547d\u4ee4\u5904\u505c\u6b62\u5904\u7406\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-PIPELINE-COMMAND-COUNT\"><span class=\"term\"><code class=\"varname\">PIPELINE_COMMAND_COUNT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6b63\u5728\u8fd0\u884c\u7684\u7ba1\u9053\u4e2d\u6392\u961f\u7684\u547d\u4ee4\u6570\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-PIPELINE-RESULT-COUNT\"><span class=\"term\"><code class=\"varname\">PIPELINE_RESULT_COUNT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6b63\u5728\u8fdb\u884c\u7684\u7ba1\u9053\u4e2d\uff0c\u6709\u591a\u5c11\u6761\u547d\u4ee4\u540e\u9762\u8ddf\u7740 <code class=\"command\">\\flushrequest</code> \u6216 <code class=\"command\">\\syncpipeline</code>\uff0c\u4ece\u800c\u5f3a\u5236\u670d\u52a1\u5668\u53d1\u9001\u7ed3\u679c\u3002\u8fd9\u4e9b\u7ed3\u679c\u53ef\u4ee5\u901a\u8fc7 <code class=\"command\">\\getresults</code> \u53d6\u56de\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-PIPELINE-SYNC-COUNT\"><span class=\"term\"><code class=\"varname\">PIPELINE_SYNC_COUNT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6b63\u5728\u8fd0\u884c\u7684\u7ba1\u9053\u4e2d\u6392\u961f\u7684\u540c\u6b65\u6d88\u606f\u6570\u91cf\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-PORT\"><span class=\"term\"><code class=\"varname\">PORT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u5230\u7684\u6570\u636e\u5e93\u670d\u52a1\u5668\u7aef\u53e3\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u4e5f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-PROMPT\"><span class=\"term\"><code class=\"varname\">PROMPT1</code><br/></span><span class=\"term\"><code class=\"varname\">PROMPT2</code><br/></span><span class=\"term\"><code class=\"varname\">PROMPT3</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e9b\u53d8\u91cf\u6307\u5b9a<span class=\"application\">psql</span>\u53d1\u51fa\u7684\u63d0\u793a\u7b26\u7684\u6a21\u6837\u3002\u89c1\u4e0b\u6587\u7684<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-PROMPTING\" title=\"\u63d0\u793a\u7b26\">\u63d0\u793a\u7b26</a>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-QUIET\"><span class=\"term\"><code class=\"varname\">QUIET</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u628a\u8fd9\u4e2a\u53d8\u91cf\u8bbe\u7f6e\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-q</code>\u3002\u5728\u4ea4\u4e92\u6a21\u5f0f\u4e0b\u53ef\u80fd\u7528\u5904\u4e0d\u5927\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-ROW-COUNT\"><span class=\"term\"><code class=\"varname\">ROW_COUNT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u6700\u8fd1\u4e00\u6761 SQL \u67e5\u8be2\u8fd4\u56de\u6216\u5f71\u54cd\u7684\u884c\u6570\uff1b\u5982\u679c\u67e5\u8be2\u5931\u8d25\u6216\u6ca1\u6709\u62a5\u544a\u884c\u6570\uff0c\u5219\u4e3a 0\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SERVER-VERSION-NAME\"><span class=\"term\"><code class=\"varname\">SERVER_VERSION_NAME</code><br/></span><span class=\"term\"><code class=\"varname\">SERVER_VERSION_NUM</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b57\u7b26\u4e32\u5f62\u5f0f\u7684\u670d\u52a1\u5668\u7248\u672c\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">9.6.2</code>\u3001<code class=\"literal\">10.1</code>\u6216\u8005<code class=\"literal\">11beta1</code>\uff0c\u4ee5\u53ca\u6570\u5b57\u5f62\u5f0f\u7684\u670d\u52a1\u5668\u7248\u672c\u53f7\uff0c\u4f8b\u5982<code class=\"literal\">90602</code>\u6216\u8005<code class=\"literal\">100001</code>\u3002\u6bcf\u6b21\u4f60\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\uff09\u65f6\uff0c\u8fd9\u4e9b\u90fd\u4f1a\u88ab\u8bbe\u7f6e\uff0c\u4f46\u53ef\u4ee5\u88ab\u6539\u53d8\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SERVICE\"><span class=\"term\"><code class=\"varname\">SERVICE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u670d\u52a1\u540d\u79f0\uff08\u5982\u679c\u9002\u7528\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SHELL-ERROR\"><span class=\"term\"><code class=\"varname\">SHELL_ERROR</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u6700\u540e\u4e00\u4e2a shell \u547d\u4ee4\u5931\u8d25\uff0c\u5219\u4e3a <code class=\"literal\">true</code>\uff1b\u5982\u679c\u6210\u529f\uff0c\u5219\u4e3a <code class=\"literal\">false</code>\u3002\u8fd9\u9002\u7528\u4e8e\u901a\u8fc7 <code class=\"literal\">\\!</code>\u3001<code class=\"literal\">\\g</code>\u3001<code class=\"literal\">\\o</code>\u3001<code class=\"literal\">\\w</code> \u548c <code class=\"literal\">\\copy</code> \u5143\u547d\u4ee4\u8c03\u7528\u7684 shell \u547d\u4ee4\uff0c\u4e5f\u9002\u7528\u4e8e\u53cd\u5f15\u53f7\uff08<code class=\"literal\">`</code>\uff09\u6269\u5c55\u3002\u8bf7\u6ce8\u610f\uff0c\u5bf9\u4e8e <code class=\"literal\">\\o</code>\uff0c\u8be5\u53d8\u91cf\u4f1a\u5728\u4e0b\u4e00\u4e2a <code class=\"literal\">\\o</code> \u547d\u4ee4\u5173\u95ed\u8f93\u51fa\u7ba1\u9053\u65f6\u66f4\u65b0\u3002\u53e6\u89c1 <code class=\"varname\">SHELL_EXIT_CODE</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SHELL-EXIT-CODE\"><span class=\"term\"><code class=\"varname\">SHELL_EXIT_CODE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6700\u540e\u4e00\u4e2a shell \u547d\u4ee4\u8fd4\u56de\u7684\u9000\u51fa\u72b6\u6001\u30020\u2013127 \u8868\u793a\u7a0b\u5e8f\u9000\u51fa\u7801\uff0c128\u2013255 \u8868\u793a\u56e0\u4fe1\u53f7\u800c\u7ec8\u6b62\uff0c-1 \u8868\u793a\u672a\u80fd\u542f\u52a8\u7a0b\u5e8f\u6216\u672a\u80fd\u53d6\u5f97\u5176\u9000\u51fa\u72b6\u6001\u3002\u8fd9\u9002\u7528\u4e8e\u901a\u8fc7 <code class=\"literal\">\\!</code>\u3001<code class=\"literal\">\\g</code>\u3001<code class=\"literal\">\\o</code>\u3001<code class=\"literal\">\\w</code> \u548c <code class=\"literal\">\\copy</code> \u5143\u547d\u4ee4\u8c03\u7528\u7684 shell \u547d\u4ee4\uff0c\u4e5f\u9002\u7528\u4e8e\u53cd\u5f15\u53f7\uff08<code class=\"literal\">`</code>\uff09\u6269\u5c55\u3002\u8bf7\u6ce8\u610f\uff0c\u5bf9\u4e8e <code class=\"literal\">\\o</code>\uff0c\u8be5\u53d8\u91cf\u4f1a\u5728\u4e0b\u4e00\u4e2a <code class=\"literal\">\\o</code> \u547d\u4ee4\u5173\u95ed\u8f93\u51fa\u7ba1\u9053\u65f6\u66f4\u65b0\u3002\u53e6\u89c1 <code class=\"varname\">SHELL_ERROR</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SHOW-ALL-RESULTS\"><span class=\"term\"><code class=\"varname\">SHOW_ALL_RESULTS</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u6b64\u53d8\u91cf\u88ab\u8bbe\u4e3a <code class=\"literal\">off</code> \u65f6\uff0c\u7ec4\u5408\u67e5\u8be2\uff08<code class=\"literal\">\\;</code>\uff09\u53ea\u663e\u793a\u6700\u540e\u4e00\u4e2a\u7ed3\u679c\uff0c\u800c\u4e0d\u662f\u663e\u793a\u5168\u90e8\u7ed3\u679c\u3002\u9ed8\u8ba4\u503c\u4e3a <code class=\"literal\">on</code>\u3002\u8bbe\u4e3a off \u7684\u884c\u4e3a\u662f\u4e3a\u4e86\u517c\u5bb9\u65e7\u7248\u672c\u7684 <span class=\"application\">psql</span>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SHOW-CONTEXT\"><span class=\"term\"><code class=\"varname\">SHOW_CONTEXT</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u53d8\u91cf\u53ef\u4ee5\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">never</code>\u3001<code class=\"literal\">errors</code>\u6216\u8005<code class=\"literal\">always</code>\u6765\u63a7\u5236\u662f\u5426\u5728\u6765\u81ea\u670d\u52a1\u5668\u7684\u6d88\u606f\u4e2d\u663e\u793a<code class=\"literal\">CONTEXT</code>\u5b57\u6bb5\u3002\u9ed8\u8ba4\u662f<code class=\"literal\">errors</code>\uff08\u8868\u793a\u5728\u9519\u8bef\u6d88\u606f\u4e2d\u663e\u793a\u4e0a\u4e0b\u6587\uff0c\u4f46\u5728\u901a\u77e5\u548c\u8b66\u544a\u6d88\u606f\u4e2d\u4e0d\u663e\u793a\uff09\u3002\u5f53<code class=\"varname\">VERBOSITY</code>\u88ab\u8bbe\u7f6e\u4e3a<code class=\"literal\">terse</code>\u6216<code class=\"literal\">sqlstate</code>\u65f6\uff0c\u8fd9\u4e2a\u8bbe\u7f6e\u65e0\u6548\uff08\u53e6\u89c1<code class=\"command\">\\errverbose</code>\uff0c\u5b83\u53ef\u4ee5\u7528\u6765\u5f97\u5230\u521a\u9047\u5230\u7684\u9519\u8bef\u7684\u8be6\u7ec6\u4fe1\u606f\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SINGLELINE\"><span class=\"term\"><code class=\"varname\">SINGLELINE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u8fd9\u4e2a\u53d8\u91cf\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-S</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SINGLESTEP\"><span class=\"term\"><code class=\"varname\">SINGLESTEP</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8bbe\u7f6e\u8fd9\u4e2a\u53d8\u91cf\u4e3a<code class=\"literal\">on</code>\u7b49\u6548\u4e8e\u547d\u4ee4\u884c\u9009\u9879<code class=\"option\">-s</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-SQLSTATE\"><span class=\"term\"><code class=\"varname\">SQLSTATE</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0e\u4e0a\u4e00\u4e2aSQL\u67e5\u8be2\u7684\u5931\u8d25\u76f8\u5173\u7684\u9519\u8bef\u4ee3\u7801\uff08\u89c1<a class=\"xref\" href=\"/docs/18/errcodes-appendix.html\" title=\"\u9644\u5f55\u00a0A.\u00a0PostgreSQL\u9519\u8bef\u4ee3\u7801\">\u9644\u5f55\u00a0A</a>\uff09\uff0c\u5982\u679c\u4e0a\u4e00\u4e2a\u67e5\u8be2\u6210\u529f\u5219\u4e3a<code class=\"literal\">00000</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-USER\"><span class=\"term\"><code class=\"varname\">USER</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8fde\u63a5\u7684\u6570\u636e\u5e93\u7528\u6237\u3002\u6bcf\u6b21\u8fde\u63a5\u5230\u4e00\u4e2a\u6570\u636e\u5e93\u65f6\u90fd\u4f1a\u8bbe\u7f6e\u8be5\u53d8\u91cf\uff08\u5305\u62ec\u7a0b\u5e8f\u542f\u52a8\u65f6\uff09\uff0c\u4f46\u662f\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u8005\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-VERBOSITY\"><span class=\"term\"><code class=\"varname\">VERBOSITY</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e2a\u53d8\u91cf\u53ef\u4ee5\u88ab\u8bbe\u7f6e\u4e3a\u503c<code class=\"literal\">default</code>\u3001<code class=\"literal\">verbose</code>\u3001<code class=\"literal\">terse</code>\u6216\u8005<code class=\"literal\">sqlstate</code>\u6765\u63a7\u5236\u9519\u8bef\u62a5\u544a\u7684\u8be6\u7ec6\u7a0b\u5ea6\uff08\u53e6\u89c1<code class=\"command\">\\errverbose</code>\uff0c\u5728\u60f3\u5f97\u5230\u521a\u9047\u5230\u7684\u9519\u8bef\u7684\u8be6\u7ec6\u4fe1\u606f\u65f6\u4f7f\u7528\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-VERSION\"><span class=\"term\"><code class=\"varname\">VERSION</code><br/></span><span class=\"term\"><code class=\"varname\">VERSION_NAME</code><br/></span><span class=\"term\"><code class=\"varname\">VERSION_NUM</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u8fd9\u4e9b\u53d8\u91cf\u5728\u7a0b\u5e8f\u542f\u52a8\u65f6\u88ab\u8bbe\u7f6e\u4ee5\u53cd\u6620<span class=\"application\">psql</span>\u7684\u7248\u672c\uff0c\u5206\u522b\u662f\u4e00\u4e2a\u8be6\u7ec6\u7684\u5b57\u7b26\u4e32\u3001\u4e00\u4e2a\u77ed\u5b57\u7b26\u4e32\uff08\u4f8b\u5982<code class=\"literal\">9.6.2</code>\u3001<code class=\"literal\">10.1</code>\u6216\u8005<code class=\"literal\">11beta1</code>\uff09\u4ee5\u53ca\u4e00\u4e2a\u6570\u5b57\uff08\u4f8b\u5982<code class=\"literal\">90602</code>\u6216\u8005<code class=\"literal\">100001</code>\uff09\u3002\u5b83\u4eec\u53ef\u4ee5\u88ab\u66f4\u6539\u6216\u53d6\u6d88\u8bbe\u7f6e\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-VARIABLES-WATCH-INTERVAL\"><span class=\"term\"><code class=\"varname\">WATCH_INTERVAL</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6b64\u53d8\u91cf\u8bbe\u7f6e<code class=\"command\">\\watch</code>\u5728\u4e24\u6b21\u6267\u884c\u67e5\u8be2\u4e4b\u95f4\u7b49\u5f85\u7684\u9ed8\u8ba4\u95f4\u9694\uff0c\u5355\u4f4d\u4e3a\u79d2\u3002\u9ed8\u8ba4\u503c\u4e3a 2 \u79d2\u3002\u82e5\u5728\u547d\u4ee4\u4e2d\u6307\u5b9a\u4e86\u95f4\u9694\uff0c\u5219\u4f1a\u8986\u76d6\u6b64\u53d8\u91cf\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-INTERPOLATION\">\n<h4 lang=\"zh\">SQL \u63d2\u503c</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u53d8\u91cf\u7684\u4e00\u4e2a\u5173\u952e\u7279\u6027\u662f\u53ef\u4ee5\u628a\u5b83\u4eec\u66ff\u6362\uff08<span class=\"quote\">\u201c<span class=\"quote\">\u63d2\u503c</span>\u201d</span>\uff09\u5230\u5e38\u89c4<acronym class=\"acronym\">SQL</acronym>\u8bed\u53e5\u4e2d\uff0c\u4e5f\u53ef\u4ee5\u628a\u5b83\u4eec\u66ff\u6362\u5230\u5143\u547d\u4ee4\u7684\u53c2\u6570\u4e2d\u3002\u6b64\u5916\uff0c<span class=\"application\">psql</span>\u8fd8\u63d0\u4f9b\u4e86\u529f\u80fd\u6765\u786e\u4fdd\u88ab\u7528\u4f5c SQL \u5b57\u9762\u91cf\u548c\u6807\u8bc6\u7b26\u7684\u53d8\u91cf\u503c\u4f1a\u88ab\u6b63\u786e\u5730\u52a0\u5f15\u53f7\u3002\u4e0d\u52a0\u5f15\u53f7\u5730\u63d2\u503c\u4e00\u4e2a\u503c\u7684\u8bed\u6cd5\u662f\u5728\u53d8\u91cf\u540d\u524d\u9762\u52a0\u4e0a\u4e00\u4e2a\u5192\u53f7\uff08<code class=\"literal\">:</code>\uff09\u3002\u4f8b\u5982\uff0c</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo 'my_table'</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM :foo;</code></strong>\n</pre>\n<p lang=\"zh\">\u5c06\u67e5\u8be2\u8868<code class=\"literal\">my_table</code>\u3002\u6ce8\u610f\u8fd9\u53ef\u80fd\u4f1a\u4e0d\u5b89\u5168\uff1a\u8be5\u53d8\u91cf\u7684\u503c\u4f1a\u88ab\u6309\u5b57\u9762\u62f7\u8d1d\uff0c\u56e0\u6b64\u5b83\u53ef\u80fd\u5305\u542b\u4e0d\u5e73\u8861\u7684\u5f15\u53f7\u751a\u81f3\u53cd\u659c\u7ebf\u547d\u4ee4\u3002\u5fc5\u987b\u786e\u4fdd\u628a\u5b83\u653e\u5728\u90a3\u91cc\u662f\u6709\u610f\u4e49\u7684\u3002</p>\n<p lang=\"zh\">\u5f53\u4e00\u4e2a\u503c\u8981\u7528\u4f5c SQL \u5b57\u9762\u91cf\u6216\u6807\u8bc6\u7b26\u65f6\uff0c\u6700\u5b89\u5168\u7684\u505a\u6cd5\u662f\u4e3a\u5b83\u52a0\u4e0a\u5f15\u53f7\u3002\u8981\u5c06\u53d8\u91cf\u503c\u4f5c\u4e3a SQL \u5b57\u9762\u91cf\u52a0\u5f15\u53f7\uff0c\u5e94\u5199\u4e00\u4e2a\u5192\u53f7\uff0c\u540e\u9762\u8ddf\u7528\u5355\u5f15\u53f7\u62ec\u8d77\u6765\u7684\u53d8\u91cf\u540d\u3002\u8981\u5c06\u53d8\u91cf\u503c\u4f5c\u4e3a SQL \u6807\u8bc6\u7b26\u52a0\u5f15\u53f7\uff0c\u5219\u5728\u5192\u53f7\u540e\u9762\u7528\u53cc\u5f15\u53f7\u62ec\u8d77\u53d8\u91cf\u540d\u3002\u8fd9\u4e9b\u5199\u6cd5\u80fd\u6b63\u786e\u5904\u7406\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165\u7684\u5f15\u53f7\u548c\u5176\u4ed6\u7279\u6b8a\u5b57\u7b26\u3002\u524d\u9762\u7684\u793a\u4f8b\u53ef\u7528\u4ee5\u4e0b\u66f4\u5b89\u5168\u7684\u5199\u6cd5\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set foo 'my_table'</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM :\"foo\";</code></strong>\n</pre>\n<p lang=\"zh\">\u5728\u52a0\u5f15\u53f7\u7684<acronym class=\"acronym\">SQL</acronym>\u5b57\u9762\u91cf\u548c\u6807\u8bc6\u7b26\u5185\u90e8\uff0c\u4e0d\u4f1a\u6267\u884c\u53d8\u91cf\u63d2\u503c\u3002\u56e0\u6b64\uff0c<code class=\"literal\">':foo'</code>\u8fd9\u6837\u7684\u5199\u6cd5\u4e0d\u80fd\u6839\u636e\u53d8\u91cf\u503c\u751f\u6210\u52a0\u5f15\u53f7\u7684\u5b57\u9762\u91cf\uff08\u5373\u4f7f\u80fd\u591f\u751f\u6548\uff0c\u4e5f\u4e0d\u5b89\u5168\uff0c\u56e0\u4e3a\u5b83\u65e0\u6cd5\u6b63\u786e\u5904\u7406\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165\u7684\u5f15\u53f7\uff09\u3002</p>\n<p lang=\"zh\">\u4f7f\u7528\u8fd9\u79cd\u673a\u5236\u7684\u4e00\u4e2a\u793a\u4f8b\u662f\u628a\u4e00\u4e2a\u6587\u4ef6\u7684\u5185\u5bb9\u62f7\u8d1d\u5230\u4e00\u4e2a\u8868\u5217\u4e2d\u3002\u9996\u5148\u628a\u8be5\u6587\u4ef6\u8f7d\u5165\u5230\u4e00\u4e2a\u53d8\u91cf\uff0c\u7136\u540e\u628a\u8be5\u53d8\u91cf\u7684\u503c\u4f5c\u4e3a\u4e00\u4e2a\u52a0\u5f15\u53f7\u7684\u5b57\u7b26\u4e32\u8fdb\u884c\u63d2\u503c\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set content `cat my_file.txt`</code></strong>\ntestdb=&gt; <strong class=\"userinput\"><code>INSERT INTO my_table VALUES (:'content');</code></strong>\n</pre>\n<p lang=\"zh\">\uff08\u6ce8\u610f\u5982\u679c<code class=\"filename\">my_file.txt</code>\u5305\u542b NUL \u5b57\u8282\uff0c\u8fd9\u6837\u4e5f\u4e0d\u884c\u3002<span class=\"application\">psql</span>\u4e0d\u652f\u6301\u5728\u53d8\u91cf\u503c\u4e2d\u5d4c\u5165 NUL \u5b57\u8282\uff09\u3002</p>\n<p lang=\"zh\">\u56e0\u4e3a\u5192\u53f7\u53ef\u4ee5\u5408\u6cd5\u5730\u51fa\u73b0\u5728 SQL \u547d\u4ee4\u4e2d\uff0c\u770b\u4f3c\u63d2\u503c\u7684\u5199\u6cd5\uff08\u5373<code class=\"literal\">:name</code>\u3001<code class=\"literal\">:'name'</code>\u6216\u8005<code class=\"literal\">:\"name\"</code>\uff09\u4e0d\u4f1a\u88ab\u66ff\u6362\uff0c\u9664\u975e\u6240\u6307\u7684\u53d8\u91cf\u5f53\u524d\u5df2\u8bbe\u7f6e\u3002\u5728\u4efb\u4f55\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u7528\u4e00\u4e2a\u53cd\u659c\u7ebf\u5bf9\u5192\u53f7\u8fdb\u884c\u8f6c\u4e49\u4ee5\u907f\u514d\u5b83\u88ab\u66ff\u6362\u3002</p>\n<p lang=\"zh\"><code class=\"literal\">:{?<em class=\"replaceable\"><code>name</code></em>}</code>\u7279\u6b8a\u8bed\u6cd5\u4f1a\u6839\u636e\u8be5\u53d8\u91cf\u662f\u5426\u5b58\u5728\u8fd4\u56de TRUE \u6216 FALSE\uff0c\u56e0\u6b64\u603b\u662f\u4f1a\u88ab\u66ff\u6362\uff0c\u9664\u975e\u5192\u53f7\u88ab\u53cd\u659c\u7ebf\u8f6c\u4e49\u3002</p>\n<p lang=\"zh\">\u53d8\u91cf\u7684\u5192\u53f7\u8bed\u6cd5\u5bf9\u5d4c\u5165\u5f0f\u67e5\u8be2\u8bed\u8a00\uff08\u4f8b\u5982<span class=\"application\">ECPG</span>\uff09\u6765\u8bf4\u662f\u6807\u51c6\u7684<acronym class=\"acronym\">SQL</acronym>\u3002\u7528\u4e8e\u6570\u7ec4\u5207\u7247\u548c\u7c7b\u578b\u8f6c\u6362\u7684\u5192\u53f7\u8bed\u6cd5\u662f<span class=\"productname\">PostgreSQL</span>\u6269\u5c55\uff0c\u5b83\u6709\u65f6\u53ef\u80fd\u4f1a\u4e0e\u6807\u51c6\u7528\u6cd5\u51b2\u7a81\u3002\u628a\u4e00\u4e2a\u53d8\u91cf\u503c\u8f6c\u4e49\u6210 SQL \u5b57\u9762\u91cf\u6216\u8005\u6807\u8bc6\u7b26\u7684\u5192\u53f7\u52a0\u5f15\u53f7\u8bed\u6cd5\u662f\u4e00\u79cd<span class=\"application\">psql</span>\u6269\u5c55\u3002</p>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-PROMPTING\">\n<h4 lang=\"zh\">\u63d0\u793a\u7b26</h4>\n<p lang=\"zh\"><span class=\"application\">psql</span> \u53d1\u51fa\u7684\u63d0\u793a\u7b26\u53ef\u4ee5\u6309\u4f60\u7684\u559c\u597d\u8fdb\u884c\u5b9a\u5236\u3002<code class=\"varname\">PROMPT1</code>\u3001<code class=\"varname\">PROMPT2</code> \u548c <code class=\"varname\">PROMPT3</code> \u8fd9\u4e09\u4e2a\u53d8\u91cf\u5305\u542b\u63cf\u8ff0\u63d0\u793a\u7b26\u5916\u89c2\u7684\u5b57\u7b26\u4e32\u548c\u7279\u6b8a\u8f6c\u4e49\u5e8f\u5217\u3002\u63d0\u793a\u7b26 1 \u662f <span class=\"application\">psql</span> \u8bf7\u6c42\u65b0\u547d\u4ee4\u65f6\u53d1\u51fa\u7684\u5e38\u89c4\u63d0\u793a\u7b26\u3002\u63d0\u793a\u7b26 2 \u4f1a\u5728\u5f55\u5165\u547d\u4ee4\u671f\u95f4\u8fd8\u9700\u8981\u66f4\u591a\u8f93\u5165\u65f6\u53d1\u51fa\uff0c\u4f8b\u5982\u547d\u4ee4\u5c1a\u672a\u4ee5\u5206\u53f7\u7ed3\u675f\uff0c\u6216\u8005\u5f15\u53f7\u5c1a\u672a\u95ed\u5408\u65f6\u3002\u5728\u6267\u884c <acronym class=\"acronym\">SQL</acronym> <code class=\"command\">COPY FROM STDIN</code> \u547d\u4ee4\u5e76\u9700\u8981\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4e00\u884c\u503c\u65f6\uff0c\u4f1a\u53d1\u51fa\u63d0\u793a\u7b26 3\u3002</p>\n<p lang=\"zh\">\u9009\u4e2d\u7684\u63d0\u793a\u7b26\u53d8\u91cf\u503c\u4f1a\u6309\u5b57\u9762\u8f93\u51fa\uff0c\u9664\u975e\u9047\u5230\u767e\u5206\u53f7\uff08<code class=\"literal\">%</code>\uff09\u3002\u6839\u636e\u4e0b\u4e00\u4e2a\u5b57\u7b26\u7684\u4e0d\u540c\uff0c\u4f1a\u66ff\u6362\u6210\u67d0\u4e9b\u5176\u4ed6\u6587\u672c\u3002\u5df2\u5b9a\u4e49\u7684\u66ff\u6362\u5982\u4e0b\uff1a</p>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-PROMPTING-M-UC\"><span class=\"term\"><code class=\"literal\">%M</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u5b8c\u6574\u4e3b\u673a\u540d\uff08\u542b\u57df\u540d\uff09\uff1b\u5982\u679c\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\uff0c\u5219\u4e3a<code class=\"literal\">[local]</code>\uff1b\u5982\u679c Unix \u57df\u5957\u63a5\u5b57\u4e0d\u5728\u7f16\u8bd1\u65f6\u6307\u5b9a\u7684\u9ed8\u8ba4\u4f4d\u7f6e\uff0c\u5219\u4e3a<code class=\"literal\">[local:<em class=\"replaceable\"><code>/dir/name</code></em>]</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-M-LC\"><span class=\"term\"><code class=\"literal\">%m</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684\u4e3b\u673a\u540d\uff0c\u5728\u7b2c\u4e00\u4e2a\u70b9\u53f7\u5904\u622a\u65ad\uff1b\u5982\u679c\u901a\u8fc7 Unix \u57df\u5957\u63a5\u5b57\u8fde\u63a5\uff0c\u5219\u4e3a<code class=\"literal\">[local]</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-GT\"><span class=\"term\"><code class=\"literal\">%&gt;</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u670d\u52a1\u5668\u76d1\u542c\u7684\u7aef\u53e3\u53f7\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-N\"><span class=\"term\"><code class=\"literal\">%n</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6570\u636e\u5e93\u4f1a\u8bdd\u7528\u6237\u540d\u3002\uff08\u5728\u6570\u636e\u5e93\u4f1a\u8bdd\u671f\u95f4\uff0c<code class=\"command\">SET SESSION AUTHORIZATION</code>\u547d\u4ee4\u53ef\u80fd\u6539\u53d8\u8be5\u503c\u7684\u6269\u5c55\u7ed3\u679c\u3002\uff09</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-S\"><span class=\"term\"><code class=\"literal\">%s</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u670d\u52a1\u540d\u79f0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-SLASH\"><span class=\"term\"><code class=\"literal\">%/</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u6570\u636e\u5e93\u7684\u540d\u79f0\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-TILDE\"><span class=\"term\"><code class=\"literal\">%~</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7c7b\u4f3c <code class=\"literal\">%/</code>\uff0c\u4f46\u5982\u679c\u8be5\u6570\u636e\u5e93\u662f\u4f60\u7684\u9ed8\u8ba4\u6570\u636e\u5e93\uff0c\u5219\u8f93\u51fa <code class=\"literal\">~</code>\uff08\u6ce2\u6d6a\u53f7\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-NUMBERSIGN\"><span class=\"term\"><code class=\"literal\">%#</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u4f1a\u8bdd\u7528\u6237\u662f\u6570\u636e\u5e93\u8d85\u7ea7\u7528\u6237\uff0c\u5219\u4e3a<code class=\"literal\">#</code>\uff0c\u5426\u5219\u4e3a<code class=\"literal\">&gt;</code>\u3002\uff08\u5728\u6570\u636e\u5e93\u4f1a\u8bdd\u671f\u95f4\uff0c<code class=\"command\">SET SESSION AUTHORIZATION</code>\u547d\u4ee4\u53ef\u80fd\u6539\u53d8\u8be5\u503c\u7684\u6269\u5c55\u7ed3\u679c\u3002\uff09</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-P\"><span class=\"term\"><code class=\"literal\">%p</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u6240\u8fde\u63a5\u540e\u7aef\u7684\u8fdb\u7a0b ID\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-P-UC\"><span class=\"term\"><code class=\"literal\">%P</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7ba1\u9053\u72b6\u6001\uff1a\u4e0d\u5728\u7ba1\u9053\u4e2d\u65f6\u4e3a <code class=\"literal\">off</code>\uff0c\u5728\u8fdb\u884c\u4e2d\u7684\u7ba1\u9053\u4e2d\u65f6\u4e3a <code class=\"literal\">on</code>\uff0c\u5728\u5df2\u4e2d\u6b62\u7684\u7ba1\u9053\u4e2d\u65f6\u4e3a <code class=\"literal\">abort</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-R\"><span class=\"term\"><code class=\"literal\">%R</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5728\u63d0\u793a\u7b26 1 \u4e2d\uff0c\u901a\u5e38\u663e\u793a =\uff1b\u4f46\u5982\u679c\u4f1a\u8bdd\u5904\u4e8e\u6761\u4ef6\u5757\u4e2d\u672a\u6fc0\u6d3b\u7684\u5206\u652f\uff0c\u5219\u663e\u793a @\uff1b\u5982\u679c\u5904\u4e8e\u5355\u884c\u6a21\u5f0f\uff0c\u5219\u663e\u793a ^\uff1b\u5982\u679c\u4f1a\u8bdd\u5df2\u65ad\u5f00\u6570\u636e\u5e93\u8fde\u63a5\uff08\u4f8b\u5982 \\connect \u5931\u8d25\u65f6\uff09\uff0c\u5219\u663e\u793a !\u3002\u5728\u63d0\u793a\u7b26 2 \u4e2d\uff0c%R \u4f1a\u66ff\u6362\u4e3a\u8868\u793a psql \u7b49\u5f85\u66f4\u591a\u8f93\u5165\u539f\u56e0\u7684\u5b57\u7b26\uff1a\u547d\u4ee4\u5c1a\u672a\u7ed3\u675f\u65f6\u4e3a -\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684 /* ... */ \u6ce8\u91ca\u65f6\u4e3a *\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u5e26\u5f15\u53f7\u5b57\u7b26\u4e32\u65f6\u4e3a\u5355\u5f15\u53f7\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u5e26\u5f15\u53f7\u6807\u8bc6\u7b26\u65f6\u4e3a\u53cc\u5f15\u53f7\uff1b\u5b58\u5728\u672a\u7ed3\u675f\u7684\u7f8e\u5143\u5f15\u7528\u5b57\u7b26\u4e32\u65f6\u4e3a\u7f8e\u5143\u7b26\u53f7\uff1b\u5b58\u5728\u672a\u5339\u914d\u7684\u5de6\u62ec\u53f7\u65f6\u4e3a (\u3002\u5728\u63d0\u793a\u7b26 3 \u4e2d\uff0c%R \u4e0d\u4ea7\u751f\u4efb\u4f55\u5185\u5bb9\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-X\"><span class=\"term\"><code class=\"literal\">%x</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e8b\u52a1\u72b6\u6001\uff1a\u5982\u679c\u5f53\u524d\u4e0d\u5728\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff1b\u5982\u679c\u5904\u4e8e\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a <code class=\"literal\">*</code>\uff1b\u5982\u679c\u5904\u4e8e\u5931\u8d25\u7684\u4e8b\u52a1\u5757\u4e2d\uff0c\u5219\u4e3a <code class=\"literal\">!</code>\uff1b\u5982\u679c\u4e8b\u52a1\u72b6\u6001\u4e0d\u786e\u5b9a\uff08\u4f8b\u5982\u56e0\u4e3a\u5f53\u524d\u6ca1\u6709\u8fde\u63a5\uff09\uff0c\u5219\u4e3a <code class=\"literal\">?</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-L\"><span class=\"term\"><code class=\"literal\">%l</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5f53\u524d\u8bed\u53e5\u4e2d\u7684\u884c\u53f7\uff0c\u4ece <code class=\"literal\">1</code> \u5f00\u59cb\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-DIGITS\"><span class=\"term\"><code class=\"literal\">%</code><em class=\"replaceable\"><code>digits</code></em></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u66ff\u6362\u4e3a\u6307\u5b9a\u516b\u8fdb\u5236\u4ee3\u7801\u5bf9\u5e94\u7684\u5b57\u7b26\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-NAME\"><span class=\"term\"><code class=\"literal\">%:</code><em class=\"replaceable\"><code>name</code></em><code class=\"literal\">:</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><span class=\"application\">psql</span> \u53d8\u91cf <em class=\"replaceable\"><code>name</code></em> \u7684\u503c\u3002\u8be6\u89c1\u4e0a\u9762\u7684<a class=\"xref\" href=\"/docs/18/app-psql.html#APP-PSQL-VARIABLES\" title=\"\u53d8\u91cf\">\u53d8\u91cf</a>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-COMMAND\"><span class=\"term\"><code class=\"literal\">%`</code><em class=\"replaceable\"><code>command</code></em><code class=\"literal\">`</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><em class=\"replaceable\"><code>command</code></em> \u7684\u8f93\u51fa\uff0c\u7c7b\u4f3c\u666e\u901a\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u53cd\u5f15\u53f7</span>\u201d</span>\u66ff\u6362\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-SQUARE-BRACKETS\"><span class=\"term\"><code class=\"literal\">%[</code> ... <code class=\"literal\">%]</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u63d0\u793a\u7b26\u4e2d\u53ef\u4ee5\u5305\u542b\u7ec8\u7aef\u63a7\u5236\u5b57\u7b26\uff0c\u4f8b\u5982\u6539\u53d8\u63d0\u793a\u6587\u672c\u7684\u989c\u8272\u3001\u80cc\u666f\u6216\u6837\u5f0f\uff0c\u6216\u8005\u6539\u53d8\u7ec8\u7aef\u7a97\u53e3\u6807\u9898\u3002\u4e3a\u4e86\u8ba9 <span class=\"application\">Readline</span> \u7684\u884c\u7f16\u8f91\u529f\u80fd\u6b63\u5e38\u5de5\u4f5c\uff0c\u8fd9\u4e9b\u4e0d\u53ef\u6253\u5370\u7684\u63a7\u5236\u5b57\u7b26\u5fc5\u987b\u7528 <code class=\"literal\">%[</code> \u548c <code class=\"literal\">%]</code> \u5305\u56f4\u8d77\u6765\uff0c\u4ee5\u6807\u8bb0\u4e3a\u4e0d\u53ef\u89c1\u5b57\u7b26\u3002\u63d0\u793a\u7b26\u4e2d\u53ef\u4ee5\u51fa\u73b0\u591a\u7ec4\u8fd9\u6837\u7684\u6807\u8bb0\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; \\set PROMPT1 '%[%033[1;33;40m%]%n@%/%R%[%033[0m%]%# '\n</pre>\n<p lang=\"zh\">\u5176\u6548\u679c\u662f\u5728\u517c\u5bb9 VT100 \u4e14\u652f\u6301\u989c\u8272\u7684\u7ec8\u7aef\u4e0a\uff0c\u751f\u6210\u4e00\u4e2a\u7c97\u4f53\uff08<code class=\"literal\">1;</code>\uff09\u7684\u9ed1\u5e95\u9ec4\u5b57\u63d0\u793a\u7b26\uff08<code class=\"literal\">33;40</code>\uff09\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-PROMPTING-W\"><span class=\"term\"><code class=\"literal\">%w</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u4e0e\u6700\u8fd1\u4e00\u6b21\u8f93\u51fa\u7684 <code class=\"varname\">PROMPT1</code> \u5177\u6709\u76f8\u540c\u5bbd\u5ea6\u7684\u7a7a\u767d\u3002\u8fd9\u53ef\u7528\u4f5c <code class=\"varname\">PROMPT2</code> \u7684\u8bbe\u7f6e\uff0c\u4f7f\u591a\u884c\u8bed\u53e5\u4e0e\u7b2c\u4e00\u884c\u5bf9\u9f50\uff0c\u4f46\u4e0d\u663e\u793a\u53ef\u89c1\u7684\u4e8c\u7ea7\u63d0\u793a\u7b26\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u8981\u5728\u63d0\u793a\u7b26\u4e2d\u63d2\u5165\u767e\u5206\u53f7\uff0c\u8bf7\u5199 %%\u3002\u63d0\u793a\u7b26 1 \u548c 2 \u7684\u9ed8\u8ba4\u503c\u4e3a '%/%R%x%# '\uff0c\u63d0\u793a\u7b26 3 \u7684\u9ed8\u8ba4\u503c\u4e3a '&gt;&gt; '\u3002</p>\n<div class=\"note\">\n<h3 class=\"title\" lang=\"zh\">\u6ce8\u610f</h3>\n<p lang=\"zh\">\u8fd9\u4e2a\u7279\u6027\u662f\u53ef\u803b\u5730\u4ece<span class=\"application\">tcsh</span>\u6284\u88ad\u8fc7\u6765\u7684\u3002</p>\n</div>\n</div>\n<div class=\"refsect3\" id=\"APP-PSQL-READLINE\">\n<h4 lang=\"zh\">\u547d\u4ee4\u884c\u7f16\u8f91</h4>\n<p lang=\"zh\">\u5982\u679c\u53ef\u7528\uff0c<span class=\"application\">psql</span> \u4f1a\u4f7f\u7528<span class=\"application\">Readline</span>\u6216<span class=\"application\">libedit</span>\u5e93\uff0c\u4ee5\u4fbf\u8fdb\u884c\u4fbf\u6377\u7684\u884c\u7f16\u8f91\u548c\u5386\u53f2\u68c0\u7d22\u3002\u5f53<span class=\"application\">psql</span>\u9000\u51fa\u65f6\uff0c\u547d\u4ee4\u5386\u53f2\u4f1a\u81ea\u52a8\u4fdd\u5b58\uff1b\u5f53<span class=\"application\">psql</span>\u542f\u52a8\u65f6\uff0c\u53c8\u4f1a\u91cd\u65b0\u8f7d\u5165\u3002\u8f93\u5165\u4e0a\u7bad\u5934\u6216 control-P \u53ef\u4ee5\u53d6\u56de\u4e4b\u524d\u7684\u884c\u3002</p>\n<p lang=\"zh\">\u5728\u8bb8\u591a\uff08\u7edd\u975e\u5168\u90e8\uff09\u4e0a\u4e0b\u6587\u4e2d\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528 TAB \u8865\u5168\u90e8\u5206\u8f93\u5165\u7684\u5173\u952e\u5b57\u548c SQL \u5bf9\u8c61\u540d\u3002\u4f8b\u5982\uff0c\u5728\u547d\u4ee4\u5f00\u5934\u8f93\u5165<code class=\"literal\">ins</code>\u5e76\u6309\u4e0b TAB \u952e\uff0c\u4f1a\u8865\u5168\u4e3a<code class=\"literal\">insert into</code> \u3002\u7136\u540e\u8f93\u5165\u8868\u540d\u6216\u6a21\u5f0f\u540d\u7684\u51e0\u4e2a\u5b57\u7b26\uff0c\u518d\u6309\u4e0b<code class=\"literal\">TAB</code>\u952e\uff0c\u5c31\u4f1a\u8865\u5168\u5c1a\u672a\u8f93\u5b8c\u7684\u540d\u79f0\uff1b\u5982\u679c\u6709\u591a\u4e2a\u5019\u9009\u9879\uff0c\u5219\u4f1a\u7ed9\u51fa\u53ef\u80fd\u7684\u8865\u5168\u83dc\u5355\u3002\uff08\u5177\u4f53\u53d6\u51b3\u4e8e\u6240\u4f7f\u7528\u7684\u5e93\uff0c\u53ef\u80fd\u9700\u8981\u6309\u591a\u6b21<code class=\"literal\">TAB</code>\u952e\u624d\u80fd\u770b\u5230\u83dc\u5355\u3002\uff09</p>\n<p lang=\"zh\">\u5bf9 SQL \u5bf9\u8c61\u540d\u8fdb\u884c TAB \u8865\u5168\u65f6\uff0c\u9700\u8981\u5411\u670d\u52a1\u5668\u53d1\u9001\u67e5\u8be2\u6765\u67e5\u627e\u53ef\u80fd\u7684\u5339\u914d\u9879\u3002\u5728\u67d0\u4e9b\u4e0a\u4e0b\u6587\u4e2d\uff0c\u8fd9\u53ef\u80fd\u4f1a\u5e72\u6270\u5176\u4ed6\u64cd\u4f5c\u3002\u4f8b\u5982\uff0c\u5728<code class=\"command\">BEGIN</code>\u4e4b\u540e\uff0c\u5982\u679c\u4e2d\u95f4\u53d1\u51fa\u4e86\u4e00\u6b21 TAB \u8865\u5168\u67e5\u8be2\uff0c\u90a3\u4e48\u518d\u53d1\u51fa<code class=\"command\">SET TRANSACTION ISOLATION LEVEL</code>\u5c31\u4e3a\u65f6\u5df2\u665a\u4e86\u3002\u5982\u679c\u6839\u672c\u4e0d\u60f3\u4f7f\u7528 TAB \u8865\u5168\uff0c\u53ef\u4ee5\u628a\u4e0b\u9762\u7684\u5185\u5bb9\u653e\u5230\u4e3b\u76ee\u5f55\u4e2d\u540d\u4e3a<code class=\"filename\">.inputrc</code>\u7684\u6587\u4ef6\u91cc\uff0c\u4ece\u800c\u6c38\u4e45\u5173\u95ed\u5b83\uff1a</p>\n<pre class=\"programlisting\">$if psql\nset disable-completion on\n$endif\n</pre>\n<p lang=\"zh\">\uff08\u8fd9\u4e0d\u662f<span class=\"application\">psql</span>\u800c\u662f\u4e00\u4e2a<span class=\"application\">Readline</span>\u529f\u80fd\u3002\u9605\u8bfb\u5176\u6587\u6863\u4ee5\u83b7\u53d6\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\u3002\uff09</p>\n<p lang=\"zh\"><code class=\"option\">-n</code>\uff08<code class=\"option\">--no-readline</code>\uff09\u547d\u4ee4\u884c\u9009\u9879\u4e5f\u53ef\u7528\u4e8e\u5728\u5355\u6b21\u8fd0\u884c<span class=\"application\">psql</span>\u65f6\u7981\u7528 <span class=\"application\">Readline</span>\u3002\u8fd9\u4f1a\u963b\u6b62TAB \u8865\u5168\u3001\u547d\u4ee4\u884c\u5386\u53f2\u7684\u4f7f\u7528\u6216\u8bb0\u5f55\uff0c\u4ee5\u53ca\u591a\u884c\u547d\u4ee4\u7684\u7f16\u8f91\u3002\u5f53\u4f60\u9700\u8981\u590d\u5236\u7c98\u8d34\u5305\u542b <code class=\"literal\">TAB</code> \u5b57\u7b26\u7684\u6587\u672c\u65f6\uff0c\u5b83\u5c24\u5176\u6709\u7528\u3002</p>\n</div>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PSQL-ENVIRONMENT\">\n<h2 lang=\"zh\">\u73af\u5883</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-ENVIRONMENT-COLUMNS\"><span class=\"term\"><code class=\"envar\">COLUMNS</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c<code class=\"literal\">\\pset columns</code>\u4e3a\u96f6\uff0c\u8fd9\u4e2a\u73af\u5883\u53d8\u91cf\u63a7\u5236\u7528\u4e8e<code class=\"literal\">wrapped</code>\u683c\u5f0f\u7684\u5bbd\u5ea6\u4ee5\u53ca\u7528\u6765\u786e\u5b9a\u8f83\u5bbd\u7684\u8f93\u51fa\u662f\u5426\u9700\u8981\u5206\u9875\u5668\uff0c\u6216\u8005\u662f\u5426\u5e94\u5207\u6362\u5230\u6269\u5c55\u81ea\u52a8\u6a21\u5f0f\u4e2d\u7684\u5782\u76f4\u683c\u5f0f\u7684\u5bbd\u5ea6\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PGDATABASE\"><span class=\"term\"><code class=\"envar\">PGDATABASE</code><br/></span><span class=\"term\"><code class=\"envar\">PGHOST</code><br/></span><span class=\"term\"><code class=\"envar\">PGPORT</code><br/></span><span class=\"term\"><code class=\"envar\">PGUSER</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u9ed8\u8ba4\u8fde\u63a5\u53c2\u6570\uff08\u89c1<a class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a032.15\u00a0\u8282</a>\uff09\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PG-COLOR\"><span class=\"term\"><code class=\"envar\">PG_COLOR</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u6307\u5b9a\u8bca\u65ad\u6d88\u606f\u662f\u5426\u4f7f\u7528\u989c\u8272\u3002\u53ef\u9009\u503c\u4e3a <code class=\"literal\">always</code>\u3001<code class=\"literal\">auto</code>\u548c <code class=\"literal\">never</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PSQL-EDITOR\"><span class=\"term\"><code class=\"envar\">PSQL_EDITOR</code><br/></span><span class=\"term\"><code class=\"envar\">EDITOR</code><br/></span><span class=\"term\"><code class=\"envar\">VISUAL</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p><code class=\"command\">\\e</code>\u3001<code class=\"command\">\\ef</code>\u4ee5\u53ca<code class=\"command\">\\ev</code>\u547d\u4ee4\u6240\u4f7f\u7528\u7684\u7f16\u8f91\u5668\u3002\u4f1a\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u68c0\u67e5\u8fd9\u4e9b\u53d8\u91cf\uff0c\u7b2c\u4e00\u4e2a\u88ab\u8bbe\u7f6e\u7684\u5c06\u88ab\u4f7f\u7528\u3002\u5982\u679c\u90fd\u6ca1\u6709\u88ab\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u662f\u4f7f\u7528Unix\u7cfb\u7edf\u4e0a\u7684<code class=\"filename\">vi</code>\u6216\u8005Windows\u7cfb\u7edf\u4e0a\u7684<code class=\"filename\">notepad.exe</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PSQL-EDITOR-LINENUMBER-ARG\"><span class=\"term\"><code class=\"envar\">PSQL_EDITOR_LINENUMBER_ARG</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5f53 <code class=\"command\">\\e</code>\u3001<code class=\"command\">\\ef</code> \u6216 <code class=\"command\">\\ev</code> \u5e26\u6709\u884c\u53f7\u53c2\u6570\u4f7f\u7528\u65f6\uff0c\u6b64\u53d8\u91cf\u6307\u5b9a\u5c06\u8d77\u59cb\u884c\u53f7\u4f20\u7ed9\u7528\u6237\u7f16\u8f91\u5668\u65f6\u6240\u7528\u7684\u547d\u4ee4\u884c\u53c2\u6570\u3002\u5bf9\u4e8e <span class=\"productname\">Emacs</span> \u6216 <span class=\"productname\">vi</span> \u4e4b\u7c7b\u7684\u7f16\u8f91\u5668\uff0c\u8fd9\u4e2a\u53c2\u6570\u662f\u4e00\u4e2a\u52a0\u53f7\u3002\u5982\u679c\u9009\u9879\u540d\u548c\u884c\u53f7\u4e4b\u95f4\u9700\u8981\u7a7a\u683c\uff0c\u8bf7\u5728\u53d8\u91cf\u503c\u4e2d\u5305\u542b\u672b\u5c3e\u7a7a\u683c\u3002\u4f8b\u5982\uff1a</p>\n<pre class=\"programlisting\">PSQL_EDITOR_LINENUMBER_ARG='+'\nPSQL_EDITOR_LINENUMBER_ARG='--line '\n</pre>\n<p lang=\"zh\">\u5728 Unix \u7cfb\u7edf\u4e0a\u9ed8\u8ba4\u662f<code class=\"literal\">+</code>\uff08\u5bf9\u5e94\u4e8e\u9ed8\u8ba4\u7f16\u8f91\u5668<code class=\"filename\">vi</code>\uff0c\u4e14\u5bf9\u5f88\u591a\u5176\u4ed6\u5e38\u89c1\u7f16\u8f91\u5668\u53ef\u7528\uff09\u3002\u5728 Windows \u7cfb\u7edf\u4e0a\u6ca1\u6709\u9ed8\u8ba4\u503c\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PSQL-HISTORY\"><span class=\"term\"><code class=\"envar\">PSQL_HISTORY</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u547d\u4ee4\u5386\u53f2\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08<code class=\"literal\">~</code>\uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PAGER\"><span class=\"term\"><code class=\"envar\">PSQL_PAGER</code><br/></span><span class=\"term\"><code class=\"envar\">PAGER</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5982\u679c\u67e5\u8be2\u7ed3\u679c\u65e0\u6cd5\u5728\u5c4f\u5e55\u4e0a\u663e\u793a\u5b8c\u6574\uff0c\u5b83\u4eec\u4f1a\u901a\u8fc7\u7ba1\u9053\u4f20\u7ed9\u6b64\u547d\u4ee4\u3002\u5178\u578b\u7684\u503c\u662f<code class=\"literal\">more</code>\u6216<code class=\"literal\">less</code>\u3002\u53ef\u4ee5\u901a\u8fc7\u5c06<code class=\"envar\">PSQL_PAGER</code>\u6216<code class=\"envar\">PAGER</code>\u8bbe\u7f6e\u4e3a\u7a7a\u5b57\u7b26\u4e32\uff0c\u6216\u901a\u8fc7\u8c03\u6574<code class=\"command\">\\pset</code>\u547d\u4ee4\u7684\u4e0e\u5206\u9875\u76f8\u5173\u7684\u9009\u9879\u6765\u7981\u7528\u5206\u9875\u5668\u3002\u8fd9\u4e9b\u53d8\u91cf\u6309\u7167\u5217\u51fa\u7684\u987a\u5e8f\u8fdb\u884c\u68c0\u67e5\uff1b\u4f7f\u7528\u6309\u8be5\u987a\u5e8f\u627e\u5230\u7684\u7b2c\u4e00\u4e2a\u5df2\u8bbe\u7f6e\u7684\u53d8\u91cf\u3002\u5982\u679c\u5b83\u4eec\u90fd\u6ca1\u6709\u8bbe\u7f6e\uff0c\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u5728\u5927\u591a\u6570\u5e73\u53f0\u4e0a\u4f7f\u7528<code class=\"literal\">more</code>\uff0c\u4f46\u5728Cygwin\u4e0a\u4f7f\u7528<code class=\"literal\">less</code>\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PSQL-WATCH-PAGER\"><span class=\"term\"><code class=\"envar\">PSQL_WATCH_PAGER</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u4f7f\u7528 \\watch \u547d\u4ee4\u53cd\u590d\u6267\u884c\u67e5\u8be2\u65f6\uff0c\u9ed8\u8ba4\u4e0d\u4f7f\u7528\u5206\u9875\u7a0b\u5e8f\u3002\u5728 Unix \u7cfb\u7edf\u4e0a\uff0c\u53ef\u4ee5\u5c06 PSQL_WATCH_PAGER \u8bbe\u4e3a\u5206\u9875\u7a0b\u5e8f\u547d\u4ee4\u6765\u6539\u53d8\u6b64\u884c\u4e3a\u3002pspg \u5206\u9875\u7a0b\u5e8f\uff08\u4e0d\u5c5e\u4e8e PostgreSQL\uff0c\u4f46\u8bb8\u591a\u5f00\u6e90\u8f6f\u4ef6\u53d1\u884c\u7248\u90fd\u63d0\u4f9b\u5b83\uff09\u4ee5 --stream \u9009\u9879\u542f\u52a8\u65f6\uff0c\u53ef\u4ee5\u663e\u793a \\watch \u7684\u8f93\u51fa\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-PSQLRC\"><span class=\"term\"><code class=\"envar\">PSQLRC</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u7528\u6237\u7684<code class=\"filename\">.psqlrc</code>\u6587\u4ef6\u7684\u66ff\u4ee3\u4f4d\u7f6e\u3002\u6ce2\u6d6a\u7ebf\uff08<code class=\"literal\">~</code>\uff09\u6269\u5c55\u4f1a\u88ab\u6267\u884c\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-SHELL\"><span class=\"term\"><code class=\"envar\">SHELL</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u88ab<code class=\"command\">\\!</code>\u547d\u4ee4\u6267\u884c\u7684\u547d\u4ee4\u3002</p>\n</p>\n</dd>\n<dt id=\"APP-PSQL-ENVIRONMENT-TMPDIR\"><span class=\"term\"><code class=\"envar\">TMPDIR</code></span> </dt>\n<dd>\n<p lang=\"zh\">\n<p>\u5b58\u50a8\u4e34\u65f6\u6587\u4ef6\u7684\u76ee\u5f55\u3002\u9ed8\u8ba4\u662f<code class=\"filename\">/tmp</code>\u3002</p>\n</p>\n</dd>\n</dl>\n</div>\n<p lang=\"zh\">\u4e0e\u5927\u591a\u6570\u5176\u4ed6 <span class=\"productname\">PostgreSQL</span> \u5de5\u5177\u4e00\u6837\uff0c\u6b64\u5de5\u5177\u4e5f\u4f7f\u7528 <span class=\"application\">libpq</span> \u652f\u6301\u7684\u73af\u5883\u53d8\u91cf\uff08\u89c1<a class=\"xref\" href=\"/docs/18/libpq-envars.html\" title=\"32.15.\u00a0\u73af\u5883\u53d8\u91cf\">\u7b2c\u00a032.15\u00a0\u8282</a>\uff09\u3002</p>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.21.10\">\n<h2 lang=\"zh\">\u6587\u4ef6</h2>\n<div class=\"variablelist\">\n<dl class=\"variablelist\">\n<dt id=\"APP-PSQL-FILES-PSQLRC\" lang=\"zh\"><span class=\"term\"><code class=\"filename\">psqlrc</code> \u548c <code class=\"filename\">~/.psqlrc</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u5982\u679c\u6ca1\u6709<code class=\"option\">-X</code>\u9009\u9879\uff0c\u5728\u8fde\u63a5\u5230\u6570\u636e\u5e93\u540e\u4f46\u5728\u63a5\u6536\u6b63\u5e38\u7684\u547d\u4ee4\u4e4b\u524d\uff0c<span class=\"application\">psql</span>\u4f1a\u5c1d\u8bd5\u4f9d\u6b21\u4ece\u7cfb\u7edf\u7ea7\u7684\u542f\u52a8\u6587\u4ef6\uff08<code class=\"filename\">psqlrc</code>\uff09\u548c\u7528\u6237\u7684\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\uff08<code class=\"filename\">~/.psqlrc</code>\uff09\u4e2d\u8bfb\u53d6\u5e76\u4e14\u6267\u884c\u547d\u4ee4\u3002\u8fd9\u4e9b\u6587\u4ef6\u53ef\u4ee5\u88ab\u7528\u6765\u8bbe\u7f6e\u5ba2\u6237\u7aef\u6216\u8005\u670d\u52a1\u5668\uff0c\u901a\u5e38\u662f\u4e00\u4e9b<code class=\"command\">\\set</code>\u548c<code class=\"command\">SET</code>\u547d\u4ee4\u3002</p>\n<p lang=\"zh\">\u7cfb\u7edf\u8303\u56f4\u7684\u542f\u52a8\u6587\u4ef6\u540d\u4e3a <code class=\"filename\">psqlrc</code>\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u4f1a\u5728\u5b89\u88c5\u7684<span class=\"quote\">\u201c<span class=\"quote\">\u7cfb\u7edf\u914d\u7f6e</span>\u201d</span>\u76ee\u5f55\u4e2d\u67e5\u627e\u5b83\uff0c\u6700\u53ef\u9760\u7684\u8bc6\u522b\u65b9\u5f0f\u662f\u8fd0\u884c <code class=\"literal\">pg_config --sysconfdir</code>\u3002\u901a\u5e38\u8fd9\u4e2a\u76ee\u5f55\u662f\u76f8\u5bf9\u4e8e\u5305\u542b <span class=\"productname\">PostgreSQL</span> \u53ef\u6267\u884c\u6587\u4ef6\u7684\u76ee\u5f55\u7684 <code class=\"filename\">../etc/</code>\u3002\u4e5f\u53ef\u4ee5\u901a\u8fc7 <code class=\"envar\">PGSYSCONFDIR</code> \u73af\u5883\u53d8\u91cf\u663e\u5f0f\u6307\u5b9a\u67e5\u627e\u76ee\u5f55\u3002</p>\n<p lang=\"zh\">\u7528\u6237\u7684\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\u540d\u4e3a<code class=\"filename\">.psqlrc</code>\uff0c\u5e76\u4e14\u5728\u8c03\u7528\u7528\u6237\u7684\u4e3b\u76ee\u5f55\u4e2d\u5bfb\u627e\u3002\u5728Windows\u4e0a\uff0c\u4e2a\u4eba\u542f\u52a8\u6587\u4ef6\u7684\u540d\u79f0\u6539\u4e3a<code class=\"filename\">%APPDATA%\\postgresql\\psqlrc.conf</code>\u3002\u5728\u4efb\u4f55\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e<code class=\"envar\">PSQLRC</code>\u73af\u5883\u53d8\u91cf\u6765\u8986\u76d6\u6b64\u9ed8\u8ba4\u6587\u4ef6\u8def\u5f84\u3002</p>\n<p lang=\"zh\">\u7cfb\u7edf\u8303\u56f4\u7684\u542f\u52a8\u6587\u4ef6\u548c\u7528\u6237\u4e2a\u4eba\u7684\u542f\u52a8\u6587\u4ef6\u90fd\u53ef\u4ee5\u901a\u8fc7\u5728\u6587\u4ef6\u540d\u540e\u9644\u52a0\u8fde\u5b57\u7b26\u548c<span class=\"productname\">PostgreSQL</span>\u7684\u5927\u7248\u672c\u6216\u5c0f\u7248\u672c\u6807\u8bc6\u7b26\u6765\u4f7f\u5176\u4e0e<span class=\"application\">psql</span>\u7248\u672c\u76f8\u5173\uff0c\u4f8b\u5982<code class=\"filename\">~/.psqlrc-18</code>\u6216<code class=\"filename\">~/.psqlrc-18.6</code>\u3002\u6700\u5177\u4f53\u7248\u672c\u5339\u914d\u7684\u6587\u4ef6\u5c06\u4f18\u5148\u8bfb\u53d6\uff0c\u800c\u4e0d\u662f\u975e\u7279\u5b9a\u7248\u672c\u7684\u6587\u4ef6\u3002\u8fd9\u4e9b\u7248\u672c\u540e\u7f00\u662f\u5728\u786e\u5b9a\u6587\u4ef6\u8def\u5f84\u540e\u6dfb\u52a0\u7684\uff0c\u5982\u4e0a\u6240\u8ff0\u3002</p>\n</dd>\n<dt id=\"APP-PSQL-FILES-PSQL-HISTORY\"><span class=\"term\"><code class=\"filename\">.psql_history</code></span> </dt>\n<dd>\n<p lang=\"zh\">\u547d\u4ee4\u884c\u5386\u53f2\u88ab\u5b58\u50a8\u5728\u6587\u4ef6<code class=\"filename\">~/.psql_history</code>\u4e2d\uff0c\u5728 Windows \u4e0a\u5219\u5b58\u50a8\u5728\u6587\u4ef6<code class=\"filename\">%APPDATA%\\postgresql\\psql_history</code>\u4e2d\u3002</p>\n<p lang=\"zh\">\u5386\u53f2\u6587\u4ef6\u7684\u4f4d\u7f6e\u53ef\u4ee5\u901a\u8fc7<code class=\"varname\">HISTFILE</code> <span class=\"application\">psql</span>\u53d8\u91cf\u6216\u8005<code class=\"envar\">PSQL_HISTORY</code>\u73af\u5883\u53d8\u91cf\u663e\u5f0f\u8bbe\u7f6e\u3002</p>\n</dd>\n</dl>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.21.11\">\n<h2 lang=\"zh\">\u6ce8\u89e3</h2>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p><span class=\"application\">psql</span>\u6700\u9002\u5408\u4e0e\u76f8\u540c\u6216\u8f83\u65e7\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\u914d\u5408\u4f7f\u7528\u3002\u5982\u679c\u670d\u52a1\u5668\u7684\u7248\u672c\u6bd4<span class=\"application\">psql</span>\u672c\u8eab\u66f4\u65b0\uff0c\u53cd\u659c\u7ebf\u547d\u4ee4\u7279\u522b\u5bb9\u6613\u5931\u8d25\u3002\u7136\u800c\uff0c<code class=\"literal\">\\d</code>\u7cfb\u5217\u7684\u53cd\u659c\u7ebf\u547d\u4ee4\u5e94\u8be5\u53ef\u4ee5\u5728\u6700\u4f4e\u81f3 9.2 \u7248\u672c\u7684\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\uff0c\u4f46\u4e0d\u4e00\u5b9a\u9002\u7528\u4e8e\u6bd4<span class=\"application\">psql</span>\u672c\u8eab\u66f4\u65b0\u7684\u670d\u52a1\u5668\u3002\u8fd0\u884cSQL\u547d\u4ee4\u548c\u663e\u793a\u67e5\u8be2\u7ed3\u679c\u7684\u4e00\u822c\u529f\u80fd\u4e5f\u5e94\u8be5\u53ef\u4ee5\u5728\u66f4\u65b0\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\u4e0a\u8fd0\u884c\uff0c\u4f46\u4e0d\u80fd\u4fdd\u8bc1\u5728\u6240\u6709\u60c5\u51b5\u4e0b\u90fd\u80fd\u5b9e\u73b0\u3002</p>\n<p>\u5982\u679c\u4f60\u60f3\u7528<span class=\"application\">psql</span>\u8fde\u63a5\u5230\u591a\u4e2a\u5177\u6709\u4e0d\u540c\u5927\u7248\u672c\u7684\u670d\u52a1\u5668\uff0c\u63a8\u8350\u4f7f\u7528\u6700\u65b0\u7248\u672c\u7684<span class=\"application\">psql</span>\u3002\u6216\u8005\uff0c\u4f60\u53ef\u4ee5\u4e3a\u6bcf\u4e00\u4e2a\u5927\u7248\u672c\u4fdd\u7559\u4e00\u4efd<span class=\"application\">psql</span>\u62f7\u8d1d\uff0c\u5e76\u4e14\u9488\u5bf9\u76f8\u5e94\u7684\u670d\u52a1\u5668\u4f7f\u7528\u5339\u914d\u7684\u7248\u672c\u3002\u4f46\u5b9e\u9645\u4e0a\uff0c\u8fd9\u79cd\u989d\u5916\u7684\u9ebb\u70e6\u662f\u4e0d\u5fc5\u8981\u7684\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5728 <span class=\"productname\">PostgreSQL</span> 9.6 \u4e4b\u524d\uff0c<code class=\"option\">-c</code> \u9009\u9879\u610f\u5473\u7740 <code class=\"option\">-X</code>\uff08<code class=\"option\">--no-psqlrc</code>\uff09\uff1b\u73b0\u5728\u5df2\u7ecf\u4e0d\u662f\u8fd9\u6837\u4e86\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u5728<span class=\"productname\">PostgreSQL</span> 8.4 \u4e4b\u524d\uff0c<span class=\"application\">psql</span>\u5141\u8bb8\u4e00\u4e2a\u5355\u5b57\u6bcd\u53cd\u659c\u7ebf\u547d\u4ee4\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u76f4\u63a5\u5199\u5728\u8be5\u547d\u4ee4\u540e\u9762\uff0c\u4e2d\u95f4\u4e0d\u9700\u8981\u7a7a\u767d\u3002\u73b0\u5728\u5219\u8981\u6c42\u7528\u7a7a\u767d\u5206\u9694\u3002</p>\n</li>\n</ul>\n</div>\n</div>\n<div class=\"refsect1\" id=\"id-1.9.4.21.12\">\n<h2 lang=\"zh\">\u7ed9 Windows \u7528\u6237\u7684\u6ce8\u89e3</h2>\n<p lang=\"zh\"><span class=\"application\">psql</span>\u662f\u4e00\u4e2a<span class=\"quote\">\u201c<span class=\"quote\">\u63a7\u5236\u53f0\u5e94\u7528</span>\u201d</span>\u3002\u7531\u4e8e Windows \u7684\u63a7\u5236\u53f0\u7a97\u53e3\u4f7f\u7528\u7684\u662f\u4e00\u79cd\u548c\u7cfb\u7edf\u4e2d\u5176\u4ed6\u5e94\u7528\u4e0d\u540c\u7684\u7f16\u7801\uff0c\u5728<span class=\"application\">psql</span>\u4e2d\u4f7f\u7528 8 \u4f4d\u5b57\u7b26\u65f6\u8981\u7279\u522b\u6ce8\u610f\u3002\u5982\u679c<span class=\"application\">psql</span>\u68c0\u6d4b\u5230\u4e00\u4e2a\u6709\u95ee\u9898\u7684\u63a7\u5236\u53f0\u4ee3\u7801\u9875\uff0c\u5b83\u5c06\u4f1a\u5728\u542f\u52a8\u65f6\u8b66\u544a\u4f60\u3002\u8981\u66f4\u6539\u63a7\u5236\u53f0\u4ee3\u7801\u9875\uff0c\u6709\u4e24\u4ef6\u4e8b\u662f\u5fc5\u8981\u7684\uff1a</p>\n<div class=\"itemizedlist\">\n<ul class=\"itemizedlist\">\n<li class=\"listitem\" lang=\"zh\">\n<p>\u8f93\u5165<strong class=\"userinput\"><code>cmd.exe /c chcp 1252</code></strong>\u53ef\u4ee5\u8bbe\u7f6e\u4ee3\u7801\u9875\uff081252 \u662f\u9002\u7528\u4e8e\u5fb7\u8bed\u7684\u4e00\u4e2a\u4ee3\u7801\u9875\uff0c\u8bf7\u5728\u8fd9\u91cc\u66ff\u6362\u6210\u4f60\u7684\u503c\uff09\u3002\u5982\u679c\u6b63\u5728\u4f7f\u7528 Cygwin\uff0c\u53ef\u4ee5\u628a\u8fd9\u4e2a\u547d\u4ee4\u653e\u5728<code class=\"filename\">/etc/profile</code>\u4e2d\u3002</p>\n</li>\n<li class=\"listitem\" lang=\"zh\">\n<p>\u628a\u63a7\u5236\u53f0\u5b57\u4f53\u8bbe\u7f6e\u4e3a<code class=\"literal\">Lucida Console</code>\uff0c\u56e0\u4e3a\u6805\u683c\u5b57\u4f53\u65e0\u6cd5\u4e0e ANSI \u4ee3\u7801\u9875\u4e00\u8d77\u4f7f\u7528\u3002</p>\n</li>\n</ul>\n</div>\n</div>\n<div class=\"refsect1\" id=\"APP-PSQL-EXAMPLES\">\n<h2 lang=\"zh\">\u793a\u4f8b</h2>\n<p lang=\"zh\">\u7b2c\u4e00\u4e2a\u793a\u4f8b\u5c55\u793a\u4e86\u5982\u4f55\u628a\u4e00\u6761\u547d\u4ee4\u5206\u6563\u5230\u591a\u884c\u8f93\u5165\u4e2d\u3002\u6ce8\u610f\u63d0\u793a\u7b26\u7684\u53d8\u5316\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>CREATE TABLE my_table (</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code> first integer not null default 0,</code></strong>\ntestdb(&gt; <strong class=\"userinput\"><code> second text)</code></strong>\ntestdb-&gt; <strong class=\"userinput\"><code>;</code></strong>\nCREATE TABLE\n</pre>\n<p lang=\"zh\">\u73b0\u5728\u518d\u6765\u770b\u4e00\u4e0b\u8fd9\u4e2a\u8868\u7684\u5b9a\u4e49\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\d my_table</code></strong>\n              Table \"public.my_table\"\n Column |  Type   | Collation | Nullable | Default\n--------+---------+-----------+----------+---------\n first  | integer |           | not null | 0\n second | text    |           |          |\n</pre>\n<p lang=\"zh\">\u73b0\u5728\u6211\u4eec\u628a\u63d0\u793a\u7b26\u6539\u6210\u66f4\u6709\u8da3\u7684\u5f62\u5f0f\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\set PROMPT1 '%n@%m %~%R%# '</code></strong>\npeter@localhost testdb=&gt;\n</pre>\n<p lang=\"zh\">\u5047\u8bbe\u4f60\u5df2\u7ecf\u5411\u8868\u4e2d\u586b\u5165\u6570\u636e\uff0c\u5e76\u60f3\u770b\u4e00\u770b\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; SELECT * FROM my_table;\n first | second\n-------+--------\n     1 | one\n     2 | two\n     3 | three\n     4 | four\n(4 rows)\n</pre>\n<p lang=\"zh\">\u4f60\u53ef\u4ee5\u4f7f\u7528 <code class=\"command\">\\pset</code> \u547d\u4ee4\u4ee5\u4e0d\u540c\u65b9\u5f0f\u663e\u793a\u8868\u683c\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 2</code></strong>\nBorder style is 2.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\n+-------+--------+\n| first | second |\n+-------+--------+\n|     1 | one    |\n|     2 | two    |\n|     3 | three  |\n|     4 | four   |\n+-------+--------+\n(4 rows)\n\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 0</code></strong>\nBorder style is 0.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\nfirst second\n----- ------\n    1 one\n    2 two\n    3 three\n    4 four\n(4 rows)\n\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset border 1</code></strong>\nBorder style is 1.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset format csv</code></strong>\nOutput format is csv.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset tuples_only</code></strong>\nTuples only is on.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT second, first FROM my_table;</code></strong>\none,1\ntwo,2\nthree,3\nfour,4\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset format unaligned</code></strong>\nOutput format is unaligned.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\pset fieldsep '\\t'</code></strong>\nField separator is \"    \".\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT second, first FROM my_table;</code></strong>\none     1\ntwo     2\nthree   3\nfour    4\n</pre>\n<p lang=\"zh\">\u6216\u8005\u4f7f\u7528\u77ed\u547d\u4ee4\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>\\a \\t \\x</code></strong>\nOutput format is aligned.\nTuples only is off.\nExpanded display is on.\npeter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table;</code></strong>\n-[ RECORD 1 ]-\nfirst  | 1\nsecond | one\n-[ RECORD 2 ]-\nfirst  | 2\nsecond | two\n-[ RECORD 3 ]-\nfirst  | 3\nsecond | three\n-[ RECORD 4 ]-\nfirst  | 4\nsecond | four\n</pre>\n<p lang=\"zh\">\u6b64\u5916\uff0c\u53ef\u4ee5\u4f7f\u7528<code class=\"literal\">\\g</code>\u4e3a\u4e00\u4e2a\u67e5\u8be2\u8bbe\u7f6e\u8fd9\u4e9b\u8f93\u51fa\u683c\u5f0f\u9009\u9879\uff1a</p>\n<pre class=\"programlisting\">peter@localhost testdb=&gt; <strong class=\"userinput\"><code>SELECT * FROM my_table</code></strong>\npeter@localhost testdb-&gt; <strong class=\"userinput\"><code>\\g (format=aligned tuples_only=off expanded=on)</code></strong>\n-[ RECORD 1 ]-\nfirst  | 1\nsecond | one\n-[ RECORD 2 ]-\nfirst  | 2\nsecond | two\n-[ RECORD 3 ]-\nfirst  | 3\nsecond | three\n-[ RECORD 4 ]-\nfirst  | 4\nsecond | four\n</pre>\n<p lang=\"zh\">\u4e0b\u9762\u662f\u4e00\u4e2a\u4f7f\u7528 <code class=\"command\">\\df</code> \u547d\u4ee4\u53ea\u67e5\u627e\u540d\u79f0\u5339\u914d <code class=\"literal\">int*pl</code> \u4e14\u7b2c\u4e8c\u4e2a\u53c2\u6570\u7c7b\u578b\u4e3a <code class=\"type\">bigint</code> \u7684\u51fd\u6570\u7684\u793a\u4f8b\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\df int*pl * bigint</code></strong>\n                          List of functions\n   Schema   |  Name   | Result data type | Argument data types | Type\n------------+---------+------------------+---------------------+------\n pg_catalog | int28pl | bigint           | smallint, bigint    | func\n pg_catalog | int48pl | bigint           | integer, bigint     | func\n pg_catalog | int8pl  | bigint           | bigint, bigint      | func\n(3 rows)\n</pre>\n<p lang=\"zh\">\u8fd9\u91cc\uff0c<code class=\"literal\">+</code> \u9009\u9879\u7528\u4e8e\u663e\u793a\u5176\u4e2d\u4e00\u4e2a\u51fd\u6570\u7684\u9644\u52a0\u4fe1\u606f\uff0c\u800c <code class=\"literal\">x</code> \u7528\u4e8e\u4ee5\u6269\u5c55\u6a21\u5f0f\u663e\u793a\u7ed3\u679c\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>\\df+x int*pl integer bigint</code></strong>\nList of functions\n-[ RECORD 1 ]-------+-----------------------------\nSchema              | pg_catalog\nName                | int48pl\nResult data type    | bigint\nArgument data types | integer, bigint\nType                | func\nVolatility          | immutable\nParallel            | safe\nOwner               | postgres\nSecurity            | invoker\nLeakproof?          | no\nAccess privileges   |\nLanguage            | internal\nInternal name       | int48pl\nDescription         | implementation of + operator\n</pre>\n<p lang=\"zh\">\u5728\u9002\u5408\u7684\u60c5\u51b5\u4e0b\uff0c\u53ef\u4ee5\u4f7f\u7528 <code class=\"command\">\\crosstabview</code> \u547d\u4ee4\u5c06\u67e5\u8be2\u7ed3\u679c\u663e\u793a\u4e3a\u4ea4\u53c9\u8868\uff1a</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>SELECT first, second, first &gt; 2 AS gt2 FROM my_table;</code></strong>\n first | second | gt2\n-------+--------+-----\n     1 | one    | f\n     2 | two    | f\n     3 | three  | t\n     4 | four   | t\n(4 rows)\n\ntestdb=&gt; <strong class=\"userinput\"><code>\\crosstabview first second</code></strong>\n first | one | two | three | four\n-------+-----+-----+-------+------\n     1 | f   |     |       |\n     2 |     | f   |       |\n     3 |     |     | t     |\n     4 |     |     |       | t\n(4 rows)\n</pre>\n<p lang=\"zh\">\u7b2c\u4e8c\u4e2a\u793a\u4f8b\u5c55\u793a\u4e86\u4e00\u4e2a\u4e58\u6cd5\u8868\uff0c\u5176\u4e2d\u884c\u6309\u6570\u5b57\u5012\u5e8f\u6392\u5217\uff0c\u800c\u5217\u6309\u72ec\u7acb\u7684\u5347\u5e8f\u6570\u5b57\u6392\u5217\u3002</p>\n<pre class=\"programlisting\">testdb=&gt; <strong class=\"userinput\"><code>SELECT t1.first as \"A\", t2.first+100 AS \"B\", t1.first*(t2.first+100) as \"AxB\",</code></strong>\ntestdb-&gt; <strong class=\"userinput\"><code>row_number() over(order by t2.first) AS ord</code></strong>\ntestdb-&gt; <strong class=\"userinput\"><code>FROM my_table t1 CROSS JOIN my_table t2 ORDER BY 1 DESC</code></strong>\ntestdb-&gt; <strong class=\"userinput\"><code>\\crosstabview \"A\" \"B\" \"AxB\" ord</code></strong>\n A | 101 | 102 | 103 | 104\n---+-----+-----+-----+-----\n 4 | 404 | 408 | 412 | 416\n 3 | 303 | 306 | 309 | 312\n 2 | 202 | 204 | 206 | 208\n 1 | 101 | 102 | 103 | 104\n(4 rows)\n</pre>\n</div>\n</div></div>", "manual_path": "app-psql.html", "localization": {"status": "complete", "sources": [{"url": "/docs/18/app-psql.html", "method": "same-major semantic node", "sha256": "4ff5633229e0afa7feecc2750a7187d2d45a7eef0ca8febc73e4e5c15ac7fa6d", "language": "zh", "matched_nodes": ["#APP-PSQL/div[10]/div[1]/ul[0]/li[0]", "#APP-PSQL/div[10]/div[1]/ul[0]/li[1]", "#APP-PSQL/div[10]/div[1]/ul[0]/li[2]", "#APP-PSQL/div[10]/h2[0]", "#APP-PSQL/div[11]/div[2]/ul[0]/li[0]", "#APP-PSQL/div[11]/div[2]/ul[0]/li[1]", "#APP-PSQL/div[11]/h2[0]", "#APP-PSQL/div[11]/p[1]", "#APP-PSQL/div[12]/p[11]", "#APP-PSQL/div[12]/p[13]", "#APP-PSQL/div[12]/p[15]", "#APP-PSQL/div[12]/p[17]", "#APP-PSQL/div[12]/p[19]", "#APP-PSQL/div[12]/p[1]", "#APP-PSQL/div[12]/p[21]", "#APP-PSQL/div[12]/p[3]", "#APP-PSQL/div[12]/p[5]", "#APP-PSQL/div[12]/p[7]", "#APP-PSQL/div[12]/p[9]", "#APP-PSQL/div[2]/p[1]", "#APP-PSQL/div[3]/h2[0]", "#APP-PSQL/div[4]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[11]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[13]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[15]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[17]/p[2]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[19]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[21]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[23]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[25]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[25]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[27]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[29]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[31]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[35]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[37]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[39]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[3]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[41]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]/div[1]/h3[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]/div[1]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[43]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[45]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[47]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[49]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[51]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[53]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[55]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[55]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[57]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[57]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[59]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[5]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[61]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[63]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[65]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[67]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[67]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[69]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[0]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[1]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[3]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[5]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[6]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[7]/p[7]", "#APP-PSQL/div[5]/div[1]/dl[0]/dd[9]", "#APP-PSQL/div[6]/h2[0]", "#APP-PSQL/div[6]/p[1]", "#APP-PSQL/div[7]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[1]/p[1]", "#APP-PSQL/div[7]/div[1]/p[2]", "#APP-PSQL/div[7]/div[1]/p[5]", "#APP-PSQL/div[7]/div[1]/p[6]", "#APP-PSQL/div[7]/div[1]/p[7]", "#APP-PSQL/div[7]/div[2]/h3[0]", "#APP-PSQL/div[7]/div[2]/p[1]", "#APP-PSQL/div[7]/div[2]/p[3]", "#APP-PSQL/div[7]/div[2]/p[4]", "#APP-PSQL/div[7]/div[2]/p[5]", "#APP-PSQL/div[7]/div[2]/p[6]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[101]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[103]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[105]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[105]/div[4]/p[1]/a[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[105]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[105]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[105]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[105]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[107]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[107]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[107]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[109]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[109]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[109]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[109]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[111]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[113]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[115]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[115]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[115]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[115]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[117]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[119]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[119]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[119]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[119]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[119]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[11]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[11]/div[1]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[11]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[121]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[121]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[123]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[125]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[127]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[127]/p[0]/a[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[127]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[127]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[127]/p[5]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[131]/div[2]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[131]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[131]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[133]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[135]/div[2]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[135]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[135]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[137]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[137]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[137]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[137]/p[5]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[137]/p[6]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[139]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[13]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[13]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[141]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[143]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[145]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[145]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[145]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[147]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[149]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[151]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[151]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[151]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[151]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[153]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[155]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[155]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[157]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[159]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[159]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[15]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[15]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[15]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[15]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[15]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[17]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[17]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[17]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[17]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[21]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[23]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[23]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[29]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[31]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[31]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[37]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[41]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[43]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[43]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[43]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dt[30]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dt[32]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dt[34]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[3]/dl[0]/dt[6]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/div[5]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[161]/p[4]/a[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[163]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[165]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[167]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[169]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[171]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[173]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[173]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[173]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[173]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[173]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[175]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[177]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[177]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[179]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[179]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[179]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[17]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[17]/div[5]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[17]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[17]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[17]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[181]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[181]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[181]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[181]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[181]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[181]/p[5]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[183]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[185]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[187]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[189]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[189]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[191]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[191]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[193]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[195]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[197]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[199]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[201]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[201]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[203]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[203]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[205]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[207]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[207]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[207]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[207]/p[5]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[21]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[21]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[21]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[23]/div[4]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[23]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[23]/p[0]/a[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[23]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[23]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[23]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[25]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[29]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[31]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[37]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[3]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[3]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[3]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[3]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[41]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[43]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[45]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[45]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[45]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[47]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[49]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[49]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[51]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[53]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[55]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[57]/div[1]/h3[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[57]/div[1]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[57]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[59]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[5]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[5]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[61]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[63]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[65]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[67]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[69]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[71]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[73]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[75]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[77]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[79]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[7]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[7]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[7]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[7]/p[3]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[7]/p[4]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[81]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[83]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[83]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[85]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[85]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[85]/p[2]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[87]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[87]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[89]/p[0]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[89]/p[1]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[91]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[93]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[95]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[97]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[99]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[104]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[130]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[132]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[134]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[138]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[140]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[150]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[152]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[162]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[166]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[192]", "#APP-PSQL/div[7]/div[3]/div[11]/dl[0]/dt[6]", "#APP-PSQL/div[7]/div[3]/div[12]/p[2]", "#APP-PSQL/div[7]/div[3]/div[12]/p[3]", "#APP-PSQL/div[7]/div[3]/div[12]/p[4]", "#APP-PSQL/div[7]/div[3]/div[12]/p[6]", "#APP-PSQL/div[7]/div[3]/div[12]/p[7]", "#APP-PSQL/div[7]/div[3]/h3[0]", "#APP-PSQL/div[7]/div[3]/p[10]", "#APP-PSQL/div[7]/div[3]/p[1]", "#APP-PSQL/div[7]/div[3]/p[2]", "#APP-PSQL/div[7]/div[3]/p[3]", "#APP-PSQL/div[7]/div[3]/p[4]", "#APP-PSQL/div[7]/div[3]/p[4]/a[2]", "#APP-PSQL/div[7]/div[3]/p[5]", "#APP-PSQL/div[7]/div[3]/p[7]", "#APP-PSQL/div[7]/div[3]/p[8]", "#APP-PSQL/div[7]/div[3]/p[9]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[15]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[15]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[17]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/div[2]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[1]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[21]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[21]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[23]/p[0]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[23]/p[2]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[33]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[39]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[41]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[43]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[45]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[47]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[47]/p[0]/a[1]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[49]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[53]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[55]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[57]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[59]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[61]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[63]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[65]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[67]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[69]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[71]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[73]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[75]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[77]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[4]/div[1]/div[12]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[4]/div[1]/div[8]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/p[10]", "#APP-PSQL/div[7]/div[4]/div[1]/p[11]", "#APP-PSQL/div[7]/div[4]/div[1]/p[1]", "#APP-PSQL/div[7]/div[4]/div[1]/p[2]", "#APP-PSQL/div[7]/div[4]/div[1]/p[4]", "#APP-PSQL/div[7]/div[4]/div[1]/p[6]", "#APP-PSQL/div[7]/div[4]/div[1]/p[7]", "#APP-PSQL/div[7]/div[4]/div[1]/p[9]", "#APP-PSQL/div[7]/div[4]/div[2]/p[10]", "#APP-PSQL/div[7]/div[4]/div[2]/p[11]", "#APP-PSQL/div[7]/div[4]/div[2]/p[12]", "#APP-PSQL/div[7]/div[4]/div[2]/p[1]", "#APP-PSQL/div[7]/div[4]/div[2]/p[3]", "#APP-PSQL/div[7]/div[4]/div[2]/p[4]", "#APP-PSQL/div[7]/div[4]/div[2]/p[6]", "#APP-PSQL/div[7]/div[4]/div[2]/p[7]", "#APP-PSQL/div[7]/div[4]/div[2]/p[9]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[11]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[13]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[15]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[17]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[19]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[1]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[23]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[25]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[27]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[29]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[31]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[33]/p[0]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[33]/p[2]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[35]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[3]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[5]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[7]", "#APP-PSQL/div[7]/div[4]/div[3]/div[3]/dl[0]/dd[9]", "#APP-PSQL/div[7]/div[4]/div[3]/div[5]/p[1]", "#APP-PSQL/div[7]/div[4]/div[3]/p[1]", "#APP-PSQL/div[7]/div[4]/div[3]/p[2]", "#APP-PSQL/div[7]/div[4]/div[4]/h4[0]", "#APP-PSQL/div[7]/div[4]/div[4]/p[3]", "#APP-PSQL/div[7]/div[4]/div[4]/p[4]", "#APP-PSQL/div[7]/div[4]/div[4]/p[5]", "#APP-PSQL/div[7]/div[4]/div[4]/p[7]", "#APP-PSQL/div[7]/div[4]/div[4]/p[8]", "#APP-PSQL/div[7]/div[4]/h3[0]", "#APP-PSQL/div[7]/h2[0]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[11]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[13]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[17]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[19]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[1]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[21]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[3]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[5]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[7]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]/p[0]", "#APP-PSQL/div[8]/div[1]/dl[0]/dd[9]/p[2]", "#APP-PSQL/div[8]/p[2]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[0]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[1]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[2]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[1]/p[3]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[3]/p[0]", "#APP-PSQL/div[9]/div[1]/dl[0]/dd[3]/p[1]", "#APP-PSQL/div[9]/div[1]/dl[0]/dt[0]", "#APP-PSQL/div[9]/h2[0]"]}, {"url": "/docs/18/indexes-index-only-scans.html", "method": "same-major semantic node", "sha256": "3433104d8b02c78dc0b08de1ab2d9f46c731577dfb71cd7805a9ee87bb0c2c0a", "language": "zh", "matched_nodes": ["#INDEXES-INDEX-ONLY-SCANS/p[25]/span[2]"]}], "language": "zh", "original_text": {"/versions/18/description/0": "psql \u2014 PostgreSQL interactive terminal", "/versions/18/facts/0/label": "Documented executable", "/versions/18/facts/1/label": "Executable version", "/versions/18/facts/2/label": "Reference inventory", "/versions/18/facts/2/value": "Client applications", "/versions/18/facts/3/label": "Option definition groups", "/versions/18/tables/0/title": "Documented options", "/versions/18/tables/1/title": "Environment variables", "/versions/18/related/0/label": "psql meta-commands", "/versions/18/related/1/label": "libpq connection parameters", "/versions/18/tables/0/rows/0/summary": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all .", "/versions/18/tables/0/rows/1/summary": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned .", "/versions/18/tables/0/rows/2/summary": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors .", "/versions/18/tables/0/rows/3/summary": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence.", "/versions/18/tables/0/rows/4/summary": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv .", "/versions/18/tables/0/rows/5/summary": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options.", "/versions/18/tables/0/rows/6/summary": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries .", "/versions/18/tables/0/rows/7/summary": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on .", "/versions/18/tables/0/rows/8/summary": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i .", "/versions/18/tables/0/rows/9/summary": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f .", "/versions/18/tables/0/columns/0/label": "Option and arguments", "/versions/18/tables/0/columns/1/label": "Description", "/versions/18/tables/0/rows/10/summary": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket.", "/versions/18/tables/0/rows/11/summary": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command.", "/versions/18/tables/0/rows/12/summary": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list .", "/versions/18/tables/0/rows/13/summary": "Write all query output into file filename , in addition to the normal output destination.", "/versions/18/tables/0/rows/14/summary": "Do not use Readline for line editing and do not use the command history (see the section called \u201cCommand-Line Editing\u201d below).", "/versions/18/tables/0/rows/15/summary": "Put all query output into file filename . This is equivalent to the command \\o .", "/versions/18/tables/0/rows/16/summary": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432.", "/versions/18/tables/0/rows/17/summary": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex .", "/versions/18/tables/0/rows/18/summary": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on .", "/versions/18/tables/0/rows/19/summary": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep .", "/versions/18/tables/0/rows/20/summary": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts.", "/versions/18/tables/0/rows/21/summary": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does.", "/versions/18/tables/0/rows/22/summary": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only .", "/versions/18/tables/0/rows/23/summary": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details.", "/versions/18/tables/0/rows/24/summary": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)", "/versions/18/tables/0/rows/25/summary": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later.", "/versions/18/tables/0/rows/26/summary": "Print the psql version and exit.", "/versions/18/tables/0/rows/27/summary": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password.", "/versions/18/tables/0/rows/28/summary": "Force psql to prompt for a password before connecting to a database, even if the password will not be used.", "/versions/18/tables/0/rows/29/summary": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded .", "/versions/18/tables/0/rows/30/summary": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file).", "/versions/18/tables/0/rows/31/summary": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero .", "/versions/18/tables/0/rows/32/summary": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero .", "/versions/18/tables/0/rows/33/summary": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied.", "/versions/18/tables/0/rows/34/summary": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables.", "/versions/18/tables/1/columns/0/label": "Variable", "/versions/18/tables/1/columns/1/label": "Meaning", "/versions/18/tables/1/rows/0/description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode.", "/versions/18/tables/1/rows/1/description": "Default connection parameters (see Section 32.15 ).", "/versions/18/tables/1/rows/2/description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never .", "/versions/18/tables/1/rows/3/description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems.", "/versions/18/tables/1/rows/4/description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems.", "/versions/18/tables/1/rows/5/description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed.", "/versions/18/tables/1/rows/6/description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If neither of them is set, the default is to use more on most platforms, but less on Cygwin.", "/versions/18/tables/1/rows/7/description": "When a query is executed repeatedly with the \\watch command, a pager is not used by default. This behavior can be changed by setting PSQL_WATCH_PAGER to a pager command, on Unix systems. The pspg pager (not part of PostgreSQL but available in many open source software distributions) can display the output of \\watch if started with the option --stream .", "/versions/18/tables/1/rows/8/description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed.", "/versions/18/tables/1/rows/9/description": "Command executed by the \\! command.", "/versions/18/tables/1/rows/10/description": "Directory for storing temporary files. The default is /tmp ."}, "fallback_fields": [], "source_language": "en", "original_snapshot_sha256": "d18bbfb49a4cc89a98678a6903511d5b896ca4f873a401899f6b203300909100"}, "comparison_data": {"options": [{"names": ["-a", "--echo-all"], "signature": "-a --echo-all", "description": "Print all nonempty input lines to standard output as they are read. (This does not apply to lines read interactively.) This is equivalent to setting the variable ECHO to all ."}, {"names": ["-A", "--no-align"], "signature": "-A --no-align", "description": "Switches to unaligned output mode. (The default output mode is aligned .) This is equivalent to \\pset format unaligned ."}, {"names": ["-b", "--echo-errors"], "signature": "-b --echo-errors", "description": "Print failed SQL commands to standard error output. This is equivalent to setting the variable ECHO to errors ."}, {"names": ["-c command", "--command= command"], "signature": "-c command --command= command", "description": "Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. command must be either a command string that is completely parsable by the server (i.e., it contains no psql -specific features), or a single backslash command. Thus you cannot mix SQL and psql meta-commands within a -c option. To achieve that, you could use repeated -c options or pipe the string into psql , for example: psql -c '\\x' -c 'SELECT * FROM foo;' or echo '\\x \\\\ SELECT * FROM foo;' | psql ( \\\\ is the separator meta-command.) Each SQL command string passed to -c is sent to the server as a single request. Because of this, the server executes it as a single transaction even if the string contains multiple SQL commands, unless there are explicit BEGIN / COMMIT commands included in the string to divide it into multiple transactions. (See Section 54.2.2.1 for more details about how the server handles multi-query strings.) If having several commands executed in one transaction is not desired, use repeated -c commands or feed multiple commands to psql 's standard input, either using echo as illustrated above, or via a shell here-document, for example: psql <<EOF \\x SELECT * FROM foo; EOF"}, {"names": ["--csv"], "signature": "--csv", "description": "Switches to CSV (Comma-Separated Values) output mode. This is equivalent to \\pset format csv ."}, {"names": ["-d dbname", "--dbname= dbname"], "signature": "-d dbname --dbname= dbname", "description": "Specifies the name of the database to connect to. This is equivalent to specifying dbname as the first non-option argument on the command line. The dbname can be a connection string . If so, connection string parameters will override any conflicting command line options."}, {"names": ["-e", "--echo-queries"], "signature": "-e --echo-queries", "description": "Copy all SQL commands sent to the server to standard output as well. This is equivalent to setting the variable ECHO to queries ."}, {"names": ["-E", "--echo-hidden"], "signature": "-E --echo-hidden", "description": "Echo the actual queries generated by \\d and other backslash commands. You can use this to study psql 's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on ."}, {"names": ["-f filename", "--file= filename"], "signature": "-f filename --file= filename", "description": "Read commands from the file filename , rather than standard input. This option can be repeated and combined in any order with the -c option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. Except for that, this option is largely equivalent to the meta-command \\i . If filename is - (hyphen), then standard input is read until an EOF indication or \\q meta-command. This can be used to intersperse interactive input with input from files. Note however that Readline is not used in this case (much as if -n had been specified). Using this option is subtly different from writing psql < filename . In general, both will do what you expect, but using -f enables some nice features such as error messages with line numbers. There is also a slight chance that using this option will reduce the start-up overhead. On the other hand, the variant using the shell's input redirection is (in theory) guaranteed to yield exactly the same output you would have received had you entered everything by hand."}, {"names": ["-F separator", "--field-separator= separator"], "signature": "-F separator --field-separator= separator", "description": "Use separator as the field separator for unaligned output. This is equivalent to \\pset fieldsep or \\f ."}, {"names": ["-h hostname", "--host= hostname"], "signature": "-h hostname --host= hostname", "description": "Specifies the host name of the machine on which the server is running. If the value begins with a slash, it is used as the directory for the Unix-domain socket."}, {"names": ["-H", "--html"], "signature": "-H --html", "description": "Switches to HTML output mode. This is equivalent to \\pset format html or the \\H command."}, {"names": ["-l", "--list"], "signature": "-l --list", "description": "List all available databases, then exit. Other non-connection options are ignored. This is similar to the meta-command \\list . When this option is used, psql will connect to the database postgres , unless a different database is named on the command line (option -d or non-option argument, possibly via a service entry, but not via an environment variable)."}, {"names": ["-L filename", "--log-file= filename"], "signature": "-L filename --log-file= filename", "description": "Write all query output into file filename , in addition to the normal output destination."}, {"names": ["-n", "--no-readline"], "signature": "-n --no-readline", "description": "Do not use Readline for line editing and do not use the command history (see the section called \u201cCommand-Line Editing\u201d below)."}, {"names": ["-o filename", "--output= filename"], "signature": "-o filename --output= filename", "description": "Put all query output into file filename . This is equivalent to the command \\o ."}, {"names": ["-p port", "--port= port"], "signature": "-p port --port= port", "description": "Specifies the TCP port or the local Unix-domain socket file extension on which the server is listening for connections. Defaults to the value of the PGPORT environment variable or, if not set, to the port specified at compile time, usually 5432."}, {"names": ["-P assignment", "--pset= assignment"], "signature": "-P assignment --pset= assignment", "description": "Specifies printing options, in the style of \\pset . Note that here you have to separate name and value with an equal sign instead of a space. For example, to set the output format to LaTeX , you could write -P format=latex ."}, {"names": ["-q", "--quiet"], "signature": "-q --quiet", "description": "Specifies that psql should do its work quietly. By default, it prints welcome messages and various informational output. If this option is used, none of this happens. This is useful with the -c option. This is equivalent to setting the variable QUIET to on ."}, {"names": ["-R separator", "--record-separator= separator"], "signature": "-R separator --record-separator= separator", "description": "Use separator as the record separator for unaligned output. This is equivalent to \\pset recordsep ."}, {"names": ["-s", "--single-step"], "signature": "-s --single-step", "description": "Run in single-step mode. That means the user is prompted before each command is sent to the server, with the option to cancel execution as well. Use this to debug scripts."}, {"names": ["-S", "--single-line"], "signature": "-S --single-line", "description": "Runs in single-line mode where a newline terminates an SQL command, as a semicolon does. Note This mode is provided for those who insist on it, but you are not necessarily encouraged to use it. In particular, if you mix SQL and meta-commands on a line the order of execution might not always be clear to the inexperienced user."}, {"names": ["-t", "--tuples-only"], "signature": "-t --tuples-only", "description": "Turn off printing of column names and result row count footers, etc. This is equivalent to \\t or \\pset tuples_only ."}, {"names": ["-T table_options", "--table-attr= table_options"], "signature": "-T table_options --table-attr= table_options", "description": "Specifies options to be placed within the HTML table tag. See \\pset tableattr for details."}, {"names": ["-U username", "--username= username"], "signature": "-U username --username= username", "description": "Connect to the database as the user username instead of the default. (You must have permission to do so, of course.)"}, {"names": ["-v assignment", "--set= assignment", "--variable= assignment"], "signature": "-v assignment --set= assignment --variable= assignment", "description": "Perform a variable assignment, like the \\set meta-command. Note that you must separate name and value, if any, by an equal sign on the command line. To unset a variable, leave off the equal sign. To set a variable with an empty value, use the equal sign but leave off the value. These assignments are done during command line processing, so variables that reflect connection state will get overwritten later."}, {"names": ["-V", "--version"], "signature": "-V --version", "description": "Print the psql version and exit."}, {"names": ["-w", "--no-password"], "signature": "-w --no-password", "description": "Never issue a password prompt. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, the connection attempt will fail. This option can be useful in batch jobs and scripts where no user is present to enter a password. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-W", "--password"], "signature": "-W --password", "description": "Force psql to prompt for a password before connecting to a database, even if the password will not be used. If the server requires password authentication and a password is not available from other sources such as a .pgpass file, psql will prompt for a password in any case. However, psql will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. Note that this option will remain set for the entire session, and so it affects uses of the meta-command \\connect as well as the initial connection attempt."}, {"names": ["-x", "--expanded"], "signature": "-x --expanded", "description": "Turn on the expanded table formatting mode. This is equivalent to \\x or \\pset expanded ."}, {"names": ["-X", "--no-psqlrc"], "signature": "-X --no-psqlrc", "description": "Do not read the start-up file (neither the system-wide psqlrc file nor the user's ~/.psqlrc file)."}, {"names": ["-z", "--field-separator-zero"], "signature": "-z --field-separator-zero", "description": "Set the field separator for unaligned output to a zero byte. This is equivalent to \\pset fieldsep_zero ."}, {"names": ["-0", "--record-separator-zero"], "signature": "-0 --record-separator-zero", "description": "Set the record separator for unaligned output to a zero byte. This is useful for interfacing, for example, with xargs -0 . This is equivalent to \\pset recordsep_zero ."}, {"names": ["-1", "--single-transaction"], "signature": "-1 --single-transaction", "description": "This option can only be used in combination with one or more -c and/or -f options. It causes psql to issue a BEGIN command before the first such option and a COMMIT command after the last one, thereby wrapping all the commands into a single transaction. If any of the commands fails and the variable ON_ERROR_STOP was set, a ROLLBACK command is sent instead. This ensures that either all the commands complete successfully, or no changes are applied. If the commands themselves contain BEGIN , COMMIT , or ROLLBACK , this option will not have the desired effects. Also, if an individual command cannot be executed inside a transaction block, specifying this option will cause the whole transaction to fail."}, {"names": ["-?", "--help[= topic ]"], "signature": "-? --help[= topic ]", "description": "Show help about psql and exit. The optional topic parameter (defaulting to options ) selects which part of psql is explained: commands describes psql 's backslash commands; options describes the command-line options that can be passed to psql ; and variables shows help about psql configuration variables."}], "synopsis": ["psql [ option ...] [ dbname [ username ]]"], "environment": [{"name": "COLUMNS", "description": "If \\pset columns is zero, controls the width for the wrapped format and width for determining if wide output requires the pager or should be switched to the vertical format in expanded auto mode."}, {"name": "PGDATABASE PGHOST PGPORT PGUSER", "description": "Default connection parameters (see Section 32.15 )."}, {"name": "PG_COLOR", "description": "Specifies whether to use color in diagnostic messages. Possible values are always , auto and never ."}, {"name": "PSQL_EDITOR EDITOR VISUAL", "description": "Editor used by the \\e , \\ef , and \\ev commands. These variables are examined in the order listed; the first that is set is used. If none of them is set, the default is to use vi on Unix systems or notepad.exe on Windows systems."}, {"name": "PSQL_EDITOR_LINENUMBER_ARG", "description": "When \\e , \\ef , or \\ev is used with a line number argument, this variable specifies the command-line argument used to pass the starting line number to the user's editor. For editors such as Emacs or vi , this is a plus sign. Include a trailing space in the value of the variable if there needs to be space between the option name and the line number. Examples: PSQL_EDITOR_LINENUMBER_ARG='+' PSQL_EDITOR_LINENUMBER_ARG='--line ' The default is + on Unix systems (corresponding to the default editor vi , and useful for many other common editors); but there is no default on Windows systems."}, {"name": "PSQL_HISTORY", "description": "Alternative location for the command history file. Tilde ( ~ ) expansion is performed."}, {"name": "PSQL_PAGER PAGER", "description": "If a query's results do not fit on the screen, they are piped through this command. Typical values are more or less . Use of the pager can be disabled by setting PSQL_PAGER or PAGER to an empty string, or by adjusting the pager-related options of the \\pset command. These variables are examined in the order listed; the first that is set is used. If neither of them is set, the default is to use more on most platforms, but less on Cygwin."}, {"name": "PSQL_WATCH_PAGER", "description": "When a query is executed repeatedly with the \\watch command, a pager is not used by default. This behavior can be changed by setting PSQL_WATCH_PAGER to a pager command, on Unix systems. The pspg pager (not part of PostgreSQL but available in many open source software distributions) can display the output of \\watch if started with the option --stream ."}, {"name": "PSQLRC", "description": "Alternative location of the user's .psqlrc file. Tilde ( ~ ) expansion is performed."}, {"name": "SHELL", "description": "Command executed by the \\! command."}, {"name": "TMPDIR", "description": "Directory for storing temporary files. The default is /tmp ."}]}, "comparison_hash": "7e52d8ca2dae4caec99412af17f0657a086f7413f9904aa5e55efb826f752e8b", "manual_language": "zh"}, "comparison": {"left": "16", "right": "17", "status": "changed", "diff": "--- PostgreSQL 16\n+++ PostgreSQL 17\n@@ -5,7 +5,7 @@\n       \"name\": \"COLUMNS\"\n     },\n     {\n-      \"description\": \"Default connection parameters (see Section 34.15 ).\",\n+      \"description\": \"Default connection parameters (see Section 32.15 ).\",\n       \"name\": \"PGDATABASE PGHOST PGPORT PGUSER\"\n     },\n     {\n@@ -71,7 +71,7 @@\n       \"signature\": \"-b --echo-errors\"\n     },\n     {\n-      \"description\": \"Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. command must be either a command string that is completely parsable by the server (i.e., it contains no psql -specific features), or a single backslash command. Thus you cannot mix SQL and psql meta-commands within a -c option. To achieve that, you could use repeated -c options or pipe the string into psql , for example: psql -c '\\\\x' -c 'SELECT * FROM foo;' or echo '\\\\x \\\\\\\\ SELECT * FROM foo;' | psql ( \\\\\\\\ is the separator meta-command.) Each SQL command string passed to -c is sent to the server as a single request. Because of this, the server executes it as a single transaction even if the string contains multiple SQL commands, unless there are explicit BEGIN / COMMIT commands included in the string to divide it into multiple transactions. (See Section 55.2.2.1 for more details about how the server handles multi-query strings.) If having several commands executed in one transaction is not desired, use repeated -c commands or feed multiple commands to psql 's standard input, either using echo as illustrated above, or via a shell here-document, for example: psql <<EOF \\\\x SELECT * FROM foo; EOF\",\n+      \"description\": \"Specifies that psql is to execute the given command string, command . This option can be repeated and combined in any order with the -f option. When either -c or -f is specified, psql does not read commands from standard input; instead it terminates after processing all the -c and -f options in sequence. command must be either a command string that is completely parsable by the server (i.e., it contains no psql -specific features), or a single backslash command. Thus you cannot mix SQL and psql meta-commands within a -c option. To achieve that, you could use repeated -c options or pipe the string into psql , for example: psql -c '\\\\x' -c 'SELECT * FROM foo;' or echo '\\\\x \\\\\\\\ SELECT * FROM foo;' | psql ( \\\\\\\\ is the separator meta-command.) Each SQL command string passed to -c is sent to the server as a single request. Because of this, the server executes it as a single transaction even if the string contains multiple SQL commands, unless there are explicit BEGIN / COMMIT commands included in the string to divide it into multiple transactions. (See Section 53.2.2.1 for more details about how the server handles multi-query strings.) If having several commands executed in one transaction is not desired, use repeated -c commands or feed multiple commands to psql 's standard input, either using echo as illustrated above, or via a shell here-document, for example: psql <<EOF \\\\x SELECT * FROM foo; EOF\",\n       \"names\": [\n         \"-c command\",\n         \"--command= command\""}}