Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The error is:
PDOException: SQLSTATE[01000]: Warning: 1265 Data truncated for column 'nid' at row 1: INSERT INTO {menu_node} (nid, mlid) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1); Array ( [:db_insert_placeholder_0] => 6705/ [:db_insert_placeholder_1] => 2109 ) in menu_node_enable() (line 59 of /var/aegir/platforms/soa.utexas.edu/sites/all/modules/menu_node/menu_node.install).
Attached patch casts the nid to an int to truncate that extra slash before it gets to the db layer. Not sure why that extra slash exists but if ti does it should be removed im sure.
* Graciously sponsored by the School of Architecture at the University of Texas
Comment | File | Size | Author |
---|---|---|---|
#19 | install_fails_exception-1691508-19.patch | 1.56 KB | gabriel.achille |
| |||
#16 | install_fails_exception-1691508-16.patch | 1.53 KB | gabriel.achille |
#6 | Screen Shot 2013-06-30 at 10.07.32 AM.png | 58.45 KB | Renee S |
cast_to_int.patch | 753 bytes | michaelfavia | |
Comments
Comment #1
agentrickardThat's pretty weird. You have any idea what database row causes this to choke? I'd like to see that data.
And doesn't db_insert() handle this for us?
Comment #2
audealexandre CreditAttribution: audealexandre commentedHi,
Maybe the following can help: I had a similar problem when installing the module :error message: "1265 data truncated for column "nid" at row 1 [...]". The problem came from the use of tokens in the menu link (module Menu tokens), which tried to insert in the table nid such as "24?lib=[node:nid]". When I delete these menu items, it worked perfectly. Maybe just add a verification before inserting the nid into the table?
Comment #3
agentrickardThat sounds like the missing information we need, yes.
Comment #4
gabriel.achille CreditAttribution: gabriel.achille commented@audealexandre, @michaelfavia:
I can't reproduce the bug: having latest release of Menu token installed (7.x-1.0-beta4), + some 'menu token' links created like "node/1?lib=[node:nid]". No errors are raised when enabling module menu_node. And according to how Menu token is storing data now into menu_links table i don't see how there could be the error mentionned above...
Feel free to explain more your particular problem if it is still present.
Comment #5
gabriel.achille CreditAttribution: gabriel.achille commentedComment #6
Renee S CreditAttribution: Renee S commentedSame problem, here, when updating to the latest dev. gabriel.achille, did you try upgrading from an earlier version with data, rather than enabling it fresh? That may be the steps to reproduce.
The following updates returned messages
menu_node module
Update #7100
Failed: PDOException: SQLSTATE[01000]: Warning: 1265 Data truncated for column 'nid' at row 1: INSERT INTO {menu_node} (nid, mlid) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1); Array ( [:db_insert_placeholder_0] => 15/members [:db_insert_placeholder_1] => 10248 ) in menu_node_enable() (line 58 of /sites/all/modules/contrib/menu_node/menu_node.install).
Comment #7
Renee S CreditAttribution: Renee S commentedConfirmed, the patch fixed this for me. I believe in my case it wasn't menu_token, it was a temporary hardcoded (not %1) views path. Same issue. Thanks!
eta: I do wonder about casting the result, as it might lead to indeterminent states if the str_replace returns false, like it would with my path of "15/members". But, hmm.
Comment #8
Renee S CreditAttribution: Renee S commentedComment #9
Renee S CreditAttribution: Renee S commentedComment #10
leymannxPatch works! Thanks!
Comment #11
kaldimar CreditAttribution: kaldimar commentedGot the same issue while installing the module, in this case because some menu links have custom paths like node/66/about/highlights. Patch provided by the OP works fine and should be committed.
Comment #12
dgtlmoon CreditAttribution: dgtlmoon commentedIn my case the patch also fixed my problem, I am using 'nodesymlinks' module which gives path such as '741/mid/9216', casting '741/mid/9216' to (int) yields 741 correctly and module installed just fine, please commit
Comment #13
DrupalGideonThis patch (although old) worked for me as well
For some reason I had
link_path
of "node/xxxxx/" in mymenu_links
table and I don't have any of the above modules mentioned installed so I would like to see this added if possible.Comment #14
codevoice CreditAttribution: codevoice commentedThis patch worked well for me as well, fixed the problem described.
Comment #15
ordermind CreditAttribution: ordermind commentedPatch works for me too and is quite safe. Please commit.
Comment #16
gabriel.achille CreditAttribution: gabriel.achille as a volunteer commentedThe issue is located in the hook_enable, for some uncommon drupal node path: when a module has added a parameter after the nid.
I tried to make a more generic patch to cover the reported issues:
node/123?arg1=value1
;node/123/extra/path
and one other :node/123#fragment
I'm using a regexp to match an integer value to avoid the possible issue noticed by renee-s in #7.
Tested ok for me.
Comment #18
joelpittet@gabriel.achille how about using
parse_url()
from PHP and drupal'sarg()
?That should deal with the #fragment
Comment #19
gabriel.achille CreditAttribution: gabriel.achille as a volunteer commented@joelpittet
I agree and it looks cleaner to me. Here a proposition of patch. I keep a test on the integer value of nid because it seems still necessary for me.
Tested ok for me.
Comment #20
RoSk0Patch from #19 looks good and fixes the issue for us. Previously was using cast_to_int.patch.
Comment #22
vuil