From: | Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: UPDATE sql question |
Date: | 2003-08-01 14:19:15 |
Message-ID: | 1059747555.7505.587.camel@haggis |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mon, 2003-07-28 at 03:24, Andrei Verovski wrote:
> Hi,
>
> What exactly will happen if UPDATE sql statement instructs to update
> some columns with the same values as already in the database? Will
> Postgres update only different values or it will simply modify all
> columns listed in UPDATE sql?
You mean this:
template1=# create table foo (f1 integer);
CREATE TABLE
template1=# insert into foo values (1);
INSERT 16992 1
template1=# insert into foo values (2);
INSERT 16993 1
template1=# insert into foo values (1);
INSERT 16994 1
template1=# insert into foo values (3);
INSERT 16995 1
template1=# select * from foo;
1
2
1
3
template1=# update foo set f1 = 1 where f1 = 1;
UPDATE 2
template1=# select * from foo;
2
3
1
1
Looks like it does what you tell it to do...
--
+-----------------------------------------------------------------+
| Ron Johnson, Jr. Home: ron(dot)l(dot)johnson(at)cox(dot)net |
| Jefferson, LA USA |
| |
| "I'm not a vegetarian because I love animals, I'm a vegetarian |
| because I hate vegetables!" |
| unknown |
+-----------------------------------------------------------------+
From | Date | Subject | |
---|---|---|---|
Next Message | Johnson, Shaunn | 2003-08-01 14:19:29 | PC color icon data? |
Previous Message | Ron Johnson | 2003-08-01 14:14:31 | Re: Table Stats |