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.l.johnson@cox.net |
| Jefferson, LA USA |
| |
| "I'm not a vegetarian because I love animals, I'm a vegetarian |
| because I hate vegetables!" |
| unknown |
+-----------------------------------------------------------------+