View Issue Details

This bug affects 1 person(s).
 6
IDProjectCategoryView StatusLast Update
09934Bug reportsInstallationpublic2015-11-10 12:28
Reportertvanderzyl Assigned Toc_schmitz  
PriorityhighSeveritypartial_block 
Status closedResolutionfixed 
Product Version2.06+ 
Fixed in Version2.06+ 
Summary09934: Activate Survey - Survey table could not be created - Database error!!
Description

We installed 2.06 a week ago. Imports went fine. Activate survey worked once. Now when I try to activate a survey:

Activate Survey - Survey table could not be created - Database error!!

I also got a message about an internal server error once.

Steps To Reproduce

Each attempt to activate a survey

TagsNo tags attached.
Bug heat6
Complete LimeSurvey version number (& build)150911
I will donate to the project if issue is resolvedNo
Browser
Database type & versionDatabase SQL2008R2 Express
Server OS (if known)Server Server 2012R2
Webserver software & version (if known)Webserver IIS 8.5 (comes with Windows 2012R2)
PHP Version5.6.0

Users monitoring this issue

There are no users monitoring this issue.

Activities

c_schmitz

c_schmitz

2015-10-01 16:45

administrator   ~33280

This is usually a sign that the survey is too big.
MSSQl only support a certain number of columns. Try removing some of the questions/groups.

tvanderzyl

tvanderzyl

2015-10-05 14:05

reporter   ~33307

Not too big, only 12 questions, and I have activated it before. Here is an additional error message:

Internal Server Error
CDbCommand failed to execute the SQL statement: SQLSTATE[42S01]: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]There is already an object named 'PRIMARY' in the database.
An internal error occurred while the Web server was processing your request. Please contact the webmaster to report this problem.

tvanderzyl

tvanderzyl

2015-10-08 17:14

reporter   ~33323

Reminder sent to: c_schmitz

I've narrowed in down - A survey can be activated once, but then if deactivated it cannot be reactivated. When trying to reactivate, I either get the error "Survey table could not be created" or "There is already an object named 'Primary'"

tvanderzyl

tvanderzyl

2015-10-14 15:30

reporter   ~33342

Is there something else we can try? Thanks.

ttenbergen

ttenbergen

2015-10-15 04:39

reporter   ~33346

I am having some issues after a port to a new install as well and realized that we have some inconsistencies between the ls_surveys, the lssurvey tables and the lstoken tables. Are yours consistent? Just a thought...

tvanderzyl

tvanderzyl

2015-10-15 14:26

reporter   ~33349

How do I check?

ttenbergen

ttenbergen

2015-10-15 17:38

reporter   ~33354

If you have access to the database you can run some SQL queries. I have a start for them... Sorry, the below is ugly, just pasting it from my notes. If you run the individual select queries I think they should all come back empty. Mine did not, still troubleshooting why and what to do now.

in ls_surveys but no table (I think this should be empty but may misunderstand how LS handles this)
SELECT sid, s_id
FROM ls_surveys

    left join 
    (select `TABLE_NAME`, mid(`TABLE_NAME`, length("ls_survey_")+1) as s_id
    from information_schema.tables 
    where table_schema = "cpdtrack_ls2"
    and locate("ls_survey", `TABLE_NAME`) = 1
    and locate("_timings", `TABLE_NAME`) = 0
    and mid(`TABLE_NAME`, length("ls_survey_")+1) REGEXP '[0-9]') as survey_tables

    on ls_surveys.sid = survey_tables.s_id

    where `survey_tables`.s_id is null

in tables but not in ls_surveys (I think this should be empty but may misunderstand how LS handles this)
select * from

    (select `TABLE_NAME`, mid(`TABLE_NAME`, length("ls_survey_")+1) as s_id
    from information_schema.tables 
    where table_schema = "cpdtrack_ls2"
    and locate("ls_survey", `TABLE_NAME`) = 1
    and locate("_timings", `TABLE_NAME`) = 0
    and mid(`TABLE_NAME`, length("ls_survey_")+1) REGEXP '[0-9]')  as survey_tables

    left join
    (select `TABLE_NAME`, mid(`TABLE_NAME`, length("ls_tokens_")+1) as s_id
    from information_schema.tables 
    where table_schema = "cpdtrack_ls2"
    and locate("ls_tokens_", `TABLE_NAME`) = 1) as token_tables

    on survey_tables.s_id = token_tables.s_id

    where token_tables.s_id is null

in languagesettings but not surveys (I think this should be empty but may misunderstand how LS handles this)
select *
from ls_surveys_languagesettings
left join ls_surveys
on ls_surveys_languagesettings.surveyls_survey_id=ls_surveys.sid
where sid is null

in surveys but not languagesettings (I think this should be empty but may misunderstand how LS handles this)
select *
from ls_surveys
left join ls_surveys_languagesettings
on ls_surveys_languagesettings.surveyls_survey_id=ls_surveys.sid
where surveyls_survey_id is null

c_schmitz

c_schmitz

2015-10-16 13:39

administrator   ~33373

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

c_schmitz

c_schmitz

2015-10-16 13:40

administrator   ~33374

For the patch to work properly you will have to delete the already created survey_(you survey ID) table manually, once.

tvanderzyl

tvanderzyl

2015-10-16 15:08

reporter   ~33377

Has it been done already? Will we need to reinstall? I still get the following when trying to reactivate.

Internal Server Error

CDbCommand failed to execute the SQL statement: SQLSTATE[42S01]: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]There is already an object named 'PRIMARY' in the database.

An internal error occurred while the Web server was processing your request. Please contact the webmaster to report this problem.

Thank you.

c_schmitz

c_schmitz

2015-10-16 15:25

administrator   ~33378

We are just preparing a new release. Either you patch it manually (see link above) or wait for the update.
As said, you will still need to delete the problematic response table manually on surveys where you already got the error.

tvanderzyl

tvanderzyl

2015-10-16 15:39

reporter   ~33379

Thank you so very much! Please have a great weekend.

tvanderzyl

tvanderzyl

2015-10-18 20:04

reporter   ~33382

Will that be 2.07?

Related Changesets

LimeSurvey: master f3f6ed7a

2015-10-16 11:39:30

c_schmitz

Details Diff
Fixed issue 09934: Survey cannot be repeatedly activated in MSSQL Affected Issues
09934
mod - application/helpers/admin/activate_helper.php Diff File

Issue History

Date Modified Username Field Change
2015-10-01 14:49 tvanderzyl New Issue
2015-10-01 16:45 c_schmitz Note Added: 33280
2015-10-01 16:45 c_schmitz Assigned To => c_schmitz
2015-10-01 16:45 c_schmitz Status new => feedback
2015-10-05 14:05 tvanderzyl Note Added: 33307
2015-10-05 14:05 tvanderzyl Status feedback => assigned
2015-10-08 17:14 tvanderzyl Note Added: 33323
2015-10-14 15:30 tvanderzyl Note Added: 33342
2015-10-15 04:39 ttenbergen Note Added: 33346
2015-10-15 14:26 tvanderzyl Note Added: 33349
2015-10-15 17:38 ttenbergen Note Added: 33354
2015-10-16 13:39 c_schmitz Changeset attached => LimeSurvey master f3f6ed7a
2015-10-16 13:39 c_schmitz Note Added: 33373
2015-10-16 13:39 c_schmitz Resolution open => fixed
2015-10-16 13:40 c_schmitz Note Added: 33374
2015-10-16 15:08 tvanderzyl Note Added: 33377
2015-10-16 15:25 c_schmitz Note Added: 33378
2015-10-16 15:25 c_schmitz Status assigned => resolved
2015-10-16 15:25 c_schmitz Fixed in Version => 2.06+
2015-10-16 15:39 tvanderzyl Note Added: 33379
2015-10-18 20:04 tvanderzyl Note Added: 33382
2015-11-10 12:28 c_schmitz Status resolved => closed