View Issue Details

This bug affects 1 person(s).
 8
IDProjectCategoryView StatusLast Update
18704Bug reportsSurvey editingpublic2023-06-19 11:52
Reporter2BITS_PL Assigned Toc_schmitz  
PrioritynoneSeveritypartial_block 
Status closedResolutionfixed 
Product Version5.5.x 
Summary18704: Again Error [SQL Server] IDENTITY_INSERT is set ON for table 'limesurvey_quota_languagesettings'
Description

[Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Explicit value must be specified for identity column in table 'lime_quota_languagesettings' either when IDENTITY_INSERT is set to ON or when a replication user is inserting into a NOT FOR REPLICATION identity column."

Identical situation as in ticket 17356, but in a completely different place. Tested on LS v5.4.11 (can't check on a newer version at the moment).

Steps To Reproduce

Steps to reproduce

  1. Import the prepared survey
  2. Go to "Global Settings" of the poll (survey must be active)
  3. Add another language version and click save

Actual result

In DevTools for the URL invoked: admin/database/index/updatesurveylocalesettings_generalsettings returns "Explicit value must be specified for identity column in table 'lime_quota_languagesettings' either when IDENTITY_INSERT is set to ON or when a replication user is inserting into a NOT FOR REPLICATION identity column."

In the file: https://github.com/LimeSurvey/LimeSurvey/blob/5.4.11%2B221114/application/helpers/common_helper.php#L3767
IDENTITY_INSERT is set to ON and quotals_id is not set in Yii::app()->db->createCommand()->insert('{{quota_languagesettings}}', $data);

If you set IDENTITY_INSERT to FALSE in the line above, the problem will be solved.
The question is, shouldn't the IDENTITY_INSERT settings be reversed here, first to FALSE (line 3788) and finally to TRUE (line 3809) ?

TagsNo tags attached.
Attached Files
Bug heat8
Complete LimeSurvey version number (& build)Version 5.4.11+221114
I will donate to the project if issue is resolvedNo
Browser
Database type & versionSQL Server 2019
Server OS (if known)Microsoft Server 2019
Webserver software & version (if known)
PHP Versionv8.0.27 NTS x64

Users monitoring this issue

2BITS_PL

Activities

2BITS_PL

2BITS_PL

2023-03-30 12:47

reporter   ~74312

confirmed in LS v5.6.13

CDbCommand failed to execute the SQL statement: SQLSTATE[42000]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Explicit value must be specified for identity column in table 'lime_quota_languagesettings' either when IDENTITY_INSERT is set to ON or when a replication user is inserting into a NOT FOR REPLICATION identity column.

2BITS_PL

2BITS_PL

2023-03-30 12:50

reporter   ~74313

This can be quickly fixed by changing:
https://github.com/LimeSurvey/LimeSurvey/blob/master/application/helpers/common_helper.php#L3788

with: switchMSSQLIdentityInsert('quota_languagesettings', true);
on: switchMSSQLIdentityInsert('quota_languagesettings', false);

in this case, this line would have to be removed:
https://github.com/LimeSurvey/LimeSurvey/blob/master/application/helpers/common_helper.php#L3809

c_schmitz

c_schmitz

2023-06-16 10:33

administrator   ~75660

Fix committed to 5.x branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=34832

c_schmitz

c_schmitz

2023-06-16 10:35

administrator   ~75661

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=34833

c_schmitz

c_schmitz

2023-06-16 10:35

administrator   ~75662

Thank you - also the test survey helped alot.

LimeBot

LimeBot

2023-06-19 11:52

administrator   ~75708

Fixed in Release 6.1.4+230620

Related Changesets

LimeSurvey: 5.x ff9b87c2

2023-06-16 10:33:01

c_schmitz

Details Diff
Fixed issue 18704: Error when trying to add another language to a survey and MSSQL server is used Affected Issues
18704
mod - application/helpers/common_helper.php Diff File

LimeSurvey: master e76bbdc9

2023-06-16 10:33:01

c_schmitz

Details Diff
Fixed issue 18704: Error when trying to add another language to a survey and MSSQL server is used Affected Issues
18704
mod - application/helpers/common_helper.php Diff File

Issue History

Date Modified Username Field Change
2023-03-27 12:18 2BITS_PL New Issue
2023-03-27 12:18 2BITS_PL File Added: survey_archive_328453.lsa
2023-03-27 15:06 ollehar Product Version => 5.5.x
2023-03-30 12:47 2BITS_PL Note Added: 74312
2023-03-30 12:47 2BITS_PL File Added: error_identity_insert_in_ls_v5613.png
2023-03-30 12:47 2BITS_PL Bug heat 0 => 2
2023-03-30 12:50 2BITS_PL Note Added: 74313
2023-03-30 12:50 2BITS_PL Issue Monitored: 2BITS_PL
2023-03-30 12:50 2BITS_PL Bug heat 2 => 4
2023-06-16 00:27 c_schmitz Assigned To => c_schmitz
2023-06-16 00:27 c_schmitz Status new => assigned
2023-06-16 10:33 c_schmitz Changeset attached => LimeSurvey 5.x ff9b87c2
2023-06-16 10:33 c_schmitz Note Added: 75660
2023-06-16 10:33 c_schmitz Bug heat 4 => 6
2023-06-16 10:33 c_schmitz Resolution open => fixed
2023-06-16 10:35 c_schmitz Changeset attached => LimeSurvey master e76bbdc9
2023-06-16 10:35 c_schmitz Note Added: 75661
2023-06-16 10:35 c_schmitz Status assigned => resolved
2023-06-16 10:35 c_schmitz Note Added: 75662
2023-06-19 11:52 LimeBot Note Added: 75708
2023-06-19 11:52 LimeBot Status resolved => closed
2023-06-19 11:52 LimeBot Bug heat 6 => 8