If an immutable function raises an exception, is that exception cached by the query optimizer? Or does it only cache in the case that a function actually returns a value?
The use case is a table books(book_id NOT NULL PRIMARY KEY, type_id) wherein type_id is considered immutable (enforced with a trigger).
The function f() must return type_id given book_id, and raise an exception if no entity with book_id exists. I'd like this function to be immutable so it can be used as a check constraint.
Kind regards,
Cochise Ruhulessin