Re: How can I change a cast from explicit only to implicit? - Mailing list pgsql-general

From Tom Lane
Subject Re: How can I change a cast from explicit only to implicit?
Date
Msg-id 847.1101405741@sss.pgh.pa.us
Whole thread Raw
In response to How can I change a cast from explicit only to implicit?  ("Julian Scarfe" <julian.scarfe@ntlworld.com>)
List 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 by date:

Previous
From: Tom Lane
Date:
Subject: Re: Using IN with subselect
Next
From: "Julian Scarfe"
Date:
Subject: Re: How can I change a cast from explicit only to implicit?