ianjones / moodle-assignsubmission_comparativejudgement

GNU General Public License v3.0
3 stars 3 forks source link

Fails on PostgreSQL #3

Closed mudrd8mz closed 3 years ago

mudrd8mz commented 4 years ago

Clicking "Manage judges" on PostgreSQL Moodle installations gives error. The hint suggests that a varchar is compared with integer which is not allowed (MySQL is fault tolerant to it).

Error reading from database

Debug info: ERROR: operator does not exist: character varying = bigint
LINE 17: ...mission_exclusion exclusion ON exclusion.entityid = u.id AND...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
SELECT
u.id,
u.id as judgeid,
u.firstnamephonetic,u.lastnamephonetic,u.middlename,u.alternatename,u.firstname,u.lastname,
COUNT(comp.id) as comparisons,
SUM(comp.timetaken) as timetaken,
MIN(comp.timecreated) as first,
MAX(comp.timemodified) as last,
AVG(comp.timetaken) as avgtimetaken,
MIN(comp.timetaken) as mintimetaken,
MAX(comp.timetaken) as maxtimetaken,
CASE WHEN exclusion.id IS NULL THEN 0 ELSE 1 END as excluded,
SUM(CASE WHEN winningsubmissionposition = 1 THEN 1 ELSE 0 END) as leftchoices,
SUM(CASE WHEN winningsubmissionposition = 2 THEN 1 ELSE 0 END) as rightchoices
FROM m_user u
LEFT JOIN m_assignsubmission_comp comp ON comp.usermodified = u.id
LEFT JOIN m_assignsubmission_exclusion exclusion ON exclusion.entityid = u.id AND exclusion.type = $1
WHERE u.id <> u.id GROUP BY u.id, u.firstnamephonetic,u.lastnamephonetic,u.middlename,u.alternatename,u.firstname,u.lastname
LIMIT 25
[array (
0 => 20,
)]
Error code: dmlreadexception
Stack trace:

    line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown
    line 329 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
    line 920 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
    line 1997 of /lib/tablelib.php: call to pgsql_native_moodle_database->get_records_sql()
    line 2019 of /lib/tablelib.php: call to table_sql->query_db()
    line 48 of /mod/assign/submission/comparativejudgement/classes/managejudgescontroller.php: call to table_sql->out()
    line 270 of /mod/assign/submission/comparativejudgement/locallib.php: call to assignsubmission_comparativejudgement\managejudgescontroller->view()
    line 3159 of /mod/assign/locallib.php: call to assign_submission_comparativejudgement->view_page()
    line 663 of /mod/assign/locallib.php: call to assign->view_plugin_page()
    line 55 of /mod/assign/view.php: call to assign->view()
andrewhancox commented 4 years ago

Fixed and pushed - MySQL lets you get away with murder...