bytea_output
Read PG 18 manual ↗Sets the output format for values of type bytea.
- Type
- enum
- Context
- user
- Measured default
- hex
- Unit
- —
- Metadata snapshot
- 18
- Allowed values
- escape, hex
Definition PG 18 manual
Sets the output format for values of type bytea. Valid values are hex (the default) and escape (the traditional PostgreSQL format). See Section 8.4 for more information. The bytea type always accepts both formats on input, regardless of this setting.
Measured default history
| Version interval | Default |
|---|---|
| 9.0 – 19 | hex |
Authored guidance from the GUC source snapshot; the version-specific manual above is the definition reference. View source ↗
How it works
bytea_output sets the output format for bytea. The choice affects textual output only: bytea input accepts both hex and escape syntax regardless of this setting.
bytea_output 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.
Operational considerations
Changing bytea_output 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 bytea_output globally without a rollback plan and a client or operational compatibility test.
Workload guidance
OLAP: Pin bytea_output for export, reporting, and reproducible analytical jobs; prefer explicit SQL formatting when a file or API has a durable schema.
OLTP: Treat bytea_output 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 bytea_output.
Related entries
Further reading
Definition snapshot: english-manuals:e7eb5e4b948c2c166cdb63c717b… · English manual source