In PostgreSQL, the pg_input_is_valid() function tests whether the given string is valid input for the specified data type.
It returns a boolean value of either true or false.
This function only works if the data type’s input function has been updated to report invalid input as a “soft” error.