View Issue Details

This bug affects 1 person(s).
 6
IDProjectCategoryView StatusLast Update
09339Bug reportsImport/Exportpublic2014-11-10 12:48
Reportersitawit Assigned Toc_schmitz  
PriorityhighSeveritycrash 
Status closedResolutionfixed 
Product Version2.05+ 
Fixed in Version2.05+ 
Summary09339: LimeSurvey products duplicate questions id when import survey that has different based language.
Description

Background
http://www.limesurvey.org/en/forum/design-issues/98783-duplicated-question-id

Problem
To summarize the problem, it happens when you import a survey file (in this case, it's .lss) to LimeSurvey. And if the base language of the survey is not the same. LimeSurvey could produces duplicate question id.

For example, you have a survey that has English as based language then you import German survey, the questions id of German survey will be restart counting from 1. So the question id will be duplicated.

Steps To Reproduce
  1. Create / import a sample survey of any language
  2. Import a sample survey that doesn't have the same base language with the one in #1.
  3. Try to browse to a question of an imported survey #2 then it should direct to a question in #1 due to have the same question id
TagsNo tags attached.
Attached Files
duplicated_test.sql (5,275 bytes)
Bug heat6
Complete LimeSurvey version number (& build)Version 2.05+ Build 141020
I will donate to the project if issue is resolvedNo
BrowserChrome
Database type & versionMySQL 5.0
Server OS (if known)Window 7
Webserver software & version (if known)2.2
PHP Version5.4

Users monitoring this issue

There are no users monitoring this issue.

Activities

c_schmitz

c_schmitz

2014-10-29 19:18

administrator   ~30882

We do not support InnoDB tables, only MyISAM.
If you can reproduce the isse on MyISAM tables please attach the related .lss files to your reproducing instructions. Thank you.

sitawit

sitawit

2014-10-30 05:26

reporter   ~30889

Last edited: 2014-10-30 08:46

They are MyISAM tables. I thought it is InnoDB but it's not. My bad.

However, this happens to Version 2.05+ Build 141020 but not Version 2.05+ Build 140703. And I'm accessing the database manually.

So if we look at "questions" table closely. There were changes of how the table is created.

According to installer\sql\create-mysql.sql of Build 141020. The primary key setting of "questions" is :-
PRIMARY KEY (language, qid)
while it was like this in Build 140703 :-
PRIMARY KEY (qid,language)

So when I change this back the table works just fine. But I'm not sure this is the way we should do it so solve the problem. While some forum suggests unique setting instead.

How I tested the table, I simply used sql insert script directly to "questions" table. Try insert the table using different value of "language".

I can't tell why you can't reproduce this one.
For environment setting. For this issue, the one I wrote is my development PC.
However, my production server has MySQL:
version = 5.5.38-0+wheezy1-log
version_comment = (Debian)
version_compile_machine =x86_64
version_compile_os =debian-linux-gnu

And it's still have the same problem.

DenisChenu

DenisChenu

2014-10-30 09:49

developer   ~30890

The lss file have the 2 language ?

Maybe best to put the lss file here ;)

sitawit

sitawit

2014-10-30 10:12

reporter   ~30891

No, they are separated surveys. Each one has different base languages.
But I can't send you the lss files, it's my company's policy.

However, I uploaded "duplicated_test.sql" the file will generates 2 "questions" tables. The one is from Build 141020 and another is Build 140703.
Then the script will insert 5 records to each of them. And you can select data from tables to see the result.

sitawit

sitawit

2014-10-30 10:33

reporter   ~30892

I uploaded 2 test surveys. Each one has different based language.

So this is how I reproduce this issue.

  1. Install new Limesurvey Build 141020
  2. Import limesurvey_survey_381139.lss
  3. Import limesurvey_survey_575216.lss
  4. Browse to survey 575216's question
  5. LimeSurvey load survey 381139's question instead because of duplicated qid.
DenisChenu

DenisChenu

2014-11-06 17:56

developer   ~30920

Last edited: 2014-11-06 17:56

Hi,
Can not reproduce.
My default language is fr, my admin language is en. Test with last GIT version.

Before staring i look at my DB, the last qid was 42347 then look at select:
SELECT * FROM lime_questions WHERE qid >=42347

  1. Import limesurvey_survey_381139.lss
    New question line : qid=>42348,sid=>381139,title=>defirstquestion ,question=>""
    1. Import limesurvey_survey_381139.lss
      New question line : qid=>42349,sid=>575216,title=>itfirstquestion,question=>this one has text

But i think we can have some error when:
1: create a survey in it (for example)
2: export lss file
3: delete survey
4: update lss file (maybe set to lang:de)
5: see waht you have.

In some situation, we have strange issue when testing, BUT : logout limesurvey admin/ login limesurvey admin allways reset .

c_schmitz

c_schmitz

2014-11-07 17:57

administrator   ~30930

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

c_schmitz

c_schmitz

2014-11-10 12:48

administrator   ~30931

Version 2.05 Build 141110 released

Related Changesets

LimeSurvey: master 71e7bc14

2014-11-07 16:57:00

c_schmitz

Details Diff
Fixed issue 09339: Duplicate questions IDs used when new survey that has different based language than previous surveys Affected Issues
09339
mod - application/config/version.php Diff File
mod - application/helpers/update/updatedb_helper.php Diff File
mod - installer/sql/create-mssql.sql Diff File
mod - installer/sql/create-mysql.sql Diff File
mod - installer/sql/create-pgsql.sql Diff File

Issue History

Date Modified Username Field Change
2014-10-29 09:53 sitawit New Issue
2014-10-29 19:18 c_schmitz Note Added: 30882
2014-10-29 19:18 c_schmitz Status new => closed
2014-10-29 19:18 c_schmitz Assigned To => c_schmitz
2014-10-29 19:18 c_schmitz Resolution open => unable to reproduce
2014-10-30 05:26 sitawit Note Added: 30889
2014-10-30 05:26 sitawit Status closed => feedback
2014-10-30 05:26 sitawit Resolution unable to reproduce => reopened
2014-10-30 08:27 Mazi Status feedback => assigned
2014-10-30 08:46 sitawit Note Edited: 30889
2014-10-30 09:49 DenisChenu Note Added: 30890
2014-10-30 10:08 sitawit File Added: duplicated_test.sql
2014-10-30 10:12 sitawit Note Added: 30891
2014-10-30 10:29 sitawit File Added: limesurvey_survey_381139.lss
2014-10-30 10:29 sitawit File Added: limesurvey_survey_575216.lss
2014-10-30 10:33 sitawit Note Added: 30892
2014-11-06 17:56 DenisChenu Note Added: 30920
2014-11-06 17:56 DenisChenu Note Edited: 30920
2014-11-07 17:57 c_schmitz Changeset attached => LimeSurvey master 71e7bc14
2014-11-07 17:57 c_schmitz Note Added: 30930
2014-11-07 17:57 c_schmitz Status assigned => resolved
2014-11-07 17:57 c_schmitz Fixed in Version => 2.05+
2014-11-07 17:57 c_schmitz Resolution reopened => fixed
2014-11-10 12:48 c_schmitz Note Added: 30931
2014-11-10 12:48 c_schmitz Status resolved => closed