User tests: Successful: Unsuccessful:
Method _getListCount of class BaseDatabaseModel select query with keyword "distinct"
joomlasite/index.php?option=com_person&view=names
Pagination with the wrong page counting, because distinct practically ignored
Nothing
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
Labels |
Added:
?
|
Labels |
Added:
?
|
@franz-wohlkoenig
sounds like a bug to me
It's a bug but should test all core components list views.
Labels |
Removed:
?
|
Did anyone read the note?
joomla-cms/libraries/src/MVC/Model/BaseDatabaseModel.php
Lines 314 to 317 in 7bc411d
Did anyone read the note?
joomla-cms/libraries/src/MVC/Model/BaseDatabaseModel.php
Lines 314 to 317 in 7bc411d
I have read this note. The phrase about "must be overridden" similar to the description of the bug. Let's just fix it.
The main idea of this fix - not use count(*) if distinct exists. It's all.
There is no bug if you follow the documentation. You have to override the method in your model. And you should do that not just to get the correct result count but also to improve performance. That fallback method is extremely slow and should be avoided.
Furthermore, simple string manipulation like this is going to cause the slow query to run more often than it should, i.e. whenever anything contains the string distinct
. This could be a table name, a column, a search keyword or anything else. So at least, if maintainers don't mind, we should add distinct capability to Database API to correctly detect where distinct is actually used or not.
@SharkyKZ So should this PR be closed according to your previous comment?
@softarius If @SharkyKZ 's answer is yes, would you agree?
It's up to maintainers to decide.
I think you are right it brings more harm and the dev should do it right as in the description.
@softarius thanks anyway for your contribution.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-12-30 11:50:47 |
Closed_By | ⇒ | HLeithner | |
Labels |
Added:
Information Required
|
If this is a new Feature please rebaso on J4 as J3 is only Bug-Fixing.