Re: ERROR: duplicate key violates unique constraint "client_alerts_PK"
От
Guillaume Lelarge
Тема
Re: ERROR: duplicate key violates unique constraint
"client_alerts_PK"
Дата
Msg-id
46E8D337.7090201@lelarge.info
Ответ на
Список
Дерево обсуждения
ERROR: duplicate key violates unique constraint "client_alerts_PK" Robert Starr <rob@surrenderdorothy.com.au>
Re: ERROR: duplicate key violates unique constraint "client_alerts_PK" "Laurent Yaish" <laurenty@gmail.com>
Re: ERROR: duplicate key violates unique constraint
"client_alerts_PK" Guillaume Lelarge <guillaume@lelarge.info>
Re: ERROR: duplicate key violates unique constraint "client_alerts_PK" "Laurent Yaish" <laurenty@gmail.com>
Laurent Yaish a écrit :
> Hi Rob,
>
> In your insert, do not explicitly specify a value for the primary key,
> instead use NEXTVAL('client_alerts_seq') which will return the next
> valid value and increment the sequence.
>
> i.e:
> insert into clients_alerts (id, client_id, alert_message,
> alert_complete, date, staff_id)
> values(NEXTVAL('client_alerts_seq'),'39','This is some alert
> text','0','2007-05-04 12:42:05','14');
>
Or, better, he doesn't have to put a value for it as it is already the
default value for this column :
insert into clients_alerts (client_id, alert_message, alert_complete,
date, staff_id)
values('39','This is some alert text','0','2007-05-04 12:42:05','14');
Regards.
--
Guillaume.
В списке pgadmin-support по дате отправления
От: Laurent Yaish
Дата: