In this one the page identifier is 81 characters blowing away the VARCHAR(64). I get many errors like this one in my PostgreSQL log file. I'm not too sure whether the page identifier is expected to somehow never go over 64 characters or whether it's possible to get such long IDs. If longer IDs are possible, then we need to change the definition. Note that a URL path can be up to 128 and you add a big number at the beginning... so 128 + max size of the number would be more appropriate. Or just using TEXT.
Thank you.
Alexis
2010-11-06 08:12:07 PDT ERROR: value too long for type character varying(64)
2010-11-06 08:12:07 PDT STATEMENT: UPDATE boost_cache SET expire = 1289661126, lifetime = -1, push = -1, page_callback = 'aggregator_page_last', page_type = '2008', timer = 1283, timer_average = 1029, base_dir = 'cache/normal/www.m2osw.com', page_id = '0920070314www.hackingnetflix.com201005netflix-now-streaming-hd-movies-to-pcs-macs', extension = '.html', url = 'http://www.m2osw.com/aggregator/2008/09/2007/03/14/www.hackingnetflix.co...', filename = 'cache/normal/www.m2osw.com/aggregator/2008/09/2007/03/14/www.hackingnetflix.com/2010/...', hash_url = '030589587e2426b7126988c1294afb0e' WHERE hash = 'a4c3ce9f87e4b8819699d996fdc3c783'
Comment | File | Size | Author |
---|---|---|---|
#3 | boost-964608.patch | 3.46 KB | mikeytown2 |
#2 | addresses-6.x-1.x-edit-address-book.patch | 2.21 KB | AlexisWilke |
Comments
Comment #1
AlexisWilke CreditAttribution: AlexisWilke commentedHi guys,
I'm still getting these errors quite often. I think it mainly happens on aggregator pages, but if you use a varchar(64), then anywhere you access that field, you should use substr($var, 0, 64) or be 100% sure that the variable is never larger than 64 chars...
Thank you.
Alexis
Comment #2
AlexisWilke CreditAttribution: AlexisWilke commentedHi guys,
I was wondering whether mysql would auto-truncate for you in which case I would understand that you would not take care of this bug. But getting one error per page load with boost is kind of worst that not having boost... 8-) -- and since I get 3 errors on each load that hit a long page, it's much worse. And of
Aren't the 'page_id' and 'child_page_id' a copy of the URL path string, right?
In the system, the URL alias path is limited to 128 characters.
And in the Menu Router (which is what you use in many places) the path is set to 255 characters:
So for boost to limit the (child) page identifier to 64 characters seems a bit restrained.
I can see two solutions, I do not know whether truncating the page identifier is safe, but that's what I'm using in my version to avoid the many errors in my logs (if MySQL truncates automatically--which wouldn't surprised me a bit--then this is a PostgreSQL problem which can be solved using a substr(..., 0, 64) as mentioned in my previous posts.) Whether boost works right for those pages, I have no clue.
I could give you a patch with the proper substr() call as that's what I'm using.
On the other hand, I think that to simplify, we should use TEXT for the two affected fields. That way, there is no database limit. You don't have to be afraid of eventually using MB of data for that one column since your browser will enforce its own limit which is generally fairly reasonable (1Kb to 4Kb for a URL, note that it also depends on your browser too!)
Thank you.
Alexis Wilke
Comment #3
mikeytown2 CreditAttribution: mikeytown2 commentedhere's a better looking patch
Comment #4
mikeytown2 CreditAttribution: mikeytown2 commentedcommitted
Comment #5
AlexisWilke CreditAttribution: AlexisWilke commentedEither way is fine with me 8-)
Thank you!
Alexis
Comment #6
mikeytown2 CreditAttribution: mikeytown2 commenteddid you look at the patch you uploaded? lol
Comment #7
AlexisWilke CreditAttribution: AlexisWilke commentedmikey,
Woahaha 8-) Well... I keep all the patches in the same folder...
Sorry about that!
Alexis