{"Entry":{"collection":"guc","key":"log_min_error_statement","name":"log_min_error_statement","aliases":[],"metadata":{"baseline":true,"boot_human":"Not specified","boot_val":null,"category":"Reporting and Logging / When to Log","category_zh":"","changed_in":[],"changes":[{"documentation_changed":true,"fields":{},"from":"7.4","status":"changed","to":"8.0"},{"documentation_changed":true,"fields":{},"from":"8.1","status":"changed","to":"8.2"},{"documentation_changed":true,"fields":{},"from":"8.2","status":"changed","to":"8.3"},{"documentation_changed":true,"fields":{},"from":"8.4","status":"changed","to":"9.0"},{"documentation_changed":true,"fields":{},"from":"14","status":"changed","to":"15"}],"content_hash":"cf25ffe72de0fdbeefd8a83dccb0324e172bd854964d29cf2a6a0a773c921e68","context":"","default_changed_in":[],"default_history":[{"from":"9.0","to":"19","value":"error"}],"editorial":{"advice":{"olap":"Analytical jobs can justify richer log_min_error_statement telemetry, but account for long statements, large bind values, and bursty completion patterns in the log pipeline.","oltp":"Tune log_min_error_statement against an explicit observability question and a measured log-volume budget. Prefer selective thresholds, sampling, or role-level overrides over indiscriminate capture.","small":"Keep log_min_error_statement useful but bounded: verify disk, collector, retention, and redaction capacity before increasing detail or frequency."},"mechanism":["log_min_error_statement causes all statements generating error at or above this level to be logged. Each level includes all the levels that follow it. The later the level, the fewer messages are sent. It governs whether the SQL statement associated with an error-level message is included; log_min_messages separately decides whether the message itself is emitted.","log_min_error_statement is a SUPERUSER-context setting. Superuser or a role granted the appropriate SET privilege can change it for a session, while ALTER ROLE or ALTER DATABASE can establish a default for future sessions.","It changes emitted diagnostic data rather than query semantics, but volume, sensitive content, log_line_prefix, destinations, collector throughput, and retention determine operational cost and usefulness."],"pitfalls":["Changing log_min_error_statement in one session and assuming role defaults, database defaults, or other pooled sessions changed with it.","Enabling richer logging without budgeting collector throughput, storage, retention, and downstream query cost.","Writing SQL text, bind values, identities, or host data without a redaction and access-control policy.","Changing log_min_error_statement globally without a rollback plan and a client or operational compatibility test."],"references":[{"title":"PostgreSQL 19 Beta 4: log_min_error_statement","url":"https://www.postgresql.org/docs/19/runtime-config-logging.html#GUC-LOG-MIN-ERROR-STATEMENT"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["log_min_messages","log_min_duration_statement","log_min_duration_sample","log_statement_sample_rate","log_transaction_sample_rate"],"summary":"log_min_error_statement is the PostgreSQL setting that causes all statements generating error at or above this level to be logged."},"enumvals":[],"first_version":"7.4","group":"Reporting and Logging","group_slug":"logging","imported_at":"2026-09-30T00:40:57.379319+08:00","intro_commit":{},"key":"log_min_error_statement","last_version":"20","max_val":"","min_val":"","name":"log_min_error_statement","position":235,"present_in":["7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"short_desc":"Controls which SQL statements that cause an error condition are recorded in the server log.","short_desc_zh":"","source_rev":"english-manuals:38ea761feb12c151ae63195d93061e8aceb1ab4b4f329c0ec7021638e2fcc069","unit":"","vartype":"enum"}},"Definition":{"Collection":"guc","Key":"log_min_error_statement","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"log_min_error_statement","SourceRevision":"english-manuals:38ea761feb12c151ae63195d93061e8aceb1ab4b4f329c0ec7021638e2fcc069","Facts":{"boot_val":"error","category":"Reporting and Logging / When to Log","context":"superuser","description":"Controls which SQL statements that cause an error condition are recorded in the server log. The current SQL statement is included in the log entry for any message of the specified severity or higher. Valid values are DEBUG5, DEBUG4, DEBUG3, DEBUG2, DEBUG1, INFO, NOTICE, WARNING, ERROR, LOG, FATAL, and PANIC. The default is ERROR, which means statements causing errors, log messages, fatal errors, or panics will be logged. To effectively turn off logging of failing statements, set this parameter to PANIC. Only superusers and users with the appropriate SET privilege can change this setting.","doc":{"anchor":"GUC-LOG-MIN-ERROR-STATEMENT","file":"runtime-config-logging.html","lang":"en","sha256":"93c48c522a72fca19705c4c91a71e951eae653662008eee2e4a9a74a11127fde","slug":"18"},"documented":true,"enumvals":["debug5","debug4","debug3","debug2","debug1","info","notice","warning","error","log","fatal","panic"],"extra_desc":"Each level includes all the levels that follow it. The later the level, the fewer messages are sent.","lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"log_min_error_statement","short_desc":"Causes all statements generating error at or above this level to be logged.","source":"pg-settings-source-snapshot","unit":null,"vartype":"enum"},"ManualEvidence":{"doc":{"anchor":"GUC-LOG-MIN-ERROR-STATEMENT","file":"runtime-config-logging.html","lang":"en","sha256":"93c48c522a72fca19705c4c91a71e951eae653662008eee2e4a9a74a11127fde","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"log_min_error_statement","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"log_min_error_statement","Summary":"","BodyHTML":"\u003cp\u003e控制在服务器日志中记录哪些导致错误条件的SQL语句。对于达到指定\u003ca href=\"/docs/18/runtime-config-logging.html#RUNTIME-CONFIG-SEVERITY-LEVELS\" rel=\"nofollow\"\u003e严重级别\u003c/a\u003e或更高级别的消息，其日志条目中会包含当前 SQL 语句。有效值为\u003ccode\u003eDEBUG5\u003c/code\u003e、\u003ccode\u003eDEBUG4\u003c/code\u003e、\u003ccode\u003eDEBUG3\u003c/code\u003e、\u003ccode\u003eDEBUG2\u003c/code\u003e、\u003ccode\u003eDEBUG1\u003c/code\u003e、\u003ccode\u003eINFO\u003c/code\u003e、\u003ccode\u003eNOTICE\u003c/code\u003e、\u003ccode\u003eWARNING\u003c/code\u003e、\u003ccode\u003eERROR\u003c/code\u003e、\u003ccode\u003eLOG\u003c/code\u003e、\u003ccode\u003eFATAL\u003c/code\u003e和\u003ccode\u003ePANIC\u003c/code\u003e。默认值为\u003ccode\u003eERROR\u003c/code\u003e，这意味着导致错误、日志消息、致命错误或紧急情况的语句将被记录。要有效地关闭记录失败的语句，将此参数设置为\u003ccode\u003ePANIC\u003c/code\u003e。只有超级用户和具有适当\u003ccode\u003eSET\u003c/code\u003e权限的用户才能更改此设置。\u003c/p\u003e","SourceRevision":"2026-09-11@29c86d9","ContentHash":"7665f7d0a8a2ff4755b41fade502803ed3d1c2372c79681ddb272d1087496091","Payload":{"carried_from":"","carry_reason":"","doc_html":"\u003cp\u003e控制在服务器日志中记录哪些导致错误条件的SQL语句。对于达到指定\u003ca href=\"/docs/18/runtime-config-logging.html#RUNTIME-CONFIG-SEVERITY-LEVELS\" title=\"表 19.2. 消息严重级别\"\u003e严重级别\u003c/a\u003e或更高级别的消息，其日志条目中会包含当前 SQL 语句。有效值为\u003ccode class=\"literal\"\u003eDEBUG5\u003c/code\u003e、\u003ccode class=\"literal\"\u003eDEBUG4\u003c/code\u003e、\u003ccode class=\"literal\"\u003eDEBUG3\u003c/code\u003e、\u003ccode class=\"literal\"\u003eDEBUG2\u003c/code\u003e、\u003ccode class=\"literal\"\u003eDEBUG1\u003c/code\u003e、\u003ccode class=\"literal\"\u003eINFO\u003c/code\u003e、\u003ccode class=\"literal\"\u003eNOTICE\u003c/code\u003e、\u003ccode class=\"literal\"\u003eWARNING\u003c/code\u003e、\u003ccode class=\"literal\"\u003eERROR\u003c/code\u003e、\u003ccode class=\"literal\"\u003eLOG\u003c/code\u003e、\u003ccode class=\"literal\"\u003eFATAL\u003c/code\u003e和\u003ccode class=\"literal\"\u003ePANIC\u003c/code\u003e。默认值为\u003ccode class=\"literal\"\u003eERROR\u003c/code\u003e，这意味着导致错误、日志消息、致命错误或紧急情况的语句将被记录。要有效地关闭记录失败的语句，将此参数设置为\u003ccode class=\"literal\"\u003ePANIC\u003c/code\u003e。只有超级用户和具有适当\u003ccode class=\"literal\"\u003eSET\u003c/code\u003e权限的用户才能更改此设置。\u003c/p\u003e","doc_same_as":""}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
