From: | Gaetano Mendola <mendola(at)gmail(dot)com> |
---|---|
To: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | new field content lost |
Date: | 2008-04-17 16:12:30 |
Message-ID: | 480776EE.1060005@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi all,
since long time I have implemented a materialized view, today I had to add a
new field and I faced the following (I believe) bug.
The bug can be replicated on a 8.2.7
-- SETUP
create table test (a integer, b integer);
create table test_trigger (a integer);
CREATE OR REPLACE FUNCTION trigger_test()
RETURNS TRIGGER AS'
DECLARE
BEGIN
update test set b = b*10 where a = NEW.a;
RETURN NEW;
END;
' LANGUAGE 'plpgsql';
CREATE CONSTRAINT TRIGGER trigger_test
AFTER INSERT OR UPDATE ON test_trigger DEFERRABLE INITIALLY DEFERRED
FOR EACH ROW EXECUTE PROCEDURE trigger_test();
insert into test values (1,1),(2,2),(3,3);
insert into test_trigger values (1),(2),(3);
-- FROM CONNECTION A
update test_trigger set a=1 where a=1;
-- FROM CONNECTION B
alter table test add column c integer;
update test set c = 15;
select * from test;
-- FROM CONNECTION A
update test_trigger set a=2 where a=2;
--FROM CONNECTION B
select * from test;
you can see that the value c=15 for a=2 has been nullified
Regards
Gaetano
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2008-04-17 16:14:50 | Re: new field content lost |
Previous Message | Kris Jurka | 2008-04-17 16:10:38 | [Pljava-dev] stack depth limit exceeded - patch possible? |