The maximum length the schema allows for urls is only 128 characters. Urls can be much longer than this.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | long_urls_patch-2096937-11.patch | 779 bytes | extremal |
| #1 | long_urls-2096937-1.patch | 804 bytes | theapi |
The maximum length the schema allows for urls is only 128 characters. Urls can be much longer than this.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | long_urls_patch-2096937-11.patch | 779 bytes | extremal |
| #1 | long_urls-2096937-1.patch | 804 bytes | theapi |
Comments
Comment #1
theapi commentedHere's a patch to change the url field to be a text field.
Comment #2
david_garcia commentedWorks great. I had failing cron jobs due to data truncating database field length.
Comment #3
grhodes commentedWorks perfectly!
And considering there is no index on url column, this shouldn't break on any configuration.
Comment #4
mgifford@grhodes so is it RTBC?
Comment #5
david_garcia commentedI didn't test the update part of the patch because I modified database schema manually.
Someone confirm they have tested the patch "as is" before RTBC.
Comment #6
grhodes commentedI actually pasted the update function into my project, ran the update via drush and it works perfectly. And as I was saying there is no index on the url column so it shouldn't break in any case I have knowledge of (but I'm quite new to Drupal).
To answer the question directly, yes it has been reviewed ans tested.
Comment #7
rv0 commentedImho, I dont feel "text" is the correct field type.
The url alias table has varchar 255
varchar is usually also much quicker than text due to the way data is linked in the table
I would recommend increasing the size of the current varchar instead of changing to text.
Comment #8
grhodes commentedI agree in theory.
The only downfall I can see of increasing the varchar length over 255 is that some old versions of MySQL don't support it (<5.0.3), which would cut off this update to some users. I don't know if this is a valid couter-argument (because I'm aware Drupal's requirements mention MySQL >= 5.0.15) but it seemed important to mention.
Then, what would be the best length?
Some discussions on this subject mention that url's over 2048 characters are not valid in some of the major browser's and that google's bot has the same sort of limitation.
My proposition would therefore be 2048 to allow maximum flexibility without going to the maximum limit.
Comment #9
rv0 commented@grhodes
"Then, what would be the best length?"
varchar(255) imho..
because
Why support longer values than what is possible in core? How would you end up with values longer than that anyway (without hacking core)
This table has 25000 entries at the moment on the site I'm using it on, and this will only grow more.. Keeping size to a reasonable minimum is needed.
Comment #10
grhodes commentedI agree, the only reason why I wasn't thinking in this way is that my use case requires url values longer than 255 chars.
I am working on a website that was created using another CMS (which has sent url's to GA that were that were over 255 chars long for about 3 years), and is today powered by Drupal and I need to keep track of page vews since creation.
I am aware that this isn't a common use case so I would understand if this patch wasn't committed, I just wanted to expose that some use cases exist.
Comment #11
extremal commentedAgree. The field should be 255.
Here is the patch against latest 7.x-1.x-dev
Comment #12
extremal commentedComment #13
mgiffordPatch looks good. I installed it just fine in a fresh instance. Would be good for an existing user to test it with a site with data.
Comment #15
marcelovaniFixed, thanks