From: | Rafał Pietrak <rafal(at)ztk-rp(dot)eu> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | a row not deletes |
Date: | 2014-04-27 08:23:18 |
Message-ID: | 535CBE76.7030909@ztk-rp.eu |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2014-04-27 11:13:05 | Re: a row not deletes |
Previous Message | Tom Lane | 2014-04-27 04:29:39 | Re: about the copy command |