Bug #93109
closedRecords can not be discarded from workspace
100%
Description
When I try to discard news records in the workspaces module I get an SQL error: Unknown column 'tablenames' in 'where clause'.
I tracked down the issue to here: https://github.com/TYPO3/TYPO3.CMS/blob/956c01e07885d5c1dffffb2a7ab8aae0db4df9d6/typo3/sysext/core/Classes/DataHandling/DataHandler.php#L5656
There it is hardcoded that the mm relation table always has a "tablenames" field. However this is not always the case, e.g. tx_news_domain_model_news.related (https://github.com/georgringer/news/blob/master/Configuration/TCA/tx_news_domain_model_news.php#L310)
Updated by Sebastian Michaelsen almost 4 years ago
- Related to Bug #93064: Properly discard workspace MM relations added
Updated by Sebastian Michaelsen almost 4 years ago
IMO setting the tablenames field is not needed here at all, because a few lines down the MM_match_fields
are applied, which includes the tablenames field if applicable.
The use case that is mentioned in the comment (tt_content.category) produces the following query (notice the duplicate tablenames
):
DELETE FROM `sys_category_record_mm` WHERE (`uid_foreign` = 42) AND(`tablenames` = 'tt_content') AND(`tablenames` = 'tt_content') AND(`fieldname` = 'categories');
This is what it behaves like in TYPO3 10.4.11 at least - but from looking at the code it will be the same in master.
Updated by Christian Kuhn almost 4 years ago
Damn. I saw this on Tuesday already when I re-reviewed some of the v10 release patches again. Wanted to fix it already and did not expect anyone would stumble upon in so quickly ...
The main issue is that db structure of MM tables is not fully documented and nailed and some TCA details are missing or are implicit.
Existence of 'tablenames' field for instance is implicit only through the MM_match_fields definition. But it is also hardcoded in RelationHandler without TCA check at at least one place - this is why i used it this way in the patch.
I'll come up with a bugfix to relax this part a bit again (I hope until Tuesday).
Updated by Gerrit Code Review almost 4 years ago
- Status changed from New to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67188
Updated by Gerrit Code Review almost 4 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67188
Updated by Gerrit Code Review almost 4 years ago
Patch set 1 for branch 10.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/67195
Updated by Christian Kuhn almost 4 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 335389a6e354b92e959c2fc40e35f5804b03f75d.