Hi,
I cannot install fusion_apply module, for the following error

PDOException: SQLSTATE[42000]: [Microsoft][SQL Server Native Client 10.0][SQL Server]Column '__unique_theme_module_element_skin' in table 'fusion_apply_skins' cannot be used in an index or statistics or as a partition key because it is non-deterministic.: CREATE UNIQUE INDEX theme_module_element_skin_unique ON [{fusion_apply_skins}] (__unique_theme_module_element_skin); Array ( ) in db_create_table() (linea 2688 di D:\aspwebsites\CHI\includes\database\database.inc).

It seems installation could not create the unique index __unique_theme_module_element_skin but i cannot figure out why.

In the following the four SQL statements logged in SQL Server Profiler

CREATE TABLE [fusion_apply_skins] (
	[sid] int NOT NULL IDENTITY CHECK (sid >= 0),
	[theme] nvarchar(128) NOT NULL CONSTRAINT fusion_apply_skins_theme_df DEFAULT '',
	[module] nvarchar(128) NOT NULL CONSTRAINT fusion_apply_skins_module_df DEFAULT '',
	[element] nvarchar(128) NOT NULL CONSTRAINT fusion_apply_skins_element_df DEFAULT '',
	[skin] nvarchar(255) NOT NULL CONSTRAINT fusion_apply_skins_skin_df DEFAULT '',
	[options] nvarchar(max) NOT NULL,
	[status] smallint NOT NULL CONSTRAINT fusion_apply_skins_status_df DEFAULT 0,
	CONSTRAINT fusion_apply_skins_pkey PRIMARY KEY CLUSTERED ([sid])
);
	
ALTER TABLE fusion_apply_skins ADD __pk UNIQUEIDENTIFIER DEFAULT NEWID();

ALTER TABLE fusion_apply_skins ADD __unique_theme_module_element_skin AS CAST(HashBytes('MD4', COALESCE(dbo.SUBSTRING(CAST(theme AS varbinary(max)),1,40) + dbo.SUBSTRING(CAST(module AS varbinary(max)),1,40) + dbo.SUBSTRING(CAST(element AS varbinary(max)),1,40) + dbo.SUBSTRING(CAST(skin AS varbinary(max)),1,40), CAST(__pk AS varbinary(max)))) AS varbinary(16));

CREATE UNIQUE INDEX theme_module_element_skin_unique ON [fusion_apply_skins] (__unique_theme_module_element_skin);

trying to execute the statements in the SQL Server Management Studio i can see the error on statement 4, e.g.:

Msg 2729, Level 16, State 1, Line 17
Column '__unique_theme_module_element_skin' in table 'fusion_apply_skins' cannot be used in an index or statistics or as a partition key because it is non-deterministic.

Perhaps the problem was in the sqlsrv module?

My Config:

Drupal 7.12 on win7 x64
Fusion Accellerator 7.x-2.0-beta1
sqlsrv-7.x-1.2

database: SQL Server 2005 SP4

Regards
Marco

Comments

sheena_d’s picture

Assigned: Unassigned » sheena_d

Hi Marco,

Thanks for this bug report. We have been having some trouble with the way that unique key is being generated, and I think we are going to have to re-think that logic completely. Just wanted to acknowledge your bug report and let you know that this won't be a quick fix - it could be a few weeks before we get a patch ready for testing. In the meantime, you might want to inquire with your database software's related documentation and/or support resource about whether there are any configuration settings that might suffice as a workaround in the interim.

For the record, the link to your issue on the same topic in the sqlsrv queue: http://drupal.org/node/1506546

Cheers,
Sheena