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