thousands comma numeric formatting in psql - Mailing list pgsql-patches

From Eugen Nedelcu
Subject thousands comma numeric formatting in psql
Date
Msg-id 20050621054216.GA367@sifolt.ro
Whole thread Raw
Responses Re: thousands comma numeric formatting in psql  (Bruno Wolff III <bruno@wolff.to>)
Re: thousands comma numeric formatting in psql  (Eugen Nedelcu <eugen@sifolt.ro>)
List pgsql-patches
Hello,

This is my first post to this list.
Sorry if my english it's not so good. It's not my native language.

I'm interrested to now if someone think that having a feature like
'thousands comma delimited numeric formatting' in psql it's a
usefull thing.

I've made a patch for psql that adds this feature, so issuing a
select like this:

my_database=> select 1234567.89;

results in:

   ?column?
--------------
 1,234,567.89

This feature is toggle on/off with a backslash command ('\n'):

my_database=> \n
Numeric formatting is off.

my_database=> select 1234567.89;

   ?column?
--------------
 1234567.89

For me, psql it's still the best client for postgres, faster and
flexible than graphic ones. And having tables with many numeric
columns witch contain huge numbers make difficult to read this
numbers.

One solution to deal with this is to use to_char function, but for
complex selects against multiple tables it's not a good option.

Another one is to make a custom function that works like this:

select my_function(... complex subselect ...);

but this seems ugly to me.

By adding the '\n' switch to psql I can make any complex select and
have all numeric fields in result formatted in easy readable form.

I'm not an expert in postgresql, so if someone thinks there is an
easier way to deal with numeric fields, please share.

If my idea is considered usefull I can post the patch to this list.

Best regards,
Eugen.

pgsql-patches by date:

Previous
From: Mark Kirkwood
Date:
Subject: Re: TODO Item - Return compressed length of TOAST datatypes
Next
From: Neil Conway
Date:
Subject: Re: Continue stmt for plpgsql