When trying to save changes to an existing book page, the error below occurred, after which the node's vid was set to 0, breaking drupal's ability to find the page:

pg_query() [function.pg-query]: Query failed: ERROR: null value in column "log" violates not-null constraint in /srv/www/drupal-6.10/includes/database.pgsql.inc on line 139.

query: INSERT INTO node_revisions (nid, uid, title, body, teaser, timestamp, format) VALUES (6, 3, 'Characters', , 1238977824, 1) in /srv/www/drupal-6.10/includes/common.inc on line 3422.

Comments

pwolanin’s picture

Version: 6.10 » 7.x-dev

The bad query isautomatically generated here: http://api.drupal.org/api/function/drupal_write_record/6

The fact that the log message is NULL is odd - suggests the real bug is here:

http://api.drupal.org/api/function/node_form/6

node fields should NOT be conditionally added to the form, but rather controlled via #access.

  if (!empty($node->revision) || user_access('administer nodes')) {

Since the bug seems to be the same in 7.x it should be fixed there first.

anderbubble’s picture

Version: 7.x-dev » 6.10

For what it's worth, I fixed this at my own installation by setting the log column in question to have a default value of (''::character varrying), to match the title column in the same table.

pwolanin’s picture

Version: 6.10 » 7.x-dev

duplicate to: http://drupal.org/node/223820

there is a patch there.

pwolanin’s picture

Status: Active » Closed (duplicate)

text columns cannot have a default value in MySQL strict mode, for example, so see the patch.

josh waihi’s picture

Version: 7.x-dev » 6.10
Status: Closed (duplicate) » Active

subscribing, will look at this when I have more time.

pwolanin’s picture

Status: Active » Closed (duplicate)

this is a duplicate - please see the linked issues, and the more general issue it links to. http://drupal.org/node/261258