Re: [GENERAL] Immutable functions, Exceptions and the Query Optimizer

2013-02-18 Thread Albe Laurenz
Cochise Ruhulessin wrote: Regarding your question about what the CHECK constraint should achieve, I had abstracted by use case into Books/Book Types, which may have caused some vagueness. The actual use case are the following tables. [...] CREATE TABLE persons( person_id int8 NOT

Re: [GENERAL] Immutable functions, Exceptions and the Query Optimizer

2013-02-15 Thread Albe Laurenz
Cochise Ruhulessin wrote: 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? If an error occurs, query processing is terminated, so nothing needs to be cached. PostgreSQL

[GENERAL] Immutable functions, Exceptions and the Query Optimizer

2013-02-14 Thread Cochise Ruhulessin
Hello all, 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