Error reading from database - Upgrading to 2.0.4 (preview) from 1.9

Error reading from database - Upgrading to 2.0.4 (preview) from 1.9

by Khushal Singh -
Number of replies: 6
Hi,

We are upgrading our moodle installation with 2.0.4 (preview) release below is the existing environment.

Windows 2003 SP2 32bit
MSSQL 2005 SP2
ALL PHP requirements are fine but upgarade is failing, and if we enable DEBUGING it throw below error.

mod_data

Error reading from database


Debug info: The data types ntext and varchar are incompatible in the not equal to operator.
SELECT COUNT('x') FROM mdl_data_content c
JOIN mdl_data_fields f ON f.id = c.fieldid
JOIN mdl_data_records r ON r.id = c.recordid
JOIN mdl_data d ON d.id = r.dataid
JOIN mdl_modules m ON m.name = 'data'
JOIN mdl_course_modules cm ON (cm.module = m.id AND cm.instance = d.id)
WHERE c.content <> '' AND c.content IS NOT NULL
AND (f.type = 'file' OR f.type = 'picture')
[array (
)]
Stack trace:
  • line 378 of \lib\dml\moodle_database.php: dml_read_exception thrown
  • line 245 of \lib\dml\mssql_native_moodle_database.php: call to moodle_database->query_end()
  • line 692 of \lib\dml\mssql_native_moodle_database.php: call to mssql_native_moodle_database->query_end()
  • line 721 of \lib\dml\mssql_native_moodle_database.php: call to mssql_native_moodle_database->get_recordset_sql()
  • line 1216 of \lib\dml\moodle_database.php: call to mssql_native_moodle_database->get_records_sql()
  • line 1291 of \lib\dml\moodle_database.php: call to moodle_database->get_record_sql()
  • line 1462 of \lib\dml\moodle_database.php: call to moodle_database->get_field_sql()
  • line 91 of \mod\data\db\upgrade.php: call to moodle_database->count_records_sql()
  • line 510 of \lib\upgradelib.php: call to xmldb_data_upgrade()
  • line 294 of \lib\upgradelib.php: call to upgrade_plugins_modules()
  • line 1277 of \lib\upgradelib.php: call to upgrade_plugins()
  • line 260 of \admin\index.php: call to upgrade_noncore()
Any help on this is appreciated

Thanks in advance.
Khushal Singh
Average of ratings: -
In reply to Khushal Singh

Re: Error reading from database - Upgrading to 2.0.4 (preview) from 1.9

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Khushal,

Thanks for your help in testing the upgrade to Moodle 2.0. approve

I'm just going to move your discussion thread to the testing and QA forum...
In reply to Khushal Singh

Re: Error reading from database - Upgrading to 2.0.4 (preview) from 1.9

by Mark Landrum -

I am having the same issue except that I am using. Win2008R2 64-bit, IIS 7, SQL2005. The upgrade runs but hangs up when trying to update mod_data.

In reply to Mark Landrum

Re: Error reading from database - Upgrading to 2.0.4 (preview) from 1.9

by Michael Woods -
Picture of Core developers
I suspect there might've been an issue with yesterday's build, as I experienced a similar message on a clean install.

I've installed today's build and things seem to be OK. Not sure if this is the same for you.
In reply to Michael Woods

Re: Error reading from database - Upgrading to 2.0.4 (preview) from 1.9

by Khushal Singh -
I given a try with latest build of moodle 2.0.4 (20100711) but no luck.

Regards
Khushal
In reply to Khushal Singh

Re: Error reading from database - Upgrading to 2.0.4 (preview) from 1.9

by Mark Williams -

Same issue - 20100802 - Upgrading from 1.9.5

Server 2008, SQL 2005, FreeTDS, IIS 7

I dont get a progress meter at all for mod_data just

Error reading from database

Debug info: The data types ntext and varchar are incompatible in the not equal to operator.
SELECT COUNT('x') FROM mdl_data_content c
JOIN mdl_data_fields f ON f.id = c.fieldid
JOIN mdl_data_records r ON r.id = c.recordid
JOIN mdl_data d ON d.id = r.dataid
JOIN mdl_modules m ON m.name = 'data'
JOIN mdl_course_modules cm ON (cm.module = m.id AND cm.instance = d.id)
WHERE c.content <> '' AND c.content IS NOT NULL
AND (f.type = 'file' OR f.type = 'picture')
[array (
)]
Stack trace:
  • line 380 of \lib\dml\moodle_database.php: dml_read_exception thrown
  • line 247 of \lib\dml\mssql_native_moodle_database.php: call to moodle_database->query_end()
  • line 694 of \lib\dml\mssql_native_moodle_database.php: call to mssql_native_moodle_database->query_end()
  • line 723 of \lib\dml\mssql_native_moodle_database.php: call to mssql_native_moodle_database->get_recordset_sql()
  • line 1218 of \lib\dml\moodle_database.php: call to mssql_native_moodle_database->get_records_sql()
  • line 1293 of \lib\dml\moodle_database.php: call to moodle_database->get_record_sql()
  • line 1464 of \lib\dml\moodle_database.php: call to moodle_database->get_field_sql()
  • line 90 of \mod\data\db\upgrade.php: call to moodle_database->count_records_sql()
  • line 512 of \lib\upgradelib.php: call to xmldb_data_upgrade()
  • line 296 of \lib\upgradelib.php: call to upgrade_plugins_modules()
  • line 1295 of \lib\upgradelib.php: call to upgrade_plugins()
  • line 260 of \admin\index.php: call to upgrade_noncore()

I would have expected this behavior as MSSQL wouldnt like WHERE c.content <> '' for an ntext datatype.  I have replaced the expression with WHERE c.content LIKE '_%' with success

In reply to Mark Williams

Re: Error reading from database - Upgrading to 2.0.4 (preview) from 1.9

by Mark Williams -
Sorry, I forgot to say.  To test:  I editted line 87 (moodle\mod\data\db\upgrade.php) to read

WHERE c.content LIKE '_%' AND c.content IS NOT NULL