Hey guys,

I get this when Drupal tries to update modules:

Failed: PDOException: SQLSTATE[42000]: [Microsoft][SQL Server Native Client 10.0][SQL Server]The object 'CK__field_data__etid__226010D3' is dependent on column 'etid'.: ALTER TABLE {field_data_comment_body} DROP COLUMN etid; Array ( ) in db_drop_field() (line 2724 of \includes\database\database.inc).

Any idea what's causing it?

Comments

ben.bunk’s picture

Sounds like an index? Any more information on when you saw this

jfha73’s picture

no, that was all I saw.

ben.bunk’s picture

I'm pretty sure this is because they don't want you to drop a field that is part of an index. I'll run a test and see if that's the case here.

damien tournoud’s picture

Priority: Critical » Major
Status: Active » Postponed (maintainer needs more info)

Which version of the driver are you using? Newer versions delete all the related objects (indexes, constraints) before dropping a field.

Could you try again with the -RC1 version released today?

jfha73’s picture

I'm not testing anymore with Drupal 7 on SQL Server, but if somebody else is still doing this, they can try and let us know.

csedev’s picture

Received a similar error when running update.php. System was attempting to update the Views module, Update #7301.

Failed: PDOException: SQLSTATE[42000]: [Microsoft][SQL Server Native Client 10.0][SQL Server]Object 'views_view.name' cannot be renamed because the object participates in enforced dependencies.: EXEC sp_rename :old, :new, :type; Array ( [:old] => views_view.name [:new] => name_old [:type] => COLUMN ) in db_change_field() (line 2984 of C:\inetpub\wwwroot\includes\database\database.inc).

Running the most recent version of the driver.

SQL Server 2008 R2
PHP 5.3
Microsoft SQL Driver for PHP 2.0.1

damien tournoud’s picture

Title: Error when running update.php » Column cannot be renamed because the object participates in enforced dependencies
Status: Postponed (maintainer needs more info) » Active

Interesting. This looks valid.

damien tournoud’s picture

Component: Code » Schema handling
geodaniel’s picture

I'm also seeing this issue on a recent update of Commerce module (Update 7108):

Failed: PDOException: SQLSTATE[42000]: [Microsoft][SQL Server Native Client 10.0][SQL Server]Object 'commerce_order.order_number' cannot be renamed because the object participates in enforced dependencies.: EXEC sp_rename :old, :new, :type; Array ( [:old] => commerce_order.order_number [:new] => order_number_old [:type] => COLUMN ) in db_change_field() (line 2988 of C:\inetpub\wwwroot\includes\database\database.inc).

panmanphil’s picture

I am also experiencing this trying to update the views module. Is there anything I can do to help, or any idea of when a solution or workaround is available.

I also have the 2.01 sql server php driver loaded. I have the 7.x-1.1 drupal sql server module loaded and so see a newer version though the status report is not recommending an update yet on that.

mainsequence’s picture

Did anyone find a solution to this? Is the database alteration one that can be made by hand in some way if the update module can't do it?

panmanphil’s picture

I am having conversations about this at the following issue:

http://drupal.org/node/1561396

have found the problem and one proposed patch is created, but the patch is not for the sqlsrv driver. Not sure if that is the correct way to go or not. Docs seem to indicate the caller, not the driver should manage indexes, and in this case an index and a computed field.

panmanphil’s picture

I have a patch posted in this issue, could any of you try it out and see if it works for you?

http://drupal.org/node/1526404

panmanphil’s picture

That patch I mentioned has been applied to the dev branch of the sqlsrv module now. http://drupal.org/node/1526404#comment-6387646, easier to try out and confirm it will work for you.

omegamonk’s picture

Status: Active » Closed (duplicate)

As @panmanphil indicated, the patch from http://drupal.org/node/1526404 was commited to 7.x-1.x-dev. I was not able reproduce the issue using the dev version of the sqlsrv driver. I am going to mark the issue closed as a duplicate of http://drupal.org/node/1526404.