Re: Looking for a doc section that presents the overload selection rules
Вложения
В списке pgsql-general по дате отправления:
| От | Peter J. Holzer |
|---|---|
| Тема | Re: Looking for a doc section that presents the overload selection rules |
| Дата | |
| Msg-id | YXMonFWzb8tNNnUo@hjp.at обсуждение |
| Ответ на | Re: Looking for a doc section that presents the overload selection rules (Bryn Llewellyn <bryn@yugabyte.com>) |
| Список | pgsql-general |
On 2021-10-22 10:26:38 -0700, Bryn Llewellyn wrote:
> There could, so easily, have been three “to_char()” overloads for these three
> data types that honored the spirit of the “::text” typecast by rendering only
> what’s meaningful, despite what the template asks for.
I think to_date() is very much intended to produce fixed-width output
even when that makes little sense given the input data. For example:
hjp=> select to_char(3::int, '999.999');
╔══════════╗
║ to_char ║
╟──────────╢
║ 3.000 ║
╚══════════╝
(1 row)
An int has no fractional part, but I asked for 3 digits after the
decimal point so I got them.
hjp=> select to_char(34567::int, '999.999');
╔══════════╗
║ to_char ║
╟──────────╢
║ ###.### ║
╚══════════╝
(1 row)
34567 doesn't fit into the 3 digits before the point I asked for, so I
just get hashes.
hp
--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp@hjp.at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера