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'm trying to create a table with 40 fields, six or so indexes, and float, int, and text data. When I hit "create" I get this error message
* Error creating table.
* Error creating table
This is unhelpful, but it's all I got.
Comment | File | Size | Author |
---|---|---|---|
#7 | 780358-7_fix-change_errors.patch | 2.91 KB | alex_b |
Comments
Comment #1
Funkymoses CreditAttribution: Funkymoses commentedFWIW: creating a one-element table and adding additional fields works, but only the most recently added field can be modified or deleted.
Comment #2
alex_b CreditAttribution: alex_b commentedChances are that the schema of the table you're trying to create is not valid. Try to print the exact SQL statement submitted to the DB to the log or the screen, debug from there...
Comment #3
kdebaas CreditAttribution: kdebaas commentedI can confirm the bug. Apparently there is a problem creating indexes and primary keys. When I do not check the index and primary key checkboxes, the table is succesfully created. However, subsequently trying to assign an index or primary key by editing the schema results in error messages:
* Error changing indexes
* Error changing primary key
Comment #4
vip_sa CreditAttribution: vip_sa commentedI get the following when trying to create a normal table with one primary key:
* user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'number) ) /*!40100 DEFAULT CHARACTER SET UTF8 */' at line 13 query: CREATE TABLE messages ( `title` VARCHAR(255) DEFAULT NULL, `mobile number` VARCHAR(255) DEFAULT NULL, `network` VARCHAR(255) DEFAULT NULL, `direction` VARCHAR(255) DEFAULT NULL, `message` VARCHAR(255) DEFAULT NULL, `local` VARCHAR(255) DEFAULT NULL, `tariff` FLOAT DEFAULT NULL, `service` VARCHAR(255) DEFAULT NULL, `status` VARCHAR(255) DEFAULT NULL, `charge` FLOAT DEFAULT NULL, `profit` FLOAT DEFAULT NULL, PRIMARY KEY (mobile number) ) /*!40100 DEFAULT CHARACTER SET UTF8 */ in C:\wamp\www\training\includes\database.inc on line 550.
* Error creating table.
* Error creating table
Comment #5
alex_b CreditAttribution: alex_b commented#4 contains field names with spaces.
Comment #6
alex_b CreditAttribution: alex_b commentedI can confirm
when trying to assign a text field PK
Comment #7
alex_b CreditAttribution: alex_b commentedThis patch should fix some of the reported problems.
The issue lies deeper though: the current UI allows changes to field specs, indexes and PKs at the same time. This leads to a myriad of permutations of potential changes that can't all be validated. We need to split up the UI.
Comment #8
alex_b CreditAttribution: alex_b commentedThis is committed now. I am adjusting the title to what has actually been fixed. Larger picture on table manipulation is captured here now: #867680: SQL errors when manipulating tables - split up table UI