WeBWorK Main Forum

Table 'webwork.locations' doesn't exist

Table 'webwork.locations' doesn't exist

by Dennis Keeler -
Number of replies: 8
Hello all. I'm trying to setup a new WW server. Everything is installed from scratch, Ubuntu 7.10, Apache 2.2, MySQL 5.0, WW 2.4.1. Everything seemed to be working, until I made my first problem set. Using the Library Browser was fine. But if I go to "Hmwk Sets Editor" and click on the number of problems in a set (in the "Edit Problems" column), I get the following error. I'm afraid I don't know enough about MySQL to diagnose it myself. Thanks. -Dennis

Error messages

DBD::mysql::st execute failed: Table 'webwork.locations' doesn't exist at /opt/webwork/webwork2/lib/WeBWorK/DB/Schema/NewSQL/Std.pm line 753.

Call stack

The information below can help locate the source of the problem.

  • in WeBWorK::DB::Schema::NewSQL::Std::handle_error called at line 352 of /opt/webwork/webwork2/lib/WeBWorK/DB/Schema/NewSQL/Std.pm
  • in WeBWorK::DB::Schema::NewSQL::Std::_get_fields_where_prepex called at line 320 of /opt/webwork/webwork2/lib/WeBWorK/DB/Schema/NewSQL/Std.pm
  • in WeBWorK::DB::Schema::NewSQL::Std::get_fields_where called at line 834 of /opt/webwork/webwork2/lib/WeBWorK/DB.pm
  • in WeBWorK::DB::listLocations called at line 597 of /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail.pm
  • in WeBWorK::ContentGenerator::Instructor::ProblemSetDetail::extraSetFields called at line 344 of /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail.pm
  • in WeBWorK::ContentGenerator::Instructor::ProblemSetDetail::FieldTable called at line 1685 of /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator/Instructor/ProblemSetDetail.pm
  • in WeBWorK::ContentGenerator::Instructor::ProblemSetDetail::body called at line 152 of /opt/webwork/webwork2/lib/WeBWorK/Template.pm
  • in WeBWorK::Template::template called at line 486 of /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator.pm
  • in WeBWorK::ContentGenerator::content called at line 194 of /opt/webwork/webwork2/lib/WeBWorK/ContentGenerator.pm
  • in WeBWorK::ContentGenerator::go called at line 353 of /opt/webwork/webwork2/lib/WeBWorK.pm

In reply to Dennis Keeler

Re: Table 'webwork.locations' doesn't exist

by Michael Gage -
did you run

webwork2/bin/wwdb_upgrade

?

The error indicates that you are missing a field from your database.

Go ahead and run it now and see if the error disappears.

-- MIke



In reply to Michael Gage

Re: Table 'webwork.locations' doesn't exist

by Dennis Keeler -
Hi Mike. Yes, I had run the wwdb_upgrade command. However, it's been giving strange output. It keeps incrementing the db_version number. Here's output of wwdb_upgrade -v. Thanks. -Dennis

Obtaining dbupgrade lock...
Got lock.
Initial system db_version is 10
Course 'modelCourse' has no db_version of it's own, assuming system db_version 10.
The course 'mth151e_S08' already contains a 'mth151e_S08_setting' table. Settings tables were introduced at db_version 24, but the current system db_version is only 10. We'll assume that this course is from a later version of WeBWorK and try to determine the course's version...
'db_version' has a NULL value. The value should always be a positive integer.
There is a 'db_version' record in the course's settings table, but it has an invalid value , so we can't determine the version. This course will be excluded from upgrades. If you know the version of this course, update 'db_version' record in the 'mth151e_S08_setting' table with the appropriate value.
The course 'admin' already contains a 'admin_setting' table. Settings tables were introduced at db_version 24, but the current system db_version is only 10. We'll assume that this course is from a later version of WeBWorK and try to determine the course's version...
'db_version' has a NULL value. The value should always be a positive integer.
There is a 'db_version' record in the course's settings table, but it has an invalid value , so we can't determine the version. This course will be excluded from upgrades. If you know the version of this course, update 'db_version' record in the 'admin_setting' table with the appropriate value.
modelCourse => 10
Lowest db_version is 10

Upgrading database from version 10 to 11...
(Version 11 fixes KEY length, adds UNIQUE KEY for set table)
Upgrading course 'modelCourse' to version 11...
DBD::mysql::db do failed: Table 'webwork.modelCourse_setting' doesn't exist at /opt/webwork/webwork2/lib/WeBWorK/Utils/DBUpgrade.pm line 436.
Releasing dbupgrade lock...
Released lock.
In reply to Dennis Keeler

Re: Table 'webwork.locations' doesn't exist

by Dennis Keeler -
OK, I ran wwdb_upgrade 13 more times until the db_version got up to 24. (I had tried the command on my old server to see what is supposed to happen.) The problem seems to be solved. Weird! -Dennis
In reply to Dennis Keeler

Re: Table 'webwork.locations' doesn't exist

by Michael Gage -
Hi Dennis,

I'm glad it's working now, but your experience does seem a bit strange to me. What I would expect is that running wwdb_upgrade would successively update from whatever version you were at (say version 10) up to the current version of the data base (and 24 seems about right).

I'd expect to the output you describe, but wouldn't expect to have to execute wwdb_upgrade more than once. In my experience it does each of the upgrades successively, but automatically.

I'll ask Sam to look into this.

-- Mike

In reply to Dennis Keeler

Re: Table 'webwork.locations' doesn't exist

by Sam Hathaway -
Hi Dennis,

This is definitely a problem with the wwdb_upgrade script. Do you happen to have a dump of your database from when you started having this problem? Could you email it to me? If not, your current database would be helpful too. Thanks.
-sam

In reply to Sam Hathaway

Re: Table 'webwork.locations' doesn't exist

by Dennis Keeler -
Sorry, I have no early dump, but I will email a current one to you, Sam.

As mentioned, this is an installation totally from scratch. If I recall correctly, the db_version number actually started at 0, so I really ran wwdb_upgrade 24 times. During initial installation, I just ran it 10 times. I had just thought that nothing was happening, besides incrementing the version number, so I quit around 10. During each run, the error messages looked about the same as the one I posted above.

Thanks for your help. -Dennis
In reply to Dennis Keeler

Re: Table 'webwork.locations' doesn't exist

by Rich Winkel -
I'm seeing the same behavior in a brand-new installation (2.4.5 from the tarball). Here's what wwdb_upgrade says:

Upgrading database from version 0 to 1...
(Version 1 adds dbupgrade table to facilitate automatic database upgrades.)
Done.

Upgrading database from version 1 to 2...
(Version 2 adds problems_per_page field to set and set_user tables of each course.)

An error occured while running the course upgrade code for version 2 on course admin:
DBD::mysql::db do failed: Duplicate column name 'problems_per_page' at /usr/local/webwork/webwork-2.4.5/bin/wwdb_upgrade line 64.
Ignore this error and go on to the next course? [y/N]

Identical errors were generated on other courses, I said "N" each time. Then it went through several successful updates until it reached:

An error occured while running the course upgrade code for version 15 on course admin:
DBD::mysql::db do failed: Can't DROP 'PRIMARY'; check that column/key exists at /usr/local/webwork/webwork-2.4.5/bin/wwdb_upgrade line 193, line 5.
Ignore this error and go on to the next course? [y/N]
In reply to Rich Winkel

Re: Table 'webwork.locations' doesn't exist

by Rich Winkel -
Kept iterating "N" until

Database is up-to-date at version 23.

Rerunning wwdb_upgrade produces just the last message.

Here's the current set of tables:

mysql> show tables from webwork;
+--------------------------------+
| Tables_in_webwork |
+--------------------------------+
| 1160_SP08_key |
| 1160_SP08_password |
| 1160_SP08_permission |
| 1160_SP08_problem |
| 1160_SP08_problem_user |
| 1160_SP08_set |
| 1160_SP08_set_locations |
| 1160_SP08_set_locations_user |
| 1160_SP08_set_user |
| 1160_SP08_setting |
| 1160_SP08_user |
| 1300_SP08_key |
| 1300_SP08_password |
| 1300_SP08_permission |
| 1300_SP08_problem |
| 1300_SP08_problem_user |
| 1300_SP08_set |
| 1300_SP08_set_locations |
| 1300_SP08_set_locations_user |
| 1300_SP08_set_user |
| 1300_SP08_setting |
| 1300_SP08_user |
| 1320_SP08_key |
| 1320_SP08_password |
| 1320_SP08_permission |
| 1320_SP08_problem |
| 1320_SP08_problem_user |
| 1320_SP08_set |
| 1320_SP08_set_locations |
| 1320_SP08_set_locations_user |
| 1320_SP08_set_user |
| 1320_SP08_setting |
| 1320_SP08_user |
| NPL-DBchapter |
| NPL-DBsection |
| NPL-DBsubject |
| NPL-author |
| NPL-chapter |
| NPL-keyword |
| NPL-path |
| NPL-pgfile |
| NPL-pgfile-keyword |
| NPL-pgfile-problem |
| NPL-problem |
| NPL-section |
| NPL-textbook |
| TestCourse_key |
| TestCourse_password |
| TestCourse_permission |
| TestCourse_problem |
| TestCourse_problem_user |
| TestCourse_set |
| TestCourse_set_locations |
| TestCourse_set_locations_user |
| TestCourse_set_user |
| TestCourse_setting |
| TestCourse_user |
| admin_key |
| admin_password |
| admin_permission |
| admin_problem |
| admin_problem_user |
| admin_set |
| admin_set_locations |
| admin_set_locations_user |
| admin_set_user |
| admin_setting |
| admin_user |
| dbupgrade |
| depths |
| location_addresses |
| locations |
| modelCourse_set_locations |
| modelCourse_set_locations_user |
| TestCourse_set_user |
| TestCourse_setting |
| TestCourse_user |
| admin_key |
| admin_password |
| admin_permission |
| admin_problem |
| admin_problem_user |
| admin_set |
| admin_set_locations |
| admin_set_locations_user |
| admin_set_user |
| admin_setting |
| admin_user |
| dbupgrade |
| depths |
| location_addresses |
| locations |
| modelCourse_set_locations |
| modelCourse_set_locations_user |
+--------------------------------+
74 rows in set (0.00 sec)