PT-2378 - extended FP precision in pt-table-sync

pt-table-sync now uses up to 17 decimal digits when writing
floating point numbers in the generated SQL statements.
This is necessary to prevent unintended data changes.
This commit is contained in:
Henning Poettker
2025-01-13 09:31:51 +01:00
parent ce20bc7dd1
commit 1e581be06a
20 changed files with 194 additions and 17 deletions

View File

@@ -6680,7 +6680,10 @@ sub quote_val {
return $val if $val =~ m/^0x[0-9a-fA-F]+$/ # quote hex data
&& !$args{is_char}; # unless is_char is true
return $val if $args{is_float};
if ( $args{is_float} ) {
return sprintf("%.17g", $val) if $val - "$val" != 0;
return $val;
}
$val =~ s/(['\\])/\\$1/g;
return "'$val'";