I have huge problem: in every course question editing is not possible because of error "error getting category record". The only place where it works is frontpage questions.
Old questions (created before upgrade) are working in quizzes, but it is not possible to edit quiz nor is possible to edit question(s).
It affects teaching staff and admins, so problem is global.
I have moodle 1.9.2+, build 20080820, upgraded from v1.8.4+.
I need some fix as soon as possible, as teachers use quizzes all the time....
Best regards,
Vedran
During the upgrade, were any errors reported? (You can find a copy of everything ouput during the upgrade in moodledata/upgradelogs.)
And can you run whatever script your database provides for checking tables for corruption. For example: Administration_FAQ#How_do_I_repair_a_corrupted_Moodle_database.3F
And can you run whatever script your database provides for checking tables for corruption. For example: Administration_FAQ#How_do_I_repair_a_corrupted_Moodle_database.3F
There were no errors... that's why I'm surprised it happened.
I'll see if database needs repairing.
Thank You.
I'll see if database needs repairing.
Thank You.
The query that is failing is
SELECT * FROM mdl_question_categories WHERE contextid = '123' ORDER BY sortorder, name LIMIT 1You might like to try that in PHPMyAdmin, or equivalent and see what error is occurring. The actual contextid number does not matter - it does not matter whether any records are matched, just that a query of this general form can be executed without errors.
Query works, no errors produced, entry retrieved...
This doesn't work on PostgreSQL database...
In reply to Vedran Mušica
Re: Question edit displays "error getting category record"
by Vedran Mušica -
In reply to Vedran Mušica
Re: Question edit displays "error getting category record"
by Vedran Mušica -
Error found.
In questionlib.php, around line 1892 is this.
if (!$categoryrs = get_recordset_select("question_categories", "contextid = '{$context->id}'", 'sortorder, name', '*', '', 1)) {
error('error getting category record');
} else {
but, when this error is commented, everything works fine. What could be reason for that?
Oh, yes, every category for questions exist - even default one.
Regards,
Vedran
In questionlib.php, around line 1892 is this.
if (!$categoryrs = get_recordset_select("question_categories", "contextid = '{$context->id}'", 'sortorder, name', '*', '', 1)) {
error('error getting category record');
} else {
but, when this error is commented, everything works fine. What could be reason for that?
Oh, yes, every category for questions exist - even default one.
Regards,
Vedran
Yes, that is the query I extracted from the code and asked you to test in isolation. Just ignoring the error does not seem like a good plan to me. I am sprised that the problem occurs in Postgres, because I use Postgres for my development, and so would expect to notice problems like this, and I haven't.
Anyway it would be better to fix the query so that it works.
Anyway it would be better to fix the query so that it works.
This is my plan, exactly.
I know that killing this error report for it self isn't a permanent solution, and I will continue to look for real error.
When I find it - and I will - I'll post here the reason and (possible) solution.
And my opinion is that the problem might be in upgrading.
I have another moodle installation (same database, v1.9.2) which had clean install (no upgrading) and it works just fine.
Best regards,
Vedran
I know that killing this error report for it self isn't a permanent solution, and I will continue to look for real error.
When I find it - and I will - I'll post here the reason and (possible) solution.
And my opinion is that the problem might be in upgrading.
I have another moodle installation (same database, v1.9.2) which had clean install (no upgrading) and it works just fine.
Best regards,
Vedran
One thing to check is the database tables in the upgraded version with the ones in the new install. Do they have the same columns with the same types?
Thank you for taking the time to investigate this issue and report your progress here. It is people like you that help make Moodle a robust platform.
Thank you for taking the time to investigate this issue and report your progress here. It is people like you that help make Moodle a robust platform.
I have checked database, and it is properly upgraded. I have one 1.8.4 installation (old test) and database tables for questions are different. In my new test installation (1.9.2+) database look exactly the same as in production one.
I will make diff scans in files, maybe there is some problem, or some file hasn't been copied well...
Regards,
Vedran
I will make diff scans in files, maybe there is some problem, or some file hasn't been copied well...
Regards,
Vedran
In reply to Vedran Mušica
Re: Question edit displays "error getting category record"
by Vedran Mušica -
Found another problem, probably related to this.
Multianswer (cloze) questions is not possible to edit. I get "Could not update question!".
Trying to find error, but I can't....
Multianswer (cloze) questions is not possible to edit. I get "Could not update question!".
Trying to find error, but I can't....
In reply to Vedran Mušica
Re: Question edit displays "error getting category record"
by Vedran Mušica -
Found error place, don't know how to fix it:
in questiontype.php, line (around) 285 is this:
if (!update_record('question', $question)) {
error('Could not update question!');
}
The problem is that I can't find ANY problem with $question data, except it is Cloze...
Any and every help with this is appreciated!
Regards,
Vedran
in questiontype.php, line (around) 285 is this:
if (!update_record('question', $question)) {
error('Could not update question!');
}
The problem is that I can't find ANY problem with $question data, except it is Cloze...
Any and every help with this is appreciated!
Regards,
Vedran
In reply to Vedran Mušica
Re: Question edit displays "error getting category record"
by Vedran Mušica -
Anybody knows?
Anybody???
Anybody???