Project

General

Profile

Actions

Bug #81208

closed

Invalid SQL query when previewing a workspace with translated relations

Added by Xavier Perseguers almost 7 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Must have
Assignee:
Category:
Extbase + l10n
Target version:
-
Start date:
2017-05-12
Due date:
% Done:

100%

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

Description

DISCLAIMER

This is quite tricky and could not understand how to reproduce it in a vanilla install.

Context

  • The problem happens for me when previewing a page from a workspace with a menu of categories associated to EXT:news records.
  • In my case I have a custom extended domain model for news records but it does not seem to be related, I removed corresponding columns/fields from the query below

Preview crashes with:

An exception occurred while executing 'SELECT `uid_local`, `uid_foreign`, `tablenames`, `sorting`, `sorting_foreign`, `fieldname`, `uid`, `pid`, `tstamp`, `crdate`, `cruser_id`, `deleted`, `hidden`, `starttime`,
`endtime`, `t3ver_oid`, `t3ver_id`, `t3ver_wsid`, `t3ver_label`, `t3ver_state`, `t3ver_stage`, `t3ver_count`, `t3ver_tstamp`, `t3ver_move_id`, `t3_origuid`, `sys_language_uid`, `l10n_parent`, `l10n_diffsource`,
`title`, `description`, `parent`, `items`, `fe_group`, `images`, `single_pid`, `shortcut`, `import_id`, `import_source`, `seo_title`, `seo_description`, `seo_headline`, `seo_text`, `l10n_state`
FROM `sys_category` WHERE (`pid` = ?) AND (`t3ver_oid` = ?) AND (`t3ver_wsid` = ?) AND (`sys_category`.`deleted` = 0) LIMIT 1' with params [-1, 29, 2]: Unknown column 'uid_local' in 'field list' 

Call stack shows:

After quite some deep debugging, I could understand the context:

  • This happens when the rows array which need to be overlaid in \TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend::doLanguageAndWorkspaceOverlay() are the result of a JOIN (in my case a JOIN from sys_category and sys_category_record_mm
  • Each row is thus containing fields coming from both tables
  • The test on $source at the beginning of method doLanguageAndWorkspaceOverlay properly detects that a JOIN is in use and extracts the right table (sys_category)
  • There are some tests whether the "original" record needs to be fetched, for instance when a move is detected, that's not invoked in my case
  • There is another test which detects that current record is a translation already and then would fetch the parent record instead, this is where the problem lies
  • If current record is a default language record AND we are in the context of fetching the content of a workspace (method is invoked multiple times with same record causing no errors until the context of the call is the actual workspace preview), then it bypasses the action of reloading the record from database
  • Since it bypasses this reload, call to versionOL is made with a row containing additional columns from sys_category_record_mm and since the test at the very beginning of method versionOL succeeds, there is a call to method getWorkspaceVersionOfRecord with those invalid additional columns and this is the source of the SQL failure

Solution Found

The test to reload the original record is extended to check if we are in the context of a workspace preview and if so, ensure no additional columns are present


Files

stacktrace.png (182 KB) stacktrace.png Xavier Perseguers, 2017-05-12 12:01
kittensftw.zip (20.1 KB) kittensftw.zip extension (kittensftw) Susanne Moog, 2018-03-07 14:02
T3D_tree_PID201_L0_2018-03-07_13-01.t3d (8.23 KB) T3D_tree_PID201_L0_2018-03-07_13-01.t3d example page t3d export Susanne Moog, 2018-03-07 14:02
81208_v9.diff (7.74 KB) 81208_v9.diff Ralf Merz, 2019-10-08 15:46
81208_v9.5.diff (5.34 KB) 81208_v9.5.diff Markus Hackel, 2020-04-27 13:09

Related issues 4 (0 open4 closed)

Related to TYPO3 Core - Bug #82750: Workspace preview doesn't preview MM relations properlyClosed2017-10-12

Actions
Related to TYPO3 Core - Feature #90072: Make inline TCA fields workspace-transparent for Extbase (foreign_field and foreign_sortby)Closed2020-01-09

Actions
Related to TYPO3 Core - Bug #85061: Extbase doesn't overlay workspace recordsClosedNicole Cordes2018-05-22

Actions
Related to TYPO3 Core - Bug #88784: Record language is incorrectly changed to default language in overlayLanguageAndWorkspaceClosedBenni Mack2019-07-16

Actions
Actions

Also available in: Atom PDF