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

cburschka created an issue. See original summary.

cburschka’s picture

Status: Active » Closed (duplicate)

#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. :)

cburschka’s picture

Status: Closed (duplicate) » Active

Apologies, 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.

cburschka’s picture

Update: 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.)

Carsten Müller’s picture

Assigned: Unassigned » Carsten Müller

Hello 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

cburschka’s picture

Hi, 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. ;) )

Carsten Müller’s picture

Version: 7.x-1.6 » 7.x-1.x-dev
Status: Active » Needs review

Hi 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

Carsten Müller’s picture

Status: Needs review » Fixed

published release 7.x-1.7 which includes this fix

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.