Moving a post fails in unknown circumstances


(Richard - DiscourseHosting.com) #1

When trying to move a single post into a new topic, it fails with:

[db8237] Processing by TopicsController#move_posts as */*
[db8237]   Parameters: {"title"=>"importer 3 fichiers", "post_ids"=>["4455"], "category_id"=>"6", "topic_id"=>"1521"}
[db8237] Completed 500 Internal Server Error in 336ms (ActiveRecord: 108.5ms)
[db8237] ActiveRecord::RecordNotUnique (PG::UniqueViolation: ERROR:  duplicate key value violates unique constraint "index_posts_on_topic_id_and_post_number"
DETAIL:  Key (topic_id, post_number)=(1521, 3) already exists.

However, that is the post I’m trying to move.

db8237=# select id,post_number from posts where topic_id=1521;
  id  | post_number 
------+-------------
 4085 |           1
 4151 |           2
 4455 |           3

reindex index index_posts_on_topic_id_and_post_number; did not help.

Does anyone have any idea where to look? Or did we trigger an obscure bug here?


(Jeff Atwood) #2

Can you repro this @jomaxro?


(Joshua Rosenfeld) #4

Hmm…I’ve moved many posts around in the last 2 weeks without issue. @RGJ, is this site on tests-passed or stable? Is this just a single post with issues, or global? Can you still repro it?


(Richard - DiscourseHosting.com) #5

Sorry for the late response.
It’s on stable, and it’s just a single post (maybe more, but it’s not global). I can still repro it.


(Joshua Rosenfeld) #6

If it’s not global I’m not going to be able to reproduce this easily. Perhaps one of the engineers can tell more from the error above.


(Jeff Atwood) #7

We need a repro @RGJ


(Richard - DiscourseHosting.com) #8

I understand - but we can only repro this on one post on one forum so far.
I wasn’t expecting an immediate solution, just reporting it for documentation purposes, and maybe getting some advice, or hearing from other people who’re seeing the same issue allowing us to maybe see a common pattern.


(Gerhard Schlager) #9

I’ve noticed the same problem with imported posts. They do not always conform to requirements like min_post_length. Moving posts triggered those validations and silently prevented the posts from being moved to the target topic. It should be fixed.


(Gerhard Schlager) #10

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.