Re: How can I change a cast from explicit only to implicit?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: How can I change a cast from explicit only to implicit?
Дата
Msg-id 847.1101405741@sss.pgh.pa.us
обсуждение исходный текст
Ответ на How can I change a cast from explicit only to implicit?  ("Julian Scarfe" <julian.scarfe@ntlworld.com>)
Список pgsql-general
"Julian Scarfe" <julian.scarfe@ntlworld.com> writes:
>                                           List of casts
>          Source type         |         Target type         |      Function
> |   Implicit?
> -----------------------------+-----------------------------+----------------
> -----+---------------
> ...
>  text                        | double precision            | float8
> | no

> OK, so to make the cast work without explicit casts in the SQL, I need the
> text to float8 (or another suitable numeric type) cast to be implicit.  But:
> ...
> So how can I force a built-in cast to become implicit?

If you're intent on doing that, you can change its entry in pg_cast.
But I think you'd be far better off to fix your application.  Implicit
casts across type categories have a habit of kicking in when you least
expected it, causing the backend to adopt surprising and unpleasant
interpretations of straightforward-looking queries.  If you check the
pgsql-bugs archives you will find some of the examples that prompted us
to change this cast to non-implicit...

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Using IN with subselect
Следующее
От: "Julian Scarfe"
Дата:
Сообщение: Re: How can I change a cast from explicit only to implicit?