# xmloption

> 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.
---

> [!NOTE]
> **Fact — official short description:** “Sets whether XML data in implicit parsing and serialization operations is to be considered as documents or content fragments.”

## Identity {#identity}

| Field | Value | Meaning |
| --- | --- | --- |
| Type | `enum` | Upstream pg_settings type |
| Context | `user` | Settable by an ordinary user |
| Unit | — | Raw unit |
| Range | — | Raw limits in the last observed version |
| Enum values | `content`, `document` | — for non-enum types |
| Category | Client Connection Defaults / Statement Behavior | Upstream classification |
| Latest boot value | `content` | content |
{.fields meta="-"}

## Lifecycle {#lifecycle}

| Fact | Value |
| --- | --- |
| First observed | PG9.0 (research boundary) |
| Present in | PG9.0–19 Beta 3 |
| Removed in | No |
| Introduction commit | Not asserted: predates the PG9.0 research boundary |
| Commit date | — |
| Discussion | — |

## Default history {#default-history}

| Versions | Raw `boot_val` | Unit | Human value |
| --- | --- | --- | --- |
| PG9.0–19 Beta 3 | `content` | — | content |
{.full-width caption="Measured PG9.0–19 Beta 3 boot defaults"}

## How it works {#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.

## Tuning advice {#tuning-advice}

> [!TIP]
> **Advice.** These are workload-specific starting points and must be validated with measurements.

| Workload | Guidance |
| --- | --- |
| 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. |
| OLAP | Pin xmloption for export, reporting, and reproducible analytical jobs; prefer explicit SQL formatting when a file or API has a durable schema. |
| Small nodes | Keep the upstream or locale-derived value unless a client requires another one. A smaller server gains no capacity from changing xmloption. |
{.full-width}

## Pigsty {#pigsty}

Values use the fixed 8-vCPU, 32-GiB, 100-GiB SSD fixture and render the current Pigsty templates for PG19 Beta 3; this does not assert current Pigsty support for that historical or beta release.

| Template | Effective value | Versus upstream boot | Source expression |
| --- | --- | --- | --- |
| OLTP | Unmodified | — | — |
| OLAP | Unmodified | — | — |
| CRIT | Unmodified | — | — |
| TINY | Unmodified | — | — |
{.full-width}

> [!CAUTION]
> **Advice — pending human review.** Fact from the current Pigsty template projection: OLTP: PG9.0–19 Beta 3 unmodified; OLAP: PG9.0–19 Beta 3 unmodified; CRIT: PG9.0–19 Beta 3 unmodified; TINY: PG9.0–19 Beta 3 unmodified. No Pigsty-specific rationale is inferred from an absent override.

## Common pitfalls {#common-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.

## Related parameters {#related-parameters}

[`bytea_output`](/parameters/bytea-output/) · [`extra_float_digits`](/parameters/extra-float-digits/) · [`xmlbinary`](/parameters/xmlbinary/) · [`client_encoding`](/parameters/client-encoding/) · [`DateStyle`](/parameters/datestyle/)

## References {#references}

- [PostgreSQL 19 Beta 3 — xmloption](https://www.postgresql.org/docs/19/runtime-config-client.html#GUC-XMLOPTION)
- [PostgreSQL 19 release notes](https://www.postgresql.org/docs/19/release-19.html)
- [Machine-readable GUC export](/data/guc.jsonl)
