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

Error with cron local_kopere_dashboard\task\db_course_access #93

Open
mciotti opened this issue May 30, 2024 · 0 comments
Open

Error with cron local_kopere_dashboard\task\db_course_access #93

mciotti opened this issue May 30, 2024 · 0 comments

Comments

@mciotti
Copy link

mciotti commented May 30, 2024

Hi,
I got this error in db postgres during the scheduled task's run :
ERROR: column "mdl_logstore_standard_log.timecreated" must appear in the GROUP BY clause or be used in an aggregate function
LINE 3: ... courseid, userid, contextinstanceid, timecreate...

I think it's enought add the field in the group by clause...

Here the complete log:
Execute scheduled task: Cron to store user logins in temporary table (local_kopere_dashboard\task\db_course_access)
... started 16:48:04. Current memory use 5.7 MB.
... used 2 dbqueries
... used 0.0085229873657227 seconds
Scheduled task failed: Cron to store user logins in temporary table (local_kopere_dashboard\task\db_course_access),Si è verificato un errore durante la lettura del database (ERROR: column "mdl_logstore_standard_log.timecreated" must appear in the GROUP BY clause or be used in an aggregate function
LINE 3: ... courseid, userid, contextinstanceid, timecreate...
^

            SELECT CONCAT(courseid,userid,contextinstanceid) AS a, COUNT(*) AS contagem,
                   courseid, userid, contextinstanceid, timecreated
              FROM mdl_logstore_standard_log
             WHERE action = 'viewed'
          GROUP BY courseid, userid, contextinstanceid
          ORDER BY timecreated DESC

[array (
)])
Debug info:
ERROR: column "mdl_logstore_standard_log.timecreated" must appear in the GROUP BY clause or be used in an aggregate function
LINE 3: ... courseid, userid, contextinstanceid, timecreate...
^

            SELECT CONCAT(courseid,userid,contextinstanceid) AS a, COUNT(*) AS contagem,
                   courseid, userid, contextinstanceid, timecreated
              FROM mdl_logstore_standard_log
             WHERE action = 'viewed'
          GROUP BY courseid, userid, contextinstanceid
          ORDER BY timecreated DESC

[array (
)]
Backtrace:

  • 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 59 of /local/kopere_dashboard/classes/task/db_course_access.php: call to pgsql_native_moodle_database->get_records_sql()
  • line 410 of /lib/classes/cron.php: call to local_kopere_dashboard\task\db_course_access->execute()
  • line 208 of /lib/classes/cron.php: call to core\cron::run_inner_scheduled_task()
  • line 125 of /lib/classes/cron.php: call to core\cron::run_scheduled_tasks()
  • line 186 of /admin/cli/cron.php: call to core\cron::run_main_process()

Thanks in advance

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