Bryn Llewellyn <bryn@yugabyte.com> writes:
> OK, so I'm obliged to answer.
> Because SQL rests on the principle that you just say *what* you want but
> not *how*.
It also rests on the principle that the programmer shouldn't be too
concerned about micro-efficiencies. You've given a perfectly good
six-line implementation of what you want; use it and be happy.
> Oracle Database 12c Release 2 (and later) has a validate_conversion() built-in.
[ shrug... ] We are not Oracle. One of the main ways in which we
are not Oracle is that we support extensible database functionality.
To write a "validate_conversion" function that supports extension
datatypes, but doesn't use something morally equivalent to a
subtransaction, would be a nightmare: large, fragile, and probably
not all that much faster.
regards, tom lane