Gurjeet Singh wrote:
>
> All's okay, except you should not have declared it IMMUTABLE, because the
> results depend on a database query.
>
> From the docs:
> IMMUTABLE indicates that the function cannot modify the database and always
> returns the same result when given the same argument values; that is, it does
> not do database lookups or otherwise use information not directly present in
> its argument list
>
Yes, my bad. Make that STABLE.
b