Re: unique constraint
От | Jeff Davis |
---|---|
Тема | Re: unique constraint |
Дата | |
Msg-id | 1287607397.28384.98.camel@jdavis-ux.asterdata.local обсуждение исходный текст |
Ответ на | Re: unique constraint (Michael Glaesemann <grzm@seespotcode.net>) |
Список | pgsql-general |
On Wed, 2010-10-20 at 16:10 -0400, Michael Glaesemann wrote: > Upgrade if you can. Otherwise you can do two updates when rearranging paragraphs. The first updates them to an "invalid"range which isn't used in "correct" data and so won't conflict with other values, and the second moves them backto the valid range of positions. > Negative numbers are often used for this middle range. The reason for the upgrade suggestion I believe was DEFERRABLE unique constraints. These allow you to temporarily violate a unique constraint, as long as it's correct at the end. See: http://www.postgresql.org/docs/9.0/static/sql-createtable.html and look for "DEFERRABLE". You can also consider a constraint trigger: http://www.postgresql.org/docs/9.0/static/sql-createconstraint.html Be careful to lock appropriately, however. Regards, Jeff Davis
В списке pgsql-general по дате отправления: