Hi the list,

I've just experienced an unexpected (for me) "loss" of DELETE. Is this a feature or a bug (postgres v.s. SQL)?

-------------------- test case -------------------------
test=# CREATE  TABLE test (a int, b text);
test=# INSERT  INTO  test (a,b) values (1,'asd');
test=# INSERT  INTO  test (a,b) values (2,'dfg');
test=# INSERT  INTO  test (a,b) values (3,'ghj');
test=# CREATE or replace FUNCTION test_del () returns trigger language plpgsql as $$ begin update test t set b = 'will delete this' where t.a=old.a; return old; end; $$; test=# CREATE TRIGGER test_trig BEFORE DELETE ON test for each row execute procedure test_del();

test=# DELETE FROM  test where a=2;
DELETE 0
test=# SELECT * from test;
 a  |  b
----+-----
  1 | asd
  3 | ghj
  2 | will delete this
(3 rows)
--------------------------------------------------------

e.g.: an indicated row is not deleted, despite the fact, that the selector wasn't changed by the intermediate UPDATE. I understand, that the bucket was changed by the update, but should that matter?

-R


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

Reply via email to