- Set up a content type that doesn't use 'body' field
- create a node of this content type
- edit the node, check 'create a new revision' checkbox, save :

PDOException: INSERT INTO {node_revision} (nid, uid, title, teaser, log, timestamp, format) 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) - Array ( [:db_insert_placeholder_0] => 1 [:db_insert_placeholder_1] => 1 [:db_insert_placeholder_2] => article1 [:db_insert_placeholder_3] => [:db_insert_placeholder_4] => [:db_insert_placeholder_5] => 1230853018 [:db_insert_placeholder_6] => 0 ) SQLSTATE[HY000]:
General error: 1364 Field 'body' doesn't have a default value in drupal_write_record() (line 3798 \includes\common.inc).

Attached patch makes the body and teaser columns nullable in node_revision table (as suggested in a comment in node_save).

CommentFileSizeAuthor
node.no_body.patch2.14 KByched

Comments

damien tournoud’s picture

Status: Needs review » Closed (duplicate)
yched’s picture

Hm, forgot about that one.
I'd argue that the body and teaser columns *should* be nullable, though. You can set a content type to not have a 'body' field, we should store NULL for those fields, not an empty string.

damien tournoud’s picture

Title: PDO error on new revision for node types without body » {node}.body and {node}.teaser should be nullable
Category: bug » task
Status: Closed (duplicate) » Postponed

I'd argue that the body and teaser columns *should* be nullable, though. You can set a content type to not have a 'body' field, we should store NULL for those fields, not an empty string.

They should be. Let's focus this issue on this, postponed until #261258: Fix node_save() insertion logic is in.

yched’s picture

Right, makes sense.

jody lynn’s picture

Version: 7.x-dev » 8.x-dev
Status: Postponed » Needs work

Well the reason for postpone is passed, but not sure if this is still an issue.

swentel’s picture

Status: Needs work » Closed (won't fix)

Yeah, those columns don't even exist anymore.