"James Harper" <james(dot)harper(at)bendigoit(dot)com(dot)au> writes:
> How much trouble am I going to get into by modifying the pg_cast table
> to call my function instead?
You can doubtless hack it to work if you slash-and-burn hard enough.
The question is why don't you fix your buggy application instead ...
regards, tom lane