#110087Performance and temporary data loss during deployment due to unconditional execution of static SQL files in extension:setup
Description
When running the extension:setup command as part of an automated deployment, the execution takes an exceptionally long time. Additionally, temporary database errors occur during the deployment process because tables vanish for a short period of time, even though they are present before and after the deployment.
The root cause lies within the core logic handling static table definitions. The extension:setup command internally invokes SqlReader::getTablesDefinitionString with the argument $withStatic set to true. This forces the core to read and execute the complete “ext_tables_static+adt.sql” files of all installed extensions on every single invocation.
There are extensions, with static_info_tables being a prominent example, that use explicit “DROP TABLE IF EXISTS” statements followed by “CREATE TABLE” and massive “INSERT” blocks in these static SQL files to ensure a clean data state upon installation. Since extension:setup is commonly triggered on every single release deployment, this causes production tables to be completely dropped in the middle of live operations and re-populated with thousands of records over several minutes. This results in severe deployment slowdowns and introduces temporary downtime or errors for live users while the tables are missing during the re-import. The underlying issue lies within the core processing mechanism affecting any extension providing large static datasets.
The TYPO3 core should provide a mechanism to control this behavior during automated setups, as repeatedly re-importing identical static data on every deployment is unnecessary.
To resolve this issue, the core could implement a new option for the extension:setup command to explicitly exclude specific extensions from the process, or introduce a dedicated flag to completely skip the execution of “ext_tables_static+adt.sql” files altogether. Alternatively, providing a PSR-14 event inside SqlReader or SetupDatabaseService would allow developers to programmatically intercept, filter, or block the processing of specific extension SQL definitions.
Reviews 0
No change resolves or names this issue in its commit message, and no comment links one.
History 3
-
Garvin Hicking commented and changed tracker
BugFeature TYPO3 Version13<span data-processor="relativetime" data-value="2026-06-23T10:16:33+00:00" > 06/23/26, 10:16 </span> -
Stefan Froemken commented <span data-processor="relativetime" data-value="2026-06-23T13:48:52+00:00" > 06/23/26, 13:48 </span>
When investigating this issue we traced the full execution path of extension:setup to understand where the destructive database operation originates. The command calls PackageActivationService::updateDatabase() with withStatic set to false. That method reads only ext_tables.sql files, passes the resulting CREATE TABLE definitions through the schema comparison, and applies only safe operations: add column, change column, create table and change table. The ext_tables_static+adt.sql file is never touched by this call, so no DROP TABLE or INSERT statements for static tables are generated at all by this path.
The actual source of the outage is one step later. After updateDatabase() returns, SetupExtensionsCommand iterates over all active packages and dispatches PackageInitializationEvent for each one. The sjbr/static-info-tables extension registers PackageInitializationEventListener to run after the core’s ImportStaticSqlDataOnPackageInitialization. That listener checks whether the extensionDataImport registry key is stored for the extension’s ext_tables_static+adt.sql file. If it is, the listener first removes last_update_status from the registry and then calls executeUpdate(). Because last_update_status was just deleted, isUpdateRequired() unconditionally returns true and executeUpdate() proceeds. It delegates to DatabaseUpdateUtility::importStaticSqlFile(), which explicitly drops every table in LocalizationUtility::TABLES before recreating the schema and reimporting all rows. That DROP TABLE sequence is the root cause of the live site errors during deployment.
The reason this problem did not exist for a long time and only surfaced recently can be traced to commit 34d515f4 of static_info_tables. Before that change, the listener was attached to AfterPackageActivationEvent. That event fires only when an extension is actually being activated, meaning the drop and reimport correctly ran only when a language pack such as static_info_tables_de was installed or enabled for the first time. The migration to PackageInitializationEvent fundamentally changed the trigger semantics. PackageInitializationEvent is dispatched by both PackageActivationService and SetupExtensionsCommand for every active package on every run, so what was previously a one-time activation action now executes on every deployment that calls extension:setup. The guard that should prevent unnecessary reruns, last_update_status, is removed by the listener itself before the guard is evaluated, which means the full drop and reimport is unconditional.
Because ext_tables_static+adt.sql is not executed by extension:setup’s own database update routine, a bug report targeting the TYPO3 core command is not the right place. The behaviour that causes the outage lives entirely within the PackageInitializationEventListener of sjbr/static-info-tables and was introduced as a side effect of the AfterPackageActivationEvent to PackageInitializationEvent migration.
-
Garvin Hicking commented and changed status
NewClosed <span data-processor="relativetime" data-value="2026-06-23T13:58:27+00:00" > 06/23/26, 13:58 </span>Thanks for checking – I agree 😅
I would consider this a feature, not a bug. Hope that’s fine with you.
I think giving `extension:setup` the ability to skip specific extensions is good, also I like the idea to be able to distinctively toggle that static SQL exection.
Something like a repeatable “skip-extension=XXX” and “skip-extension-static-sql=XXX” would be nice there.
Otherwise I would say that EXT:static_tables should probably use a registry value and do its own data population based on a JSON file or so delivered with the extension, not a static SQL file. That would allow versioning and incremental updates. This is why I don’t see the useful static sql feature not a bug, but rather exploitative usage ;)