mirror of
https://github.com/postgres/postgres.git
synced 2025-11-06 07:49:08 +03:00
Don't lose precision for float fields of Nodes.
Historically we've been more worried about making the output of float fields look pretty than whether they'd be read back exactly. That won't work if we're to compare the read-back nodes for equality, so switch to using the Ryu code for float output. Author: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://www.postgresql.org/message-id/flat/4159834.1657405226@sss.pgh.pa.us
This commit is contained in:
@@ -983,29 +983,29 @@ _read${n}(void)
|
||||
}
|
||||
elsif ($t eq 'double')
|
||||
{
|
||||
print $off "\tWRITE_FLOAT_FIELD($f, \"%.6f\");\n";
|
||||
print $off "\tWRITE_FLOAT_FIELD($f);\n";
|
||||
print $rff "\tREAD_FLOAT_FIELD($f);\n" unless $no_read;
|
||||
}
|
||||
elsif ($t eq 'Cardinality')
|
||||
{
|
||||
print $off "\tWRITE_FLOAT_FIELD($f, \"%.0f\");\n";
|
||||
print $off "\tWRITE_FLOAT_FIELD($f);\n";
|
||||
print $rff "\tREAD_FLOAT_FIELD($f);\n" unless $no_read;
|
||||
}
|
||||
elsif ($t eq 'Cost')
|
||||
{
|
||||
print $off "\tWRITE_FLOAT_FIELD($f, \"%.2f\");\n";
|
||||
print $off "\tWRITE_FLOAT_FIELD($f);\n";
|
||||
print $rff "\tREAD_FLOAT_FIELD($f);\n" unless $no_read;
|
||||
}
|
||||
elsif ($t eq 'QualCost')
|
||||
{
|
||||
print $off "\tWRITE_FLOAT_FIELD($f.startup, \"%.2f\");\n";
|
||||
print $off "\tWRITE_FLOAT_FIELD($f.per_tuple, \"%.2f\");\n";
|
||||
print $off "\tWRITE_FLOAT_FIELD($f.startup);\n";
|
||||
print $off "\tWRITE_FLOAT_FIELD($f.per_tuple);\n";
|
||||
print $rff "\tREAD_FLOAT_FIELD($f.startup);\n" unless $no_read;
|
||||
print $rff "\tREAD_FLOAT_FIELD($f.per_tuple);\n" unless $no_read;
|
||||
}
|
||||
elsif ($t eq 'Selectivity')
|
||||
{
|
||||
print $off "\tWRITE_FLOAT_FIELD($f, \"%.4f\");\n";
|
||||
print $off "\tWRITE_FLOAT_FIELD($f);\n";
|
||||
print $rff "\tREAD_FLOAT_FIELD($f);\n" unless $no_read;
|
||||
}
|
||||
elsif ($t eq 'char*')
|
||||
|
||||
Reference in New Issue
Block a user