Hi,

We run our Drupal sites on IIS with MS SQL server behind them. My Drupal Core is at 7.59.

The last one of security updates is giving issues. I have only Tablefield database updates pending.
Tablefield 7002 through 7006. But when executing them I get a database exception

SQLSTATE[22018]: [Microsoft][ODBC Driver 11 for SQL Server][SQL [error]

Server]Conversion failed when converting the nvarchar value
'field_basic_table_table' to data type int.
Performed update: tablefield_update_7002 [ok]

I've managed to check the SQL statement that's being tried and it's pretty clear what the error is:

SELECT fci.* 
FROM field_config_instance fci 
    INNER JOIN field_config fc 
    ON fc.id = fci.field_id 
    WHERE ( ([fci].[field_id] IN ('field_basic_table_table')) 
    AND ([fc].[active] = 1) 
    AND ([fc].[storage_active] = 1) 
    AND ([fc].[deleted] = 0) 
    AND ([fci].[deleted] = 0) )

Of course field_id is an integer and thus cannot handle the conversion from the parameter. The query however is being build up somewhere and I haven't been able to figure out where and how. Can anyone tell me how the query is being build and where I can patch the update so the parameter gives the correct id instead of the field_name? Or replace field_id with the field_name so it will find the correct field?

The error comes from the Tablefield 7002 update which I find in de field.install and not the tablefield.install but anyway. I suppose it's this code generating the query:

function field_update_7002() {
  $settings = variable_get('field_bundle_settings', array());
  if ($settings) {
    foreach ($settings as $entity_type => $entity_type_settings) {
      foreach ($entity_type_settings as $bundle => $bundle_settings) {
        variable_set('field_bundle_settings_' . $entity_type . '__' . $bundle, $bundle_settings);
      }
    }
    variable_del('field_bundle_settings');
  }
}

Thanks,

Comments

Jagitc created an issue. See original summary.

Jagitc’s picture

Issue summary: View changes
lolandese’s picture

You write:

Performed update: tablefield_update_7002 [ok]

That indicates that the 7002 update went well, so probably it is something in 7003.

Can you try to upgrade in two steps and go to the 7.x-3.0 version first? That seemed to be a workaround in #2984369: Error message on update.

Jagitc’s picture

Hi lolandese,
thanks for the suggestion. I am currently trying to get version 7.x-3.0 since I was focusing on doing the security updates first.
If it's not the 7002, it can't be the 7003 since that seems to be an empty update when I check the install file:

function field_update_7003() {
  // Empty update to force a rebuild of the registry.
}

Unless I'm looking at the wrong install file of course that might be a possibility :-)

Thanks

liam morland’s picture

Status: Active » Closed (outdated)

Drupal 7 is no longer supported. If this applies to a supported version, please re-open.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.