Deferrable constraints - Mailing list pgsql-general

From Oleg Lebedev
Subject Deferrable constraints
Date
Msg-id 993DBE5B4D02194382EC8DF8554A527303364B@postoffice.waterford.org
Whole thread Raw
Responses Re: Deferrable constraints  (Bruno Wolff III <bruno@wolff.to>)
List 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 by date:

Previous
From: Sven Köhler
Date:
Subject: Re: full featured alter table?
Next
From: Richard Welty
Date:
Subject: Re: How to Process Mail in Postgre?