Problem

I get the following error when upgrading a Drupal 6 database which had a UUID 6.x-1.0-rc2 module enabled:

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the[error]
right syntax to use near 'AS , t.tid AS tid
FROM
taxonomy_term_data t
WHERE  ( IN  ('bcb92ce8-2236-e264-6' at line 1
Performed update: uuid_update_7103                                                                                                                                  [ok]

Diagnosis

Apparently a NULL value is supplied for $uuid_key in the db_select() of entity_get_id_by_uuid. This is because $info['entity keys']['uuid'] is not set.

Workaround

Add this to uuid.install right after entity_get_info() in uuid_update_7103():

if (!isset($info['entity keys']['uuid'])) continue;

Comments

kpaxman’s picture

Title: UUID query fails when upgrading from Drupal 6 » UUID query fails when upgrading
Status: Active » Needs review
Issue tags: +D7 upgrade
StatusFileSize
new488 bytes

I had this same issue in Drupal 7; removed the version # from the title and added "D7 upgrade" to the tags.

I tried the proposed workaround and got the following error:
PHP Fatal error: Cannot break/continue 1 level in uuid.install on line 243

Then I realized there was more than one entity_get_info() in the update hook. When I insert the workaround after the SECOND one, it works.

Attached is a patch for review.

skwashd’s picture

Status: Needs review » Needs work

@kpaxman thanks for the patch, but it does comply with the Drupal coding standards. Please resubmit the patch.

liam morland’s picture

Status: Needs work » Needs review
StatusFileSize
new504 bytes

Fixed version attached. Thanks.

liam morland’s picture

StatusFileSize
new504 bytes

Reroll.

liam morland’s picture

StatusFileSize
new504 bytes

Reroll.

liam morland’s picture

Title: UUID query fails when upgrading » uuid_update_7103() fails
liam morland’s picture

Patch still applies. If anyone else has used this successfully, please RTBC.