Skip to content

A platform for community discussion. Free, open, simple.

This commit fixes an undesirable geometric query memory usage introduced in b908abe35a0121e7df69ab3bbced259b6a2b7104 (#29539)

pgcd725d2411e5e7
diff --git a/app/models/topic.rb b/app/models/topic.rb
index d796b3c895f..f17c7eecf53 100644
--- a/app/models/topic.rb
+++ b/app/models/topic.rb
@@ -881,7 +881,8 @@ class Topic < ActiveRecord::Base
WHERE
topics.archetype <> 'private_message' AND
X.topic_id = topics.id AND
- Y.topic_id = topics.id AND (
+ Y.topic_id = topics.id AND
+ Z.topic_id = topics.id AND (
topics.highest_staff_post_number <> X.highest_post_number OR
topics.highest_post_number <> Y.highest_post_number OR
topics.last_posted_at <> Y.last_posted_at OR
@@ -926,7 +927,8 @@ class Topic < ActiveRecord::Base
WHERE
topics.archetype = 'private_message' AND
X.topic_id = topics.id AND
- Y.topic_id = topics.id AND (
+ Y.topic_id = topics.id AND
+ Z.topic_id = topics.id AND (
topics.highest_staff_post_number <> X.highest_post_number OR
topics.highest_post_number <> Y.highest_post_number OR
topics.last_posted_at <> Y.last_posted_at OR