| От | Brian |
|---|---|
| Тема | Update with join ignores where clause - updates all rows |
| Дата | |
| Msg-id | 000801c48d46$fc84b840$6a00a8c0@cygnusx1 обсуждение исходный текст |
| Ответы |
Re: Update with join ignores where clause - updates all rows
|
| Список | pgsql-bugs |
This WHERE clause finds a single row that has the same year,month,day,hour =
in another table.
It correctly counts 1 row.
SELECT count(*) FROM
dw.prints_by_hour_work w , dw.prints_by_hour h
WHERE
w.year =3D h.year
and w.month =3D h.month
and w.day =3D h.day
and w.hour =3D h.hour
The same join here, updates every row in the table which is incorrect.
update
dw.prints_by_hour
set
count =3D h.count + w.count
from
dw.prints_by_hour_work w , dw.prints_by_hour h
WHERE
w.year =3D h.year
and w.month =3D h.month
and w.day =3D h.day
and w.hour =3D h.hour
Is the join supported for UPDATE ?
If its supported then I can send the create statements etc so you can repro=
duce.
В списке pgsql-bugs по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера