diff --git a/mod/quiz/classes/privacy/provider.php b/mod/quiz/classes/privacy/provider.php index 016f5a40eafc2..70b560fb1f453 100644 --- a/mod/quiz/classes/privacy/provider.php +++ b/mod/quiz/classes/privacy/provider.php @@ -493,10 +493,17 @@ protected static function export_quiz_attempts(approved_contextlist $contextlist $userid ); + // The layout column causes the union in the following query to fail on Oracle, it also appears to not be used. + // So we can filter the return values to be only those used to generate the data, this will have the benefit + // improving performance on all databases as we will no longer be returning a text field for each row. + $attemptfields = 'qa.id, qa.quiz, qa.userid, qa.attempt, qa.uniqueid, qa.preview, qa.state, qa.timestart, ' . + 'qa.timefinish, qa.timemodified, qa.timemodifiedoffline, qa.timecheckstate, qa.sumgrades, ' . + 'qa.gradednotificationsenttime'; + $sql = "SELECT c.id AS contextid, cm.id AS cmid, - qa.* + $attemptfields FROM {context} c JOIN {course_modules} cm ON cm.id = c.instanceid AND c.contextlevel = :contextlevel1 JOIN {modules} m ON m.id = cm.module AND m.name = 'quiz' @@ -508,7 +515,7 @@ protected static function export_quiz_attempts(approved_contextlist $contextlist SELECT c.id AS contextid, cm.id AS cmid, - qa.* + $attemptfields FROM {context} c JOIN {course_modules} cm ON cm.id = c.instanceid AND c.contextlevel = :contextlevel2 JOIN {modules} m ON m.id = cm.module AND m.name = 'quiz'