"Merlin Moncure" <[EMAIL PROTECTED]> writes:
> now, if ps ends up using a index scan on t, everything is ok.  However,
> if ps does a seqscan, f executes for every row on t examined until the
> [expr] criteria is met.  Is this a bug?

Works for me.

regression=# create function f(int) returns int as '
regression'# begin
regression'#   raise notice ''f(%)'', $1;
regression'#   return $1;
regression'# end' language plpgsql;
CREATE FUNCTION
regression=# select f(unique2) from tenk1 where unique2%2 = 1 limit 2;
NOTICE:  f(1)
NOTICE:  f(3)
 f
---
 1
 3
(2 rows)

regression=# prepare ps as
regression-# select f(unique2) from tenk1 where unique2%2 = 1 limit 2;
PREPARE
regression=# execute ps;
NOTICE:  f(1)
NOTICE:  f(3)
 f
---
 1
 3
(2 rows)

regression=#

You sure you aren't using f() in the WHERE clause?

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

               http://www.postgresql.org/docs/faqs/FAQ.html

Reply via email to