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

From: "Julian Scarfe" <julian(dot)scarfe(at)ntlworld(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: How can I change a cast from explicit only to implicit?
Date: 2004-11-25 17:23:35
Message-ID: 029101c4d313$7fceb8b0$0600a8c0@Wilbur
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

In 7.2.x

template1=# select point('1'::text, '2'::text);
point
-------
(1,2)
(1 row)

but in 7.4.x

template1=# select point('1'::text, '2'::text);
ERROR: function point(text, text) does not exist
HINT: No function matches the given name and argument types. You may need
to add explicit type casts.

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:

template1=# create cast (text as float8) with function float8(text) as
implicit;
ERROR: cast from type text to type float8 already existsoat8(text) as
implicit;

template1=# drop cast (text as float8);
ERROR: cannot drop cast from text to double precision because it is
required by the database system

So how can I force a built-in cast to become implicit?

Thanks

Julian Scarfe

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2004-11-25 17:25:46 Re: Using IN with subselect
Previous Message Dave Smith 2004-11-25 17:19:23 Re: Using IN with subselect