Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Postgres error using report #3

Open
mchurchward opened this issue Oct 3, 2016 · 2 comments
Open

Postgres error using report #3

mchurchward opened this issue Oct 3, 2016 · 2 comments

Comments

@mchurchward
Copy link

mchurchward commented Oct 3, 2016

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()
@mchurchward
Copy link
Author

Reviewing this issue, I'm not clear on what the "gg.overridden" field is used for. Since it doesn't appear to be used to filter the results, my guess is it should be included in the "GROUP BY" clause.

@mchurchward
Copy link
Author

This pull request is what I believe needs to be done - PoetOS@8dea0f0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant