server_encoding
Read PG 18 manual ↗Reports the database encoding (character set).
- Type
- string
- Context
- internal
- Measured default
- SQL_ASCII
- Unit
- —
- Metadata snapshot
- 18
Definition PG 18 manual
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.
Measured default history
| Version interval | Default |
|---|---|
| 9.0 – 19 | SQL_ASCII |
Authored guidance from the GUC source snapshot; the version-specific manual above is the definition reference. View source ↗
How it works
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.
Operational considerations
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.
Workload guidance
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.
Version history 1
- PG 13 → 14changed
Related entries
Further reading
Definition snapshot: english-manuals:c5a1f78c647d275e92e4c390ec1… · English manual source