After updating Discourse from 2.9.0.beta9 to 2.9.0.beta11, a user encountered a PG::UndefinedColumn: column bookmarks.post_id does not exist error, which originated from a migration that removed the post_id column from the bookmarks table. The issue persisted even in safe mode, ruling out plugins as the initial cause. Despite attempts to resolve it by restarting and removing the column, the error remained. Eventually, the user discovered that the issue was caused by an outdated plugin related to the topic-list-preview theme component, which had been abandoned and was no longer maintained. Switching to the maintained fork resolved the problem. theSuess identified the root cause after troubleshooting, while sam and codingCoffee provided insights and temporary fixes, such as re-adding the column.
After updating my discourse installation from 2.9.0.beta9 to 2.9.0.beta11, the installation completely froze as all calls listing topics suddenly return column bookmarks.post_id does not exist
I’ve tracked down the commit dropping this column to f8939bd294ff6822a61fb653b44a4df351321f54 which drops the column from the database. The issue also occurs in safe mode so I do not think a plugin is at fault.
Stacktrace:
app/models/topic_list.rb:84:in `topics'
app/serializers/suggested_topics_mixin.rb:17:in `include_suggested_topics?'
(eval):6:in `_fast_attributes'
app/controllers/topics_controller.rb:1199:in `block (2 levels) in perform_show_response'
app/controllers/topics_controller.rb:1194:in `perform_show_response'
app/controllers/topics_controller.rb:169:in `show'
app/controllers/application_controller.rb:413:in `block in with_resolved_locale'
app/controllers/application_controller.rb:413:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:71:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:366:in `call'
config/initializers/100-quiet_logger.rb:23:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
lib/middleware/enforce_hostname.rb:23:in `call'
lib/middleware/request_tracker.rb:202:in `call'
Failed to handle exception in exception app middleware : ActiveRecord::StatementInvalid : PG::UndefinedColumn: ERROR: column bookmarks.post_id does not exist
LINE 1: ...marks"."bookmarkable_type" FROM "bookmarks" WHERE "bookmarks...
I am very confused, this has been an ignored column for quite a while.
@martin needed to remove it, it is not longer something we use.
Do you have a custom setup? Are there any special plugins involved? Was the error a “transitional” thing that happened when the migration ran? (I would expect this error possibly during live update from the web interface under outlier conditions)
I’m using the default docker setup with a few plugins, but I could reproduce it in safe mode. Also, the stack traces do not contain any obvious references to plugins.
Updated using a full rebuild without any errors during the migration. Also tried re-running the migrations which reported no changes.
Previous versions of the Topic List Previews (TLP) were distributed as a plugin and then split up into a plugin and a theme component. During this initial split users were instructed to load the plugin from a new branch. However, as time went on, the branch got abandoned and was no longer maintained. After switching to the maintained fork, everything works again.