Deferrable constraints

Поиск
Список
Период
Сортировка
От Oleg Lebedev
Тема Deferrable constraints
Дата
Msg-id 993DBE5B4D02194382EC8DF8554A527303364B@postoffice.waterford.org
обсуждение исходный текст
Ответы Re: Deferrable constraints  (Bruno Wolff III <bruno@wolff.to>)
Список pgsql-general
Are there any plans to implement deferrable unique constraints?
 
I have two identical tables a1 and a2. Each of them has a primary key 'id' and unique constraint on 'prod' and 'code'.
Now, imagine the following situation:
a1:
 
id prod code
1  1     abc1
2  1     abc2
 
a2:
 
id prod code
1  1     abc2
2  1     abc1
 
Basically, a1 and a2 have code values swapped.
Now, I want to update 'code' values in table a1 with values from table a2 relying on equal 'id' values. This throws a 'can not insert duplicate value' exception.
Is there a way to deal with this situation? I would prefer not to update 'id' values based on 'prod' and 'code' values though.
 
Thanks.
 
Oleg

*************************************

This e-mail may contain privileged or confidential material intended for the named recipient only.
If you are not the named recipient, delete this message and all attachments.
Unauthorized reviewing, copying, printing, disclosing, or otherwise using information in this e-mail is prohibited.
We reserve the right to monitor e-mail sent through our network.

*************************************

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

Предыдущее
От: Sven Köhler
Дата:
Сообщение: Re: full featured alter table?
Следующее
От: Richard Welty
Дата:
Сообщение: Re: How to Process Mail in Postgre?