Bug #93109

Records can not be discarded from workspace

Added by Sebastian Michaelsen 9 months ago. Updated 9 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Workspaces
Target version:
-
Start date:
2020-12-18
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

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)


Related issues

Related to TYPO3 Core - Bug #93064: Properly discard workspace MM relationsClosed2020-12-11

Actions
#1

Updated by Sebastian Michaelsen 9 months ago

  • Related to Bug #93064: Properly discard workspace MM relations added
#2

Updated by Sebastian Michaelsen 9 months 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.

#3

Updated by Christian Kuhn 9 months 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).

#4

Updated by Christian Kuhn 9 months ago

  • Category set to Workspaces
#5

Updated by Gerrit Code Review 9 months 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

#6

Updated by Gerrit Code Review 9 months 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

#7

Updated by Gerrit Code Review 9 months 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

#8

Updated by Christian Kuhn 9 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
#9

Updated by Benni Mack 9 months ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF