It's not reasonable to expect the system to figure out the behavior
of C functions (see: halting problem). In the end this is why
creating base types is a superuser-only operation: it's possible
to crash the server with a wrong definition. I don't see any prospect
of making that meaningfully safer.