# «max topic title length» does not conform to the database field capacity because the database field is unable to store more than 255 characters anyway

**URL:** https://meta.discourse.org/t/max-topic-title-length-does-not-conform-to-the-database-field-capacity-because-the-database-field-is-unable-to-store-more-than-255-characters-anyway/35480
**Category:** Bug
**Created:** [2015 年11 月 12 日 04:06 UTC](https://meta.discourse.org/t/max-topic-title-length-does-not-conform-to-the-database-field-capacity-because-the-database-field-is-unable-to-store-more-than-255-characters-anyway/35480 "2015-11-12T04:06:36Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![dmitry\_fedyuk](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dmitry_fedyuk/32/293153_2.png) [@dmitry\_fedyuk](https://meta.discourse.org/u/dmitry_fedyuk)
#### Post date: [2015 年11 月 12 日 04:06 UTC](https://meta.discourse.org/t/max-topic-title-length-does-not-conform-to-the-database-field-capacity-because-the-database-field-is-unable-to-store-more-than-255-characters-anyway/35480/1 "2015-11-12T04:06:36Z")

</div>

So when an administrator set a «`max topic title length`» value which is great than `255` then it can lead to the database error

```plaintext
ActiveRecord::StatementInvalid (PG::StringDataRightTruncation: ERROR: value too long for type character varying(255) : INSERT INTO "topics"

```

---

<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: [2015 年11 月 12 日 05:17 UTC](https://meta.discourse.org/t/max-topic-title-length-does-not-conform-to-the-database-field-capacity-because-the-database-field-is-unable-to-store-more-than-255-characters-anyway/35480/2 "2015-11-12T05:17:41Z")

</div>

Good point can you add a max allowed int validation param to the yml for this site setting @techapj? We certainly set max int on other site settings.

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [2015 年11 月 12 日 06:31 UTC](https://meta.discourse.org/t/max-topic-title-length-does-not-conform-to-the-database-field-capacity-because-the-database-field-is-unable-to-store-more-than-255-characters-anyway/35480/3 "2015-11-12T06:31:58Z")

</div>

Fixed via:

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

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [2015 年11 月 12 日 06:32 UTC](https://meta.discourse.org/t/max-topic-title-length-does-not-conform-to-the-database-field-capacity-because-the-database-field-is-unable-to-store-more-than-255-characters-anyway/35480/4 "2015-11-12T06:32:05Z")

</div>


