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 getting the following errors when adding a new field to a content type:
Notice: Array to string conversion in _field_sql_storage_columnname() (line 79 of .../modules/field/modules/field_sql_storage/field_sql_storage.module).
There was a problem creating field Quiz: SQLSTATE[42000]: Syntax error or access violation: 1072 Key column 'field_quiz_Array' doesn't exist in table
Maybe a problem with the schema definition?
This is using Drupal 7.26, PHP 5.4 and MySQL 5.5.
Comments
Comment #2
cburschka#2694839: Unable to add 'field_quiz' in content type beacuse of index length issue with MySQL
Since the fix is a few weeks old and the module is basically unusable as is, I'd suggest a new release. :)
Comment #3
cburschkaApologies, I got turned around while browsing the git repo and thought it'd been fixed since then. The patch from the issue linked above is actually what broke it in the first place.
So I'm not sure if the field schema API has changed between 7.26 and the latest stable core? If so, then maybe a version requirement or some version-checking logic in hook_field_schema would be the way to go.
Comment #4
cburschkaUpdate: It looks like this API was added in Drupal 7.37. If you rely on it, I'd recommend adding
dependencies[] = system (>=7.37)
to the info file to avoid mystery errors.(Or alternatively checking the core version in hook_field_schema(), but that's more code.)
Comment #5
Carsten Müller CreditAttribution: Carsten Müller as a volunteer commentedHello cburschka,
sorry for my late reply, but my time is very limited.
I tried to reproduce this, but i was not able.
Can you maybe provide more informations?
Is this still a problem with Drupal Version 7.53?
I also tested with version 7.50. but as 7.52 is a security update, it is recommended to update to 7.52 anyway.
Cheers
Carsten
Comment #6
cburschkaHi, iirc this is specifically an issue in 7.36 and older. I'd recommend simply adding a version dependency to the info file to make sure the module is not installable if the core is too outdated. Better to know explicitly why it doesn't work than having to hunt down the problem.
(There are some outdated production sites around that only apply the security patches. I don't like it either, but in that case I had to work with what I got. ;) )
Comment #8
Carsten Müller CreditAttribution: Carsten Müller as a volunteer commentedHi cburschka,
i added the following line to add the version dependency, as recommended.
dependencies[] = drupal:system (>= 7.37)
I pushed it into the 7.x-1.x branch. I will create a new release soon, which than has this included.
Cheers
Carsten
Comment #9
Carsten Müller CreditAttribution: Carsten Müller as a volunteer commentedpublished release 7.x-1.7 which includes this fix