update the same tuple in one command twice

Поиск
Список
Период
Сортировка
От terry
Тема update the same tuple in one command twice
Дата
Msg-id hnnb78$2svu$1@news.hub.org
обсуждение исходный текст
Ответы Re: update the same tuple in one command twice
Список pgsql-bugs
In one command, why can we update the same tuple for twice?
And the result is not predicated!!

Welcome to psql 8.3.3, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

TEST=# CREATE TABLE t1(a INT, b INT);
CREATE TABLE
TEST=# CREATE TABLE t2(c INT, d INT, e INT);
CREATE TABLE
TEST=# INSERT INTO t1 VALUES(1, 1);
INSERT 0 1
TEST=# INSERT INTO t1 VALUES(2, 3);
INSERT 0 1
TEST=# INSERT INTO t2 VALUES(2, 203, 212);
INSERT 0 1
TEST=# INSERT INTO t2 VALUES(2, 324, 1342);
INSERT 0 1
TEST=# INSERT INTO t2 VALUES(3, 342, 214);
INSERT 0 1
TEST=# update t1 set a = t2.d from t2 where a=t2.c;
UPDATE 1
TEST=# select * from t1;
  a  | b
-----+---
   1 | 1
 203 | 3
(2 rows)

why not is:
  a  | b
-----+---
   1 | 1
 324 | 3
(2 rows)

TEST=# select * from t2;
 c |  d  |  e
---+-----+------
 2 | 203 |  212
 2 | 324 | 1342
 3 | 342 |  214
(3 rows)

TEST=#

В списке pgsql-bugs по дате отправления:

Предыдущее
От: beulah prasanthi
Дата:
Сообщение: could not load library
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Error when lock conflict on REPLACE function