Error reading from database in just one course in Moodle 3.9

Error reading from database in just one course in Moodle 3.9

by Arnoldo Diaz -
Number of replies: 12

Hi,

After setting time restrictions for one activity I was unable to access a course anymore and receive the following error message every time I try to access that course: "Error reading from database". I can access any other of my courses as a user, and every other course as Admin. Our Moodle 3.9.2 runs on Debian 10 and MariaDB 10.3. After setting the site in Debug mode I get the following information:

Debug info: Unknown column 'username' in 'where clause'

SELECT id

FROM mdl_questionnaire_response

WHERE complete = 'y'

AND username = ?

AND survey_id = ? LIMIT 0, 1

[array (

0 => '191',

1 => '65',

)]

Error code: dmlreadexception

Stack trace:

  • line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown
  • line 1212 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
  • line 1955 of /lib/dml/moodle_database.php: call to mysqli_native_moodle_database->get_recordset_sql()
  • line 1349 of /blocks/progress/lib.php: call to moodle_database->record_exists_sql()
  • line 262 of /blocks/progress/block_progress.php: call to block_progress_attempts()
  • line 341 of /blocks/moodleblock.class.php: call to block_progress->get_content()
  • line 235 of /blocks/moodleblock.class.php: call to block_base->formatted_contents()
  • line 1181 of /lib/blocklib.php: call to block_base->get_content_for_output()
  • line 1239 of /lib/blocklib.php: call to block_manager->create_block_contents()
  • line 374 of /lib/blocklib.php: call to block_manager->ensure_content_created()
  • line 3966 of /lib/outputrenderers.php: call to block_manager->region_has_content()
  • line 41 of /theme/fordson/layout/course.php: call to core_renderer->blocks()
  • line 1374 of /lib/outputrenderers.php: call to include()
  • line 1304 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
  • line 244 of /course/view.php: call to core_renderer->header()

Any help will be greatly appreciated.


Average of ratings: -
In reply to Arnoldo Diaz

Re: Error reading from database in just one course in Moodle 3.9

by Arnoldo Diaz -
I forgot to mention that nobody can access that course. Everyone gets the same error: "Error reading from database!
In reply to Arnoldo Diaz

Re: Error reading from database in just one course in Moodle 3.9

by Ken Task -
Picture of Particularly helpful Moodlers

Login as an admin level user.

Then using the browser url line add the following to the url to your site:

/course/edit.php?id=6

ID # above is the ID number of the course that no one can reach.

Hopefully, there will be some parameter there you can change.

Alternative is to directory edit the database table for the setup of courses .... think it's mdl_courses ... id is same number.

Couldn't tell you what to change ... just have to look! smile  Related to the debug error?

'SoS', Ken


In reply to Ken Task

Re: Error reading from database in just one course in Moodle 3.9

by Arnoldo Diaz -
Dear Ken,
Thanks a lot for replying. As admin I have access to the course configuration. However, after checking the "save" or "cancel" options I get the "Error reading from database" error. I did nit fins any unusual or strange in the course configuration. Yesterday I set up a survey (questionnaire) and after finishing defining the questions, when I tried to set the time parameters for the activity, I started to get that error. I deleted the "questionnaire" entries of my course (questions) on the database but I still get the error. As far as I know, it is the only course in the entire site that has this problem.
Regards,
Arnoldo
In reply to Arnoldo Diaz

Re: Error reading from database in just one course in Moodle 3.9

by Ken Task -
Picture of Particularly helpful Moodlers

2 possibles ...

Theme using no longer compat ... edit config.php and add

$CFG->theme='boost';

will force entire site to use a native 3.9 theme.

The other item in debug pointed to the progress block.

That block is an addon ... could temp disable it to see if that gets you into the troubled course.

'SoS', Ken


In reply to Ken Task

Re: Error reading from database in just one course in Moodle 3.9

by Arnoldo Diaz -
Dear Ken.
Perhaps the problem is due to a bug in the progress block. After reading again the debug information I recalled that the problem started after I tried to include the survey in the progress block. How can I disable the progress temporarily? If I uninstall it to will affect the courses of the entire site. Is then a way to disable/uninstall it just for one course? Remember that I don'y hacia access to it.
In reply to Arnoldo Diaz

Re: Error reading from database in just one course in Moodle 3.9

by Arnoldo Diaz -
I am able to access the course using the mobile app, where progress bar does not show. It seem that the progress block is causing the problem. I need to find the way to disable it only for my course. Any suggestion is welcomed!
In reply to Arnoldo Diaz

Re: Error reading from database in just one course in Moodle 3.9

by Ken Task -
Picture of Particularly helpful Moodlers

Yes, if delete, data goes.

Best to concentrate on that one course.

Go to a course that works - note it's course ID number.   Edit blocks in that course ... and focus on progress block.

Note the URL's the working course shows you.

Copy those URL's to notepad or text edit - a text file.

Once you've collected urls, change them in the text file to point to the troubled course - want to get to the screens that allows one to remove the progress block.

Possible: Can you make a full backup of the course?

Step through backup screens and do not include the progress block or survey.

If that works, restore the course to a new course.

Check new course.

If it works hide old course, activate new course.

'SoS', Ken


In reply to Ken Task

Re: Error reading from database in just one course in Moodle 3.9

by Arnoldo Diaz -
Dear Ken,
The problem is already solved, thanks for your suggestions. I realized that the process block is outdated and it seems that it's been replaced by the completion progress block. I deleted the "progress" folder from the moodle folder and I was able to access the course again. Thanks a lot for your support.
Best regards,
Arnoldo
In reply to Arnoldo Diaz

Re: Error reading from database in just one course in Moodle 3.9

by Ken Task -
Picture of Particularly helpful Moodlers

Glad to hear it is solved.   Thanks for getting  back with the 'fix'.  Are you taking away anything (like admin notes to admins) from this hickup for future admin of a moodle?

'SoS', Ken

In reply to Ken Task

Re: Error reading from database in just one course in Moodle 3.9

by Arnoldo Diaz -
Ken, I am really sorry but I don't understand the meaning of this paragraph: "Are you taking away anything (like admin notes to admins) from this hickup for future admin of a moodle?" My English is not as good as I wanted. Could you help me explaining it in a different form? You have been so kind that I want to answer any question yo may have.
Regards,
Arnoldo
In reply to Arnoldo Diaz

Re: Error reading from database in just one course in Moodle 3.9

by Ken Task -
Picture of Particularly helpful Moodlers

What I meant ... before upgrading ... run System Admin Environment check to see if system can handle upgrade (php version, mysql version).

Also check 3rd party plugins (not core) installed to see if there is a compatible version available for destination version.

It's the item above that caused your last issue.   You did figure it out ... this time ... and solution wasn't that difficult ... next time that might not be true.

The question was really more for 'food for thought' than a question for response. ;)

'SoS', Ken


In reply to Ken Task

Re: Error reading from database in just one course in Moodle 3.9

by Arnoldo Diaz -
Dear Ken,
I do agree with everything you recommend. I check every week for operating system's upgrades, and for Moodle and plugins new releases. However, I installed this particular plugin several years ago and I didn't realized that it es kept outdated. I will perform a comprehensive plugin status check to avoid future problems. And your advise is great, we must perform this kind of verification often.
Thanks again for replying to my post. I appreciate your support.
Best regards,
Arnoldo