I have a website with more than 10K nodes of type "book", which I created using Content Types in Drupal 7.

But I cannot edit the first 300 nodes in my website and I get this error:

Error message
PDOException: in drupal_write_record() (line 6851 of public_html/includes/common.inc).

But other nod are just fine. I check nodes which are editable and nodes which are not using DEVEL and both nodes seems pretty as the same. I also check 'node', 'node_revision', 'field_data_NNN', field_revision_NNN' and they both seems the same.

I got stuck in this problem and I cannot figure out why this problem caused only to the first 300 nodes. Is there a way to debug drupal_write_record so I can understand exactly which fields or problematic.

Comments

Mamouri’s picture

I found the solution. Actually the problem cause by a field which it's content was corrupted. To found which field is causing the problem, I suggest to temporarily change "drupal_write_record" function to found the problem:

  // *********** Print $fields array to investigate which field content are problematic
  print_r($fields);

  // Build the SQL.
  if (empty($primary_keys)) {
    // We are doing an insert.
    $options = array('return' => Database::RETURN_INSERT_ID);

In my case it was alias field of 'url_alias' table. I regenrated all aliases and cleared cache_path table and problem solved.

Mamouri’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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

digitaldonkey’s picture

Thanks. That Helped. For me it was defaultcontent trying ti insert an image which existed allready.