Re: thousands comma numeric formatting in psql

From: Eugen Nedelcu <eugen(at)sifolt(dot)ro>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: thousands comma numeric formatting in psql
Date: 2005-07-18 08:14:59
Message-ID: 20050718081459.GA385@sifolt.ro
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

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

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Simon Riggs 2005-07-18 12:20:25 Re: Constraint Exclusion (Partitioning) - Initial Review
Previous Message Tom Lane 2005-07-18 05:32:38 Re: PL/PGSQL: Dynamic Record Introspection