Peter Eisentraut <peter_e@gmx.net> writes:
> One more thing is that instead of looking up a cast function from type A
> to type B as "returns A, is named A, takes arg B" it could be looked up as
> "returns A, takes arg B, is a cast function", which would generalize this
> whole thing a bit more.
I thought about that, but it would require keeping an extra index on
pg_proc (there's no efficient way to search by result type now). Not
clear that it's worth it, especially considering that there's really
only one reasonable name for a cast function anyway. What else would
you want to call it than the name of the destination type?
Also, this convention assures that there's at most *one* cast function
for any type coercion A to B. If the name could be anything then we'd
need some auxiliary mechanism to prevent conflicting cast functions
from being declared. Seems like a lot of mechanism for a dubious goal.
regards, tom lane