nhovratov/content-blocks

SQL type "varchar" for fieldtype "Select" could be too short for storing data

PKuhlmay opened this issue · 2 comments

Hi I have a fieldtype select, where I can select pages.

  - identifier: references
    type: Select
    renderType: selectTree
    size: 20
    foreign_table: 'pages'
    foreign_table_where: 'ORDER BY pages.uid'
    treeConfig:
      parentField: pid
      appearance:
        expandAll: true
        showHeader: true

In the database this field is created with a varchar:

return "`$column` VARCHAR(255) DEFAULT '' NOT NULL";

In some cases this could lead into an error like this:
Bildschirmfoto 2024-04-30 um 09 45 14

I checked a lot of pages inside the selectTree, untill it came to this error. There might be very few cases where it could come to this error but it could happen.

The field "pages" is stored with type "text" inside the database, maybe this could be the solution for type "Select" of CB.

This will be solved automatically with v13 as SQL columns will be generated based on TCA and the best fitting type will be chosen. For now, one must override the SQL in ext_tables.sql if varchar is not enough.

Okay I close this for now.