Moodle

Upgrading moodle 1.5 to 1.9

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Not a bug
  • Affects Version/s: 1.9.3
  • Fix Version/s: None
  • Component/s: Questions
  • Labels:
    None
  • Environment:
    Linux, php5, postgres8.3
  • Database:
    PostgreSQL
  • Affected Branches:
    MOODLE_19_STABLE

Description

I trying to upgrade moodle from 1.5 to 1.9.3, folling the instructions on upgradingo moodle (1.5->1.6->1.8->1.9), I can upgrade to 1.8.9 without any problem, but whe i try to upgrade to 1.9 , the upgrade process stops with this erro

(postgres7): SELECT d.adnum as num, d.adsrc as def from pg_attrdef d, pg_class c where d.adrelid=c.oid and c.relname='mdl_question_categories' order by d.adnum (postgres7): UPDATE mdl_question_categories SET name = '',info = '',stamp = 'ebaula.ensino.eb.br+080601172801+RBEFrc',parent = '125',sortorder = '999',contextid = NULL WHERE id = 167 -1: ERROR: null value in column "contextid" violates not-null constraint

ADOConnection._Execute(UPDATE mdl_question_categories SET name = '',info = '',stamp = 'ebaula.ensino.eb.br+080601172801+RBEFrc',parent = '125',sortorde..., false) % line 891, file: adodb.inc.php
ADOConnection.Execute(UPDATE mdl_question_categories SET name = '',info = '',stamp = 'ebaula.ensino.eb.br+080601172801+RBEFrc',parent = '125',sortorde...) % line 1703, file: dmllib.php
update_record(question_categories, Object:stdClass) % line 292, file: upgrade.php
question_upgrade_context_etc() % line 1673, file: upgrade.php
xmldb_main_upgrade(2007080903) % line 364, file: index.php

During the environment, there is a warning about Random Questions Selecting from Subcategories, but when i click in the links i get access denied error (admin/report/question/index.php), or goes to moodle docs page.

Activity

Hide
Tim Hunt added a comment -

Can you try

SELECT * FROM mdl_question_categories WHERE course IS NULL;

or

SELECT * FROM mdl_question_categories qc LEFT JOIN mdl_course c ON qc.course = c.id WHERE c.id IS NULL;

Both of those queries should return nothing. However, if there is a problem in your Moodle database before upgrading, one of them will, and the data it returns may help us diagnose the problem.

Show
Tim Hunt added a comment - Can you try SELECT * FROM mdl_question_categories WHERE course IS NULL; or SELECT * FROM mdl_question_categories qc LEFT JOIN mdl_course c ON qc.course = c.id WHERE c.id IS NULL; Both of those queries should return nothing. However, if there is a problem in your Moodle database before upgrading, one of them will, and the data it returns may help us diagnose the problem.
Hide
Carlos Alexandre S. da Fonseca added a comment -

I haved tried
SELECT * FROM mdl_question_categories WHERE course IS NULL, and no results

after i try

select id,course from mdl_question_categories cc where cc.id not in (select qc.id from mdl_question_categories qc inner JOIN mdl_context c ON qc.course=c.instanceid where c.contextlevel=50);

and i figure out which question_categories has no courses, and correct it

Thanks a lot

Show
Carlos Alexandre S. da Fonseca added a comment - I haved tried SELECT * FROM mdl_question_categories WHERE course IS NULL, and no results after i try select id,course from mdl_question_categories cc where cc.id not in (select qc.id from mdl_question_categories qc inner JOIN mdl_context c ON qc.course=c.instanceid where c.contextlevel=50); and i figure out which question_categories has no courses, and correct it Thanks a lot
Hide
Tim Hunt added a comment -

In that case I guess this is a problem with the data in your old system, and not a bug in the upgrade, so closing this issue. Please reopen if you disagree.

Show
Tim Hunt added a comment - In that case I guess this is a problem with the data in your old system, and not a bug in the upgrade, so closing this issue. Please reopen if you disagree.
Hide
Sílvia Frías added a comment -

I'm upgrading from 1.8.2 to 1.9.4 and I'm getting the same error.
As I see, this report is not a bug and it's resolved, but I don't know what I have to do to resolve it. Can anybody help me?

Show
Sílvia Frías added a comment - I'm upgrading from 1.8.2 to 1.9.4 and I'm getting the same error. As I see, this report is not a bug and it's resolved, but I don't know what I have to do to resolve it. Can anybody help me?
Hide
Tim Hunt added a comment -

Can you try running the two database queries I give in my comment of 02/Jun/09 04:20 PM.

Show
Tim Hunt added a comment - Can you try running the two database queries I give in my comment of 02/Jun/09 04:20 PM.
Hide
Carlos Alexandre S. da Fonseca added a comment -

Sílvia Frías, try the queries above, works for me

These queries expect to return no results, if return any you have the same problem.... question categories without course or with invalid course id

Show
Carlos Alexandre S. da Fonseca added a comment - Sílvia Frías, try the queries above, works for me These queries expect to return no results, if return any you have the same problem.... question categories without course or with invalid course id
Hide
Sílvia Frías added a comment -

Oops, I'm sorry that's ok now.
I corrected the table question_categories after trying twice the upgrade and I figure the database, was corrupted.
So I've just restored a backup from the database, corrected first the errors and then run the upgrade.
Thanks a lot.

Show
Sílvia Frías added a comment - Oops, I'm sorry that's ok now. I corrected the table question_categories after trying twice the upgrade and I figure the database, was corrupted. So I've just restored a backup from the database, corrected first the errors and then run the upgrade. Thanks a lot.

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: