Possible bug on update

From: "Jackson, DeJuan" <djackson(at)cpsgroup(dot)com>
To: PGSQL Hackers <pgsql-hackers(at)hub(dot)org>
Subject: Possible bug on update
Date: 1999-02-10 19:45:53
Message-ID: F10BB1FAF801D111829B0060971D839F661902@cpsmail
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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?

Browse pgsql-hackers by date

  From Date Subject
Next Message Ricardo J.C.Coelho 1999-02-10 21:47:29 Multiples concatenation operator (||)
Previous Message Angelos Karageorgiou 1999-02-10 19:15:45