Re: Odd numeric->float4/8 casting behaviour

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Odd numeric->float4/8 casting behaviour
Дата
Msg-id 17690.1167927677@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Odd numeric->float4/8 casting behaviour  (Gregory Stark <stark@enterprisedb.com>)
Ответы Re: Odd numeric->float4/8 casting behaviour  (Gregory Stark <stark@enterprisedb.com>)
Список pgsql-hackers
Gregory Stark <stark@enterprisedb.com> writes:
> I believe this is happening because the numeric is being cast to float8 and
> then the float4-float8 cross-data-type operator is being used. It seems like
> it would be preferable to cast it to float4 and use the non-cross-data-type
> operator. They're both marked as implicit casts so I'm unclear what decides
> which gets used.

Without having traced through the code, I think the fact that float8 is
a "preferred type" is driving it.  It's not clear whether we could
change this without getting into a "can't resolve ambiguous operator"
problem.

> Also, as a side note I was surprised to find the above being parsed as
> -(0.999::numeric(3,3)) rather than (-0.999)::numeric(3,3) is that expected?

Yeah, :: binds VERY tightly.
        regards, tom lane


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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: Tabs or Spaces
Следующее
От: Gregory Stark
Дата:
Сообщение: Re: Odd numeric->float4/8 casting behaviour