How to do an UPDATE for all the fields that do NOT break a constraint?

Поиск
Список
Период
Сортировка
От Phoenix Kiula
Тема How to do an UPDATE for all the fields that do NOT break a constraint?
Дата
Msg-id e373d31e0901260509v6e67f1ebx412a215d4849a823@mail.gmail.com
обсуждение исходный текст
Ответы Re: How to do an UPDATE for all the fields that do NOT break a constraint?
Re: How to do an UPDATE for all the fields that do NOT break a constraint?
Список pgsql-general
I wonder if this is an SQL limitation or something I'm missing in the
PG manual, but I need to run an update on my database (to replace the
value of a column to match a new design structure).

Due to the new business logic, the  replaced value of a field may end
up being already present in the database in another record. This leads
to unique key violations when I run the update.

My question: I don't mind if the update transaction skips the records
where the key would be violated (this preservation is in fact what we
want) but these are only about 2% of the overall updatable records.

Is there anyway to make the transaction go through with the remaining
98% of the update SQL which will in fact NOT violate the unique
constraint?

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

Предыдущее
От: Grzegorz Jaśkiewicz
Дата:
Сообщение: where (x,y,z) in ((x1,y1, z1), (x1,y1, z1), (x1,y1, z1), (x2,y2, z2)) (not) optimized
Следующее
От: Matthias Karlsson
Дата:
Сообщение: Re: How to do an UPDATE for all the fields that do NOT break a constraint?