Possible bug on update - Mailing list pgsql-hackers

From Jackson, DeJuan
Subject Possible bug on update
Date
Msg-id F10BB1FAF801D111829B0060971D839F661902@cpsmail
Whole thread Raw
List pgsql-hackers
What should be the results of this little test:

drop table t1;
drop table t2;
create table t1 (a int, b int);
create table t2 (a int, c int);
insert into t1(a, b) VALUES (1, 1); 
insert into t1(a, b) VALUES (1, 2); 
insert into t1(a, b) VALUES (1, 3); 
insert into t1(a, b) VALUES (1, 4); 
insert into t1(a, b) VALUES (2, 1);   
insert into t1(a, b) VALUES (2, 2); 
insert into t1(a, b) VALUES (2, 3); 
insert into t1(a, b) VALUES (3, 1);  
insert into t1(a, b) VALUES (3, 2); 
select * from t1;
insert into t2 (a, c) select distinct a, 0 from t1;   
select * from t2;
update t2 set c = c+b from t1 where t1.a=t2.a;
select * from t2;

My guess would be:
a|c
-+--
1|10
2|6
3|3
(3 rows)
How does the standard address this?


pgsql-hackers by date:

Previous
From: Angelos Karageorgiou
Date:
Subject: ...
Next
From: "Ricardo J.C.Coelho"
Date:
Subject: Multiples concatenation operator (||)