On Thu, 1 Sep 2005, Tom Lane wrote:
> Andrew Dunstan <andrew@dunslane.net> writes:
>> Tom Lane wrote:
>>> Sure you can. Make a SQL or PLPGSQL function that does the conversion
>>> you want and then create a cast using it.
>
>> That probably won't help him much with "values(0)":
>
> If I remember the context of the original request, it wasn't about that
> anyway, but about dealing with an existing smallint column.
Nope, actually, the original was to just convert an existing table from
using smallint->boolean, but what I'm looking at with the CREATE CAST is
to avoid reducing the # of changes that I have to make to the existing
application, so being able to auto-cast 0->'f' on an INSERT/UPDATE would
help wtih that ...
The app still needs to be fixed, but this would allow for the initial
change to be made a bit easier ...
----
Marc G. Fournier Hub.Org Networking Services (http://www.hub.org)
Email: scrappy@hub.org Yahoo!: yscrappy ICQ: 7615664