On Sat, Oct 03, 2009 at 12:48:57PM -0400, Tom Lane wrote:
> I think the reason CREATE CAST exists is exactly that the cast mechanism
> *isn't* intended to provide conversions between any arbitrary pair of
> datatypes. It's only intended to provide conversions in those cases
> where the conversion semantics are obvious to some degree or other.
Yup, but the decision to officially bless some code as being a cast
rather than "just" a function seems very arbitrary, I think this is why
I don't understand its purpose.
> Since that's somewhat in the eye of the beholder, we allow the user
> to adjust edge cases by creating/removing casts --- but there's no
> expectation that when you define a new datatype, you'll provide casts
> to or from unrelated types.
I know there's no expectation to create any casts. I think what I'm
confused about is why anyone would ever bother creating any in the first
place. I have a feeling I may have used the functionality once, but
I can't think why or for what now. Having a function seems just as
expressive to me, which is why I think I'm missing the point.
--
Sam http://samason.me.uk/