Feature #91688

TCA: Make default value mandatory for some field types if SQL field defined as "NOT NULL" - avoid error in extensions due to strict and missing default

Added by Sybille Peters 11 months ago.

Should have
Database API (Doctrine DBAL)
Target version:
Start date:
Due date:
% Done:


Estimated time:
PHP Version:
Sprint Focus:


I propose to generate a warning if TCA does not have a default value and the field is defined as "NOT NULL" in ext_tables.sql

For some fields, this may not be necessary (e.g. select, passthrough).

Fields where it could be checked: e.g. input.

To be honest, I have not entirely figured out when it is a problem and will create an error and when a default is set automatically.

See also Stack Overflow questions:

  1. TYPO3: SQL error: 'Incorrect integer value: '' for column 'sys_language_uid' at row 1'
  2. How to set default values correctly in TCA to avoid strict error messages and when is it necessary? (without answer)

An alternative solution might be that the TCA default value is automatically set correctly due to the type of the DB field.

Newer Versions of MySQL / MariaDB have strict (STRICT_TRANS_TABLES) by default.

If you have the SQL field defined as NOT NULL and no default is set via TCA, you might get an error like this:

SQL error: Field `something` doesn't have a default value

I had this problem with ods_osm (which has now been patched, so it is not resproducible anymore).


  2. Use extension ods_osm
  3. Remove the default line in TCA overrides for fe_groups https://github.com/bobosch/ods_osm/blob/master/Configuration/TCA/Overrides/fe_groups.php
  4. Clear cache
  5. Create a new FE group

You should now see the above error

The problem with missing defaults is only a problem with extensions as the core does not have the problem because it sets the defaults correctly. However, I think this setting might prevent problems in the future where extension authors test with a database server without strict setting and may not be aware of the problem their extension might be causing.

With other systems, it is enough to define the table schema with a default value. With TYPO3 it is not enough.

Related issues

Related to TYPO3 Core - Bug #88331: MySQL strict mode: let integer time fields be filled with NULLNew2019-05-10


Updated by DANIEL Rémy 6 months ago

  • Related to Bug #88331: MySQL strict mode: let integer time fields be filled with NULL added

Also available in: Atom PDF