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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Julian Scarfe" <julian(dot)scarfe(at)ntlworld(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How can I change a cast from explicit only to implicit?
Date: 2004-11-25 18:02:21
Message-ID: 847.1101405741@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Julian Scarfe" <julian(dot)scarfe(at)ntlworld(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Julian Scarfe 2004-11-25 18:56:23 Re: How can I change a cast from explicit only to implicit?
Previous Message Tom Lane 2004-11-25 17:57:01 Re: Using IN with subselect