Problem/Motivation

This bug occurs when creating a 2nd display for a view. The error that occurs is:

PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'data' at row 1: INSERT INTO {ctools_object_cache} (sid, obj, name, data, updated) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array

Proposed resolution

Make the data field of {ctools_object_cache} bigger (LONGBLOB?)

Comments

merlinofchaos’s picture

That's already declared as a 'big' 'text' field, which should be about as big as we can make it.

In MySQL that translates to this:

+---------+------------------+------+-----+---------+-------+
| Field   | Type             | Null | Key | Default | Extra |
+---------+------------------+------+-----+---------+-------+
| data    | longtext         | YES  |     | NULL    |       |
+---------+------------------+------+-----+---------+-------+
blasto333’s picture

In my version of ctools the field is a blob. Should it be LONGTEXT? See http://drupal.org/node/865142

Peter Bex’s picture

No, it should most definitely be blob, at least for postgresql. It's not storing just textual data but also binary stuff and postgres will rightly refuse to store invalid UTF-8 byte sequences.

It's actually even worse; PDO actually passes the binary data as a string to postgres functions that accept NUL-terminated strings, which will cause implicit truncation if the data happens to include NUL bytes.

dawehner’s picture

Status: Active » Closed (duplicate)

But this is not an issue of views, let's mark it as duplicate of #865142: Make ctools_object_cache.data DB column blob for storing arbitrary bytes.