Failed: PDOException:

SQLSTATE[22004]: Null value not allowed:
1138 Invalid use of NULL value: ALTER TABLE {invite} CHANGE `status` `status` INT NOT NULL COMMENT 'Invitation status.';
Array ( ) in db_add_field() (line 2900 from /var/www/drupal/includes/database/database.inc).

After updating the database I always get this error message. Can anyone help how to solve it?
Thanks katasun

CommentFileSizeAuthor
#10 invite-pdo-exception-2828440-9.patch636 bytesSpartyDan

Comments

katasun created an issue. See original summary.

dynahiol’s picture

Same here after update to the new release.
Failed: PDOException: SQLSTATE[22004]: Null value not allowed: 1138 Invalid use of NULL value: ALTER TABLE {invite} CHANGE `status` `status` INT NOT NULL COMMENT 'Invitation status.'; Array ( ) in db_add_field() (line 2900 of /home/xxx/www/includes/database/database.inc).

katasun’s picture

// Add status field to invite table
db_add_field('invite', 'status', array('type' => 'int', 'not null' => TRUE, 'description' => 'Invitation status.'));

To me it seems that this expression is causing the problem: 'not null' => TRUE, this statement in conjunction with the latest version of maria db or mysql db.

The latest versions have stricter security settings. This needs to be proofed by someone with better knowledge of these dbs

katasun

SpartyDan’s picture

I haven't had any success in reproducing this error.

It would be very helpful if you could provide some additional information such as:
- When did the error occur? Please provide a specific URL which resulted in the error.
- The step to reproduce the error.
- Have you run /update.php or drush updb?
- Which previous version of Invite were you using? If you were using -dev please include the commit hash.
- A backtrace using the function ddebug_backtrace in the Devel module.

Also, if you have been able to resolve the issue on your site, please give us detailed information about how you fixed the issue or submit a patch.

I would like to resolve this issue quickly. Any additional information that you can provide would be helpful.

Please refer to How to create a good issue. It provides very good information about how to help module maintainers fix bugs.

SpartyDan’s picture

Status: Active » Postponed (maintainer needs more info)

Setting status to Postponed (maintainer needs more info)

dynahiol’s picture

The error occur to me when updating the module to the new version. It require the db to be updated - what i did using the drupal interface. the it produces the error above. After some times, my site got a database error. I had to downgrade the database with my backups for my site to come back online. So
- Update the module to new version (replace in the module folder)
- Update db (require) => produse the error.
That's how it happend to me.

Coupon Code Swap’s picture

I experienced a similar issue after attempting to update. Reverted back to beta3 until a patch is available. MySQL 5.5.53, PHP 5.6.27.

Failed: PDOException: SQLSTATE[01000]: Warning: 1265 Data truncated for column 'status' at row 1: ALTER TABLE {invite} CHANGE `status` `status` INT NOT NULL COMMENT 'Invitation status.'; Array ( ) in db_add_field() (line 2900 of includes/database/database.inc).

Amanda Jane’s picture

I have the same problem.

MYSQL 5.5.52-cll-lve
PHP 5.5

I downloaded and updated through Drupal admin and immediately went to do database update and was served with the following:

invite module

7401 - Adding 'status' to invite table.

Update #7401
Failed: PDOException: SQLSTATE[01000]: Warning: 1265 Data truncated for column 'status' at row 1: ALTER TABLE {invite} CHANGE `status` `status` INT NOT NULL COMMENT 'Invitation status.'; Array ( ) in db_add_field() (line 2900 of ... public_html/includes/database/database.inc).

I'm not a database expert by far so can't give you any more information, hope that helps.

  • SpartyDan committed 63f2e3b on 7.x-4.x
    Issue #2828440 by SpartyDan, dynahiol, Coupon Code Swap, Amanda Jane:...
SpartyDan’s picture

StatusFileSize
new636 bytes

PDO Exception caused by not having a default value for status field. This was not an issue with MySQL. In Drupal's database.inc if a default value is not provided it creates the field and set 'not null' = FALSE and later in the function it modifies the field and changes 'not null' to TRUE.

invite-pdo-exception-2828440-9.patch fixes the issue.

Patch committed.

SpartyDan’s picture

Status: Postponed (maintainer needs more info) » Fixed

Status: Fixed » Closed (fixed)

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