thousands comma numeric formatting in psql

Поиск
Список
Период
Сортировка
От Eugen Nedelcu
Тема thousands comma numeric formatting in psql
Дата
Msg-id 20050621054216.GA367@sifolt.ro
обсуждение исходный текст
Ответы 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>)
Список 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 по дате отправления:

Предыдущее
От: Mark Kirkwood
Дата:
Сообщение: Re: TODO Item - Return compressed length of TOAST datatypes
Следующее
От: Neil Conway
Дата:
Сообщение: Re: Continue stmt for plpgsql