libraries_update_7200() always fails for me:

    Failed: PDOException: SQLSTATE[HY000]: General error: 1005 Can't create table 'd7git.cache_libraries' (errno: -1): CREATE TABLE {cache_libraries} ( `cid` VARCHAR(255) NOT NULL DEFAULT '' COMMENT 'Primary Key: Unique cache ID.', `data` LONGBLOB NULL DEFAULT NULL COMMENT 'A collection of data to cache.', `expire` INT NOT NULL DEFAULT 0 COMMENT 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.', `created` INT NOT NULL DEFAULT 0 COMMENT 'A Unix timestamp indicating when the cache entry was created.', `serialized` SMALLINT NOT NULL DEFAULT 0 COMMENT 'A flag to indicate whether content is serialized (1) or not (0).', PRIMARY KEY (`cid`), INDEX `expire` (`expire`) ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8 COMMENT 'Generic cache table for caching things not separated out...'; Array ( ) in db_create_table() (line 2686 of /home/rfay/workspace/d7git/includes/database/

I've experimented with a few variants of the update function, including

function libraries_update_7200() {
  if (!db_table_exists('cache_libraries')) {
    $specs = libraries_schema();
    db_create_table('cache_libraries', $specs['cache_libraries']);

But nothing seems to get me anywhere.

#4 libraries.improve_update_7200-2.patch978 byteststoeckler
#2 libraries.improve_update_7200.patch487 bytesrfay
PASSED: [[SimpleTest]]: [MySQL] 128 pass(es). View
Members fund testing for the Drupal project. Drupal Association Learn more


tstoeckler’s picture

Status: Active » Postponed (maintainer needs more info)

Hmm... I just retried the update on my local install and everything went through fine. So I don't really know where to look for the error.

You're proposed update function is correct, though. We currently call drupal_get_schema_unprocessed() directly in the update function (instead of libraries_schema()), and because of that the table description is wrong for people who upgraded (like in your error message). Not that that will break anything (and I don't think we should add a second update function for that), but we should change the (existing) update function nonetheless.

rfay’s picture

Status: Postponed (maintainer needs more info) » Needs review
487 bytes
PASSED: [[SimpleTest]]: [MySQL] 128 pass(es). View

TLDR; This was an inndb/mysql error that was fixed by attempting to drop the database, actually having to remove the directory (which contained cache_libraries.ibd). The patch you liked is attached, and that's why it's set to needs review although it's fixed for me. I note that the successful update happened with this in place, but I wouldn't assume anything from that.



Cannot create table. If the error message refers to error 150, table creation failed because a foreign key constraint was not correctly formed. If the error message refers to error –1, table creation probably failed because the table includes a column name that matched the name of an internal InnoDB table.

I also see this stackoverflow item, but I don't see anything useful from show engine innodb status;

Finally, I note DamZ's response on, in which the issue there was actually an INNODB failure.

I dumped my database, intending to drop it and recreate it. Then I dropped it. But got

MariaDB [(none)]> drop database d7git;
ERROR 1010 (HY000): Error dropping database (can't rmdir './d7git', errno: 39)

So I went to see what was in there:

root@rfay-dell:/var/lib/mysql# ls d7git/

So there was a remnant of some previous cache_libraries somehow left there, either as a result of upgrades or...

Now, having recreated my database, the update succeeds.

In case you're interested, I'm attaching the patch from the OP; otherwise this can be "fixed". Thanks so much for your responsiveness.

tstoeckler’s picture

Status: Needs review » Fixed

Thanks very much! What a terrible debugging crusade!!! Poor you...

I added a little comment to the update function, in case people wonder why they have two table comments for the same table on two different sites (for example). I also noticed that tables in Drupal core end their table comment with a period, so I added that. I hope no kittens were harmed.
Committed the attached patch.
Thanks again!

tstoeckler’s picture

Here's the patch.

Status: Fixed » Closed (fixed)

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