Hi there,

after upgrading from 2.x to 3.1 the following error messages appears after running update.php:

* warning: pg_query() [function.pg-query]: Query failed: ERROR: column "excluded_components" contains null values in /xxxxxxxxx/includes/database.pgsql.inc on line 139.
* user warning: query: ALTER TABLE drupal6_webform_emails ALTER excluded_components SET NOT NULL in /xxxxxxxxx/includes/database.pgsql.inc on line 670.

and in the area "The following queries werde executed":

Update #6308
* ALTER TABLE {webform_emails} ADD COLUMN excluded_components text
* Failed: ALTER TABLE {webform_emails} ALTER excluded_components SET NOT NULL
* ALTER TABLE {webform_component} DROP COLUMN email

Trying to upgrade from 2.9 and 2.10 throws the same error.

My setting:
Drupal 6.19
Postgres 8.3.11
PHP 5.2.6

regards,
Maschi

Comments

quicksketch’s picture

Title: Upgrade failed from from 2.x to 3.1 » Upgrade failed from from 2.x to 3.1 under PostGres

Thanks for the report. This sounds like it's probably a PostGres SQL specific problem (since I haven't gotten any other reports like this from the users upgrading so far). We can probably fix this by doing a simple query to set a value of '' (an empty string) where value = NULL before converting the column to NOT NULL.

maschi’s picture

Title: Upgrade failed from from 2.x to 3.1 under PostGres » Upgrade failed from 2.x to 3.1 under PostGres
StatusFileSize
new804 bytes

I have made a patch and upgrade (from 2.9) shows no error anymore.

Output of logfile:

Update #6308

    * ALTER TABLE {webform_emails} ADD COLUMN excluded_components text
    * ALTER TABLE {webform_emails} RENAME "excluded_components" TO "excluded_components_old"
    * ALTER TABLE {webform_emails} ADD COLUMN excluded_components text
    * UPDATE {webform_emails} SET excluded_components = CAST(excluded_components_old AS text)
    * ALTER TABLE {webform_emails} ALTER excluded_components SET NOT NULL
    * ALTER TABLE {webform_emails} DROP COLUMN excluded_components_old
    * ALTER TABLE {webform_component} DROP COLUMN email

Is it ok?

quicksketch’s picture

It may be that all we need is to set a default of "".

db_add_field($ret, 'webform_emails', 'excluded_components', array('type' => 'text', 'not null' => TRUE, 'default' => ''));
maschi’s picture

Yepp, that worked. And is much smarter :o)

Thx!

quicksketch’s picture

Status: Active » Fixed
StatusFileSize
new1.14 KB

I've committed this patch. Thanks for testing!

Status: Fixed » Closed (fixed)

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

artscientific’s picture

Status: Closed (fixed) » Active

Hello gentlemen,

I'm getting a similar webform_emails error trying to go from 2.6 to 3.1 but not using postgres:
"
Drupal database update
user warning: Duplicate column name 'excluded_components' query: ALTER TABLE drup_webform_emails ADD `excluded_components` TEXT DEFAULT NULL in xxxx/includes/database.mysql-common.inc on line 298.
"
The following queries were executed
webform module
"
Update #6308
Failed: ALTER TABLE {webform_emails} ADD `excluded_components` TEXT DEFAULT NULL
UPDATE {webform_emails} SET excluded_components = '%s' ()
ALTER TABLE {webform_emails} CHANGE `excluded_components` `excluded_components` TEXT NOT NULL
ALTER TABLE {webform_component} DROP email
"

Not only does it fail but it brings the whole site down!

Really appreciate any insight or suggestions, I've checked the table and it doesnt appear to be corrupted (even tried to repair it for good measure) ... come to think of it, it wasnt sending messages to the first e-mail address listed at one point, dont know if its related.

Thanks in advance!

quicksketch’s picture

Status: Active » Closed (fixed)

@artscientific: I'd appreciate you opening a new issue with your description. Let's keep issues that have been closed for over a year closed, this is clearly a new problem (sounds like you've run the same update more than once, so the columns already exist).