{"Entry":{"collection":"guc","key":"extra_float_digits","name":"extra_float_digits","aliases":[],"metadata":{"baseline":true,"boot_human":"Not specified","boot_val":null,"category":"Client Connection Defaults / Locale and Formatting","category_zh":"","changed_in":["12"],"changes":[{"documentation_changed":true,"fields":{},"from":"8.3","status":"changed","to":"8.4"},{"documentation_changed":true,"fields":{},"from":"8.4","status":"changed","to":"9.0"},{"documentation_changed":true,"fields":{"boot_val":{"from":"0","to":"1"},"extra_desc":{"from":"This affects real, double precision, and geometric data types. The parameter value is added to the standard number of digits (FLT_DIG or DBL_DIG as appropriate).","to":"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."}},"from":"11","status":"changed","to":"12"}],"content_hash":"d4f2c773020f0447b76c60e95da581338f862f0526732fa328e3ab8cb16eeed2","context":"","default_changed_in":["12"],"default_history":[{"from":"9.0","to":"11","value":"0"},{"from":"12","to":"19","value":"1"}],"editorial":{"advice":{"olap":"Pin extra_float_digits for export, reporting, and reproducible analytical jobs; prefer explicit SQL formatting when a file or API has a durable schema.","oltp":"Treat extra_float_digits 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 extra_float_digits."},"mechanism":["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. Since PostgreSQL 12, positive values select shortest-precise output; zero and negative values request rounded legacy output and can lose round-trip fidelity.","extra_float_digits 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."],"pitfalls":["Changing extra_float_digits 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.","Carrying pre-12 assumptions forward even though positive values now select shortest-precise output."],"references":[{"title":"PostgreSQL 19 Beta 4: extra_float_digits","url":"https://www.postgresql.org/docs/19/runtime-config-client.html#GUC-EXTRA-FLOAT-DIGITS"},{"title":"PostgreSQL 19 release notes","url":"https://www.postgresql.org/docs/19/release-19.html"}],"related":["bytea_output","xmlbinary","xmloption","client_encoding","DateStyle"],"summary":"extra_float_digits is the PostgreSQL setting that defines the number of digits displayed for floating-point values."},"enumvals":[],"first_version":"7.4","group":"Client Connection Defaults","group_slug":"client","imported_at":"2026-09-27T17:57:31.274134+08:00","intro_commit":{},"key":"extra_float_digits","last_version":"20","max_val":"","min_val":"","name":"extra_float_digits","position":146,"present_in":["7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"short_desc":"This parameter adjusts the number of digits used for textual output of floating-point values, including float4, float8, and geometric data types.","short_desc_zh":"","source_rev":"english-manuals:0f40d6e6e6649cb09813e3cf12f780072507d6c3d22889fdf131a188aa14a539","unit":"","vartype":"integer"}},"Definition":{"Collection":"guc","Key":"extra_float_digits","SourceDatabase":"center","Version":"18","SourceTable":"guc","SourceKey":"extra_float_digits","SourceRevision":"english-manuals:0f40d6e6e6649cb09813e3cf12f780072507d6c3d22889fdf131a188aa14a539","Facts":{"boot_val":"1","category":"Client Connection Defaults / Locale and Formatting","context":"user","description":"This parameter adjusts the number of digits used for textual output of floating-point values, including float4, float8, and geometric data types. If the value is 1 (the default) or above, float values are output in shortest-precise format; see Section 8.1.3. The actual number of digits generated depends only on the value being output, not on the value of this parameter. At most 17 digits are required for float8 values, and 9 for float4 values. This format is both fast and precise, preserving the original binary float value exactly when correctly read. For historical compatibility, values up to 3 are permitted. If the value is zero or negative, then the output is rounded to a given decimal precision. The precision used is the standard number of digits for the type (FLT_DIG or DBL_DIG as appropriate) reduced according to the value of this parameter. (For example, specifying -1 will cause float4 values to be output rounded to 5 significant digits, and float8 values rounded to 14 digits.) This format is slower and does not preserve all the bits of the binary float value, but may be more human-readable. Note The meaning of this parameter, and its default value, changed in PostgreSQL 12; see Section 8.1.3 for further discussion.","doc":{"anchor":"GUC-EXTRA-FLOAT-DIGITS","file":"runtime-config-client.html","lang":"en","sha256":"6be6cc70f29eca4695dc43b2b2b94c75b7e0eaaa2c00273d7a98488917a7edb7","slug":"18"},"documented":true,"enumvals":null,"extra_desc":"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.","lang":"en","max_val":"3","metadata_version":"18","min_val":"-15","name":"extra_float_digits","short_desc":"Sets the number of digits displayed for floating-point values.","source":"pg-settings-source-snapshot","unit":null,"vartype":"integer"},"ManualEvidence":{"doc":{"anchor":"GUC-EXTRA-FLOAT-DIGITS","file":"runtime-config-client.html","lang":"en","sha256":"6be6cc70f29eca4695dc43b2b2b94c75b7e0eaaa2c00273d7a98488917a7edb7","slug":"18"}},"MeasuredEvidence":{"metadata_version":"18"}},"Text":{"Collection":"guc","Key":"extra_float_digits","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"extra_float_digits","Summary":"","BodyHTML":"\u003cp\u003e这个参数调整以文本形式输出浮点值时所用的位数，包括\u003ccode\u003efloat4\u003c/code\u003e，\u003ccode\u003efloat8\u003c/code\u003e以及几何数据类型。\u003c/p\u003e\u003cp\u003e如果值为 1（默认值）或更高，浮点值被输出为最短精确格式；参见\u003ca href=\"/docs/18/datatype-numeric.html#DATATYPE-FLOAT\" rel=\"nofollow\"\u003e第 8.1.3 节\u003c/a\u003e。实际生成的位数只取决于输出的值，而不取决于此参数的值。\u003ccode\u003efloat8\u003c/code\u003e 值最多需要 17 位数字，\u003ccode\u003efloat4\u003c/code\u003e值最多需要9位数字。这种格式既快速又精确，在正确读取时精确地保留了原始的二进制浮点值。为了历史兼容性，允许的值最大为3。\u003c/p\u003e\u003cp\u003e如果值为零或负，则输出四舍五入为给定的十进制精度。所用精度以该类型的标准位数（根据类型使用\u003ccode\u003eFLT_DIG\u003c/code\u003e或\u003ccode\u003eDBL_DIG\u003c/code\u003e）为基础，再按此参数的值减少。（例如，指定 -1 将导致\u003ccode\u003efloat4\u003c/code\u003e 值输出四舍五入为 5 位有效数字，而\u003ccode\u003efloat8\u003c/code\u003e值四舍五入为 14 位。）此格式较慢，不会保留二进制浮点值的所有位，但可能更便于阅读。\u003c/p\u003e\u003cdiv\u003e\n注意\u003cp\u003e此参数的含义，以及其默认值，在 \u003cspan\u003ePostgreSQL\u003c/span\u003e 12 中发生了变化；参见\u003ca href=\"/docs/18/datatype-numeric.html#DATATYPE-FLOAT\" rel=\"nofollow\"\u003e第 8.1.3 节\u003c/a\u003e了解进一步讨论。\u003c/p\u003e\u003c/div\u003e","SourceRevision":"2026-09-11@29c86d9","ContentHash":"ebf073fb96bfb6da91bd23d601f6b8d991814b8fdb05d08df39c3c596869b286","Payload":{"carried_from":"","carry_reason":"","doc_html":"\u003cp\u003e这个参数调整以文本形式输出浮点值时所用的位数，包括\u003ccode class=\"type\"\u003efloat4\u003c/code\u003e，\u003ccode class=\"type\"\u003efloat8\u003c/code\u003e以及几何数据类型。\u003c/p\u003e\u003cp\u003e如果值为 1（默认值）或更高，浮点值被输出为最短精确格式；参见\u003ca href=\"/docs/18/datatype-numeric.html#DATATYPE-FLOAT\" title=\"8.1.3. 浮点类型\"\u003e第 8.1.3 节\u003c/a\u003e。实际生成的位数只取决于输出的值，而不取决于此参数的值。\u003ccode class=\"type\"\u003efloat8\u003c/code\u003e 值最多需要 17 位数字，\u003ccode class=\"type\"\u003efloat4\u003c/code\u003e值最多需要9位数字。这种格式既快速又精确，在正确读取时精确地保留了原始的二进制浮点值。为了历史兼容性，允许的值最大为3。\u003c/p\u003e\u003cp\u003e如果值为零或负，则输出四舍五入为给定的十进制精度。所用精度以该类型的标准位数（根据类型使用\u003ccode class=\"literal\"\u003eFLT_DIG\u003c/code\u003e或\u003ccode class=\"literal\"\u003eDBL_DIG\u003c/code\u003e）为基础，再按此参数的值减少。（例如，指定 -1 将导致\u003ccode class=\"type\"\u003efloat4\u003c/code\u003e 值输出四舍五入为 5 位有效数字，而\u003ccode class=\"type\"\u003efloat8\u003c/code\u003e值四舍五入为 14 位。）此格式较慢，不会保留二进制浮点值的所有位，但可能更便于阅读。\u003c/p\u003e\u003cdiv class=\"note\"\u003e\n注意\u003cp\u003e此参数的含义，以及其默认值，在 \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e 12 中发生了变化；参见\u003ca href=\"/docs/18/datatype-numeric.html#DATATYPE-FLOAT\" title=\"8.1.3. 浮点类型\"\u003e第 8.1.3 节\u003c/a\u003e了解进一步讨论。\u003c/p\u003e\u003c/div\u003e","doc_same_as":""}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
