Don't convert to and from floats in pg_dump.
authorJeff Davis <jdavis@postgresql.org>
Sat, 8 Mar 2025 19:25:36 +0000 (11:25 -0800)
committerJeff Davis <jdavis@postgresql.org>
Sat, 8 Mar 2025 19:25:36 +0000 (11:25 -0800)
commit1852aea3f526b124b95585f7b1f655f3af04afd5
tree95a98196996524a7b6f740dae6bb04adefda4070
parent7fb880102138e45f58bf626cb2a4599bade8b172
Don't convert to and from floats in pg_dump.

Commit 8f427187db improved performance by remembering relation stats
as native types rather than issuing a new query for each relation.

Using native types is fine for integers like relpages; but reltuples
is floating point. The commit controllled for that complexity by using
setlocale(LC_NUMERIC, "C"). After that, Alexander Lakhin found a
problem in pg_strtof(), fixed in 00d61a08c5.

While we aren't aware of any more problems with that approach, it
seems wise to just use a string the whole way for floating point
values, as Corey's original patch did, and get rid of the
setlocale(). Integers are still converted to native types to avoid
wasting memory.

Co-authored-by: Corey Huinker <corey.huinker@gmail.com>
Discussion: https://postgr.es/m/3049348.1740855411@sss.pgh.pa.us
Discussion: https://postgr.es/m/560cca3781740bd69881bb07e26eb8f65b09792c.camel%40j-davis.com
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/pg_dump.h