In Date Tools creating new content type:

Your content type ActivityDate has been created.
PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'delta' at row 1: INSERT INTO {block} (module, delta, theme, status, weight, region, pages, title) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7); Array ( [:db_insert_placeholder_0] => views [:db_insert_placeholder_1] => calendar_activitydate-calendar_block_1 [:db_insert_placeholder_2] => bartik [:db_insert_placeholder_3] => 1 [:db_insert_placeholder_4] => -1 [:db_insert_placeholder_5] => sidebar_first [:db_insert_placeholder_6] => [:db_insert_placeholder_7] => ) in drupal_write_record() (line 6846 of /srv/www/htdocs/DEVTEST/includes/common.inc).

Delta field in Table BLOCK is defined:
`delta` varchar(32) NOT NULL DEFAULT '0' COMMENT 'Unique ID for block within a module.',

This is not the first time I encounter this kind of problem.
May be Drupal CORE should make this field 64 because of the long standard naming system?

CommentFileSizeAuthor
#4 Screen-shot-2011-07-07-at-7.56.jpg199.65 KBchiappa
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bkmarsh’s picture

subscribe

KarenS’s picture

Status: Active » Fixed

I made a few changes to make a slightly longer content type name work and added some validation to the Date Tool to prevent you from trying to create a block that will be too long for that field.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

chiappa’s picture

Thank you! I am a total n00b yet I managed to solve it & my headache is gone.. This happened to me a couple of times as well, on the weirdest occasions.

For the next victim, I have attached a screenshot of phpmyadmin, where you need to go and change the 32 to a 64. In the screenshot it says varchar(64) but obviously it's going to show varchar(32) which you need to change.

BeaPower’s picture

do you change all 3 to 32? Because in drupal 7 - delta is already 32

choosedrupal’s picture

Great, it worked for me. Thanks for the post.

Turned out to be caused by cloning a mini panel. It added "clone_" to a machine name which caused this error.

bernard63’s picture

I changed the value of VARCHAR to 64 then 255 and still have the same problem:
I don't know how to solve this problem.

se7en76’s picture

I also had the issue just after having duplicated a mini-panel.
Direct database fix worked quietly for me. You're wonderful guys! thks again :)

subhojit777’s picture

thank you very much :) you saved my life

vacho’s picture

I have solved thanks to your response. Thanks..

jchatard’s picture

Status: Closed (fixed) » Active

Well just encountered the same behavior, so this cannot be considered fixed as it requires manual database tweaks.

jchatard’s picture

Status: Active » Closed (fixed)

Changing the status of the issue, as using a different LAMP stack don't let me reproduce the error.

sudhanshushekhar’s picture

#4 This is a perfect solution. Thanx a lot.

aaronmeister’s picture

I encountered this same problem when I cloned a mini panel.

I deleted the panel and just created a new mini panel with the necessary particulars. Much more simple than altering the database, which I'm not comfortable with.

jojojibba’s picture

Yessssss! Good solution. Thanks.

jmbailey’s picture

Just wanted to thank post #4. Worked great!

therobyouknow’s picture

#4 worked for me too - I did it in the command line:

mysql> ALTER TABLE `block` CHANGE `delta` `delta` VARCHAR(64);
Query OK, 106 rows affected (0.57 sec)
Records: 106  Duplicates: 0  Warnings: 0

mysql> 

So thank you, post #4, spot on, right on the money, thank you very much! Anyone who hasn't got this to work please comment here with more detail and we'll see if we can help, I want to be optimistic this would work for you.

(Just a side note/helpful tip: The poster of #4 has drupal as their prefix on table names in their db, which allows them to have the drupal tables in the same database used by other programs as it allows their drupal installation to 'pick out' the correct tables (drupal install provides for prefix to table names). This is a useful approach particularly for shared hosting environments where databases allowed are limited by package chosen. In my case I didn't use such a prefix so all I needed to refer to was the block table without a prefix. Note that I didn't include the other parameters shown in #4 post like UTF stuff as I think these are superfluous in this fix and were perhaps added by phpmyadmin; I just changed what was needed to be changed. By the way I love phpmyadmin but didn't have it set up on my system at the time.)

sunly917’s picture

Great post.

zuernBernhard’s picture

Issue summary: View changes
function MYMODULE_update_7000(&$sandbox) {
  // Increase length for type column in panels_pane
  $new_type_spec = array(
    'type' => 'varchar',
    'length' => '255',
    'default' => '',
  );
  db_change_field('panels_pane', 'type', 'type', $new_type_spec);

  // Increase length for pane column in panels_pane
  $new_panel_spec = array(
    'type' => 'varchar',
    'length' => '255',
    'default' => '',
  );
  db_change_field('panels_pane', 'panel', 'panel', $new_panel_spec);
}
drusims’s picture

It is too bad you fixed it this way because it does not let the Migrate module handle long file names (and, for instance, shorten them)

mchar’s picture

Comment #4 seems to be the case.

This is what I did:

  1. Backup the block table: mysqldump -uroot -p my_database block > block.sql
  2. Export the data from the block table before changing the delta's column varchar length: drush sql-query "select * from block" > block.txt
    so to be able to have a view of the data before and after the change.
  3. Do the colum's modification: drush sql-query "alter table block MODIFY delta VARCHAR(64)"
  4. Export the data again and compare them with the previous export
  5. Last, do a desc block at MySQL and see the actual change on the delta table from delta | varchar(32) to delta | varchar(64)
sunil-kumar’s picture

Very useful.