{"Entry":{"collection":"guc","key":"server_encoding","name":"server_encoding","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Preset Options","category_zh":"","changed_in":["14"],"changes":[{"documentation_changed":false,"fields":{},"from":"7.4","status":"added","to":"8.0"},{"documentation_changed":true,"fields":{},"from":"8.0","status":"changed","to":"8.1"},{"documentation_changed":false,"fields":{"category":{"from":"Client Connection Defaults / Locale and Formatting","to":"Preset Options"},"short_desc":{"from":"Sets the server (database) character set encoding.","to":"Shows the server (database) character set encoding."}},"from":"13","status":"changed","to":"14"}],"content_hash":"2f595cf8ded710a1358a0a0a0a34762e4c4390099c6fdf415f69d7a7826a4f70","context":"","default_changed_in":[],"default_history":[{"from":"9.0","to":"19","value":"SQL_ASCII"}],"editorial":{"advice":{"olap":"Not tunable. Use server_encoding to verify format, build, or resource assumptions on analytical nodes and keep every read/write candidate compatible.","oltp":"Not tunable. Record server_encoding as a deployment/capability fact; if it is unexpected, fix the binary, initdb, or database-creation process rather than trying SET.","small":"Not tunable. Preserve it in inventory and incident reports; do not custom-build or rebuild merely to change it without a demonstrated compatibility need."},"mechanism":["Shows the server (database) character set encoding. It is read-only and cannot be changed with SET or configuration-file edits.","It reports the current database encoding. Encoding is selected at database creation and can differ between databases in a cluster.","Interpret it with lc_collate, lc_ctype, client_encoding. Applications and operations tooling may read server_encoding for capability or environment detection, but cannot SET it; cross-cluster comparisons must account for build, initdb, and current-database differences."],"pitfalls":["Trying to change read-only server_encoding with SET or a configuration file.","Assuming every cluster, database, or vendor build reports the same value.","Ignoring the value in file-format or feature-compatibility checks.","Treating reported metadata as a performance target instead of an environment fact."],"references":[{"title":"PostgreSQL 19 Beta 4: server_encoding","url":"https://www.postgresql.org/docs/19/runtime-config-preset.html#GUC-SERVER-ENCODING"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["lc_collate","lc_ctype","client_encoding","default_text_search_config","icu_validation_level","server_version"],"summary":"server_encoding — Shows the server (database) character set encoding. Observed in PG9.0–19 Beta 4; its last measured boot default is SQL_ASCII in PG19 Beta 4, with internal context. This is a beta-snapshot fact and can change before PostgreSQL 19 GA."},"enumvals":[],"first_version":"8.0","group":"Preset Options","group_slug":"preset","imported_at":"2026-09-27T17:57:31.945387+08:00","intro_commit":{},"key":"server_encoding","last_version":"20","max_val":"","min_val":"","name":"server_encoding","position":352,"present_in":["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":"Reports the database encoding (character set).","short_desc_zh":"","source_rev":"english-manuals:3e5d722be6dab50fb59e246a4ba53e45e30a8cb003e467838db8467d94cdbe11","unit":"","vartype":"string"}},"Definition":{"Collection":"guc","Key":"server_encoding","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"server_encoding","SourceRevision":"english-manuals:3e5d722be6dab50fb59e246a4ba53e45e30a8cb003e467838db8467d94cdbe11","Facts":{"boot_val":"SQL_ASCII","category":"Preset Options","context":"internal","description":"Reports the database encoding (character set). It is determined when the database is created. Ordinarily, clients need only be concerned with the value of client_encoding.","doc":{"anchor":"GUC-SERVER-ENCODING","file":"runtime-config-preset.html","lang":"en","sha256":"4dbfec727b9cee838adefb8a766217748d91ab90190b452a58cec737459582ce","slug":"18"},"documented":true,"enumvals":null,"extra_desc":null,"lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"server_encoding","short_desc":"Shows the server (database) character set encoding.","source":"pg-settings-source-snapshot","unit":null,"vartype":"string"},"ManualEvidence":{"doc":{"anchor":"GUC-SERVER-ENCODING","file":"runtime-config-preset.html","lang":"en","sha256":"4dbfec727b9cee838adefb8a766217748d91ab90190b452a58cec737459582ce","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"server_encoding","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"server_encoding","Summary":"","BodyHTML":"\u003cp\u003e报告数据库的编码（字符集）。这是在数据库被创建时决定的。通常，客户端只需要关心\u003ca href=\"/docs/18/runtime-config-client.html#GUC-CLIENT-ENCODING\" rel=\"nofollow\"\u003eclient_encoding\u003c/a\u003e的值。\u003c/p\u003e","SourceRevision":"2026-09-11@29c86d9","ContentHash":"d9904719d687cca14b1946bef0bcf003d2fb24925088ab23863edb1bb0a6e76a","Payload":{"carried_from":"","carry_reason":"","doc_html":"\u003cp\u003e报告数据库的编码（字符集）。这是在数据库被创建时决定的。通常，客户端只需要关心\u003ca href=\"/docs/18/runtime-config-client.html#GUC-CLIENT-ENCODING\"\u003eclient_encoding\u003c/a\u003e的值。\u003c/p\u003e","doc_same_as":""}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","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}
