Re: a problem with index and user define type

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Weiping He <laser(at)zhengmai(dot)com(dot)cn>
Cc: Wang Mike <itlist(at)msn(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: a problem with index and user define type
Date: 2003-06-24 14:03:08
Message-ID: 19026.1056463388@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Weiping He <laser(at)zhengmai(dot)com(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-06-24 14:13:06 Re: Many Pl/PgSQL parameters -> AllocSetAlloc(128)?
Previous Message Tom Lane 2003-06-24 13:56:34 Re: dblink_ora - a first shot on Oracle ...