Parameter · Client Connection Defaults / Locale and Formatting
extra_float_digits
Sets the number of digits displayed for floating-point values. This affects real, double precision, and geometric data types. A zero or negative parameter value is added to the standard number of digits (FLT_DIG or DBL_DIG as appropriate). Any value greater than zero selects precise output mode.
- Default:
1 - Type: integer
- Range: -15 … 3
- Applies: Session (any user)
In plain words
Floating-point numbers like 0.1 + 0.2 are not exact in binary. With the default (1), PostgreSQL prints the shortest text that reads back as exactly the same number, which can look surprising: 0.30000000000000004. Zero or negative values round the output to fewer digits.
For DBAs and operators
Applies to real, double precision and geometric types; never to numeric.
- 1 to 3: shortest-precise output (the "Ryu" algorithm). The text always round-trips to the identical binary value. Values 2 and 3 behave like 1 and exist for compatibility; pg_dump and several drivers set 3 to guarantee exact dumps.
- 0: round to 15 significant digits (
DBL_DIG) for double, 6 (FLT_DIG) for real: the pre-12 default look. - negative: subtract from those digit counts (down to -15) to suppress noise.
The meaning and default changed in PostgreSQL 12: before 12 the default was 0 and positive values added digits. Upgrades from 11 or older therefore made reports suddenly show values like 0.30000000000000004; nothing about the stored data changed.
If an application compares float text output or needs exact decimals, the real fix is the numeric type or explicit rounding (round(x::numeric, 2)), not lowering this setting: rounded output does not read back as the same value.
How to change it
Any user can change it for their session with SET.