Moodle

ORA error: infinite loop when restoring courses!

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 1.7.1, 1.8
  • Fix Version/s: 1.7.3, 1.8.3, 1.9
  • Component/s: Database SQL/XMLDB
  • Labels:
    None
  • Environment:
    Solaris 10,
    Oracle 10g,
    Firefox 2.0.0.2,
    Developer messages on
  • Database:
    Oracle
  • URL:
    /backup/restore.php
  • Affected Branches:
    MOODLE_17_STABLE, MOODLE_18_STABLE
  • Fixed Branches:
    MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE

Description

We have made a course backup on a 1.7.1-mysql-windows-system and uploaded the zip file to our new 1.7.1-oracle-solaris-system!

We started the restore process and got some ora errors (we create different issues for them!) and an infinite loop when the system wants to create the gradebook (categories, preferences, letters) - please take a look at the screenshot...

We have found a solution, but we're not quite sure, if its raising other issues... (...we haven't noticed yet...):
At line 1198

//Process preferences
if ($preferencescount && $continue) {
if (!defined('RESTORE_SILENTLY')) { echo '<li>'.get_string('preferences','grades').'</li>'; }
$counter = 0;
while ($counter < $preferencescount) {
//Fetch recordset_size records in each iteration
$recs = get_records_select("backup_ids","table_name = 'grade_preferences' AND backup_code = '$restore->backup_unique_code'",
"old_id",
"old_id, old_id",
$counter,
$recordset_size);

change "old_id, old_id", to only one "old_id",

Do the same at lines 1252 and 1302...

Heres the better readable error message again:

Creating gradebook

  • Preferences
    ORA-00960: In der SELECT-Liste ist eine nicht eindeutige Spalte

SELECT old_id, old_id FROM m_backup_ids WHERE table_name = 'grade_preferences' AND backup_code = '1177587671' ORDER BY old_id

ORA-00960: In der SELECT-Liste ist eine nicht eindeutige Spalte

SELECT old_id, old_id FROM m_backup_ids WHERE table_name = 'grade_preferences' AND backup_code = '1177587671' ORDER BY old_id

ORA-00960: In der SELECT-Liste ist eine nicht eindeutige Spalte

SELECT old_id, old_id FROM m_backup_ids WHERE table_name = 'grade_preferences' AND backup_code = '1177587671' ORDER BY old_id

ORA-00960: In der SELECT-Liste ist eine nicht eindeutige Spalte
.........

  1. restorelib.php.patch
    16/Aug/07 3:14 AM
    5 kB
    Alan Trick
  2. restorelib.php.patch
    15/Aug/07 2:55 AM
    4 kB
    Alan Trick
  1. moodle_bug_restore.JPG
    95 kB
    26/Apr/07 8:00 PM

Activity

Hide
D P added a comment -

The lines refer to /backup/restorelib.php!

Btw: Am I allowed to edit a committed issue?

Show
D P added a comment - The lines refer to /backup/restorelib.php! Btw: Am I allowed to edit a committed issue?
Hide
Alan Trick added a comment -

This is still a problem in the CVS code.

As far as I can tell, there's absolutely no point in the second 'old_id' and removing it works fine. I've attached a patch to do that.

Show
Alan Trick added a comment - This is still a problem in the CVS code. As far as I can tell, there's absolutely no point in the second 'old_id' and removing it works fine. I've attached a patch to do that.
Hide
Alan Trick added a comment -

Also, this isn't Oracle specific. MSSQL gives error messages too and I assume just about any DB would be unhappy with this SQL.

Show
Alan Trick added a comment - Also, this isn't Oracle specific. MSSQL gives error messages too and I assume just about any DB would be unhappy with this SQL.
Hide
Alan Trick added a comment -

I missed one of the lines, here's another patch with it included

Show
Alan Trick added a comment - I missed one of the lines, here's another patch with it included
Hide
Jonathan Newman added a comment -

I replicated this bug on Moodle 1.8 on Oracle 10gR2, and have confirmed that the patch fixes the issue.

Show
Jonathan Newman added a comment - I replicated this bug on Moodle 1.8 on Oracle 10gR2, and have confirmed that the patch fixes the issue.
Hide
Eloy Lafuente (stronk7) added a comment -

Hi,

this has been fixed under 1.7, 1.8 and 1.9 !

In fact, there is a problem when using repeated fields (we needed them before Moodle 1.7) and using the "limitXXX" parameters of all the selectXXX functions under those DBs not supporting natively the "LIMIT" clause.

I think we destroyed all those calls (using doubled "id", but obviously, missed those "old_id" ones.

Thanks and ciao

Show
Eloy Lafuente (stronk7) added a comment - Hi, this has been fixed under 1.7, 1.8 and 1.9 ! In fact, there is a problem when using repeated fields (we needed them before Moodle 1.7) and using the "limitXXX" parameters of all the selectXXX functions under those DBs not supporting natively the "LIMIT" clause. I think we destroyed all those calls (using doubled "id", but obviously, missed those "old_id" ones. Thanks and ciao

People

Vote (1)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: