Forums | Mahara Community

Support /
Upgrade 1.8 to 1.9 fail


Viktor's profile picture
Posts: 13

17 August 2015, 22:55

Hello,

when I try upgrade from Mahara 1.8.7 to Mahara 1.9.7, upgrade fails. I tried also versions 1.9.5 and 1.9.6. Any suggestions (database is PostgreSQL 9.1, PHP 5.3)?

:( Could not execute command: UPDATE "view_rows_columns" SET id = ? WHERE view = ? AND row = ? AND columns = ?

Call stack (most recent first):
  • execute_sql("UPDATE {view_rows_columns} SET id = ? WHERE view =...", array(size 4)) at/var/www/html/lib/db/upgrade.php:2851
  • xmldb_core_upgrade("2013101424") at /var/www/html/lib/upgrade.php:297
  • upgrade_core(object(stdClass)) at /var/www/html/admin/upgrade.json.php:79
Robert Lyon's profile picture
Posts: 756

21 August 2015, 14:00

Hi Viktor,

I am unable to replicate this bug - but it will exist if you have previously upgrading from a site installed before version 1.8.0.

What happened was in 1.8.0 we added a table called "view_rows_columns". If you installed you site with 1.8.0 or later it would have added the table with 4 columns:

 id, view, row and columns

but if you had upgraded from an earlier version it only had 3 columns: view, row and columns

So there was a fix for this to add in the id column for version 1.9.0 to add in the missing 'id' column.

The code to do this (and where your upgrade is failing) is:

 $x = 1
 foreach ($records as $record) {
    execute_sql('UPDATE {view_rows_columns} SET id = ? WHERE view = ? AND row = ? AND columns = ?',
        array($x, $record->view, $record->row, $record->columns));
    $x++;
 }

This could fail if the values it is trying to add to the db are not valid.

Can you check your "view_rows_columns" table (before upgrade) and make sure that all the values are integers, that all rows have integers for each column and that each 'view' value actually has a corresponding 'id' in the "view" table.

Also if there is more error message mentioning what values it was trying to insert that would be helpful as well

Cheers

Robert

Viktor's profile picture
Posts: 13

21 August 2015, 23:21

Dear Robert,

many thanks for your reply. Issue was in insufficient permissions in database. Previous upgrades was finished successful and I thought, that the error is elsewhere.

3 results