Repository navigation
[3.0] Lists the posts to split off a topic in a defined order - #9714
Merged
jdarwood007 merged 1 commit intoOct 4, 2026
Merged
jdarwood007 merged 1 commit into
jdarwood007 merged 1 commit into
Conversation
The queries behind the split page only said ORDER BY when the member views topics newest first, and otherwise left the order to the database. MySQL happens to return InnoDB rows in primary key order, so it never showed there. PostgreSQL returns them in the order they sit in the table, so an edited post was listed after later ones, and with LIMIT on the same queries a post could appear on two pages of the list and be missing from another. They now always order by the message id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
This was referenced Sep 30, 2026
This was referenced Oct 4, 2026
jdarwood007
pushed a commit
that referenced
this pull request
Oct 31, 2026
The four queries behind the split page only ordered by message id for members who view topics newest first. Otherwise the order was the database's, which on PostgreSQL puts an edited post last, and with LIMIT decides which posts land on which page. Backport of #9714. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The page for choosing which posts to split off a topic lists them in no particular order on PostgreSQL.
All four queries behind it (
TopicSplit, the page itself and its xml refresh, for the selected and the not selected lists) only addedORDER BYwhen the member views topics newest first:Otherwise the order was the database's choice. MySQL happens to return InnoDB rows in primary key order, which is why this has gone unnoticed since 2.1 (v2.1.7 has the same line). PostgreSQL returns rows in the order they sit in the table, and an
UPDATEwrites a row's new version at the end, so a post that has been edited is listed after the posts that came after it. Because the same queries useLIMIT, the order also decides which posts land on which page of the list, so a post can appear on two pages and be missing from another.The queries now always order by the message id, descending for members who view newest first:
Test
TopicSplitTestposts a topic and two replies through the posting form, edits the first post in the database, and checks the split page lists the three oldest first. The edit is what makes PostgreSQL misorder the list; on MySQL the test passes either way. Without the change, on PostgreSQL:With it, it passes on both MySQL and PostgreSQL.
Found while building the template snapshot tests in #9712, where the split page's snapshot changed order on PostgreSQL between two runs.
Issues References (Fixes|Related|Closes)
Related: #9712
🤖 Generated with Claude Code