it is a critical problem for DB2: DB2 only allow "not null" field act as primary or unique key, and so it will cause at least 2 problems:

  1. we will not able to create such table, since it break the rule of primary key and unique key under DB2
  2. even i try to force all primary key or unique key field as "not null" during table creation, it will face query error as we are trying to insert a NULL into "noy null" field. information will not able to store within {node}
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Gábor Hojtsy’s picture

What could have been the function of the NULL vid insertion?

hswong3i’s picture

i am also question about why we need to insert a NULL as vid, for a new node? for a new node, $update_node is TRUE, and so its vid will be updated before the end of node_save(). inserting a NULL as placeholder is the same meaning as inserting a default value (0).

Dries’s picture

This patch seems to make sense, but I'll let Gabor commit it -- I'm not 100% I understood what Gabor was asking for.

hswong3i’s picture

minor version update: it is also a problem for create index with primary key field.
it is a duplicate handling, and not allow in Oracle and DB2: Oracle and DB2 will index primary key field as default.

Gábor Hojtsy’s picture

Status: Needs review » Fixed

OK, the vid is later handled. Committed!

Anonymous’s picture

Status: Fixed » Closed (fixed)
bjaspan’s picture

Status: Closed (fixed) » Needs work

This patch introduces a schema discrepancy.

node_schema() declares node.vid as 'not null' => TRUE but system_update_6023() sets it to 'not null' => FALSE (by not specifying 'not null' at all) and has a comment that "vid is NULL".

bjaspan’s picture

Status: Needs work » Fixed

This is fixed by my patch in http://drupal.org/node/173982.

hswong3i’s picture

@bjaspan: sorry for introducing this inconsistence, and thank you for your kindly help :)

Anonymous’s picture

Status: Fixed » Closed (fixed)