Say you create a database table whose table name begins with uppercase (in your drupal db instance). At the "admin/build/data/adopt" interface you will see such table, but upon hitting "create", I do not see it the "default view" created nor I can add fields to any view from the allegedly adopted table.
Workaround -- when I made a copy of such table to a table with lowercase name, all went fine.
Perhaps is that the DrupalAPI works with all lowercase. It is all fine and well if you know it, but if you do not know it, then please beware of the workaround (making a copy of the desired Table with lowercase table name).
In mysql, I issued these two commands: (say my original desired table was named TableNAME)
CREATE TABLE tablename LIKE TableNAME;
INSERT tablename SELECT * from TableNAME;
Hope other folks don't waste 30+ mins like I did.
Inigo
Comments
Comment #1
x-lette commentedThat might be part of an issue I'm having with tables not being adoptable at all as described in issue #915270: Adopting tables doesn't work when drupal installed with db_prefix. All of the tablenames I'm trying to adopt begin with uppercase letters. I wouldn't ever have thought about this being relevant. I'll give it a try offering these tables with lowercase letters.
Another point regarding your workaround: making a copy of an existing table is somehow unfavourable as you might change data in original table which would not be reflected in copied table. To get around that, if you're using mysql 5.0.1 or newer, you can create a VIEW which just reflects the contents of your original table:
CREATE OR REPLACE VIEW <lowercasename> AS SELECT * FROM <uppercasename>;You can access contents of that view just as if it was a regular table with one limitation: you cannot change the content, i.e. no INSERT, UPDATE or DELETE will work. But as these tables are meant to be readonly from Drupal there's usually no need for these statements.
Comment #2
x-lette commentedAt least for me it doesn't work either. I tried with uppercase names and lowercase names, with and without prefix but data still won't show any contents. I'm giving up.
Comment #3
eneko1907 commentedThanks for the tip on how to make the adopted table more dynamic -- completely agree.
On a separate note, I also had trouble making all this work on multi-site Drupal instances (or specifically, using db_prefix). I did not revisit the thread with the issue, sort of gave up too.
Comment #4
kanani commentedon D7 version I'm able to adopt lower case tables, but not upper case tables.
Comment #5
avpadernoI am closing this issue, as Drupal 4.7, 5, and 6 are now not supported.