Details
-
Bug
-
Status: Resolved
-
Critical
-
Resolution: Fixed
-
2.0.2
-
None
-
PostgreSQL
-
MOODLE_20_STABLE
-
MOODLE_20_STABLE, MOODLE_21_STABLE
Description
I set up a demo questionnaire with "visible groups", and a course that had a couple of users in different groups. Each user completed the questionnaire and then went to view the results clicking on the "all responses" link.
Error reading from database
More information about this error
Debug info: ERROR: operator does not exist: character varying = bigint
LINE 7: R.username=GM.userid
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
SELECT R.id, R.survey_id, R.submitted, R.username
FROM mdl_questionnaire_response R,
mdl_groups_members GM
WHERE R.survey_id=2 AND
R.complete='y' AND
GM.groupid>0 AND
R.username=GM.userid
ORDER BY R.id
[array (
)]
Stack trace:
• line 391 of /lib/dml/moodle_database.php: dml_read_exception thrown
• line 232 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
• line 672 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
• line 163 of /mod/questionnaire/report.php: call to pgsql_native_moodle_database->get_records_sql()
This is caused because R.username is a character not integer field. The SQL needs to be (cast (R.username as int))=GM.userid.
Once fixed at line 163,176,199 the same error is revealed at lines and in choose_group_form.php at line 61 and in locallib.php at line 2271.
There may be other places that use a similar query which I haven't uncovered yet!
Attachments
Issue Links
- has been marked as being related by
-
CONTRIB-3136 CAST(R.username as int) causes mysql/mssql/oracle issues when viewing activity report
-
- Resolved
-