From 537c750e328cd080365e465acd4f0383bf0febf3 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Thu, 10 Dec 2015 16:17:20 +0100 Subject: MDEV-8521 Drastic loss of precision in COLUMN_JSON() on DOUBLEs fixed conversion --- mysys/ma_dyncol.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'mysys') diff --git a/mysys/ma_dyncol.c b/mysys/ma_dyncol.c index 7dfaf29a1a7..06820a0c3c5 100644 --- a/mysys/ma_dyncol.c +++ b/mysys/ma_dyncol.c @@ -3837,7 +3837,9 @@ mariadb_dyncol_val_str(DYNAMIC_STRING *str, DYNAMIC_COLUMN_VALUE *val, return ER_DYNCOL_RESOURCE; break; case DYN_COL_DOUBLE: - len= my_snprintf(buff, sizeof(buff), "%g", val->x.double_value); + + len= my_gcvt(val->x.double_value, MY_GCVT_ARG_DOUBLE, + sizeof(buff) - 1, buff, NULL); if (dynstr_realloc(str, len + (quote ? 2 : 0))) return ER_DYNCOL_RESOURCE; dynstr_append_mem(str, buff, len); -- cgit v1.2.1