Обсуждение: numeric type conversions

Поиск
Список
Период
Сортировка

numeric type conversions

От
Ruslan A Dautkhanov
Дата:
Hi,

I should cast field of 'text' type to the 'numeric' type,
but PG output error message: "ERROR:  Cannot cast type 'text' to
'numeric'".
I had tried to use conversion to type 'float' and all works good,
and now I must write quaries like next one:
    SELECT price::float::numeric .... FROM priceValues WHERE ...

Why confusion situation between types numeric, float and text ?
There are any reasons to not to write default type conversion
from 'text' to 'numeric' in the PostgreSQL 7.3?

Imho, almost all types should have default convertors from and to
the 'text' (varchar etc) type..

Thanks,
Ruslan A Dautkhanov

Re: numeric type conversions

От
Tom Lane
Дата:
Ruslan A Dautkhanov <rusland@scn.ru> writes:
> I should cast field of 'text' type to the 'numeric' type,
> but PG output error message: "ERROR:  Cannot cast type 'text' to
> 'numeric'".

This has been fixed for 7.3.

> Imho, almost all types should have default convertors from and to
> the 'text' (varchar etc) type..

Probably.

            regards, tom lane