Re: Update violating constraint

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Update violating constraint
Дата
Msg-id 4639CF68.5080701@archonet.com
обсуждение исходный текст
Ответ на Re: Update violating constraint  (Alban Hertroys <alban@magproductions.nl>)
Ответы Re: Update violating constraint  (Alban Hertroys <alban@magproductions.nl>)
Список pgsql-general
Alban Hertroys wrote:
> Naz Gassiep wrote:
>> Hi,
>>     I'm trying to do an update on a table that has a unique constraint
>> on the field, I need to update the table by setting field = field+1

> I think you're looking for deferrable constraints; see:
>
> http://www.postgresql.org/docs/8.2/static/sql-set-constraints.html

Which won't work with unique constraints unfortunately. That's because
they're implemented through a unique index.

The work-around is to do: field = -field then field = -field + 1 or similar.

--
   Richard Huxton
   Archonet Ltd

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

Предыдущее
От: Alban Hertroys
Дата:
Сообщение: Re: Cross-schema inheritence problem
Следующее
От: Michael Glaesemann
Дата:
Сообщение: Re: Update violating constraint