# New index on post\_custom\_fields can not be created

**URL:** https://meta.discourse.org/t/new-index-on-post-custom-fields-can-not-be-created/31434
**Category:** Bug
**Created:** [July 26, 2015, 12:36am UTC](https://meta.discourse.org/t/new-index-on-post-custom-fields-can-not-be-created/31434 "2015-07-26T00:36:57Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![Steven](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/steven/32/187890_2.png) [@Steven](https://meta.discourse.org/u/Steven)
#### Post date: [July 26, 2015, 12:36am UTC](https://meta.discourse.org/t/new-index-on-post-custom-fields-can-not-be-created/31434/1 "2015-07-26T00:36:57Z")

</div>

Hi everyone !

When I use the docker manager to upgrade Discourse, I have an error during the `db migrate` part since thursday or friday. Tonight I tried to rebuild app to see what happens (why not right ? 😅 ) and it always fail on bootstrap, here the message :

```
FAILED
--------------------
RuntimeError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 510 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:105:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"bundle_exec", "cmd"=>["su discourse -c 'bundle install --deployment --verbose --without test --without development'", "su discourse -c 'bundle exec rake db:migrate'", "su discourse -c 'bundle exec rake assets:precompile'"]}
d296ee0c0364464ffaaad8aaa34ece7826d517dde1326e3f068dd68b9b8c354c

```

When I reboot the droplet on Digital Ocean, my forum is fine, and it seems that my discourse version is actually upgrading (currently v1.4.0.beta6 +93) but this problem intrigue me.

I have some plugin : [spoiler alert](https://github.com/discourse/discourse-spoiler-alert), [discourse details](https://github.com/discourse/discourse-details) and some personal plugins (based on the creations of the community) : [some organized emojis](https://github.com/iunctis/vb_emoji), [a complete toolbar](https://github.com/iunctis/iunctis_toolbar), and some [bbcodes](https://github.com/iunctis/iunctis_bbcodes), but it doesn’t seem to be the problem considering the report. I didn’t add any plugins in the last 2 or 3 weeks.

Do you have an idea of the cause of that problem ? This error message is enough or do you need more info ?

Again, sorry for my english, I hope i’m pretty clear 😜

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [July 26, 2015, 12:47am UTC](https://meta.discourse.org/t/new-index-on-post-custom-fields-can-not-be-created/31434/2 "2015-07-26T00:47:53Z")

</div>

Almost certainly unsupported plugins. Unless we ship them, disable them and try again. Also you would need to look much further upstream in the logs for the actual error.

---

<div class="post-metadata">

### Author: ![Steven](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/steven/32/187890_2.png) [@Steven](https://meta.discourse.org/u/Steven)
#### Post date: [July 27, 2015, 12:04am UTC](https://meta.discourse.org/t/new-index-on-post-custom-fields-can-not-be-created/31434/3 "2015-07-27T00:04:47Z")

</div>

Hello again, thanks for the reply. Tonight, I edited the app.yml and delete my plugins, leaving only the Docker Manager plugin, it failed again during the rebuild app.

I copied the process :

- via [Docker Manager](http://www.iunctis.ovh/docker_manager.txt) (it always stops at this time)
- via [the rebuild app process](http://www.iunctis.ovh/rebuild_app.txt)

Nothing urgent here, my problem is not a priority, Discourse is up to date via Docker Manager and with a reboot it’s running fine. But if someone has an idea, I’ll take it 😉

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [July 27, 2015, 1:49am UTC](https://meta.discourse.org/t/new-index-on-post-custom-fields-can-not-be-created/31434/4 "2015-07-27T01:49:34Z")

</div>

We would need the full logs your error is deeper upstream

---

<div class="post-metadata">

### Author: ![Steven](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/steven/32/187890_2.png) [@Steven](https://meta.discourse.org/u/Steven)
#### Post date: [July 27, 2015, 1:25pm UTC](https://meta.discourse.org/t/new-index-on-post-custom-fields-can-not-be-created/31434/5 "2015-07-27T13:25:23Z")

</div>

Where can I find the full logs ?

Is it the production log in /var/discourse/shared/standalone/log/rails ?

---

<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: [July 27, 2015, 1:58pm UTC](https://meta.discourse.org/t/new-index-on-post-custom-fields-can-not-be-created/31434/6 "2015-07-27T13:58:33Z")

</div>

The full output of launcher rebuild…

---

<div class="post-metadata">

### Author: ![Steven](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/steven/32/187890_2.png) [@Steven](https://meta.discourse.org/u/Steven)
#### Post date: [July 27, 2015, 3:56pm UTC](https://meta.discourse.org/t/new-index-on-post-custom-fields-can-not-be-created/31434/7 "2015-07-27T15:56:37Z")

</div>

That’s what I did in this file : [http://www.iunctis.ovh/rebuild\_app.txt](http://www.iunctis.ovh/rebuild_app.txt)

Something’s missing ?

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [July 27, 2015, 4:50pm UTC](https://meta.discourse.org/t/new-index-on-post-custom-fields-can-not-be-created/31434/8 "2015-07-27T16:50:52Z")

</div>

```plaintext
PG::ProgramLimitExceeded: ERROR: index row size 5640 exceeds maximum 2712 for index "index_post_custom_fields_on_name_and_value"
HINT: Values larger than 1/3 of a buffer page cannot be indexed.
Consider a function index of an MD5 hash of the value, or use full text indexing.
: CREATE INDEX "index_post_custom_fields_on_name_and_value" ON "post_custom_fields" ("name", "value")/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rack-mini-profiler-0.9.6/lib/patches/db/pg.rb:90:in `exec'

```

Do we need to kill that index?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [July 27, 2015, 7:46pm UTC](https://meta.discourse.org/t/new-index-on-post-custom-fields-can-not-be-created/31434/9 "2015-07-27T19:46:21Z")

</div>

Hmm is this your index @eviltrout?

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [July 27, 2015, 7:47pm UTC](https://meta.discourse.org/t/new-index-on-post-custom-fields-can-not-be-created/31434/10 "2015-07-27T19:47:49Z")

</div>

Yes I added it because @sam asked me to. Maybe we should only index the first few characters of `value`?

---

<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: [July 27, 2015, 8:56pm UTC](https://meta.discourse.org/t/new-index-on-post-custom-fields-can-not-be-created/31434/11 "2015-07-27T20:56:04Z")

</div>

aha … probably, we need to do something here.

I have a feeling that this is going to be tricky

> <https://stackoverflow.com/questions/19256009/create-index-on-first-3-characters-area-code-of-phone-field/19256183#19256183>

---

<div class="post-metadata">

### Author: ![Steven](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/steven/32/187890_2.png) [@Steven](https://meta.discourse.org/u/Steven)
#### Post date: [July 28, 2015, 12:28am UTC](https://meta.discourse.org/t/new-index-on-post-custom-fields-can-not-be-created/31434/12 "2015-07-28T00:28:42Z")

</div>

I hope it’ll not be a big trouble.

Tonight, I upgraded discourse to the latest version and I cannot access any topic : [http://iunctis.fr/](http://iunctis.fr/)

```
Topic failed to load

Sorry, we couldn't load that topic, possibly due to a connection 
problem. Please try again. If the problem persists, let us know.

```

I shutdown the server, restarted it, It doesn’t work

 ![](https://global.discourse-cdn.com/meta/original/3X/a/9/a9ed1fe2d69d3a6930649ad925b32f47402ac5b0.jpg) 

Could it be connected ? Or should I open a new topic ?

---

<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: [July 28, 2015, 12:50am UTC](https://meta.discourse.org/t/new-index-on-post-custom-fields-can-not-be-created/31434/13 "2015-07-28T00:50:46Z")

</div>

This should fix you up:

[https://github.com/discourse/discourse/commit/ea5ef3bcf69b70f9b68edd2aeb3b2122a61b2b45](https://github.com/discourse/discourse/commit/ea5ef3bcf69b70f9b68edd2aeb3b2122a61b2b45)

Wait till it hits tests-passed

---

<div class="post-metadata">

### Author: ![Steven](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/steven/32/187890_2.png) [@Steven](https://meta.discourse.org/u/Steven)
#### Post date: [July 28, 2015, 12:57am UTC](https://meta.discourse.org/t/new-index-on-post-custom-fields-can-not-be-created/31434/14 "2015-07-28T00:57:16Z")

</div>

It works ! Thanks @sam !

I tried to rebuild app first, it didn’t work. But a few minutes ago, the new version appeared in my docker manager and It worked

[http://iunctis.fr/uploads/default/\_emoji/obama6.png](http://iunctis.fr/uploads/default/_emoji/obama6.png)

---

<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: [July 28, 2015, 1:11am UTC](https://meta.discourse.org/t/new-index-on-post-custom-fields-can-not-be-created/31434/15 "2015-07-28T01:11:00Z")

</div>


