Re: BUG #7651: Superfluous calls to functions used for indexing

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: m-pg(at)8d(dot)no
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #7651: Superfluous calls to functions used for indexing
Date: 2012-11-15 22:44:38
Message-ID: 1353019478.14335.23.camel@sussancws0025
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Sun, 2012-11-11 at 15:45 +0000, m-pg(at)8d(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message chenhj 2012-11-16 03:48:42 BUG #7664: Program using libpq and ecpglib can not output native language
Previous Message ilfb 2012-11-15 17:15:04 BUG #7663: is not a bug but...