Greetings. As soon as I enable UUID I get this error upon going to the Comments page. After installing the module I clear the cache and run update.php but the error still appears. Disabling the module allows me to access the comments page again without a problem. Any help would be greatly appreciated. I need this module in order to run Node Export.

Error message
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'base.uuid' in 'field list': SELECT base.cid AS cid, base.pid AS pid, base.nid AS nid, base.uid AS uid, base.subject AS subject, base.hostname AS hostname, base.created AS created, base.changed AS changed, base.status AS status, base.thread AS thread, base.name AS name, base.mail AS mail, base.homepage AS homepage, base.language AS language, base.uuid AS uuid, n.type AS node_type, u.name AS registered_name, u.uid AS u_uid, u.signature AS signature, u.signature_format AS signature_format, u.picture AS picture FROM {comment} base INNER JOIN {node} n ON base.nid = n.nid INNER JOIN {users} u ON base.uid = u.uid WHERE (base.cid IN (:db_condition_placeholder_0, :db_condition_placeholder_1, :db_condition_placeholder_2, :db_condition_placeholder_3, :db_condition_placeholder_4, :db_condition_placeholder_5, :db_condition_placeholder_6, :db_condition_placeholder_7, :db_condition_placeholder_8, :db_condition_placeholder_9, :db_condition_placeholder_10, :db_condition_placeholder_11, :db_condition_placeholder_12, :db_condition_placeholder_13, :db_condition_placeholder_14, :db_condition_placeholder_15, :db_condition_placeholder_16, :db_condition_placeholder_17, :db_condition_placeholder_18, :db_condition_placeholder_19, :db_condition_placeholder_20, :db_condition_placeholder_21, :db_condition_placeholder_22, :db_condition_placeholder_23, :db_condition_placeholder_24, :db_condition_placeholder_25, :db_condition_placeholder_26, :db_condition_placeholder_27, :db_condition_placeholder_28, :db_condition_placeholder_29, :db_condition_placeholder_30, :db_condition_placeholder_31, :db_condition_placeholder_32, :db_condition_placeholder_33, :db_condition_placeholder_34, :db_condition_placeholder_35, :db_condition_placeholder_36, :db_condition_placeholder_37, :db_condition_placeholder_38, :db_condition_placeholder_39, :db_condition_placeholder_40, :db_condition_placeholder_41, :db_condition_placeholder_42, :db_condition_placeholder_43, :db_condition_placeholder_44, :db_condition_placeholder_45, :db_condition_placeholder_46, :db_condition_placeholder_47, :db_condition_placeholder_48, :db_condition_placeholder_49)) ; Array ( [:db_condition_placeholder_0] => 64 [:db_condition_placeholder_1] => 63 [:db_condition_placeholder_2] => 62 [:db_condition_placeholder_3] => 61 [:db_condition_placeholder_4] => 60 [:db_condition_placeholder_5] => 59 [:db_condition_placeholder_6] => 57 [:db_condition_placeholder_7] => 56 [:db_condition_placeholder_8] => 55 [:db_condition_placeholder_9] => 54 [:db_condition_placeholder_10] => 53 [:db_condition_placeholder_11] => 52 [:db_condition_placeholder_12] => 51 [:db_condition_placeholder_13] => 50 [:db_condition_placeholder_14] => 49 [:db_condition_placeholder_15] => 48 [:db_condition_placeholder_16] => 47 [:db_condition_placeholder_17] => 46 [:db_condition_placeholder_18] => 45 [:db_condition_placeholder_19] => 44 [:db_condition_placeholder_20] => 43 [:db_condition_placeholder_21] => 42 [:db_condition_placeholder_22] => 41 [:db_condition_placeholder_23] => 12 [:db_condition_placeholder_24] => 22 [:db_condition_placeholder_25] => 21 [:db_condition_placeholder_26] => 20 [:db_condition_placeholder_27] => 19 [:db_condition_placeholder_28] => 18 [:db_condition_placeholder_29] => 17 [:db_condition_placeholder_30] => 40 [:db_condition_placeholder_31] => 39 [:db_condition_placeholder_32] => 38 [:db_condition_placeholder_33] => 37 [:db_condition_placeholder_34] => 36 [:db_condition_placeholder_35] => 35 [:db_condition_placeholder_36] => 34 [:db_condition_placeholder_37] => 33 [:db_condition_placeholder_38] => 32 [:db_condition_placeholder_39] => 31 [:db_condition_placeholder_40] => 30 [:db_condition_placeholder_41] => 29 [:db_condition_placeholder_42] => 28 [:db_condition_placeholder_43] => 27 [:db_condition_placeholder_44] => 26 [:db_condition_placeholder_45] => 25 [:db_condition_placeholder_46] => 24 [:db_condition_placeholder_47] => 23 [:db_condition_placeholder_48] => 15 [:db_condition_placeholder_49] => 14 ) in DrupalDefaultEntityController->load() (line 196 of /Users/[username]/Sites/[sitename]/includes/entity.inc).
The website encountered an unexpected error. Please try again later.
CommentFileSizeAuthor
#4 1922038-uuid-hook-modules-enabled.patch480 bytesAlan Evans
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

eckersley’s picture

Extrapolating from some other advice I found I was able to fix my comment page by injecting a column into its table with phpMyAdmin thus:

ALTER TABLE  comment ADD uuid VARCHAR( 36 ) NOT NULL DEFAULT  '' COMMENT  'The Universally Unique Identifier.';

There must be a better way but for now I am at least up and running again.
Thanks, all.

Alan Evans’s picture

I think I've seen this too and I'd speculate that the issue is related to the fact that uuid implements hook_modules_installed but not hook_modules_enabled. That leaves various gaps for module enabling/disabling sequences whereby you could end up missing those extra columns. I'll attempt to get STR as soon as I have some time.

Alan Evans’s picture

STR:

  1. - create fresh D7 site
  2. - create test content >= 1 + comments >= 1
  3. - disable comment module without uninstalling
  4. - enable uuid
  5. - enable comment
  6. - view commented node.
  7. - BOOM https://www.evernote.com/shard/s57/sh/d114f098-fff4-4aea-801f-a0fb4081b4...
Alan Evans’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
480 bytes
Alan Evans’s picture

I just tested against the STR locally. Will see what the bot makes of it. Not 100% sure whether this bugfix needs a test as it seems soooo unlikely to get reverted (famous last words ...)

jamadar’s picture

Today I am facing same issue in our one of the production website and this we got resolved as following steps:
1) Disable the UUID module using MySQL query.
2) Clear the all the cache tables.
3) Try to re-build the module or drupal local instance.
4) Enable the UUID module.

And we got our production website running successfully with out an this error.

subhojit777’s picture

#6 helped thanks.

bloke_zero’s picture

#6 helped me too. Amazing that enabling one module can bork your whole installation.

snipebin’s picture

For those who got #6 to work, what is meant by "3) Try to re-build the module or drupal local instance."? Is it simply re-enabling the module after disabling it in the DB?

Thanks

antongp’s picture

Status: Needs review » Needs work

I have a similar problem, not exact, but basically caused by the same things:

I have a custom entity which I want to be integrated with the UUID, but I don't want to declare explicit dependency on UUID. So I added needed info to the entity definition (hook_entity_info() implementation) and also need to add field to the schema, something like:

if (module_exists('uuid')) {
  $field = uuid_schema_field_definition();
  $schema['my_entity']['fields']['uuid'] = $field;
  $schema['my_entity']['indexes']['uuid'] = array('uuid');
}

Problems appear when I have my module with entity definition already installed, and then I want to install/enable UUID... UUID module adds needed field(s) to the core entities schemes only (and to field collection...), so I have to react on UUID installation/enabling and add needed field(s) to my schema, basically I would do this via hook_modules_enabled() or hook_modules_installed(). UUID tries to fill missing uuids in my schema on install (via hook_install() implementation), but I don't have uuid field in my schema at that moment, so I have similar error "PDOException:..." here.

So any contrib module which defines entity (and has to maintain its own schema) may be affected here. I would remove uuid_sync_all() call from the uuid_install() (core's entities schema updates may be left here), but there are other changes needed to be done to handle this right. Please see another issue for other reasons to do this: #1728310: Module installation fails on big sites

BTW, uuid_install() called twice when UUID itself installed, and the same will happen if #4 will be applied.

rolfmeijer’s picture

@snipebin, what I guess is meant in comment 6, is using (drush) registry rebuild. That is what fixed the issue for me anyway.

ansari4263’s picture

Sir Please Resolve this Issue

alek123’s picture

alek123’s picture

arnoldbird’s picture

What fixed it for me is simply emptying all the cache tables in my database. I didn't have to disable uuid.

sinov’s picture

can'i help me for this error ?

PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'node.type' in 'where clause': SELECT n.nid AS nid FROM {node} n WHERE (n.status = :db_condition_placeholder_0) AND (n.nid IN (:db_condition_placeholder_1, :db_condition_placeholder_2)) AND (node.type <> :db_condition_placeholder_3) ; Array ( [:db_condition_placeholder_0] => 1 [:db_condition_placeholder_1] => 1 [:db_condition_placeholder_2] => 2 [:db_condition_placeholder_3] => user_profile_comment )

Ajascosoft’s picture

Having same issue. I had uuid enabled but comments was not enabled. When i enabled comments, the site is now giving me
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'uuid' in 'field list': INSERT INTO {comment} (pid, nid, uid, subject, hostname, created, changed, status, thread, name, mail, homepage, language, uuid) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12, :db_insert_placeholder_13); Array ( [:db_insert_placeholder_0] => 0 [:db_insert_placeholder_1] => 114 [:db_insert_placeholder_2] => 1 [:db_insert_placeholder_3] => Best deal [:db_insert_placeholder_4] => 196.50.24.35 [:db_insert_placeholder_5] => 1508835182 [:db_insert_placeholder_6] => 1508835181 [:db_insert_placeholder_7] => 1 [:db_insert_placeholder_8] => 01/ [:db_insert_placeholder_9] => Ajascosoft [:db_insert_placeholder_10] => [:db_insert_placeholder_11] => [:db_insert_placeholder_12] => und [:db_insert_placeholder_13] => 0a5ac23f-5dcf-4909-9e0f-9d338e857d3f ) in drupal_write_record() (line 7383 of /../../../includes/common.inc).

I have emptied all the cache tables but the error still persists. Not a Php programmer so have not been adventurous in writing any code. Could you please help with a simple and straight forward solution?

Ajascosoft’s picture

@eckersley, your solution worked for me, thanks

mvc’s picture

FWIW I had this problem when re-installing a site using memcache. You would have to flush the memcache bins, wait for the cache keys to time out, or change the memcache key prefix to work around this.

jukka792’s picture

I got this same error when disabling the Universally Unique IDentifier 1.2 module.
I was going to uninstall the module because I do not need it anymore. Then the whole site went down and gave PDOException: SQLSTATE[42S22] error.

I could not clear the caches after disabling the module with Drush. Had to rollback to backup.

So is there a way how to unistall the module?
Should I update to version 1.3 which is currently the latest version first and then uninstall?