pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Davis <pgsql@j-davis.com>
To: m-pg@8d.no
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #7651: Superfluous calls to functions used for indexing
Date: Thu, 15 Nov 2012 14:44:38 -0800
Message-ID: <1353019478.14335.23.camel@sussancws0025> (raw)
In-Reply-To: <E1TXZjO-0000S2-1e@wrigleys.postgresql.org>
References: <E1TXZjO-0000S2-1e@wrigleys.postgresql.org>

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





view thread (4+ messages)  latest in thread

Message-ID: <1353019478.14335.23.camel@sussancws0025>
Permalink:  ../1353019478.14335.23.camel@sussancws0025/
Also on:    postgresql.org/message-id/1353019478.14335.23.camel@sussancws0025

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: pgsql@j-davis.com, m-pg@8d.no
  Subject: Re: BUG #7651: Superfluous calls to functions used for indexing
  In-Reply-To: <1353019478.14335.23.camel@sussancws0025>
  References: <E1TXZjO-0000S2-1e@wrigleys.postgresql.org> <1353019478.14335.23.camel@sussancws0025>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox