In function format_numericsep() you have:

new_str = pg_local_malloc(len_numericseps(my_str) + 1),

instead of:

new_str = pg_local_malloc(len_with_numericsep(my_str) + 1)

Another bug is in function len_numericseps(). This apear for querys 
like:

select NULL::numeric; or
select * from table_with_numeric_fields; where one of numeric fields
have null values;

For such values, len_numericseps returns -1, instead of 0.

Instead of:

if (int_len % groupdigits != 0)
    sep_len = int_len / groupdigits;
else
    sep_len = int_len / groupdigits - 1;
    
you must have:

if (int_len % groupdigits != 0 || int_len == 0)
    sep_len = int_len / groupdigits;
else
    sep_len = int_len / groupdigits - 1;

Best Regards,
Eugen

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply via email to