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.
The db_type_map() function for mysql declares that the Schema API type 'numeric' maps to the mysql type 'numeric'. This works fine, but mysql treats 'numeric' as an alias for its native type 'decimal'. Thus, if you create a column with a Schema API type of 'numeric', when schema.module inspects the database, mysql says the column is of type 'decimal', and schema.module reports an error where none exists.
I can work around this in schema.module but the right solution is to use the correct native type name in core. Trivial patch attached.
Comment | File | Size | Author |
---|---|---|---|
#3 | mysql-numeric-type-198234-3.patch | 1.27 KB | bjaspan |
mysql-numeric-type.patch | 664 bytes | bjaspan | |
Comments
Comment #1
bjaspan CreditAttribution: bjaspan commentedI left out a step in my explanation.
When schema.module inspects the database and learns that table foo column bar is of type 'decimal', it looks through the results of db_type_map() for which Schema API data type maps to the mysql type 'decimal'. It doesn't find one (because currently the type map lists 'numeric'), and reports an error.
Comment #2
hass CreditAttribution: hass commentedsubscribe :-)
Comment #3
bjaspan CreditAttribution: bjaspan commentedExactly the same problem exists with pgsql's Schema type char:normal. It maps to 'char' but should map to 'character'. Again, worked around in schema.module but should be fixed in core.
New patch attached.
Comment #4
hass CreditAttribution: hass commented@bjaspan: isn't this not critical for the final release?
Comment #5
chx CreditAttribution: chx commentedTrivial indeed.
Comment #6
Gábor HojtsyThanks, committed.
Comment #7
(not verified) CreditAttribution: commentedAutomatically closed -- issue fixed for two weeks with no activity.