Re: unique key problem on update

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Re: unique key problem on update
Дата
Msg-id l1htsh$l9e$1@ger.gmane.org
обсуждение исходный текст
Ответ на Re: unique key problem on update  (Gary Stainburn <gary.stainburn@ringways.co.uk>)
Список pgsql-sql
Gary Stainburn wrote on 20.09.2013 18:30:
>> You need to define the primary key as deferrable:
>>
>> create table skills_pages
>> (
>>    sp_id        serial not null,
>>    sp_sequence  integer not null,
>>    sp_title     character varying(80),
>>    sp_narative  text,
>>    primary key (sp_id) deferrable
>> );
>
> Cheers. I'll look at that. It's actually the second unique index that's the
> problem but I'm guessing I can set that index up as deferrable too.

Ah, sorry didn't see that ;) but, yes it works the same way:

create table skills_pages
(  sp_id        serial not null,  sp_sequence  integer not null,  sp_title     character varying(80),  sp_narative
text, primary key (sp_id),  unique (sp_sequence) deferrable
 
);
 
> Hopefully it'll work for mysql too.
No, it won't.

MySQL neither has deferrable constraints nor does it evaluate them on statement level (they are *always* evaluated
row-by-row).







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

Предыдущее
От: Gary Stainburn
Дата:
Сообщение: Re: unique key problem on update
Следующее
От: James Sharrett
Дата:
Сообщение: the value of OLD on an initial row insert