Re: text(bool), text(numeric)

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: text(bool), text(numeric)
Дата
Msg-id Pine.LNX.4.30.0111281429110.636-100000@peter.localdomain
обсуждение исходный текст
Ответ на text(bool), text(numeric)  (Vicktor <vic@adv.ru>)
Список pgsql-bugs
Vicktor writes:

>  Why not exists functions for convert any type to text?
>  I can't find text(bool), text(numeric) ...

Just because *some* mapping between data types exists it doesn't mean it's
the sound, well-defined, be-all-end-all.  For instance, one might think
that TRUE => 't' and FALSE => 'f' is a reasonable bool=>text conversion,
but the first person you'll run into will claim that 1 and 0 is better,
and the second person will say that the answer should be locale-dependent.
So instead of bothering with this you get to make your own choice with

    CASE WHEN value THEN 'value if true' ELSE 'value if false' END

The issues are similar with numeric=>text, but the to_char() family of
functions should be able to solve all your problems in this area.

--
Peter Eisentraut   peter_e@gmx.net

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Vicktor
Дата:
Сообщение: Re: text(bool), text(numeric)
Следующее
От: pgsql-bugs@postgresql.org
Дата:
Сообщение: Bug #524: Bad quoting of backslash in text arrays