| От | Tom Lane |
|---|---|
| Тема | Re: Cast possible only throught a function |
| Дата | |
| Msg-id | 9272.1059228593@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | Cast possible only throught a function ("Mendola Gaetano" <mendola@bigfoot.com>) |
| Список | pgsql-bugs |
"Mendola Gaetano" <mendola@bigfoot.com> writes:
> but I notice that the following function return correctly
> doing the integer -> interval cast in one "shot":
What plpgsql is doing is roughly comparable to
regression=# select '0'::interval;
interval
----------
00:00:00
(1 row)
This is not the same as a SQL type conversion --- that works only when a
cast function is defined in pg_cast.
plpgsql is pretty lax about datatype considerations. It is willing to
try to convert anything to anything else by running the first type's
output procedure (to get text) and then the second type's input
procedure. In straight SQL you'd have to specify a cast to text to
get the equivalent behavior.
regards, tom lane
В списке pgsql-bugs по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера