Ok... here's a quick fix which prevents webform from being installed (clean install)...

FIX:

Find "excluded_components" in webform.install, and remove " 'default' => '', "

Before:

      'excluded_components' => array(
        'description' => 'A list of components that will not be included in the %email_values token. A list of CIDs separated by commas.',
        'type' => 'text',
        'not null' => TRUE,
        'default' => '',
      ),

after:

      'excluded_components' => array(
        'description' => 'A list of components that will not be included in the %email_values token. A list of CIDs separated by commas.',
        'type' => 'text',
        'not null' => TRUE
      ),

Here's the error if trying to do a clean install, prior to fix...

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1101 BLOB/TEXT column 'excluded_components' can't have a default value: CREATE TABLE {webform_emails} ( `nid` INT unsigned NOT NULL DEFAULT 0 COMMENT 'The node identifier of a webform.', `eid` SMALLINT unsigned NOT NULL DEFAULT 0 COMMENT 'The e-mail identifier for this row’s settings.', `email` TEXT DEFAULT NULL COMMENT 'The e-mail address that will be sent to upon submission. This may be an e-mail address, the special key \"default\" or a numeric value. If a numeric value is used, the value of a component will be substituted on submission.', `subject` VARCHAR(255) DEFAULT NULL COMMENT 'The e-mail subject that will be used. This may be a string, the special key \"default\" or a numeric value. If a numeric value is used, the value of a component will be substituted on submission.', `from_name` VARCHAR(255) DEFAULT NULL COMMENT 'The e-mail \"from\" name that will be used. This may be a string, the special key \"default\" or a numeric value. If a numeric value is used, the value of a component will be substituted on submission.', `from_address` VARCHAR(255) DEFAULT NULL COMMENT 'The e-mail \"from\" e-mail address that will be used. This may be a string, the special key \"default\" or a numeric value. If a numeric value is used, the value of a component will be substituted on submission.', `template` TEXT DEFAULT NULL COMMENT 'A template that will be used for the sent e-mail. This may be a string or the special key \"default\", which will use the template provided by the theming layer.', `excluded_components` TEXT NOT NULL DEFAULT '' COMMENT 'A list of components that will not be included in the %email_values token. A list of CIDs separated by commas.', PRIMARY KEY (`nid`, `eid`) ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8 COMMENT 'Holds information regarding e-mails that should be sent...'; Array ( )  in db_create_table() (line 2569 of /home/public_html/includes/database/database.inc).

Comments

nhck’s picture

Title: Can't install on drupal 7.x-dev 2010-Aug-27 (PDOException...'excluded_components' can't have a default value) » schema D7: BLOB/TEXT column 'excluded_components' can't have a default value
Version: 7.x-3.0-beta8 » 7.x-3.x-dev
Priority: Critical » Normal
Status: Closed (fixed) » Needs review
StatusFileSize
new447 bytes

This is not fixed in current cvs - thus setting it to correct status and providing patch.

quicksketch’s picture

We need to test this with postGres. The default value was introduced to fix #887580: Upgrade failed from 2.x to 3.1 under PostGres. Note I'm not sure if that issue affects Drupal 7 or not.

quicksketch’s picture

Status: Needs review » Needs work

Okay, after some Googling it looks like this is the situation:

  • TEXT columns cannot have a default value in MySQL (though they can in almost every other database system: pgSQL, MSSQL, Oracle)
  • Even in MySQL, specifying a default value won't cause a problem unless MySQL is running in strict mode (the default on most Windows installations apparently).
  • PostGres will not allow you to add a NOT NULL column unless every row already has a value.

The universal solution here apparently is to:

  • Update every row in the table to set the value to '' if the value is currently NULL
  • Add the database column and do not have a default value.
  • Always specify a default of '' when doing any inserts.

In addition, when adding a column we can use the "initial" property to set an initial value of '' when adding a NOT NULL text column. This handbook page on Schema API explains the whole thing pretty well: https://drupal.org/node/159329

This patch makes a start but we need to fix the upgrade path as described in #887580: Upgrade failed from 2.x to 3.1 under PostGres.

quicksketch’s picture

StatusFileSize
new1.13 KB

Okay looks like your patch is fine for Drupal 7, it's only Drupal 6 that needed any changes (since the upgrade path was the broken part in Drupal 6). I've committed your patch to D7 and this patch to D6.

quicksketch’s picture

Title: schema D7: BLOB/TEXT column 'excluded_components' can't have a default value » BLOB/TEXT column 'excluded_components' can't have a default value
Status: Needs work » Fixed
quicksketch’s picture

Marked #894596: Upgrade from 2.x to 3.2 fails under IIS 7 with MySQL 5.1.x as duplicate (see #3 for the explanation on why this was Windows-specific and why it's fixed with this patch).

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.