Hello

one my customer reported following problem (checked on 8.4 and 8.3.6)

test case:

create table test(a integer);

create or replace function getid(_a integer) returns integer as $$
begin
  update test set a = _a where a = _a;
  return _a;
end;
$$ language plpgsql;

insert into test values(20);
select * from test where a = 20; --> one row
select getid(20); --> 20

the problem:

postgres=# delete from test where a = getid(20);
DELETE 0
Time: 1,510 ms

but

postgres=# explain analyze delete from test where a = getid(20);
                                           QUERY PLAN
-------------------------------------------------------------------------------------------------
 Seq Scan on test  (cost=0.00..640.00 rows=12 width=6) (actual
time=0.149..0.154 rows=1 loops=1)
   Filter: (a = getid(20))
 Total runtime: 0.221 ms
(3 rows)


explain analyze signalise one deleted row, but this is not true

regards
Pavel Stehule

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to