View Issue Details

This issue affects 1 person(s).
 2
IDProjectCategoryView StatusLast Update
20761Bug reportsOtherpublic2026-10-23 15:57
ReporterDenisChenu Assigned Totibor.pacalat  
PrioritynoneSeverityminor 
Status ready for code reviewResolutionopen 
Product Version7.5.x 
Summary20761: MS-SQL Survey activation can remove unique index on response table
Description

With MS-SQD : there are potential issue about the unique index in response table.
Sometimes receive an SQL error about a duplicate index after survey is activated: "duplicate index on INDEX_1234 ..."

Steps To Reproduce

Steps to reproduce

  1. get a MSSQL DB
  2. Create a bunch of surveys, launch (to have an autonumber_start > 0) , activate, deactivate, activate deactivate etc ...

Expected result

Sometimes receive an error aboity ducplicate index INDEX_(random number)

Actual result

Never recieve error

Additional Information

https://github.com/LimeSurvey/LimeSurvey/pull/5456

TagsNo tags attached.
Bug heat2
Complete LimeSurvey version number (& build)5 to 7
I will donate to the project if issue is resolvedNo
Browsernot relevant
Database type & versionMS-SQL
Server OS (if known)IIS
Webserver software & version (if known)not relevant
PHP Versionnot relevant
Git branch / Pull Request URLhttps://github.com/LimeSurvey/LimeSurvey/pull/5456

Users monitoring this issue

There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2026-10-12 12:46

developer   ~86335

Last edited: 2026-10-12 12:47

I have the issue,
I remind to have this error some month agoi, but don't understand it at this time.
No error since one week, but it's random.

Error code at : createResponseTableKeys() in SurveyActivator
https://github.com/LimeSurvey/LimeSurvey/blob/f25d93a75584c59db9cbe35d95891949f3a80e7f/application/models/SurveyActivator.php#L417

The index name is broken 'PRIMARY_' . rand(1, 50000) I use in a plugin : https://gitlab.com/SondagesPro/coreAndTools/DbSurveyIndexManage 'idx_surveyid' . $surveyId . '_' . date('YmdHis')

But we can use same than token : "idx_survey_token_{$this->survey->primaryKey}_" . rand(1, 50000): error can happen but really more rarely. I think using sureyid + datetime is OK

DenisChenu

DenisChenu

2026-10-23 15:49

developer   ~86720

In MSSQL : index name muts be unique in all database. Sometimes receive issues about "INDEX_1234 primary key broken (something like that)

DenisChenu

DenisChenu

2026-10-23 15:56

developer   ~86721

How for review ?

DenisChenu

DenisChenu

2026-10-23 15:57

developer   ~86722

https://github.com/LimeSurvey/LimeSurvey/pull/5456

Issue History

Date Modified Username Field Change
2026-10-12 12:42 DenisChenu New Issue
2026-10-12 12:42 DenisChenu Assigned To => DenisChenu
2026-10-12 12:42 DenisChenu Status new => assigned
2026-10-12 12:46 DenisChenu Note Added: 86335
2026-10-12 12:46 DenisChenu Bug heat 0 => 2
2026-10-12 12:47 DenisChenu Note Edited: 86335
2026-10-12 18:18 DenisChenu Summary MS-SQL Survey activation can removge unique index on response table => MS-SQL Survey activation can remove unique index on response table
2026-10-23 15:49 DenisChenu Note Added: 86720
2026-10-23 15:56 DenisChenu Assigned To DenisChenu => tibor.pacalat
2026-10-23 15:56 DenisChenu Status assigned => ready for code review
2026-10-23 15:56 DenisChenu Note Added: 86721
2026-10-23 15:57 DenisChenu Additional Information Updated
2026-10-23 15:57 DenisChenu Git branch / Pull Request URL N/A => https://github.com/LimeSurvey/LimeSurvey/pull/5456
2026-10-23 15:57 DenisChenu Note Added: 86722