-
Notifications
You must be signed in to change notification settings - Fork 159
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
Column 'moodle_customcert.templateid' is invalid. Not contained in either an aggregate function or the GROUP BY clause. #649
Comments
Plugin Version: 4.4.3 (2024042207). Moodle Version: 4.4.3+ (Build: 20240920). |
I was able to resolve this by doing so: MSSQL is a bit strict with Group By functions and requires columns be listed in the group by statement if it is referenced in the select statement. In this case, the c.* retrieves all columns in the select statement. Potential "quick" workaround line 91: \mod\customcert\classes\task\issue_certificates_task.php from: to: |
@eiconsult can you try with the latest version which includes 4425055? I dont have access to an easily accessible SQL database without a bunch of docker configurations? If you can provide a diff, or even a PR that would be great. |
Ah. You've got it. I see 2024042206 replaced with 2024042207.
I'll drop a note when confirmed
…-Eseosa
________________________________
From: Mark Nelson ***@***.***>
Sent: Friday, October 18, 2024 11:56:25 AM
To: mdjnelson/moodle-mod_customcert ***@***.***>
Cc: Eseosa Iyare ***@***.***>; Mention ***@***.***>
Subject: Re: [mdjnelson/moodle-mod_customcert] Column 'moodle_customcert.templateid' is invalid. Not contained in either an aggregate function or the GROUP BY clause. (Issue #649)
@eiconsult<https://github.com/eiconsult> can you try with the latest version which includes 4425055<4425055>? I dont have access to an easily accessible SQL database without a bunch of docker configurations? If you can provide a diff, or even a PR that would be great.
—
Reply to this email directly, view it on GitHub<#649 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BMHPYGRCSTJEHSHT3JZF3BDZ4EVSTAVCNFSM6AAAAABQGFS7LKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMRSG44DGNJTGM>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Hey @eiconsult, any update? :) Would like to fix this if it wasn't actually fixed by the patch I listed. |
:) client owns the MSSQL service. It will take a few to get this situated.
Thank you
-Eseosa
…________________________________
From: Mark Nelson ***@***.***>
Sent: Monday, October 21, 2024 10:20:38 AM
To: mdjnelson/moodle-mod_customcert ***@***.***>
Cc: Eseosa Iyare ***@***.***>; Mention ***@***.***>
Subject: Re: [mdjnelson/moodle-mod_customcert] Column 'moodle_customcert.templateid' is invalid. Not contained in either an aggregate function or the GROUP BY clause. (Issue #649)
Hey @eiconsult<https://github.com/eiconsult>, any update? :) Would like to fix this if it wasn't actually fixed by the patch I listed.
—
Reply to this email directly, view it on GitHub<#649 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BMHPYGX4ETH2W3ETFDABBP3Z4UETNAVCNFSM6AAAAABQGFS7LKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMRWHAZDOOBWGU>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Some time on the weekend ill get Moodle docker setup and run it against MSSQL and Oracle. I've just been too lazy to do that. 😅 |
Execute scheduled task: Issue certificates task (mod_customcert\task\issue_certificates_task)
... started 19:11:25. Current memory use 29.3 MB.
Debugging increased temporarily due to faildelay of 86400
... used 1 dbqueries
... used 2.8524348735809 seconds
Scheduled task failed: Issue certificates task (mod_customcert\task\issue_certificates_task),Error reading from database (SQLState: 42000
Error Code: 8120
Message: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Column 'moodle_customcert.templateid' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
SELECT c.id, c.templateid, c.course, c.requiredtime, c.emailstudents, c.emailteachers, c.emailothers,
ct.id AS templateid, ct.name AS templatename, ct.contextid, co.id AS courseid,
co.fullname AS coursefullname, co.shortname AS courseshortname
FROM moodle_customcert c
JOIN moodle_customcert_templates ct
ON c.templateid = ct.id
JOIN moodle_course co
ON c.course = co.id
JOIN moodle_course_categories cat
ON co.category = cat.id
LEFT JOIN moodle_customcert_issues ci
ON c.id = ci.customcertid WHERE (c.emailstudents = '1'
OR c.emailteachers = '1'
OR LEN(c.emailothers) >= 3) AND co.visible = 1 AND cat.visible = 1 AND (co.enddate > '1697681485' OR (co.enddate = 0 AND ci.timecreated > '1697681485')) GROUP BY c.id, ct.id, ct.name, ct.contextid, co.id, co.fullname, co.shortname
[array (
0 => 1,
1 => 1,
2 => 1697681485,
3 => 1697681485,
)])
Debug info:
SQLState: 42000
Error Code: 8120
Message: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Column 'moodle_customcert.templateid' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
SELECT c.id, c.templateid, c.course, c.requiredtime, c.emailstudents, c.emailteachers, c.emailothers,
ct.id AS templateid, ct.name AS templatename, ct.contextid, co.id AS courseid,
co.fullname AS coursefullname, co.shortname AS courseshortname
FROM moodle_customcert c
JOIN moodle_customcert_templates ct
ON c.templateid = ct.id
JOIN moodle_course co
ON c.course = co.id
JOIN moodle_course_categories cat
ON co.category = cat.id
LEFT JOIN moodle_customcert_issues ci
ON c.id = ci.customcertid WHERE (c.emailstudents = '1'
OR c.emailteachers = '1'
OR LEN(c.emailothers) >= 3) AND co.visible = 1 AND cat.visible = 1 AND (co.enddate > '1697681485' OR (co.enddate = 0 AND ci.timecreated > '1697681485')) GROUP BY c.id, ct.id, ct.name, ct.contextid, co.id, co.fullname, co.shortname
[array (
0 => 1,
1 => 1,
2 => 1697681485,
3 => 1697681485,
)]
Backtrace:
The text was updated successfully, but these errors were encountered: