Hello,

We tried to update the Entity Reference Module and get the error below.

Error while performing database update for Entity Reference 7.x-1.3

An AJAX HTTP error occurred. HTTP Result Code: 200 Debugging information follows. Path: /update.php?op=selection&token=kuRJfmgtX1gyvq-Hb_-qqJNNXbkLACpw4sfFa3j-sLQ&id=96&op=do StatusText: OK ResponseText: Fatal error: Unsupported operand types in /home/www/drupal7/includes/database/mysql/schema.inc on line 86

The update process was aborted prematurely while running update #7100 in entityreference.module. All errors have been logged. You may need to check the watchdog database table manually.

Server Setup

Drupal version: 7.54
PHP version: 5.5.9
Ubuntu version: 14.04.5 LTS
MySQL version: 5.5.55

Comments

Anonymous’s picture

Bwolf created an issue. See original summary.

Anonymous’s picture

I have the same issue on 4 different multi site installs.

jcory’s picture

I did not get an error when upgrading to v. 1.3, but afterwards a term reference field fails to show values if set to select list. It works fine with term reference tree widget. When I edit any views that use that vocabulary I get the message:
An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /dev/admin/structure/views/view/service_area/preview/page_1/ajax
StatusText: OK
ResponseText: [ currency_notation_form_alter Form ID: views_ui_preview_form[ currency_notation_form_alter Form ID: views_ui_preview_form[{"command":"settings","settings":{"basePath":"\/dev\/","pathPrefix":"","ajaxPageState":{"theme":"seven","theme_token":"ET_DLWzsxfPn-0xyhz-BKFl6GBCV7IrfjiKzGZCfkww","css":{"modules\/contextual\/contextual.css":1},"js":{"modules\/contextual\/contextual.js":1}},"better_exposed_filters":{"views":{"service_area":{"displays":{"page_1":{"filters":[]}}}}},"viewsImplicitFormSubmission":{"views-ui-preview-form":{"defaultButton":"preview-submit"}},"ajax":{"preview-submit":{"wrapper":"views-preview-wrapper","event":"click","progress":{"type":"throbber"},"method":"replaceWith","url":"\/dev\/admin\/structure\/views\/view\/service_area\/preview\/page_1\/ajax","submit":{"_triggering_element_name":"op","_triggering_element_value":"Update preview"}}},"urlIsAjaxTrusted":{"\/dev\/admin\/structure\/views\/view\/service_area\/preview\/page_1\/ajax":true,"\/dev\/admin ...

Ran the update to version 1.4 of Ent Ref and the error persists. Could not find a Taxonomy_Index_Tmp table in the database as suggested in https://www.drupal.org/node/2877592.

I will be restoring my database to before the version update to see if the problem was there before install.
Drupal version: 7.54
PHP version: 5.4.45
Server OS: Linux
MySQL version: 10.0.30-MariaDB

-- Update:

I kept going back and restoring recently updated modules. When I got to Internationalization 1.7 and went back to 1.5 the select list worked again. The problem had to do with the Multilingual Options for the vocabulary: it needed to be "Field Translate" for Entity Translation.
Sorry to point the finger at Ent Ref.

thomas.krooshof.bc’s picture

Same issue here. No multi site, only multilingual (i18n).

Anonymous’s picture

Priority: Major » Critical
sd42’s picture

I can confirm the issue for 7.x-1.3 and a consecutive attempt for 7.x-1.4:

Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Unsupported operand types in [...] /includes/database/mysql/schema.inc, line 86

Configuration:
- Drupal 7.54 (no multi site, i18n in use)
- MySQL 5.6.34
- PHP 7.0

sco_tt’s picture

Same issue here as @sd42, Drupal 7.50. Maybe the issues is with the db_create_table function?

https://www.drupal.org/node/1668586

Anonymous’s picture

Our groups system admins found a way to patch the entityreference.install file to get database update 7100 to work properly. The problem is with these two lines, beginning with line 178 of entityreference.install version 7.x-1.4:
$tx_schema = drupal_get_schema('taxonomy_index');
db_create_table('taxonomy_index_tmp', $tx_schema);
In the current update script, $tx_schema needs to be defined as the array containing the schema for the taxonomy_index table, so it uses the drupal_get_schema() function to accomplish this. Then it uses that value to create the taxonomy_index_tmp table with a matching schema. In our view, there are two problems with this:
• drupal_get_schema() is not a good way to find the table schema for an update script (its shortcomings for this use are causing it to return FALSE for us and other users, which in turn sets $tx_schema to FALSE)
• There is no check in place to determine whether $tx_schema is set to FALSE (rather than a valid array) before inputting it into db_create_table(), so when it fails, there's no easy way to figure that out.
For our purposes, the taxonomy_index table has no reason to change from its original schema. So we simply replaced the current line 178:
$tx_schema = drupal_get_schema('taxonomy_index');
With the original schema definition, straight from the taxonomy module install file, as well as a line that checks $tx_schema to confirm that it isn't set to FALSE, which would cause the script to fail:
    $tx_schema = array(
      'description' => 'Maintains denormalized information about node/term relationships.',
      'fields' => array(
        'nid' => array(
          'description' => 'The {node}.nid this record tracks.',
          'type' => 'int',
          'unsigned' => TRUE,
          'not null' => TRUE,
          'default' => 0,
        ),
        'tid' => array(
           'description' => 'The term ID.',
           'type' => 'int',
           'unsigned' => TRUE,
           'not null' => TRUE,
           'default' => 0,
        ),
        'sticky' => array(
          'description' => 'Boolean indicating whether the node is sticky.',
          'type' => 'int',
          'not null' => FALSE,
          'default' => 0,
          'size' => 'tiny',
        ),
        'created' => array(
          'description' => 'The Unix timestamp when the node was created.',
          'type' => 'int',
          'not null' => TRUE,
          'default'=> 0,
        ),
      ),
      'indexes' => array(
        'term_node' => array('tid', 'sticky', 'created'),
        'nid' => array('nid'),
      ),
      'foreign keys' => array(
        'tracked_node' => array(
          'table' => 'node',
          'columns' => array('nid' => 'nid'),
        ),
        'term' => array(
          'table' => 'taxonomy_term_data',
          'columns' => array('tid' => 'tid'),
        ),
      ),
    );
   // added for sanity - check your return values!
    if ($tx_schema === false) throw new \Exception('Unable to get taxonomy_index schema');

sco_tt’s picture

StatusFileSize
new2.13 KB

Thanks @Bwolf, this worked for me and I was able to run database updates after making the change.

I've created a quick-and-dirty patch to reflect Bwolf's fix; I imagine there is a more long-term solution that will come out of this, but wanted to save some time for anyone else!

Anonymous’s picture

Thank my system admins Reinard and Hunter! :)

hgoto’s picture

entityreference_update_7100() was introduced in the following issue and this can be helpful to get to know the cause.

#1924444: Duplicate entries with taxonomy_index index.

hgoto’s picture

Status: Active » Needs review
StatusFileSize
new778 bytes

I myself didn't experience this problem but I guess that this is caused when the taxonomy_index table exists but the schema taxonomy_index doesn't exist.


function entityreference_update_7100() {
  if (db_table_exists('taxonomy_index')) {
    if (db_table_exists('taxonomy_index_tmp')) {
      db_drop_table('taxonomy_index_tmp');
    }

    $tx_schema = drupal_get_schema('taxonomy_index');
    db_create_table('taxonomy_index_tmp', $tx_schema);


This situation happens if taxonomy module is once installed and then disabled but not yet uninstalled.

If I understood it correctly, the attached patch would fix the problem. I'd like someone to try this.

(Edited: the patch is for the latest dev not for 7.x-1.3.)

genjohnson’s picture

Status: Needs review » Reviewed & tested by the community

The patch in #12 fixes the issue for me.

mlzr’s picture

Hello, I was expiriencing this error to.
While this has something to do with taxonomy, I first look at the configurations of that. I find out I don't use taxonomy on this site and this mudule was turned off. So I turned it back on and tryed the /update.php again. And then no errors!

So maybe check if you have this module taxonomy is turned on, if not, do so. It works for me..

Marchello

cayenne’s picture

I am having a problem with this module as well. Running update DELETES my taxonomy_index table. As near as I can tell, the taxonomy_index_tmp table never gets created, so the attempt to rename it to taxonomy_index fails, but you go ahead and drop taxonomy_index anyway.

It would be great to introduce a little error checking in that update routine, a great many weird things crash when there is no taxonomy index table.

Michael

skobe’s picture

#12 helped. thanks <3

ekorotkin’s picture

#14 was my issue. Thanks!

smaz’s picture

+1 for the patch in #12 resolving the issue for me too.

Thanks!

JCynthia’s picture

#14 It also works for me. Thanks!! :)

c13l0’s picture

#14 worked for me. We have no need for taxonomy so it was turned off. Enabling the taxonomy module worked perfect.

finex’s picture

+1 for #14

  • minorOffense committed bc8d884 on 7.x-1.x authored by hgoto
    Issue #2879941 by hgoto, sco_tt: Error while performing database update...
minoroffense’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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