Skip to content

Truncate cascade on non-mysql database platforms for Testbase#684

Merged
lolli42 merged 3 commits intoTYPO3:mainfrom
lleicher-sg:trunace_cascade_for_non_mysql
Nov 21, 2025
Merged

Truncate cascade on non-mysql database platforms for Testbase#684
lolli42 merged 3 commits intoTYPO3:mainfrom
lleicher-sg:trunace_cascade_for_non_mysql

Conversation

@lleicher-sg
Copy link
Contributor

@lleicher-sg lleicher-sg commented Oct 1, 2025

When using typo3/testing-framework with Postgres, you get the following error for tables with foreign keys:

PDOException: SQLSTATE[0A000]: Feature not supported: 7 ERROR:  cannot truncate a table referenced in a foreign key constraint
DETAIL:  Table "tx_groups_members_mm" references "fe_users".
HINT:  Truncate table "tx_groups_members_mm" at the same time, or use TRUNCATE ... CASCADE.

(I am using Postgres 15)

This is caused by \TYPO3\TestingFramework\Core\Testbase::truncateAllTablesForOtherDatabases, because the cascade argument is false by default.

This PR simply sets cascade to true.
Given that only the PostgreSQLPlatform uses the parameter atm, I don't think there will be any side effects.

@sbuerk
Copy link
Collaborator

sbuerk commented Oct 2, 2025

Note

TYPO3 does not support/guarentee foreign key support, neither
in the database analyzer stack nor in any API like datahandler,
extbase and so forth. Something not easily doable anyway.

Looking into the pr later, I guess we may take it.

@lolli42
Copy link
Member

lolli42 commented Nov 21, 2025

LGTM

@lolli42
Copy link
Member

lolli42 commented Nov 21, 2025

checked current core v13 & v14 is fine:
https://review.typo3.org/c/Packages/TYPO3.CMS/+/91799
https://review.typo3.org/c/Packages/TYPO3.CMS/+/91798
will merge. sorry for the delay.

@lolli42 lolli42 merged commit 3ca70ed into TYPO3:main Nov 21, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants