-
Bug
-
Resolution: Fixed
-
Minor
-
2.5.4, 2.6.1
-
2012021400
-
MOODLE_25_STABLE, MOODLE_26_STABLE
-
MOODLE_25_STABLE, MOODLE_26_STABLE
Note this is regarding the related block_eledia_usercleanup
When trying to run the block_eledia_usercleanup plugin, I get the following error:
[10-Jan-2014 12:40:01 America/Los_Angeles] Default exception handler: Error writing to database Debug: ERROR: syntax error at or near "user"
LINE 1: INSERT INTO mdl_block_eledia_usercleanup (user,mailedto,time...
^
INSERT INTO mdl_block_eledia_usercleanup (user,mailedto,timestamp) VALUES($1,$2,$3) RETURNING id
[array (
'user' => '33',
'mailedto' => 'jamesc@meridianlink.com',
'timestamp' => 1389386401,
)]
Error code: dmlwriteexception
- line 426 of \lib\dml\moodle_database.php: dml_write_exception thrown
- line 248 of \lib\dml\pgsql_native_moodle_database.php: call to moodle_database->query_end()
- line 857 of \lib\dml\pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
- line 909 of \lib\dml\pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->insert_record_raw()
- line 165 of \blocks\eledia_usercleanup\block_eledia_usercleanup.php: call to pgsql_native_moodle_database->insert_record()
- line 298 of \lib\cronlib.php: call to block_eledia_usercleanup->cron()
- line 61 of \admin\cli\cron.php: call to cron_run()
After investigating the issue, it seems that 'user' is a keyword in PostgreSQL (it is not a keyword in MySQL)... For that reason, the database errors out in the SQL call...
Possible Solutions are to send the query with the keyword 'user' in "" or to simply use a different field like ml_user...
Please solve the issue quickly as our database is becoming bloated with inactive users!
PS: If anybody knows any alternatives to this plugin, such suggestions are welcome!