{"Entry":{"collection":"guc","key":"xmloption","name":"xmloption","aliases":[],"metadata":{"baseline":false,"boot_human":"Not specified","boot_val":null,"category":"Client Connection Defaults / Statement Behavior","category_zh":"","changed_in":[],"changes":[{"documentation_changed":false,"fields":{},"from":"8.2","status":"added","to":"8.3"}],"content_hash":"68b02834b8a9347609d66580870283e8689db695735274648882781ae839c6c5","context":"","default_changed_in":[],"default_history":[{"from":"9.0","to":"19","value":"content"}],"editorial":{"advice":{"olap":"Pin xmloption for export, reporting, and reproducible analytical jobs; prefer explicit SQL formatting when a file or API has a durable schema.","oltp":"Treat xmloption as an application contract, not a performance knob. Standardize it per role or connection pool and keep wire formats explicit where clients parse text.","small":"Keep the upstream or locale-derived value unless a client requires another one. A smaller server gains no capacity from changing xmloption."},"mechanism":["xmloption sets whether XML data in implicit parsing and serialization operations is to be considered as documents or content fragments. CONTENT permits XML fragments while DOCUMENT requires a single well-formed XML document, changing implicit casts and serialization behavior.","xmloption is a USER-context setting. An authorized role can change it for a session, while ALTER ROLE or ALTER DATABASE can establish a default for future sessions.","It changes representation, parsing, or locale behavior at the client boundary rather than physical storage. Coordinate it with the other locale and formatting settings and with driver-native binary or typed protocols."],"pitfalls":["Changing xmloption in one session and assuming role defaults, database defaults, or other pooled sessions changed with it.","Assuming a presentation setting changes stored values or server-side type semantics.","Changing a role or database default without testing text-parsing clients, exports, and pooled sessions.","Changing xmloption globally without a rollback plan and a client or operational compatibility test."],"references":[{"title":"PostgreSQL 19 Beta 4: xmloption","url":"https://www.postgresql.org/docs/19/runtime-config-client.html#GUC-XMLOPTION"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["bytea_output","extra_float_digits","xmlbinary","client_encoding","DateStyle"],"summary":"xmloption is the PostgreSQL setting that defines whether XML data in implicit parsing and serialization operations is to be considered as documents or content fragments."},"enumvals":[],"first_version":"8.3","group":"Client Connection Defaults","group_slug":"client","imported_at":"2026-09-27T17:57:32.397174+08:00","intro_commit":{},"key":"xmloption","last_version":"20","max_val":"","min_val":"","name":"xmloption","position":489,"present_in":["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":"Sets whether DOCUMENT or CONTENT is implicit when converting between XML and character string values.","short_desc_zh":"","source_rev":"english-manuals:6488cefabfa18fee89133ee39a4f15b07bfbbcf59a75850a012f120556cf73bb","unit":"","vartype":"enum"}},"Definition":{"Collection":"guc","Key":"xmloption","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"xmloption","SourceRevision":"english-manuals:6488cefabfa18fee89133ee39a4f15b07bfbbcf59a75850a012f120556cf73bb","Facts":{"boot_val":"content","category":"Client Connection Defaults / Statement Behavior","context":"user","description":"Sets whether DOCUMENT or CONTENT is implicit when converting between XML and character string values. See Section 8.13 for a description of this. Valid values are DOCUMENT and CONTENT. The default is CONTENT. According to the SQL standard, the command to set this option is SET XML OPTION { DOCUMENT | CONTENT }; This syntax is also available in PostgreSQL.","doc":{"anchor":"GUC-XMLOPTION","file":"runtime-config-client.html","lang":"en","sha256":"6be6cc70f29eca4695dc43b2b2b94c75b7e0eaaa2c00273d7a98488917a7edb7","slug":"18"},"documented":true,"enumvals":["content","document"],"extra_desc":null,"lang":"en","max_val":null,"metadata_version":"18","min_val":null,"name":"xmloption","short_desc":"Sets whether XML data in implicit parsing and serialization operations is to be considered as documents or content fragments.","source":"pg-settings-source-snapshot","unit":null,"vartype":"enum"},"ManualEvidence":{"doc":{"anchor":"GUC-XMLOPTION","file":"runtime-config-client.html","lang":"en","sha256":"6be6cc70f29eca4695dc43b2b2b94c75b7e0eaaa2c00273d7a98488917a7edb7","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"xmloption","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"xmloption","Summary":"","BodyHTML":"\u003cp\u003e设置在 XML 与字符串值之间进行转换时，隐含采用\u003ccode\u003eDOCUMENT\u003c/code\u003e还是\u003ccode\u003eCONTENT\u003c/code\u003e。有关说明参见\u003ca href=\"/docs/18/datatype-xml.html\" rel=\"nofollow\"\u003e第 8.13 节\u003c/a\u003e。有效值是\u003ccode\u003eDOCUMENT\u003c/code\u003e和\u003ccode\u003eCONTENT\u003c/code\u003e。默认值是\u003ccode\u003eCONTENT\u003c/code\u003e。\u003c/p\u003e\u003cp\u003e根据 SQL 标准，设置这个选项的命令是：\u003c/p\u003e\u003cpre\u003eSET XML OPTION { DOCUMENT | CONTENT };\n\u003c/pre\u003e\u003cp\u003e这种语法在 PostgreSQL 也可用。\u003c/p\u003e","SourceRevision":"2026-09-11@29c86d9","ContentHash":"8ad54da07b0d979ebf03a98da73bfa0cc1daf1803c18b9dd0fdfabafa42ae50f","Payload":{"carried_from":"","carry_reason":"","doc_html":"\u003cp\u003e设置在 XML 与字符串值之间进行转换时，隐含采用\u003ccode class=\"literal\"\u003eDOCUMENT\u003c/code\u003e还是\u003ccode class=\"literal\"\u003eCONTENT\u003c/code\u003e。有关说明参见\u003ca href=\"/docs/18/datatype-xml.html\" title=\"8.13. XML类型\"\u003e第 8.13 节\u003c/a\u003e。有效值是\u003ccode class=\"literal\"\u003eDOCUMENT\u003c/code\u003e和\u003ccode class=\"literal\"\u003eCONTENT\u003c/code\u003e。默认值是\u003ccode class=\"literal\"\u003eCONTENT\u003c/code\u003e。\u003c/p\u003e\u003cp\u003e根据 SQL 标准，设置这个选项的命令是：\u003c/p\u003e\u003cpre\u003eSET XML OPTION { DOCUMENT | CONTENT };\n\u003c/pre\u003e\u003cp\u003e这种语法在 PostgreSQL 也可用。\u003c/p\u003e","doc_same_as":""}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","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}
