Skip to content
Snippets Groups Projects
Commit ccb7bc9d authored by Stefan Bürk's avatar Stefan Bürk Committed by Christian Kuhn
Browse files

[BUGFIX] Ensure deterministic orderBy of CategoryCollection

Missing deterministic orderBy for database queries leads to
different records retrieved across dbms and dbms version.
Some major dbms tends to order by primary key implictly,
where in newer versions it behaves differently. Even if
the database structure and data seems to look identically,
dbms tends to handle it in different ways.

Test fixtures for CategeoryCollectionTests do not provide
any values for sorting. Inserting the data to the database
is done through plain database inserts through the testing
framework, not taking care of table specific sorting fields
if test data missing them, which DataHandler and
RelationHandler takes care of in the core.

There can be instances with extensions omitting the usage
of datahandler and as such inserting nondeterministic datasets,
deterministic queries must be implemented.

Retrieving related records for categories has been missing
the required sorting field, so sorting was unreliable.

Ensuring deterministic record retrieval by adding
'uid_foreign' as last orderBy to kick in if two records
have the same sorting value.

This allows activation of a CategoryCollection related
functional test with postgres.

Even though the test data misses proper sorting field values,
this is not changed to ensure deterministic sorting does not
break again.

This patch acts as follow up for #95061.

$ Build/Scripts/runTests.sh -s functional -d postgres \
  typo3/sysext/core/Tests/Functional/Category/Collection/\
  CategoryCollectionTest.php

Resolves: #95091
Related: #95061
Releases: master, 10.4
Change-Id: I9feec421ff9628aabe100fbab9a69c570b9dd029
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/70877


Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarJochen <rothjochen@gmail.com>
Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: default avatarJochen <rothjochen@gmail.com>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 4dd7465f
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment