is it possible to raise the 32 character limitation for field_name to 63. As far as I know PostgreSQL 8.4 and MySQL are both able to handle such a "high" value.

Comments

Yoran’s picture

Title: 32 character field size limitation » 32 character field name length limitation
Yoran’s picture

Status: Active » Needs review
StatusFileSize
new5.48 KB

A small patch to prove this is working nicely on at least on Postgresql and MySQL.

Yoran’s picture

StatusFileSize
new7.01 KB

Updated patch for fieldgroup

mafrosis’s picture

I have wondered about this limit. I can no reason why it would be capped at 32 chars, and in a large application it is really difficult to maintain sensible naming conventions with such a limit in place.

Remember of course that 6 chars get taken for 'field_' as well!

Is this going to be changed in D7?

serg.remote’s picture

Thanks for the patch, additionally you'd probably need to alter content_group_fields table to make fields varchar(64) instead of varchar(32)

karens’s picture

Status: Needs review » Closed (works as designed)

The D7 version has the same limit, so changing it in D6 would make it impossible to upgrade to D7. The field name is used in many ways and there are some places where a limit is needed. I don't ATM remember all the reasons why it had to be 32, but I assure you that has been hashed out in the past.

serg.remote’s picture

I agree that this isn't a bug but having 32 bytes is rather difficult if you have hundreds of fields and need meaningful names for them. Isn't there a chance to review it and probably change for both D6 & D7?

Yoran’s picture

Status: Closed (works as designed) » Needs review

Sorry to re-open this but you can't close an issue without giving more explanations than "I assure you that has been hashed out in the past". This limitation is a really bad design flaw (it reminds me MS-DOS 8.3 limitation... leading to cryptic file names ;-). As serg said, when you have hundred of fields, 32c with a "field_" penalty is just not enough. I understand that most Drupal users just don't care as everything is masked behind Views, but for developers, this is a real issue. So if I have to patch D7 in order to allow correct upgrade path, I'll do it. But please don't close this without explanations.

karens’s picture

Status: Needs review » Closed (works as designed)

There is nothing else I can say, there is no point in re-opening this. This has always been built into the module, I don't remember what all the reasons were and have no time to try to find all the issues to point you to. It won't get changed in D6 or D7 so there is no point in letting people create fields that will break. If you want to patch things and see what breaks for you, you are welcome to do so in your own installation, but we can't add this into the code we maintain without confirming it will not break anything anywhere, and the subject has come up before so I know something somewhere *will* break.

admataz’s picture

For anyone else hitting this seemingly arbitrary limitation, there is an explanation here that I discovered: http://drupal.org/node/198420#comment-652923 .
I hit the same limitation creating a CTools content-type plugin for the Panels module today.

serg.remote’s picture

Karen's explanation was that: "We already have problems with the size of CCK queries with all the long field and table names". However max query size is configurable on the DB server side and I believe with time there will be more demand to increase it because more large websites will switch to Drupal. As an example: I work on a growing website having 500+ CCK fields at the moment and it would be a real pain to have a separate translation spreadsheet for all the field names.

smokris’s picture

See also #1191434: Standardize entity type is a maximum of 32 characters (not 64 or 128), where chx says:

each char takes three bytes in an index and you only have 1000 of those.

and Dave Reid says:

The problem is that with a longer value, entity_type is *very* commonly used in primary keys and indexes (which for cross-db compatability must have <1000 bytes). If entity_type = 128, then we are already at 384 bytes or 38% of the available key length. Add a field like bundle (128 chars / 384 bytes) or field_name (32 / 96 bytes), and it fills up fast. I think it makes sense to keep entity types fairly short (and the same length as field names). Once we have a length standardized, we can increase it as needed in the future.