Very impressed with this module! Small problem however when working with PostgreSQL as storage engine for both Drupal and LimeSurvey.

PDOException: SQLSTATE[42804]: Datatype mismatch: 7 ERROR: argument of WHERE must be type boolean, not type integer LINE 1: ... AS ls_token, submitdate FROM survey_588599 WHERE 1 ORDER BY... ^: SELECT id AS ls_aid, startlanguage AS ls_lang, token AS ls_token, submitdate FROM {survey_588599} WHERE 1 ORDER BY id ASC; Array ( ) in limesurvey_sync_answ_extract_answers() (line 529 of /Library/WebServer/Documents/drupal/sites/all/modules/limesurvey_sync/ls_api/limesurvey_sync_api_answ.inc).

I'm not sure why the default datatype aliasses in Drupal do not catch this. Can anyone reproduce this?

Comments

thedut’s picture

Assigned: Unassigned » thedut

Hello ericsol !

I have never tested my module using PostgreSQL, I'm glad you did it !
You report a common bug happening with PostgreSQL :
- PostgreSQL query error when searching,
- SELECT * FROM ... WHERE 1 breaks PostGres,
- Some queries don't work in PostgreSQL.

Thank you for reporting it.
I need to adapt each 'WHERE 1' string in the LimeSurvey Sync module code in order to fix this PostgreSQL issue.

I'm not sure why the default datatype aliasses in Drupal do not catch this. Can anyone reproduce this?

I guess it is not catched because I am using static queries (not dynamic ones), for performance reasons.

I will fix this issue for the next release.

thedut’s picture

I hope I will only have to execute a 'find and replace' procedure :
Finding : WHERE 1
replacing it by : WHERE 1=1
and make sure MySql still works !

thedut’s picture

Hi ericsol,

I provide the fix here : you can try either the patch or the whole module directory (they are equal) attached.
there was only 3 lines to edit.
Please report if ti solves your postgreSQL issue.

thedut’s picture

Status: Active » Patch (to be ported)

I guess this issue is fixed. I will include this patch into the next release.

ericsol’s picture

Sorry for slow response. Confirmed working.

Eric

thedut’s picture

great, thanks.

thedut’s picture

Status: Patch (to be ported) » Closed (fixed)

Fixed into the LimeSurvey_sync v7.x-1.3 and LimeSurvey_Sync v6.x-1.3 releases.