Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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.

pgsql-patches by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group