I have a content-type whose name is 35 characters long. When trying to assign actions to this content-type via the Trigger page (admin/build/trigger/workflow/1, for example), I would get a message in green that said that the action had been added, when in fact the action had not been added, had no effect on anything, and did not show up under the Trigger listing for that action.

After poking around in the database I found that the value for op in the database table drupal_trigger_assignments was being truncated based on the fact that my content-type has a long name. I changed the length of the op field (from VARCAR 30 (i think that was the original value) to VARCAR 46), which was sufficient to fit the name of my content-type plus the prefixes and suffixes that Workflow adds, and voilà, everything worked afterwards.

But there's no doubt that the default length of this field should be changed to accomodate long content-type names. I would suggest VARCAR 255.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jvandyk’s picture

Project: Workflow » Drupal core
Version: 6.x-1.x-dev » 7.x-dev
Component: Code » trigger.module
FileSize
656 bytes

In the 5.x-2.5 version of actions this column has already been increased to 40. But since noblends has even exceeded that limit, we should probably consider 64 or 128.

lilou’s picture

Status: Active » Needs work

Patch no longer applies.

jvandyk’s picture

See also http://drupal.org/node/309919#comment-1021853 where this was fixed in actions 5.x.

drewish’s picture

Status: Needs work » Needs review
FileSize
882 bytes

this expands it to 64

drewish’s picture

Status: Needs review » Needs work

humm... looks like the upgrade fails on MySQL: max key length is 1000 bytes

deekayen’s picture

gagarine’s picture

gagarine’s picture

To #5 the max length is 46 for 1000 bytes

jvandyk’s picture

Well, the op field should be going away anyway...since D7 no longer has ops.

http://drupal.org/node/525540

gagarine’s picture

Version: 7.x-dev » 6.x-dev
Status: Needs work » Needs review
FileSize
825 bytes

Thanks for this infos jvandyk

So the patch for D6...

jlaver’s picture

I decided 128 was a reasonable limit to solve the issues I've been having with the workflow module. In order to fit this into MySQL's maximum key length limit, I had to drop the length of 'aid' to 173 characters (no, the maths doesn't seem to even remotely add up, but that's MySQL for you).

webchick’s picture

Status: Needs review » Needs work

I can confirm this patch fixed the issue for me.

We were upgrading from a 5.x site with 4.7-style "content_foo_bar" CCK type names, and since Workflow module stores its ops as strings like "workflow-content_something_something-26", it soon got to the point that our primary key index was "workflow-workflow-content_something_something-26-og_remove_groups_action" which quickly overflowed. (See #638928: Action associations completely obliterated in upgrade from 5.x-1.x to 6.x-1.x for the nitty-gritty details, if you care, but I'm sure you don't. :))

This patch fixed the problem. It sounds like James found a better fix, though.

cwgordon7’s picture

Title: op field in drupal_trigger_assignments needs to be longer to support content types with long names » fields in drupal_trigger_assignments needs to be longer to support content types with long names
Version: 6.x-dev » 7.x-dev

Just because the 'op' field no longer exists in Drupal 7 does not mean that this issue is not equally applicable there. The data that was previously held in the 'op' field will no longer be there, but will be put in the hook name, making the hook name longer. We could quite easily see hooks that are longer than 32 characters, particularly with variable hook names - e.g., think hook_workflow_{node_type_name}_{id}, or hook_form_{form_id}_alter.

This should probably be fixed in the latest development version first before working on a Drupal 6 solution.

quicksketch’s picture

This issue has arisen in the Flag queue too: #1167538: flag name can be too long for trigger Poor trigger.module just doesn't get much love.

lalit774’s picture

FileSize
780 bytes

Hi ,

I have been trying to upgrade my site from Drupal 6 to 7 for a number of days now and each time, I run the update.php, I get errors in the Trigger module and Search module. I have followed everything in the upgrade.txt down to the 'T' and started from scratch each time the update process fails.

This is the error I get in my Trigger module:

Failed: PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'hook' at row 1: UPDATE {trigger_assignments} SET hook=:db_update_placeholder_0 WHERE (hook = :db_condition_placeholder_0) AND (op = :db_condition_placeholder_1) AND (aid = :db_condition_placeholder_2) ; Array ( [:db_update_placeholder_0] => workflow_workflow-pro_tournament_report-1 [:db_condition_placeholder_0] => workflow [:db_condition_placeholder_1] => workflow-pro_tournament_report-1 [:db_condition_placeholder_2] => 4 ) in trigger_update_7000() (line 67 of .../modules/trigger/trigger.install).

i have try to fixed. but not sure. it not impacting on other things. if we read the code of line 67.

<?php 
->fields(array('hook' => $record->hook . '_' . $record->op))
?>

any my drupal 6 data show trigger_assignments table like

hook op aid weight

workflow workflow-page-7 node_publish_action 1
workflow workflow-page-7 node_save_action 2
workflow workflow-page-3 node_publish_action 1

Now according to above line 67 the make update hook like this workflow_workflow-page-7. the hook name already added there and split with -. so i have changed the line 67 coding replace hook- to hook_.

find enclosed patch for this.

xjm’s picture

Status: Needs work » Closed (duplicate)

This sounds like a duplicate of #1280792: Trigger upgrade path: Node triggers removed when upgrading to 7-dev from 6.25. Could you try the patch in that issue and see if it resolves the problem? Thank you!