Issue Details (XML | Word | Printable)

Key: MDL-9592
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Eloy Lafuente (stronk7)
Reporter: D P
Votes: 1
Watchers: 0
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

ORA error: infinite loop when restoring courses!

Created: 26/Apr/07 08:00 PM   Updated: 05/Sep/07 11:49 PM
Return to search
Component/s: Database SQL/XMLDB
Affects Version/s: 1.7.1, 1.8
Fix Version/s: 1.7.3, 1.8.3, 1.9

File Attachments: 1. Text File restorelib.php.patch (5 kB)
2. Text File restorelib.php.patch (4 kB)

Image Attachments:

1. moodle_bug_restore.JPG
(95 kB)
Environment:
Solaris 10,
Oracle 10g,
Firefox 2.0.0.2,
Developer messages on

Database: Oracle
URL: /backup/restore.php
Participants: Alan Trick, D P, Eloy Lafuente (stronk7) and Jonathan Newman
Security Level: None
Resolved date: 05/Sep/07
Affected Branches: MOODLE_17_STABLE, MOODLE_18_STABLE
Fixed Branches: MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE


 Description  « Hide
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
.........

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
D P added a comment - 26/Apr/07 08:12 PM
The lines refer to /backup/restorelib.php!

Btw: Am I allowed to edit a committed issue?


Alan Trick added a comment - 15/Aug/07 02:55 AM
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.


Alan Trick added a comment - 15/Aug/07 03:03 AM
Also, this isn't Oracle specific. MSSQL gives error messages too and I assume just about any DB would be unhappy with this SQL.

Alan Trick added a comment - 16/Aug/07 03:14 AM
I missed one of the lines, here's another patch with it included

Jonathan Newman added a comment - 05/Sep/07 01:37 PM
I replicated this bug on Moodle 1.8 on Oracle 10gR2, and have confirmed that the patch fixes the issue.

Eloy Lafuente (stronk7) added a comment - 05/Sep/07 11:49 PM
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