Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I found this while trying to test a patch:
An error occurred.
Path: /batch?id=2&op=do
Message: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'database.simpletest360750profile_field' doesn't exist: SELECT DISTINCT(category) FROM {profile_field}; Array
(
)
in profile_user_categories() (line 495 of .../public/modules/profile/profile.module).
To reproduce:
- check out latest 7.x from CVS,
- enable all modules,
- run any test, and you should get a similar exception.
Comments
Comment #1
boombatower CreditAttribution: boombatower commentedWould seem this might be culprit: #472684: Install non-default modules one at a time to ensure proper module list is maintained during installation hooks
Comment #2
JamesAn CreditAttribution: JamesAn commentedI'm not sure..
The exception is thrown when I'm just dealing with core modules and in tests that I don't think install anything. I'm not very familiar with how the install process or Simpletest work though.. ^^"
Comment #3
JamesAn CreditAttribution: JamesAn commentedI'm pretty sure this issue isn't related to #472684: Install non-default modules one at a time to ensure proper module list is maintained during installation hooks.
There's conflict somewhere between the Simpletest and the profile module. If I turn on all modules except the profile module, tests run fine. If I turn on the profile module, tests suddenly no longer work with that "table cannot be found" error.
I'll give this issue some more time today and try to isolate what's going on.
-------------
You can even run all the tests for the profile module while it's disabled. But all testing halts when it's enabled.
Comment #4
JamesAn CreditAttribution: JamesAn commentedIt looks like the problem arose from the patch committed in #479966: document and "fix" hook_user_categories, which changed profile_categories() to profile_user_categories(). Now, profile_user_categories() is called during a test run (if the profile module is enabled), which runs a query on the table {profile_field}.
The problem is that simpletest doesn't make a test table copy of {profile_field} like it does for many of the other tables. I don't know where to make the change to have that happen, but that looks like the root of the problem, as far as I can currently tell.
Comment #5
Senpai CreditAttribution: Senpai commentedI'm waiting on this issue to get fixed so I can finish my #46149: Prevent account cancellation for uid 1 (comment 111) issue. I was planning on marking this issue active again, so thanks for comment #3.
Comment #6
Senpai CreditAttribution: Senpai commentedDangit, crossposted, and that's even with two page refreshes before posting! :)
Comment #7
JamesAn CreditAttribution: JamesAn commentedThe exception occurs on line 200 of include/module.inc when it executes:
where
I haven't been able to figure out exactly why yet.. sticking all sorts of fun debug and exit statements to post stuff.
Comment #8
babbage CreditAttribution: babbage commentedI admit, I may be totally off base here, but does this issue have any relevance?
#347959: modules_installed is broken during testing
Comment #9
JamesAn CreditAttribution: JamesAn commentedPossibly. #347959: modules_installed is broken during testing seems to be dealing with the same segment of code, namely, the stuff that happens in DrupalWebTestCase->setUp() in modules/simpletest/drupal_web_test_case.php.
I manually traced the bug to a menu_rebuild() call from inside the toolbar_install() as it's called by DrupalWebTestCase->setUp(). Not sure why it's executing code in the profile module, profile_user_categories, when the profile module is not one of the modules that DrupalWebTestCase->setUp() is installing. It looks like the fact that the profile module is enabled in the parent database is somehow carried into DrupalWebTestCase->setUp() when it's not supposed to be.
I'm neither familiar with this testing stuff, nor with the installing-module stuff, but I do what I can.
Comment #10
JacobSingh CreditAttribution: JacobSingh commentedI have the same problem. Can't run any tests.
Comment #11
mradcliffeConfirming bug with latest cvs and postgresql.
Comment #12
aspilicious CreditAttribution: aspilicious commentedCan't reproduce this anymore, reopen if necessary...
Comment #13
boombatower CreditAttribution: boombatower commentedYea!