Weiping He <laser@zhengmai.com.cn> writes:
> we found the problem:
> We used IMMUTABLE modifier in our CREATE FUNCTION definition,
> though it's correct for our function to return same value if input the
> same *data*,
> but our data are passed by reference, not by value, so, some times we can't
> retrive out data. Remove IMMUTABLE fixed the problem.
> So, it seems to make it clear in docs would be a good help to function
> writers, would commit a documentation patch later if necessary.
I'm not sure what problem you're really describing, but it would be
entirely wrong for the docs to claim that pass-by-reference datatypes
shouldn't have immutable functions. float8 is pass-by-ref, for
instance, but they don't come any more immutable than sqrt(x) ...
I'd suggest taking a closer look to understand what the problem really
is. Trying to index on a non-immutable function makes no sense, which
is why the system forbids it.
regards, tom lane