View Issue Details

This bug affects 1 person(s).
 10
IDProjectCategoryView StatusLast Update
03527Bug reportsSurvey takingpublic2009-07-31 07:18
Reporteruser4399Assigned Tokadejo  
PriorityhighSeveritypartial_block 
Status closedResolutionfixed 
Product Version1.85+ 
Fixed in Version1.85+ 
Summary03527: Due to SQL bad syntax, survey can not be activated at all under PostgreSQL (any version)
Description

The problem is located at admin/activate.php, line 63:

$groupquery = "SELECT g.gid,g.group_name,count(q.qid) as count from {$dbprefix}questions as q RIGHT JOIN {$dbprefix}groups as g ON q.gid=g.gid WHERE g.sid=$postsid group by g.gid AND g.language='$baselang' AND q.language='$baselang';";

As you can see, there is a condition, AND g.language='$baselang' AND q.language='$baselang' after group by clause, what it is not very sql compliant :-p. I saw that MySQL doesn't have any problem with that, but PostgreSQL just can't execute the sentence, so just reescribing the sentence is enough to solve the bug, just this way:

$groupquery = "SELECT g.gid,g.group_name,count(q.qid) as count from {$dbprefix}questions as q RIGHT JOIN {$dbprefix}groups as g ON q.gid=g.gid WHERE g.sid=$postsid AND g.language='$baselang' AND q.language='$baselang' group by g.gid;";

I'm telling my friend kadejo if this can be uploaded, in fact I can make all PostgreSQL tests because I use limesurvey with that DBMS at work... could I?

TagsNo tags attached.
Bug heat10
Complete LimeSurvey version number (& build)1.85
I will donate to the project if issue is resolved
Browserany
Database type & versionPostgreSQL any version (tested under 8.2 and 8.3)
Server OS (if known)GNU/Linux
Webserver software & version (if known)Apache2
PHP Version5.2

Relationships

duplicate of 03494 closedjcleeland MS SQL syntax error upon survey activation attempt 
has duplicate 03520 closedc_schmitz MSSQL Syntax error 

Users monitoring this issue

There are no users monitoring this issue.

Activities

user4399

2009-07-31 03:42

  ~08991

Also, it is needed to include g.group_name under group by clause, so line 63 would be:
$groupquery = "SELECT g.gid,g.group_name,count(q.qid) as count from {$dbprefix}questions as q RIGHT JOIN {$dbprefix}groups as g ON q.gid=g.gid WHERE g.sid=$postsid AND g.language='$baselang' AND q.language='$baselang' group by g.gid,g.group_name;";

kadejo

kadejo

2009-07-31 07:06

reporter   ~08992

Thank you Patricia!

Your fix works great. I think that nowadays there is nobody testing LimeSurvey thoroughly on PostgreSQL, so if you can work on this, everybody will be very happy!. I am going to ask that on limesurvey-developers.

kadejo

kadejo

2009-07-31 07:08

reporter   ~08993

Fix kindly given by Patricia Araya, see note 8991.

Issue History

Date Modified Username Field Change
2009-07-31 03:30 user4399 New Issue
2009-07-31 03:30 user4399 Status new => assigned
2009-07-31 03:30 user4399 Assigned To => user372
2009-07-31 03:30 user4399 Build Number => 1.85
2009-07-31 03:30 user4399 Browser => any
2009-07-31 03:30 user4399 Database & DB-Version => PostgreSQL any version (tested under 8.2 and 8.3)
2009-07-31 03:30 user4399 Operating System (Server) => GNU/Linux
2009-07-31 03:30 user4399 Webserver => Apache2
2009-07-31 03:30 user4399 PHP Version => 5.2
2009-07-31 03:32 kadejo Assigned To user372 => kadejo
2009-07-31 03:32 kadejo Priority normal => high
2009-07-31 03:42 user4399 Note Added: 08991
2009-07-31 07:06 kadejo Note Added: 08992
2009-07-31 07:06 kadejo Status assigned => resolved
2009-07-31 07:08 kadejo Note Added: 08993
2009-07-31 07:08 kadejo Status resolved => closed
2009-07-31 07:08 kadejo Resolution open => fixed
2009-07-31 07:08 kadejo Fixed in Version => 1.85+
2009-07-31 07:18 user372 Relationship added has duplicate 03520
2009-07-31 07:18 user372 Relationship added duplicate of 03494
2010-10-25 00:18 c_schmitz Category Survey at Runtime => Survey taking