Review 13.4 Merged

87656[BUGFIX] Create `CHAR` and `BINARY` as fixed length columns

Stefan Bürk CR +2 V +2 Expert +994 −22 updated 01/07/25, 12:49

Commit message

In relational database management systems (RDBMS) using Doctrine
DBAL, `CHAR` and `BINARY` are fixed length fields, while their
counterparts `VARCHAR` and `VARBINARY` have variable lengths.
These are differentiated within Doctrine DBAL by the `StringType`
column option `fixed` (boolean).

TYPO3 parses `ext_tables.sql` files to define the virtual database
schema in the first step, tokenizing aforementioned types correctly
as different `AbstractDataType` and transforming them to Doctrine
DBAL Schema classes within the `TableBuilder`.

The `fixed` flag is now set to `true` for the `BinaryDataType`
and `CharDataType` and allows to define fixed sized columns for
these types.

Fixed char behaviour is not consistently handled across all
supported database engines, requiring different handling
dependant on the used RDBMS when creating and retrieving queries
on such columns.

Because of this, usage of `CHAR` or `BINARY` in TYPO3 Core should be
avoided to prevent requiring different code paths depending on the
used RDBMS. Specialized queries must be covered with functional tests
and use additional helpers, for example `ExpressionBuilder->trim()`
to ensure equal behaviour across all supported databases.

This bugfix allows to properly pass the `fixed` DBAL column option,
so that environments which do not need to deal with cross-RDBMS
support can utilize the `CHAR` and `BINARY` type columns. This is
usually the case in controlled project-environments or private
extensions.

An "important" Changelog item is added to describe this behaviour
and describe consequences and scenarios.

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
  • Verified V +2 Done
    • Stefan Bürk +2
    • core-ci +1 CI

Issues 1

Files 11

Review log 34

  1. Stefan Bürk commented on patch set 1 01/07/25, 12:35

    Cherry Picked from branch main.
  2. core-ci voted on patch set 1 V +1 01/07/25, 12:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72043

  3. Stefan Bürk voted on patch set 1 CR +2 V +2 01/07/25, 12:47

  4. Stefan Bürk merged patch set 2 01/07/25, 12:49