Skip to content

Postgres error using report #3

@mchurchward

Description

@mchurchward

Error reading from database

More information about this error
Debug info: ERROR: column "gg.overridden" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: ....id AS giid, u.firstname, u.lastname, u.idnumber, gg.overrid...
^
SELECT u.id AS userid, fp.id AS postid, gi.id AS giid, u.firstname, u.lastname, u.idnumber, gg.overridden,
fp.message, gi.itemname, gg.finalgrade, fp.created AS timesubmitted, fp.modified AS timecreated,
u.firstnamephonetic, u.lastnamephonetic, u.middlename, u.alternatename
FROM mdlforum_posts fp
INNER JOIN mdlforum_discussions fd ON fd.id = fp.discussion
INNER JOIN mdlforum f ON f.id = fd.forum
INNER JOIN mdlgrade_items gi ON gi.iteminstance = fd.forum
LEFT JOIN mdlgrade_grades gg ON gg.itemid = gi.id AND gg.userid = fp.userid
INNER JOIN mdluser u ON u.id = fp.userid AND fp.userid in (3)
WHERE fd.course = $1
AND f.assessed > 0
AND fp.userid != 0
AND gi.itemmodule = 'forum'
AND fp.created >= $2
AND fp.created <= $3
GROUP BY fp.userid, u.id, fp.id, gi.id, u.firstname, u.lastname, u.idnumber, fp.message, gi.itemname, gg.finalgrade,
fp.created
ORDER BY fp.created ASC, u.lastname ASC, u.firstname ASC
[array (
0 => 5,
1 => 1475467200,
2 => 1475553599,
)]
Error code: dmlreadexception
Stack trace:

line 474 of /lib/dml/moodle_database.php: dml_read_exception thrown
line 244 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
line 753 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
line 1192 of /report/ncccscensus/lib.php: call to pgsql_native_moodle_database->get_recordset_sql()
line 716 of /report/ncccscensus/lib.php: call to report_ncccscensus_build_grades_array()
line 63 of /report/ncccscensus/index.php: call to report_ncccscensus_generate_report()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions