Download & Extend

{node}.body and {node}.teaser should be nullable

Project:Drupal core
Version:8.x-dev
Component:node system
Category:task
Priority:normal
Assigned:Unassigned
Status:needs work

Issue Summary

- 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).

AttachmentSizeStatusTest resultOperations
node.no_body.patch2.14 KBIdleInvalid patch format in node.no_body.patch.View details | Re-test

Comments

#1

Status:needs review» closed (duplicate)

This is a duplicate of #261258: Fix node_save() insertion logic.

#2

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.

#3

Title:PDO error on new revision for node types without body» {node}.body and {node}.teaser should be nullable
Category:bug report» 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.

#4

Right, makes sense.

#5

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.

nobody click here