academic-moodle-cooperation / moodle-mod_publication

Online texts and files can be collected and published via the Student Folder activity and thus made available to everyone in a Moodle course. Submissions can be made directly by uploading or alternatively can be taken over by teachers from an assignment activity.
https://academic-moodle-cooperation.org/mod_publication/
12 stars 21 forks source link

dmlreadexception #83

Open Atirianos opened 1 month ago

Atirianos commented 1 month ago

Hello developers,

we are getting the error below in our moodle instance (4.3.4+) with plugin version: v4.3.0 (2024011110).

Best regards Knut

Error message:

Debug-Info:  ERROR: column "g.name" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: SELECT DISTINCT g.id, g.name AS groupname, NULL AS groupmemb...
^
SELECT DISTINCT g.id, g.name AS groupname, NULL AS groupmembers, COUNT(*) AS filecount,
SUM(files.studentapproval) AS studentapproval, SUM(files.teacherapproval) AS teacherapproval, MAX(files.timecreated) AS timemodified
FROM ( SELECT 0 AS id, $1 AS name
UNION ALL
SELECT mdl_groups.id, mdl_groups.name AS name
FROM mdl_groups) AS g JOIN mdl_publication_file files ON g.id = files.userid AND files.publication = $2 AND files.teacherapproval = 1
WHERE g.id IN ($3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40)
GROUP BY g.id
ORDER BY groupname ASC NULLS FIRST LIMIT 10
[array (
0 => 'Standard-Gruppe',
1 => '96',
2 => 891,
3 => 832,
4 => 833,
5 => 834,
6 => 835,
7 => 836,
8 => 837,
9 => 838,
10 => 839,
11 => 840,
12 => 841,
13 => 842,
14 => 843,
15 => 844,
16 => 845,
17 => 846,
18 => 847,
19 => 848,
20 => 849,
21 => 850,
22 => 851,
23 => 852,
24 => 853,
25 => 854,
26 => 855,
27 => 856,
28 => 857,
29 => 858,
30 => 859,
31 => 860,
32 => 861,
33 => 862,
34 => 863,
35 => 864,
36 => 865,
37 => 866,
39 => 0,
38 => 867,
)]
Error code: dmlreadexception Stack trace: 

    line 494 of /lib/dml/moodle_database.php: dml_read_exception thrown
    line 293 of /lib/dml/moodle_read_slave_trait.php: call to moodle_database->query_end()
    line 358 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->read_slave_query_end()
    line 1044 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
    line 358 of /mod/publication/classes/local/allfilestable/base.php: call to pgsql_native_moodle_database->get_records_sql()
    line 2210 of /lib/tablelib.php: call to mod_publication\local\allfilestable\base->query_db()
    line 560 of /mod/publication/locallib.php: call to table_sql->out()
    line 202 of /mod/publication/view.php: call to publication->display_allfilesform()
mwreichel commented 1 month ago

Hi @Atirianos, thank you for reporting this. We'll have a look on it.

Kind regards, Martin

mwreichel commented 1 month ago

@Atirianos : please could you add some information to the steps you did before/ when this error happened? Thanks.

Atirianos commented 1 month ago

Hi Martin, the error occurred in a course for our students and was reported to me as an admin. My colleague divided the students into groups (36 in total + 1 empty group, each group 3 - 6 students). The groups had to submit a paper via an assignment activity. After the deadline, they released the submissions to everyone via "Student Folder". They have made some adjustments via the settings (see below) and pressed "Save and display". After pressing the button, the error appears. Settings (translated from German):

image

Best regards Knut

mwreichel commented 1 month ago

Hi @Atirianos , thanks for the further details to this. We'll give you an update after checking it.

All the best, Martin

mwreichel commented 1 month ago

@Atirianos : In a first test, I was not able to get this message with publication 4.3. Which settings were set before the changes? ... and does this behaviour still occures? Which version of php do you use?

Thanks, Martin

Atirianos commented 1 month ago

There was a change in the settings we switch from MariaDB to postgres. I tested it myself. The Error only occurs on moodle instances with postgres databases. The message does not appear on MariaDB instances. PHP: 8.1.27 Best Regards, Knut

mwreichel commented 1 week ago

Hi @Atirianos, thank you for your further details. We'll have a closer look on this.

Kind regards, Martin