# Undefined column 'boomarks.post\_id' after update

**URL:** https://meta.discourse.org/t/undefined-column-boomarks-post-id-after-update/245365
**Category:** Self-hosting
**Created:** [November 12, 2022, 10:29am UTC](https://meta.discourse.org/t/undefined-column-boomarks-post-id-after-update/245365 "2022-11-12T10:29:25Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![theSuess](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thesuess/32/214128_2.png) [@theSuess](https://meta.discourse.org/u/theSuess)
#### Post date: [November 12, 2022, 10:29am UTC](https://meta.discourse.org/t/undefined-column-boomarks-post-id-after-update/245365/1 "2022-11-12T10:29:25Z")

</div>

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](https://meta.discourse.org/t/53504?silent=true) so I do not think a plugin is at fault.

Stacktrace:

```plaintext
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...

```

Any help is appreciated

---

<div class="post-metadata">

### Author: ![theSuess](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thesuess/32/214128_2.png) [@theSuess](https://meta.discourse.org/u/theSuess)
#### Post date: [November 12, 2022, 10:33am UTC](https://meta.discourse.org/t/undefined-column-boomarks-post-id-after-update/245365/2 "2022-11-12T10:33:10Z")

</div>

I’ve fixed it for now by adding back the column to the database but I think that the root cause should be fixed instead 😬

Am happy to drop the column again if you need further diagnostics

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [November 15, 2022, 2:07am UTC](https://meta.discourse.org/t/undefined-column-boomarks-post-id-after-update/245365/4 "2022-11-15T02:07:56Z")

</div>

I am very confused, this has been an ignored column for quite a while.

> <https://github.com/discourse/discourse/blob/99cdb5a5a7a1226c76d85b466218fd7c6f303784/app/models/bookmark.rb#L4-L7>

@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)

---

<div class="post-metadata">

### Author: ![codingCoffee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codingcoffee/32/281892_2.png) [@codingCoffee](https://meta.discourse.org/u/codingCoffee)
#### Post date: [November 15, 2022, 7:17am UTC](https://meta.discourse.org/t/undefined-column-boomarks-post-id-after-update/245365/5 "2022-11-15T07:17:23Z")

</div>

Faced the same issue while updating today. Adding back the `post_id` column helped fix it.

Steps:

1. enter the discourse container

```plaintext
./launcher enter app

```

1. Enter `psql`

```plaintext
sudo -u postgres psql discourse

```

1. Add back the `post_id` column in the `bookmarks` table

```plaintext
ALTER TABLE bookmarks ADD COLUMN post_id int;

```

---

<div class="post-metadata">

### Author: ![theSuess](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thesuess/32/214128_2.png) [@theSuess](https://meta.discourse.org/u/theSuess)
#### Post date: [November 15, 2022, 7:51am UTC](https://meta.discourse.org/t/undefined-column-boomarks-post-id-after-update/245365/6 "2022-11-15T07:51:52Z")

</div>

I’m using the default docker setup with a few plugins, but I could reproduce it in [safe mode](https://meta.discourse.org/t/53504?silent=true). 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.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [November 16, 2022, 4:53am UTC](https://meta.discourse.org/t/undefined-column-boomarks-post-id-after-update/245365/7 "2022-11-16T04:53:14Z")

</div>

I’m confused…

Can you try

1. Removing the column again
2. Restarting your container `./launcher restart app`

Does the error persist?

Adding the column should not be needed.

---

<div class="post-metadata">

### Author: ![theSuess](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thesuess/32/214128_2.png) [@theSuess](https://meta.discourse.org/u/theSuess)
#### Post date: [November 16, 2022, 6:29am UTC](https://meta.discourse.org/t/undefined-column-boomarks-post-id-after-update/245365/8 "2022-11-16T06:29:16Z")

</div>

I’ve already tried restarting when first encountering the error. Just to verify, I did it again and the error persists. Might a theme component be causing issues? The topic-list-preview theme component was one of the similarities I’ve identified between our instance and [krita-artists.org](http://krita-artists.org) mentioned here: [Oops. The software powering this discussion forum encountered an unexpected problem - #10 by raghukamath](https://meta.discourse.org/t/oops-the-software-powering-this-discussion-forum-encountered-an-unexpected-problem/245593/10)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [November 16, 2022, 11:01am UTC](https://meta.discourse.org/t/undefined-column-boomarks-post-id-after-update/245365/9 "2022-11-16T11:01:16Z")

</div>

A theme component is very unlikely to trigger this, what is the full list of plugins you use?

Would you mind trying one more time?

---

<div class="post-metadata">

### Author: ![theSuess](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thesuess/32/214128_2.png) [@theSuess](https://meta.discourse.org/u/theSuess)
#### Post date: [November 16, 2022, 4:16pm UTC](https://meta.discourse.org/t/undefined-column-boomarks-post-id-after-update/245365/10 "2022-11-16T16:16:29Z")

</div>

I found the issue 🥳 It was a plugin issue after all 😅

Previous versions of the [Topic List Previews (TLP)](https://meta.discourse.org/t/topic-list-previews-theme-component/209973) 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.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [December 16, 2022, 4:17pm UTC](https://meta.discourse.org/t/undefined-column-boomarks-post-id-after-update/245365/11 "2022-12-16T16:17:15Z")

</div>

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