Bug #65789

Extbase: Wrong SQL statement when using Offset and no Limit

Added by Eric no-lastname-given over 4 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
Extbase
Start date:
2015-03-17
Due date:
% Done:

100%

TYPO3 Version:
7
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:
On Location Sprint

Description

When building a query with OFFSET but no LIMIT, this line in

TYPO3\CMS\Extbase\Persistence\Generic\Storage\Typo3DbBackend

protected function createQueryCommandParametersFromStatementParts(array $statementParts):

321:  'limit' => ($statementParts['offset'] ? $statementParts['offset'] . ', ' : '')
322:     . ($statementParts['limit'] ? $statementParts['limit'] : '')

produces an SQL Error, because the SQL ends with a comma: ...DESC LIMIT 3,

It should only add a comma, when there is a OFFSET and a LIMIT

Associated revisions

Revision 01a04f12 (diff)
Added by Ian SEBBAGH over 3 years ago

[BUGFIX] Introduce exception for using offset without limit

In Typo3DbBackend::createQueryCommandParametersFromStatementParts,
if an offset is defined, but no limit is, an LogicException is thrown.

SQL does not provide possibility to set offset without limit.
To retrieve all rows from a certain offset up to the end of the
result set, you can use some large number for the limit.
See: http://dev.mysql.com/doc/refman/5.7/en/select.html

Resolves: #65789
Releases: master, 7.6
Change-Id: Icf4db2fbe8dfac21e5da2e32fe5dada38ffd3a77
Reviewed-on: https://review.typo3.org/48461
Reviewed-by: Wouter Wolters <>
Reviewed-by: Susanne Moog <>
Tested-by: Susanne Moog <>
Reviewed-by: Andreas Fernandez <>
Reviewed-by: Anja Leichsenring <>
Tested-by: Anja Leichsenring <>
Reviewed-by: Joerg Boesche <>
Tested-by: Joerg Boesche <>
Reviewed-by: Jan Helke <>
Tested-by: Jan Helke <>

Revision dc8a9da2 (diff)
Added by Ian SEBBAGH over 3 years ago

[FOLLOWUP][BUGFIX] Introduce exception for using offset without limit

In Typo3DbBackend::createQueryCommandParametersFromStatementParts,
if an offset is defined, but no limit is, an LogicException is thrown.

SQL does not provide possibility to set offset without limit.
To retrieve all rows from a certain offset up to the end of the
result set, you can use some large number for the limit.
See: http://dev.mysql.com/doc/refman/5.7/en/select.html

Fix failing fonctionnal tests.

Resolves: #65789
Releases: master
Change-Id: I066725383422829ec89a1b2621e1fdbead3cf115
Reviewed-on: https://review.typo3.org/48475
Reviewed-by: Anja Leichsenring <>
Tested-by: Anja Leichsenring <>
Reviewed-by: Susanne Moog <>
Reviewed-by: Wouter Wolters <>
Reviewed-by: Frank Naegler <>
Tested-by: Susanne Moog <>
Tested-by: Frank Naegler <>
Reviewed-by: Christian Kuhn <>
Tested-by: Christian Kuhn <>

Revision 0bfa7644 (diff)
Added by Ian SEBBAGH over 3 years ago

[WIP][BUGFIX] Introduce exception for using offset without limit

In Typo3DbBackend::createQueryCommandParametersFromStatementParts,
if an offset is defined, but no limit is, an LogicException is thrown.

SQL does not provide possibility to set offset without limit.
To retrieve all rows from a certain offset up to the end of the
result set, you can use some large number for the limit.
See: http://dev.mysql.com/doc/refman/5.7/en/select.html

Resolves: #65789
Releases: master, 7.6
Change-Id: Icf4db2fbe8dfac21e5da2e32fe5dada38ffd3a77
Reviewed-on: https://review.typo3.org/48473
Reviewed-by: Jan Helke <>
Tested-by: Jan Helke <>
Reviewed-by: Anja Leichsenring <>
Tested-by: Anja Leichsenring <>

History

#1 Updated by Tommy Bley almost 4 years ago

plz fix it

#2 Updated by B. Kausch almost 4 years ago

  • Target version set to 6.2.16

Serious Bug. Already exists in 6.2 ...

#3 Updated by Riccardo De Contardi over 3 years ago

  • Category set to Extbase
  • Target version changed from 6.2.16 to Candidate for patchlevel

#4 Updated by Ian SEBBAGH over 3 years ago

  • Assignee set to Ian SEBBAGH
  • Sprint Focus set to On Location Sprint

#5 Updated by Ian SEBBAGH over 3 years ago

  • Status changed from New to In Progress

#6 Updated by Gerrit Code Review over 3 years ago

  • Status changed from In Progress 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/48461

#7 Updated by Gerrit Code Review over 3 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/48461

#8 Updated by Gerrit Code Review over 3 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/48461

#9 Updated by Gerrit Code Review over 3 years ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48461

#10 Updated by Gerrit Code Review over 3 years ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48461

#11 Updated by Gerrit Code Review over 3 years ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48461

#12 Updated by Gerrit Code Review over 3 years ago

Patch set 1 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48473

#13 Updated by Ian SEBBAGH over 3 years ago

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

#14 Updated by Gerrit Code Review over 3 years ago

  • Status changed from Resolved to Under Review

Patch set 2 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48473

#15 Updated by Gerrit Code Review over 3 years ago

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/48475

#16 Updated by Gerrit Code Review over 3 years ago

Patch set 3 for branch TYPO3_7-6 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/48473

#17 Updated by Ian SEBBAGH over 3 years ago

  • Status changed from Under Review to Resolved

#18 Updated by Benni Mack about 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF