Deferrable constraints

From: Oleg Lebedev <oleg(dot)lebedev(at)waterford(dot)org>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Deferrable constraints
Date: 2003-06-17 17:20:15
Message-ID: 993DBE5B4D02194382EC8DF8554A527303364B@postoffice.waterford.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joseph Shraibman 2003-06-17 17:32:33 Re: order of nested loop
Previous Message Richard Welty 2003-06-17 17:20:11 Re: How to Process Mail in Postgre?