Attempted to enable both Views and Views UI at once, with the attached error. Modules list showed that Views enable had completed, and Views UI enabled correctly on the second attempt - the failure was only on simultaneous install. Replicated twice more after disabling both.

DatabaseSchemaObjectExistsException: Table views_view already exists. in DatabaseSchema->createTable() (line 544 of /home/d7/includes/database/schema.inc).

The website encountered an unexpected error. Please try again later.

Linux ccserver 2.6.26-2-686 #1 SMP Sat Dec 26 09:01:51 UTC 2009 i686 GNU/Linux
memory_limit 128M

Comments

marcvangend’s picture

Priority: Minor » Normal

I can confirm this bug, just tested with the latest D7 and Views from CVS. Definitely not minor IMO, enabling both Views and Views UI is a very common thing to do and the error message doesn't provide any clue about what to do next.

dawehner’s picture

Status: Active » Postponed (maintainer needs more info)

Mh.

What do you do to install views?

I deinstalled views. Then i enabled views and views_ui and it worked fine

PS: I'm using the latest dev.

dawehner’s picture

Status: Postponed (maintainer needs more info) » Active

Oh i tested on an old core version.

marcvangend’s picture

I tried again just to make sure. Steps:
- get latest D7 HEAD from CVS
- install with standard profile
- checkout Views (branch DRUPAL-7--3) from CVS into /sites/all/modules/views
- opened the modules page
- checked the Views and Views UI modules and clicked 'Save configuration'
Result: The error message mentioned earlier.

When going back to the modules page, Views was enabled, but Views UI was not. When checking Views UI again and saving the configuration, Views UI was properly enabled.
I was able to trigger the error again by disabling both modules (first UI, then Views) and enabling them again simultaneously.

dawehner’s picture

Title: Simultaneous Views/Views UI enable failure » Enabling module + dependency causes the module to create a table two times
Project: Views (for Drupal 7) » Drupal core
Version: 7.x-3.x-dev » 7.x-dev
Component: Miscellaneous » install system

Views does not do something special here. For me this is a drupal core bug. It seams to be, that the schema for views is created two times.

There was a patch which removes checking of already created tables

marcvangend’s picture

Priority: Normal » Critical

Dereine, you're right, it's a core issue. Enabling Coder and Coder Review simultaneously returns a similar error:

DatabaseSchemaObjectExistsException: Table <em class="placeholder">cache_coder</em> already exists. in DatabaseSchema->createTable() (line 558 of G:\www\d7\includes\database\schema.inc).

I'm marking this as critical. While it doesn't completely break the module page, we really shouldn't ship D7 with a bug like this.

David_Rothstein’s picture

Title: Enabling module + dependency causes the module to create a table two times » Simultaneous Views/Views UI enable failure
Project: Drupal core » Views (for Drupal 7)
Version: 7.x-dev » 7.x-3.x-dev
Component: install system » Code
Status: Active » Needs review
StatusFileSize
new1.47 KB

In Drupal 7, modules are not supposed to install their own schema: http://drupal.org/node/224333#install-schema

I haven't actually tested this patch, but I expect it should work. Looks like there should be a similar issue filed against the Coder module?

dawehner’s picture

Status: Needs review » Fixed

Thanks!

I tested the patch, it worked fine

marcvangend’s picture

Thanks for the fix. I assume Coder had the same issue, but I noticed I wasn't using the latest dev version. I just updated Coder and the issue is fixed already.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

geosmaga’s picture

quick option: I just deleted the tables from db then enable the two modules one by one and is working fine.