When the following conditions are true, visiting the node edit page or node delete page causes an error:
- statistics module is enabled
- enable access log is set on statistics settings page
- node title is 255 characters
- you visit that node's edit page or delete page
The error message is:
PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'title' at row 1: INSERT INTO {accesslog} (title, path, url, hostname, uid, sid, timer, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7); Array ( [:db_insert_placeholder_0] => Edit Basic page Cras sed ante. Phasellus in massa. Curabitur dolor eros, gravida et, hendrerit ac, cursus non, massa. Aliquam lorem. In hac habitasse platea dictumst. Cras eu mauris. Quisque lacus. Donec ipsum. Nullam vitae sem at nunc pharetra ultricies. Vivamus elit e. [:db_insert_placeholder_1] => node/52/edit [:db_insert_placeholder_2] => http://drupal7/node/52 [:db_insert_placeholder_3] => 127.0.0.1 [:db_insert_placeholder_4] => 1 [:db_insert_placeholder_5] => drd1ggxfgimsmX3TYJb0jgF2PNU5MoKEldFrI0xyCig [:db_insert_placeholder_6] => 358 [:db_insert_placeholder_7] => 1311015739 ) in statistics_exit() (line 90 of /Users/balarama/Sites/git/drupal/modules/statistics/statistics.module).
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | pdo_title-exception-1222434-7.patch | 2.08 KB | marcingy |
| #5 | pdo_title-exception-1222434-5.patch | 2.57 KB | marcingy |
Comments
Comment #1
moonray commentedRelated, or perhaps even a duplicate of #1180642: PDOException in statistics_exit() when path longer than 255 characters.
Comment #2
moonray commentedAnother related issue #107824: Convert {watchdog}.referer and {accesslog}.url from VARCHAR to TEXT
Comment #3
marcingy commentedYes it is a duplicate of #1180642: PDOException in statistics_exit() when path longer than 255 characters.
Comment #4
marcingy commentedActually no isn't a dup but it is related as the 255 are being appended with additional characters. Marking as normal.
Comment #5
marcingy commentedAmends columns to text.
Comment #6
catchI think we can skip the update for Drupal 8 and just do that straight for Drupal 7, otherwise looks great.
Comment #7
marcingy commentedReroll for d8 without an update, d7 will need a reroll with the update hunk readded before it can applied.
Comment #8
catchIf we do any sorting on this table then turning this from varchar to text risks making any temporary tables disk rather than in memory - MySQL can't create memory temp tables with TEXT or BLOB columns.
Comment #9
marcingy commentedNo sorting is done on title, the only potential issue is
but I don't believe this affects the index at all after doing some explains against the query built in statistics_top_pages with the title column set to text and varchar in both cases 'Using temporary; Using filesort' is utilised for this query
Comment #10
catchThe index won't be affected, however the temporary table will always be written to disk, whereas without it has a chance of being written to memory. I'm not sure if there's an easy way to do before/after for in memory vs disk temporary tables but will try to find out.
Comment #11
marcingy commentedClosing as #1274406: PDO exception is thrown when saving a node with a title that is too long. gives the agreed solution.