Upon database update:

user warning: BLOB/TEXT column 'site' used in key specification without a key length query: CREATE TABLE contemplate_files ( site varchar(256) NOT NULL, data longblob NOT NULL, UNIQUE KEY site (site) ) /*!40100 DEFAULT CHARACTER SET utf8 */; in ***/drupal/includes/database.mysql.inc on line 172.

Failed: CREATE TABLE contemplate_files ( site varchar(256) NOT NULL, data longblob NOT NULL, UNIQUE KEY site (site) ) /*!40100 DEFAULT CHARACTER SET utf8 */;

CommentFileSizeAuthor
#11 contemplate - UNIQUE_KEY site.patch1.19 KBsatori1984

Comments

cog.rusty’s picture

Version: 5.x-1.5 » 5.x-1.6

I got the same error using version 1.6 on MySQL 4.1.21
I solved it by adding the 256 length in the unique key clause too in contemplate.install, and then re-running update 2.

CREATE TABLE {contemplate_files} (
site varchar(256) NOT NULL,
data longblob NOT NULL,
UNIQUE KEY site (site(256))
) /*!40100 DEFAULT CHARACTER SET utf8 */
jonathanwinn’s picture

I solved it by adding the 256 length in the unique key clause too in contemplate.install, and then re-running update 2.

Can you please explain this in detail for laypersons?

And will this patch do the same thing?

jonathanwinn’s picture

okay, I changed the code in the contemplate.install patch as you described, and overwrote the old one on my server. I then did update.php without incident, but I still get the following error on pages that use contemplate:
user warning: Table 'play7com_Drupal5.contemplate_files' doesn't exist query: SELECT data FROM contemplate_files WHERE site = 'sites/default' in /home/play7com/public_html/includes/database.mysql.inc on line 172.

What is involved in "re-running update 2"?

thanks,

jw

Hunabku’s picture

I get the same error - i just replaced the new contemplate version with the old one (overwrote the contemplate folder with the old folder) and the problem went away. I wait till this gets figured out before installing the new version.

jonathanwinn’s picture

i just replaced the new contemplate version with the old one (overwrote the contemplate folder with the old folder) and the problem went away.

Lucky you. I tried the same thing, but the error message didn't go away. :-(

jonathanwinn’s picture

Priority: Normal » Critical

okay, I think I figured out that "re-running update 2" is going to update.php, expanding the "select versions" link, and selecting "2" from the pull-down list next to "contemplate module." So I did all this and I still get this error on my contemplate pages:

user warning: Table 'play7com_Drupal5.contemplate_files' doesn't exist query: SELECT data FROM contemplate_files WHERE site = 'sites/default' in /home/play7com/public_html/includes/database.mysql.inc on line 172.

I am on Drupal 5.2 with MySQL 4.1.22 and PHP 4.4.7
trying to install Contemplate 1.6

jonathanwinn’s picture

Just wondering if anyone can answer this in the meantime. Is it safe to take my site live while this is happening? I noticed the error and took it offline immediately. I'd rather not have the error message on all my contemplate nodes, but I can't really afford the downtime. Will it damage the database to keep executing queries on a nonexistent table?

benjackson’s picture

Many thanks, the combination of the change suggested by cog.rusty and the info about update2 from jonathanwinn fixed it for me.
I'm running Drupal 5.2 with MySQL 5.0.38 and PHP 5.2.1

jonathanwinn’s picture

benjackson,

thanks for posting your experience. I went back and tried again, but my update still failed to create the table. I thought I might have committed a typing error, so I pasted cog.rusty's code exactly as below (data longblob NOT NULL, was 'data' longblob NOT NULL, in the module.install file I downloaded, so I took away the single quotes around data). Can I simply create this table manually from phpMyAdmin? Can anyone tell me how?

jonathanwinn’s picture

Okay I think I fixed it. There was another place I needed to enter the 256 number at the bottom of the file:

function contemplate_update_2() {
  $ret = array();

  switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $ret[] = update_sql('CREATE TABLE {contemplate_files} (
      site varchar(256) NOT NULL,
      data longblob NOT NULL,
      UNIQUE KEY site (site(256))
      ) /*!40100 DEFAULT CHARACTER SET utf8 */;');
      break;
    }

  return $ret;

}

All back to normal now. Thanks everybody for their input!!

satori1984’s picture

Status: Active » Needs review
StatusFileSize
new1.19 KB

Working fine on MySQL 4.1.11

After patching, re-run update 2 (see comment #6)

jjeff’s picture

Status: Needs review » Fixed

Patch applied and committed. Release 1.7 created.

Sorry for the chaos. Hope this fixes it.

Yes, re-run update 2 if you've had this problem.

Anonymous’s picture

Status: Fixed » Closed (fixed)