Re: unique key problem on update

Поиск
Список
Период
Сортировка
От Thomas Kellerer
Тема Re: unique key problem on update
Дата
Msg-id l1ht05$9cq$1@ger.gmane.org
обсуждение исходный текст
Ответ на unique key problem on update  (Gary Stainburn <gary.stainburn@ringways.co.uk>)
Ответы Re: unique key problem on update
the value of OLD on an initial row insert
Список pgsql-sql
Gary Stainburn wrote on 20.09.2013 18:07:
> I want to add a new page after page 2 so I try to increase the sequence number
> of each row from page 3 onwards to make space in the sequence for the new
> record. However, I get duplicate key errors when I try. Can anyone suggest
> how I get round this.
>
> Also, the final version will be put onto a WordPress web site which means I
> will have to port it to MYSQL which I don't know, so any solution that will
> work with both systems would be a great help.
>

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,
primarykey (sp_id) deferrable
 
);






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

Предыдущее
От: Gary Stainburn
Дата:
Сообщение: unique key problem on update
Следующее
От: Gary Stainburn
Дата:
Сообщение: Re: unique key problem on update