How to programmatically set a node field as empty? I have some nodes of a content type with following fields:


title
body
image


I want to programmatically (!important) set the body field as empty (to make it like it was never set with any value).

This is what I have done:

$this_node = node_load($nid);
$this_node-&gt;body = array(); //to set it as an empty field
node_save($this_node);


After executing this, the node is not saved. Instead, in db_log following error is loged:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '104418'
for key 'PRIMARY': INSERT INTO {node} (nid, vid, type, language, title, uid, status, created,
changed, comment, promote, sticky, tnid, translate, uuid) VALUES
(*******placeholders &amp; their values*******) in drupal_write_record()
(line 7170 of /var/www/rotary.local/docroot/includes/common.inc).


Is there someting I am missing? How I can set the body field as empty?

NOTE:

I don't want to use field_attach_update for caching purposes.
To remove the value from you field you should do like this before saving it:

$this_node-&gt;body[$this_node-&gt;language] = array();