Hello, I'm working on an NNTP -> Discourse importer and I keep encountering a strange error message.
The error is:
ActiveRecord::RecordNotUnique: PG::Error: ERROR: duplicate key value violates unique constraint "cat_featured_threads"
DETAIL: Key (category_id, topic_id)=(90, 2893) already exists.
As i understand it, the featured topics for each category are the ones that appear under that category when it's viewed. I've looked into the database and I can see that the 'category_featured_topic' table only contains category id, topic id, creation/update dates and a ranking. Bearing in mind that the importer is creating a new post from each of the NNTP entries, it seemed impossible that it would give any two posts the same ID, and therefore it shouldn't be conflicting in this table.
Saying this, I have noticed that this error tends to occur when the topic title is similar to that of one that has already been given this 'featured' status. I can understand that topic title's being too similar can cause conflict, but when the 'category_featured_topics' table only relies on IDs, it doesn't seem so obvious as to wh this is happening.
Any light you can shed would be appeciated.
Matt