When going to /admin/build/block I get following SQL error:
user warning: Data too long for column 'delta' at row 1 query: INSERT INTO blocks (module, delta, theme, status, weight, region, custom, throttle, visibility, pages, title, cache) VALUES ('panels_mini', 'over_32_characters_here_causes_this_error', 'my_theme', 0, 0, '', 0, 0, 0, '', '', 1)
panels_mini_block() seems to create the block delta based on the mini panel name. However, there seems to be no validation for the name, so the user can type names exceeding the 32 character limit that is set by the database schema.
Comments
Comment #1
merlinofchaos commentedChecked in a max length value on the name property. Thanks for the report!
Comment #3
blackdog commentedThis happened today with D7. The mini panel name column in the DB is set to 255, but block delta is only 32. Happened after cloning a clone of a clone.
Comment #4
anacronaut commentedUsing Drupal 7.4 & Panels 7.x-3.0-alpha3 on CentoOS 5 and Apache 2.2.3. Received the following error when attempting to clear the cash using drush:
Deleted and recreated the mini panel with a shorter machine name (i.e. - 'delta') as a workaround.
Comment #5
guybedford commentedI also had this issue today - I increased the length of the column in the block table as a temporary work around.
Comment #6
damien_vancouver commentedI've also encountered the fatal PDO error: String data, right truncated: 1406 Data too long for column 'delta' at row 1
When I clear the cache and I have a mini-panel with a machine name that's longer than 32 characters.
I was able to recover from it by cloning the offending mini-panel and setting the clone to have a shorter machie name, then deleting the original one with the long name.
Seems we're missing that max length index on the machine name, at least for mini-panels in the current alpha!
Comment #7
damienmckennaThis is related to #956394: Database column not large enough making it impossible to assign a layout to a panels page, but this time in the opposite direction - allowing minipanels with names longer than 32 varchars will cause problems for the internal Block system.
Comment #8
BeaPower commentedThank you for helping me resolve this issue -- it was a problem with a mini panel whose machine name was very very long. Ive recreated it!
Comment #9
doompal commentedCould this not be resolved by not copying the old machine name when cloning - or perhaps enlarging the "edit" text, or maybe its just my eyes which are failing? To emphasise, I couldn't see that the field was editable and got caught by clone of a clone etc.
Comment #10
Letharion commented@merlinofchaos Has the maxlength perhaps just gone missing from D7? Is that still the solution? I'll roll a patch if that's the case.
Comment #11
Anonymous (not verified) commentedThe same error even occurs during cron-run and when installing/activating new modules (/admin/modules/list/confirm). Seen in 7.x-3.0-alpha3.
I therefore raised the priority to major and adjusted the issue title.
Setting the database-field block.delta to varchar(64) helps, at least as long as the names don't get longer than 64 chars.
Comment #12
dibs commentedThis issue just struck me while building some minipanels.
In my scenario it would have been good to have a limited on the machine name as the resulting error was very unhelpful.
We increased delta to 64 chars to work around.
Please fix :)
Comment #13
damienmckennaI believe this is fixed thanks to #956394: Database column not large enough making it impossible to assign a layout to a panels page? Anyone care to test it?
Comment #14
merlinofchaos commentedYes I think the maxlength has disappeared due to the conversion to export ui. This may not be a simple patch. This is annoying.
Comment #15
damienmckennaOk. So one reason to limit the names to 32 characters is that the core Block module won't allow a block delta longer than that, so you wouldn't be able to place the minipanel using block rules and in fact it may give an error if you happen to save the Block page at all (not confirmed). Just something to be aware of.
Comment #16
merlinofchaos commentedYeah.
We could go the route Views did and keep a hash so we can keep deltas short enough if necessary. That'd remove the need to fix the names, but of course it'll have the same problem Views has of totally wrecking your deltas if your names are too long.
Comment #17
mike503 commentedDefinitely an issue with cloning of a mini panel. It's biting us like mad right now.
Have to wind up changing block table to 64 chars, and/or force renaming the clone's machine name to stop the errors coming out.
Seems like this can be trapped just on the machine name creation for the mini panel name. truncate as necessary and if dupe name, truncate shorter and do a _1 _2 or something?
Comment #18
davemurphy commentedthis is a major issue for us, any fix in the pipeline?
rgds Dave
Comment #19
merlinofchaos commentedReally? You can't just make sure your mini panel names are under 32 characters? I realize it's a bug and all, but there's an obvious workaround.
Comment #20
mike503 commentedI believe it prefixes stuff and you don't realize it until too late; and once it is in the database it is broken without manual database surgery. At least in my experience.
Comment #21
acrollet commentedI ran into this issue as well, worth fixing IMO. Patch attached for review. Works for Me (TM).
Comment #22
Jorrit commentedPersonally, I would not do:
but:
In that way, the translatable string doesn't start with a space, which is nicer. Apart from that, it works fine.
Comment #23
mrf commentedLike the patch, I am using it to prevent site users who are unaware of this issue from regularly breaking cache clearing and update.php by adding yet another mini panel that causes this issue.
Patch still applies cleanly.
I'd prefer a solution that goes to the core of the problem... but any port in a storm.
Comment #24
acrollet commentedre-roll incorporating the suggestion in #22 - imo it's not a big enough change to warrant changing back to needs review...
Comment #25
merlinofchaos commentedCommitted and pushed. Thanks for the patch!
Comment #27
jisuo commentedJust wanted to give you a heads up that the patch #24 is missing in 7.x-3.3
I just had this happen again after updating the module.
Comment #28
merlinofchaos commentedThe release date of 7.x-3.3 is in 2012. The patch in #24 is dated 2013.
I believe this should adequately explain why 7.x-3.3 doesn't contain this patch.
Comment #29
pwaterz commentedThis is still happening in panels 3.3
Comment #30
pwaterz commentedScreen shot
Comment #31
merlinofchaos commentedpwaterz: Please read #28.
Comment #32
pwaterz commentedhaha woops, early morning!
Comment #33
esbenvb commentedThis patch solves the problem on 6.x-3.9
Comment #34
loopduplicate commentedHi All,
I have a client who needs me to finish up some work today so I have limited time to share right now.
I'll try to provide a patch when I finally get some sleep but for now, to work around the issue, I've created a custom module which alters the form to show a message and adds a validation function which prevents the form from being submitted if the machine name exceeds 32 characters.
Cheers,
Jeff
Comment #36
esbenvb commentedThis patch is the same as #33 but with proper file paths.