upgrade from 2.4 to 2.5 faild question_match

upgrade from 2.4 to 2.5 faild question_match

by Christine Wolf -
Number of replies: 18

 I follow the upgrade prompts until I reach the "Plugins check" page which shows all the plugins to be upgraded. At the bottom of the page I select "Upgrade Moodle database now". The plugins begin updating, but they reach an error which reads:

qtype_match Table "question_match" already exists

More information about this error

Debug info: can not rename table
Error code: ddltablealreadyexists
Stack trace:
  • line 505 of /lib/ddl/database_manager.php: ddl_exception thrown
  • line 53 of /question/type/match/db/upgrade.php: call to database_manager->rename_table()
  • line 501 of /lib/upgradelib.php: call to xmldb_qtype_match_upgrade()
  • line 1586 of /lib/upgradelib.php: call to upgrade_plugins()
  • line 386 of /admin/index.php: call to upgrade_noncore()

My only option is "Continue", which lands me at the front page of my Moodle site. If I attempt to login (with the admin account), it sends me back to the "Plugins check" page and the erroneous loop begins again.

Average of ratings: -
In reply to Christine Wolf

Re: upgrade from 2.4 to 2.5 faild question_match

by Mitja Podreka -
Picture of Translators

Did you tried the upgrade before?

I had the same problem yesterday and then figured out that the table "question_match" did indeed exist from the upgrade test I did before.

Solution: delete all the tables from the database (I presume you are doing this on test server), then import the old database and then upgrade.

In reply to Mitja Podreka

Re: upgrade from 2.4 to 2.5 faild question_match

by Christine Wolf -

Thank you verry much for your suggestion.

This does't do the trick for me. I upgrade from 2.4 -> 2.5 and there already is a mdl_question_mach database table in 2.4. If I simply delete it I run into another error.

 

qtype_match

Unknown DDL library error

More information about this error

Debug info: table probably already renamed
Error code: ddlunknownerror
Stack trace:
  • line 497 of /lib/ddl/database_manager.php: ddl_exception thrown
  • line 53 of /question/type/match/db/upgrade.php: call to database_manager->rename_table()
  • line 501 of /lib/upgradelib.php: call to xmldb_qtype_match_upgrade()
  • line 1586 of /lib/upgradelib.php: call to upgrade_plugins()
  • line 386 of /admin/index.php: call to upgrade_noncore()

 

I can only press continue and again I'm in that loop.

In reply to Christine Wolf

Re: upgrade from 2.4 to 2.5 faild question_match

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

The error makes no sense to me. During the upgrade, the table is supposed to be renamed mdl_question_match -> mdl_qtype_match.

So question_match should exist before the upgrade. (Don't delete it, you will lose vital data.)

In reply to Tim Hunt

Re: upgrade from 2.4 to 2.5 faild question_match [solved]

by Christine Wolf -

Don't worry I work in a devel environment and have multiple dumps of the database smile

You made me think of s.th. In my case mdl_question_match was supposed to be renamed to qtype_match_options see: /question/type/match/db/upgrade.php. So of course qtype_match_options already existed and therefore the error.

After I deleted all tables starting with mdl_qtype the update worked.

In my case I deleted all those tables:

    mdl_qtype_essay_options     
    mdl_qtype_match_subquestions     
    mdl_qtype_poodllrecording_opts
    mdl_qtype_regexp     
    mdl_qtype_shortanswer_options

 

Thanks again to both of you cool

In reply to Christine Wolf

Re: upgrade from 2.4 to 2.5 faild question_match [solved]

by José Eduardo Chaves Costa -
Christine, your solution is perfect! I have the same problem and fix with your solution, work! wink
In reply to Christine Wolf

Re: upgrade from 2.4 to 2.5 faild question_match [solved]

by Randy Shuttleworth -

Hello Christine -- Thanks so much. I had the same problem. 

 

Worked perfectly.

 

Randy S

In reply to Christine Wolf

Re: upgrade from 2.4 to 2.5 faild question_match [solved]

by David Andrew -

Thanks that worked for me too.

Fully tested by users, and then applied to production server, however now getting issues all over about mdl_qtype_essay_options does not exist.

Simple things like backup and restore to copy the course gets the error.

 

Anyone with any help PLEASE

In reply to David Andrew

Re: upgrade from 2.4 to 2.5 faild question_match [solved]

by Anis Jradah -

Dear All,


Any fix for this problem?

Thank you.

Best regards,

Anis



In reply to Christine Wolf

Re: upgrade from 2.4 to 2.5 faild question_match

by Chris Wharton -

Hi, I am getting the same error upgrading a 2.3.8 to 2.5.1. Using MySQL 5.5.12, PHP 5.3.10.

Cli upgrade output:

 

-->qtype_match
Default exception handler: Table "question_match" already exists Debug: can not rename table
Error code: ddltablealreadyexists
* line 505 of /lib/ddl/database_manager.php: ddl_exception thrown
* line 53 of /question/type/match/db/upgrade.php: call to database_manager->rename_table()
* line 501 of /lib/upgradelib.php: call to xmldb_qtype_match_upgrade()
* line 1586 of /lib/upgradelib.php: call to upgrade_plugins()
* line 166 of /admin/cli/upgrade.php: call to upgrade_noncore()

Looking at the database before the upgrade, it contains only the table mdl_question_match.

Pre upgrade plugin version is: qtype_match 2012061700

 

 

After getting to this step and the upgrade stopping, both mdl_question_match and mdl_qtype_match_options tables exist.

The error message is a bit misleading. On line 505 of /lib/ddl/database_manager.php, the code 1) checks if the newname table exists, 2) if so, display the error "Table "<oldname>" already exists Debug: can not rename table". This should really be "Table <newname> already exists, Debug: cannot rename table <oldname>."

I can't find anywhere else in the code where the qtype_match_options table is defined, apart from question/type/match/db/install.xml of course. Tomorrow I'll try track where the rogue table is coming from.

 

In reply to Chris Wharton

Re: upgrade from 2.4 to 2.5 faild question_match

by james mergenthaler -

Chris, did you ever find a workaround for this problem? Im stuck at this upgrade point. Can I change something, code, in the file as a workaround?

In reply to james mergenthaler

Re: upgrade from 2.4 to 2.5 faild question_match

by Chris Wharton -

Hi James, I'll have a look back through last years work and see if I can find something useful for you.

In reply to Chris Wharton

Re: upgrade from 2.4 to 2.5 faild question_match

by james mergenthaler -

I would really appreciate it.  I tried again this am, saw the error, commented out the throw error line inside the if block...but that lead to another error....I sure chasing errors and commenting out throw statements is not the solution either.

Oddly, I have another instance, where I used the exact same builds upgrading from 2.3.2 - 2.3.11 - 2.4.9 - 2.5.5 - 2.6.2 and did not see this error.  So one instance generates the error while the other does not.....

I have build test instances and am upgrading them, prior to updating the live site.  Good thing, or I would be very stressed.

This is my blog post, where I talked a bit more about it.

Thanks

In reply to james mergenthaler

Re: upgrade from 2.4 to 2.5 faild question_match

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Note this bug reprot, MDL-43393 which is about a different DB table, but I think it is the same underlying issue.

In reply to james mergenthaler

Re: upgrade from 2.4 to 2.5 faild question_match

by Luis de Vasconcelos -

You're not using a MS SQL Server database, are you?

If you are, what $CFG->dbtype driver are you using? SQLSRV or MSSQL?

In reply to james mergenthaler

Re: upgrade from 2.4 to 2.5 faild question_match

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
I know this is an old post but I ran into this today upgrading someone else's site and this is what I did to resolve it.

This seems to happen after a failed install - some tables are created and then when you try to reinstall, it has a fit because the tables are already there.

Once on the failed install page, click on Continue to Load the Plugins page.  Don't do anything yet...

Go into the database, rename all of the qtype table to their name with .old on the end. DO NOT just delete them as they do not always get recreated as they should.

Back to your Plugins page and click Continue.  This should now go through without a hitch.

Return to the database and make sure that all the tables were recreated.  I found that two were not - the qtype_match_options and the qtype_essay_options.  So I renamed those two tables that I had renamed previously back to their original names.  And this seems to be working.  

(Before renaming these tables back to their original names, I had discovered that I couldn't open match questions.) After the rename, these work again.

Average of ratings: Useful (1)
In reply to Emma Richardson

This forum post has been removed

The content of this forum post has been removed and can no longer be accessed.
In reply to Deleted user

Re: upgrade from 2.4 to 2.5 faild question_match

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Good deal.  I was happy to find this post when I ran into the issue.  Got me pointed in the right direction!