The #9 upgrade for content.install uses the Drupal core update function db_add_column to install the update. This function uses an attribute array for setting default values and NULL/NOT NULL constraints. The attached patch fixes a problem with attempting to set a default value of an empty string for a the column added in update #9.

CommentFileSizeAuthor
#2 content.install_6.patch518 bytesjaydub

Comments

yched’s picture

patch missing :-)
plus : can you describe what is the problem that gets fixed ?

jaydub’s picture

StatusFileSize
new518 bytes

ah yes adding the patch would have helped...The problem that gets fixed is the success of running the update for CCK. The #9 update adds the column display_settings to the node_field_instance table. The MySQL add column is done with a straight SQL call. The PostgreSQL add column is done using the core Drupal update.php db_add_column function.

This function takes as part of its arguments an array of attributes for the added column. In this particular case, the attributes for the added column are NOT NULL and DEFAULT of an empty string (''). The patch addresses the fact that sending an array element of key => '' will result in the value of that array literally being an empty string rather than that desired value of ''. So changing the array element to key => "''" fixes this problem.

Basically you just gotta look at how the db_add_column function operates and it will become clear...

yched’s picture

Status: Needs review » Fixed

Quite right. Committed - thanks !

Anonymous’s picture

Status: Fixed » Closed (fixed)