DB Error: Data too long for column 'comment_title' at row 1

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.
Saad Alsomihi
Posts: 1
Joined: Fri Jan 04, 2008 1:13 pm

DB Error: Data too long for column 'comment_title' at row 1

Postby Saad Alsomihi » Fri Jan 04, 2008 3:39 pm

The following message
DB Error: Data too long for column 'comment_title' at row 1
Arises when the reviewer trying to insert comment on article.

So I tried to know the reason behind it, and discovered that the size of the field for the name of article in ojs database is 255 characters but for comment title field is 90 characters only

So my solution is to increase the size for field
'comment_title' in table article_comments to be 255 characters

Same as the field setting_name in table article_settings

Is the solution to the problem which I have done is acceptable or that there problems behind him

Please assist in this.
And clarify whether this is a problem in the system or not

Saad alsomihi

Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm

Re: DB Error: Data too long for column 'comment_title' at row 1

Postby asmecher » Mon Jan 07, 2008 10:36 am

Hi Saad,

To increase the maximum length of that field, you'll need to change it in two places:
  • The dbscripts/xml/ojs_schema.xml descriptor, as you've done
  • The live database, by executing:

    Code: Select all

    ALTER TABLE article_comments CHANGE comment_title comment_title VARCHAR(255) NOT NULL;
Whenever you upgrade to a newer release, please make sure that this change is kept in the descriptor before running the upgrade script, or you may truncate your comments.

The reason this is happening is probably that you're not using UTF-8 support in your database (as configured in config.inc.php). This causes mismatches in the lengths of strings containing accents and other special characters, depending on whether you ask PHP or MySQL for the length of that string. If possible, I'd suggest enabling UTF-8 support.

Alec Smecher
Public Knowledge Project Team

Return to “OJS Technical Support”

Who is online

Users browsing this forum: No registered users and 2 guests