The following bug has been logged online:
Bug reference: 2150
Logged by: Aaron Swartz
Email address: me(at)aaronsw(dot)com
PostgreSQL version: 8.1.1
Operating system: Mac OS X
Description: PL/Python function delcared STABLE gets run repeatedly
Details:
We have the PL/Python function get_foo(n) that returns an array. If this
function is declared IMMUTABLE, then:
SELECT * FROM tablenamehere WHERE id = any(get_foo(21));
returns quickly. If the function is declared STABLE, however, PostgreSQL
seems to incorrectly run it for every row in the table and it takes forever.