Re: BUG #7651: Superfluous calls to functions used for indexing - Mailing list pgsql-bugs

From Jeff Davis
Subject Re: BUG #7651: Superfluous calls to functions used for indexing
Date
Msg-id 1353019478.14335.23.camel@sussancws0025
Whole thread Raw
In response to BUG #7651: Superfluous calls to functions used for indexing  (m-pg@8d.no)
Responses Re: BUG #7651: Superfluous calls to functions used for indexing
List pgsql-bugs
On Sun, 2012-11-11 at 15:45 +0000, m-pg@8d.no wrote:
> Bug: When making an index over a function, then selecting a result that does
> not contain the function call (but orders on it), Superfluous function calls
> are made. This possibly because the plan creates a projection containing the
> function value.

It's possible that the function call may be unnecessary, but that is
more of a performance enhancement, not a bug.

Also, the example function has side effects. If you declare functions
with side effects to be IMMUTABLE, you can get all kinds of problems.
You should certainly not rely on an IMMUTABLE function to be called a
specific number of times.

Regards,
    Jeff Davis

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #7662: INSERT rule doesn't work as expected
Next
From: chenhj@cn.fujitsu.com
Date:
Subject: BUG #7664: Program using libpq and ecpglib can not output native language