No, I meant implementing the syntax for being able
to declare a custom CAST function as safe (or not). Basically adding the
[SAFE] to
CREATE CAST (source_type AS target_type)
WITH [SAFE] FUNCTION function_name [ (argument_type [, ...]) ]
I'm not tied to this syntax choice, but this one seemed the most obvious and least invasive.
But this brings up an interesting point: if a cast is declared as WITHOUT FUNCTION aka COERCION_METHOD_BINARY, then the cast can never fail, and we should probably check for that because a cast that cannot fail can ignore the DEFAULT clause altogether and fall back to being an ordinary CAST().