Thousands commas in psql

From: Eugen Nedelcu <eugen(at)sifolt(dot)ro>
To: pgsql-paches(at)postgresql(dot)org
Subject: Thousands commas in psql
Date: 2005-06-20 07:11:14
Message-ID: 20050620071114.GA501@sifolt.ro
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Hello everyone,

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 interested if someone think that having a feature like 'thousands
comma delimited numbers' in psql is a good thing.

I have made a patch for psql that adds this functionality.
This feature is triggered by a backslash switch '\n'.

So, issuing a select like:

my_database=> select 1234567.89;

results in:

?column?
--------
1,234,567.89
(1 row)

If we want to turn this feature off:

my_database=> \n
Number formating is off.
my_database=> select 1234567.89;

?column?
1234567.89
(1 row)

For me psql is still the best client for postgres, faster and flexible
than graphic ones. And having tables with many numeric columns that
contain huge numbers makes difficult to read this numbers.

One option for what I want was to use 'to_char' function. But this
is not a solution for complex selects against tables with 20 or more
numeric columns.

Another option was to make a custom function that act like this:
select my_function(... complex subselect against several tables,etc...);
but this seems ugly.

I'm not an expert in postgresql, so if someone thinks there is a better
way to resolv the problem exposed here, please share. If someone is
interested for my patch I will post it to this list or somewere else.

Best Regards,
Eugen.

Browse pgsql-patches by date

  From Date Subject
Next Message Andrew Dunstan 2005-06-20 09:06:32 plperl better array support
Previous Message Neil Conway 2005-06-20 05:40:36 code cleanup for tz