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'

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

AlexisWilke’s picture

Title: Page ID limited to only 64 chars?! » Page ID limited to only 64 chars -- get many overflow errors

Hi 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

AlexisWilke’s picture

Title: Page ID limited to only 64 chars -- get many overflow errors » Page ID and Child Page ID limited to only 64 chars -- get many overflow errors
Assigned: Unassigned » AlexisWilke
Priority: Normal » Major
Status: Active » Needs review
FileSize
2.21 KB

Hi 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.

  [...]
    $schema['url_alias'] = array(
      [...]
      'src' => array(
        'description' => 'The Drupal path this alias is for; e.g. node/12.',
        'type' => 'varchar',
        'length' => 128,
        'not null' => TRUE,
        'default' => ''),
  [...]

And in the Menu Router (which is what you use in many places) the path is set to 255 characters:

  [...]
  $schema['menu_router'] = array(
    'fields' => array(
      'path'             => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
  [...]

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

mikeytown2’s picture

FileSize
3.46 KB

here's a better looking patch

mikeytown2’s picture

Status: Needs review » Fixed

committed

AlexisWilke’s picture

Either way is fine with me 8-)

Thank you!
Alexis

mikeytown2’s picture

did you look at the patch you uploaded? lol

AlexisWilke’s picture

mikey,

Woahaha 8-) Well... I keep all the patches in the same folder...

Sorry about that!
Alexis

Status: Fixed » Closed (fixed)
Issue tags: -overflow

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