I need to enable the 'Aggregator' module on my Drupal 7 website. When I do that, I get a error message saying:

DatabaseSchemaObjectExistsException: Table aggregator_category already exists. in DatabaseSchema

I researched on this and what it means is that the table for the module already exists in the DB. Now in case of contributed modules I can disable them, uninstall it and make a fresh install and re-enable. I am not sure what can be or should be done in case of core modules.

Any guidance is greatly appreciated.

2 Answers 2


You somehow have aggregator uninstalled with its tables existing, which should not be. By examining aggregator_schema() in aggregator.install you can see that upon installation aggregator will create several tables named aggregator_(something). Table names correspond to the keys of the array returned by aggregator_schema(). If any of those tables exist you must delete them from the database before attempting to enable the aggregator module. As always, back up and understand how to restore your database first before attempting something like this and rehearse on a test system.


That is not different from third-party modules that aren't installed. If for any reason, the module cannot be installed because its tables are already present in the database, you need to manually delete its database tables, and then try installing the module again.
You say you need to enable the module, but its database tables are only created when the module is being installed. When modules are already installed, and they are re-enabled, Drupal doesn't try to create its database tables.

To delete the database tables created from the module, you can use the following script. Save it in the same directory containing the index.php file used Drupal, execute cd to make that directory the current directory, and run it.

define('DRUPAL_ROOT', getcwd());

require_once DRUPAL_ROOT . '/includes/bootstrap.inc';

$file = DRUPAL_ROOT . '/modules/aggregator/aggregator.install'
if (is_file($file)) {
  require_once $file;

  // Make sure the installation API is available
  include_once DRUPAL_ROOT . '/includes/install.inc';

  // Get the schema from the module.
  $schema = call_user_func_array('aggregator_schema', array());
  foreach ($schema as $table) {
    if (db_table_exists($table['name'])) {

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.