Re: Problems inserting data into a table with a sequence

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Problems inserting data into a table with a sequence
Дата
Msg-id 26029.1192489157@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Problems inserting data into a table with a sequence  (RNG <rgasch@gmail.com>)
Список pgsql-general
RNG <rgasch@gmail.com> writes:
> Trying to insert data into this table using the following SQL
> ...
> gives us the following error:
>  ERROR:  duplicate key violates unique constraint "pn_categories_category_pkey"

Usually the reason for this is that you inserted some rows with manually
assigned serial numbers (perhaps a COPY from an old version of the
table?) and forgot to advance the sequence past those numbers.  Try
something like

SELECT setval('pn_categories_category_cat_id_seq',
              (SELECT MAX(cat_id) + 1 FROM pn_categories_category));


            regards, tom lane

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

Предыдущее
От: RNG
Дата:
Сообщение: Problems inserting data into a table with a sequence
Следующее
От: "Merlin Moncure"
Дата:
Сообщение: Re: Convert bytea to Float8