Обсуждение: Deferrable constraints

Поиск
Список
Период
Сортировка

Deferrable constraints

От
Oleg Lebedev
Дата:
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.

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

Re: Deferrable constraints

От
Bruno Wolff III
Дата:
On Tue, Jun 17, 2003 at 11:20:15 -0600,
  Oleg Lebedev <oleg.lebedev@waterford.org> wrote:
> Are there any plans to implement deferrable unique constraints?

It is on the TODO list (http://developer.postgresql.org/todo.php):
* Allow DEFERRABLE UNIQUE constraints

Re: Deferrable constraints

От
Oleg Lebedev
Дата:
Hmm,
I really need to disable that unqiue constraint temporarily during the
table update. I tried to mess with pg_constraint and pg_index, but
didn't figure out how to do this.
Any ideas from system schema buffs?
Thanks.

Oleg

-----Original Message-----
From: Bruno Wolff III [mailto:bruno@wolff.to]
Sent: Tuesday, June 17, 2003 11:37 AM
To: Oleg Lebedev
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Deferrable constraints


On Tue, Jun 17, 2003 at 11:20:15 -0600,
  Oleg Lebedev <oleg.lebedev@waterford.org> wrote:
> Are there any plans to implement deferrable unique constraints?

It is on the TODO list (http://developer.postgresql.org/todo.php):
* Allow DEFERRABLE UNIQUE constraints

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

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.

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