Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
When attempting to save a node with a CNR to another node with a CCK link field, I received the following error:
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1: INSERT INTO {field_data_field_link} (entity_type, entity_id, revision_id, bundle, delta, language, field_link_url, field_link_title, field_link_attributes) 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] => node [:db_insert_placeholder_1] => 7 [:db_insert_placeholder_2] => 7 [:db_insert_placeholder_3] => carousel_item [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => http://jamestkirk.com/ [:db_insert_placeholder_7] => ) in field_sql_storage_field_storage_write() (line 424 of /Users/acrollet/Sites/puam/www/modules/field/modules/field_sql_storage/field_sql_storage.module).
There is a related issue in the link queue: #1290904: Link > node_load() > field_attach_update() =PDOException: SQLSTATE[42000] INSERT INTO {field_data_field_link}. Adding a call to field_attach_presave before the field_attach_update in the _corresponding_node_references_update function fixed the issue. Will attach a patch.
Comment | File | Size | Author |
---|---|---|---|
#1 | add_field_attach_presave-1354816-1.patch | 503 bytes | acrollet |
Comments
Comment #1
acrollet CreditAttribution: acrollet commentedPatch attached.
Comment #2
apfelkraut.org CreditAttribution: apfelkraut.org commentedSame error here.
Using Drupal 7.9, References 7.x-2.0-beta3 and CNR 4.22, beside some others like Link 7.x-1.0.
I am using CNR to reference some different content types in a 1-unlimited relationship. Content types have also fields provided by the Link module. Did work fine the last months but I didn't need to create or update any relation lately. I applied the latest CNR update recently.
Today I added new content and tried to interrelate it to each other, I got the same error message like acrollet:
I deleted the content and created 2 new nodes, filled out some fields including URLs to outside Web pages but did not set any node relation. Saved nodes, everything fine. Edited nodes to add the relationship ... same error as given above.
Tried to test the patch. I updated References to 7.x-2.x-dev (2011-Oct-10), CNR to 7.x-4.x-dev (2011-Nov-17) and applied the provided patch so that my "corresponding_node_references.crud.inc" looks like
I am still seeing the same error when creating a node relationship.UPDATE (2011/12/06): Patch works also FINE with my site. Problem was that I patched the CNR module in directory "mysite/modules/" and had still an unpatched version in "mysite/sites/all/modules/" running. After I removed the unpatched version, the patched CNR modules works as expected and the error never appeared again. Thanks for the quick patch and sorry for the confusion!!
Comment #3
notasheep CreditAttribution: notasheep commentedPatch worked for me. Much thanks!
Comment #4
C. Lee CreditAttribution: C. Lee commentedThe patch in #1 solved the problem. Thanks.
Comment #5
bforchhammer CreditAttribution: bforchhammer commentedI guess this is RTBC: 3 people confirming that this works, and I can't see anything wrong with it either...
Comment #6
czigor CreditAttribution: czigor commentedCommitted.
Comment #8
seehive CreditAttribution: seehive commentedthanks... it works for me...
i was facing problem to apply this patch through command prompt so, i did this by coping the content of this patch and pasted it in "corresponding_node_references.crud.inc" and its working :). So, its simple way to apply patch i think
Comment #9
SGhosh CreditAttribution: SGhosh commentedWorked for Version 7.x-4.22.