Bug #43114
closedsanitizeSelectPart - select CONTENT using DISTINCT
100%
Description
Hi,
I've encounter a problem while upgrading to 4.5.22. The sanitizeSelectPart() method was introduced (backported from 4.6 I think) and poses a new problem while using DISTINCT directive. Ex :
test = CONTENT
test {
table = tx_test
select.selectFields = DISTINCT as test
}
The sanitizeSelectPart method will add uid and pid in select clause and so... it won't do what we expect
I saw that some exception was already introduced (count|max|min|avg|sum). Adding distinct will solved the problem.
I don't understand why these "necessaryFields" (uid, pid) were introduced cause in many cases they are not necessary, but this method doesn't smell good and adding some exceptions like it was already done smell worse...
Updated by GAYA La Nouvelle Agence about 12 years ago
small correction in the selectfield example :
test = CONTENT test { table = tx_test select.selectFields = DISTINCT(my_field) as test }
Updated by Michael Stucki about 12 years ago
- Assignee deleted (
Michael Stucki)
Please don't assign tickets without asking back!
Updated by GAYA La Nouvelle Agence over 11 years ago
- Target version changed from 4.5.23 to 4.5.24
A patch could simply be done by adding distinct exception :
typo3_src-4.7.7/typo3/sysext/cms/tslib/class.tslib_content.php
7852c7852
< && !preg_match('/(count|max|min|avg|sum)\([^\)]+\)/i', $selectPart)) {
---
&& !preg_match('/(count|max|min|avg|sum|distinct)\([^\)]+\)/i', $selectPart)) {
8100c8100
Updated by GAYA La Nouvelle Agence over 11 years ago
- Target version changed from 4.5.24 to 4.5.26
Updated by Mathias Schreiber almost 10 years ago
- Target version changed from 4.5.26 to 7.2 (Frontend)
- Is Regression set to No
Updated by Gerrit Code Review over 9 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 http://review.typo3.org/38372
Updated by Benni Mack over 9 years ago
- Target version changed from 7.2 (Frontend) to 7.4 (Backend)
Updated by Susanne Moog over 9 years ago
- Target version changed from 7.4 (Backend) to 7.5
Updated by Andreas Kienast about 9 years ago
- Status changed from Under Review to New
Updated by Benni Mack about 9 years ago
- Status changed from New to Under Review
- Target version deleted (
7.5)
Updated by Daniel Goerz almost 9 years ago
- Status changed from Under Review to New
Patch was abandoned.
Updated by Gerrit Code Review over 4 years ago
- Status changed from New to Under Review
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/+/38372
Updated by Gerrit Code Review over 4 years ago
Patch set 3 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/+/38372
Updated by Gerrit Code Review over 4 years ago
Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/63471
Updated by Susanne Moog over 4 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 7002c0862175aaa0da74e07576f5ac56b5f05ab3.