Thousands commas in psql - Mailing list pgsql-patches

From Eugen Nedelcu
Subject Thousands commas in psql
Date
Msg-id 20050620071114.GA501@sifolt.ro
Whole thread Raw
List 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.

pgsql-patches by date:

Previous
From: Petr Jelínek
Date:
Subject: [PATCH] fix for pg_stat_database (numbackends is always zero)
Next
From: Tom Lane
Date:
Subject: Re: [BUGS] BUG #1707: statistics collector starts with stats_start_collector