Sets the language in which messages are displayed.
At a glance
| Property | Value |
|---|---|
| Parameter | lc_messages |
| Category | Client Connection Defaults |
| Default | (see documentation) |
| Value type | string |
| Change scope | Per-session (SET) |
| Available in | PostgreSQL 12, 13, 14, 15, 16, 17, 18, 19 (added in 12) |
What it does
Sets the language in which messages are displayed. Acceptable values are system-dependent; see locale for more information. If this variable is set to the empty string (which is the default) then the value is inherited from the execution environment of the server in a system-dependent way.
On some systems, this locale category does not exist. Setting this variable will still work, but there will be no effect. Also, there is a chance that no translated messages for the desired language exist. In that case you will continue to see the English messages.
(Description quoted from the official PostgreSQL documentation.)
How to apply a change
Can be set per session with SET, per role/database with ALTER ROLE/DATABASE ... SET, or globally in postgresql.conf.
Inspect the current value and source with SHOW lc_messages; or SELECT name, setting, unit, context, source FROM pg_settings WHERE name = 'lc_messages';.
Tuning guidance
This sets a session default (locale, formatting, search path or transaction behaviour) rather than a performance knob. Set it per role or database with ALTER ROLE/DATABASE ... SET so the right default follows the right workload, and prefer setting it explicitly in the application for behaviour the query results depend on.