Issue Bug Resolved

#93760uidInList does not respect the order of the comma-separated values

S P 03/17/21, 09:39 updated 09/25/26, 20:35

Description

Using uidInList (either TS select or DatabaseQueryProcessor) does not respect the order of the uids.

One has to use an ugly workaround, like this:

selectFields = *, FIND_IN_SET(uid, ###uidList###) AS uid_sort

(the marker being simply filled with the CSV field).

Of course this comes from the underlaying storage engine (MySQL in my case), but the core should implicitly order by the list automatically by adding a proper SQL statement ( FIND_IN_SET or ORDER BY FIELD()) or post-processing the result before passing it back to the user.

This is a bug, because TYPO3 allows to have sortable TCA select fields (multipleSideBySide, for example) that can be stored as CSV. So the core should respect the order when selecting on such a field.

Reviews 4

History 1217

  1. Benni Mack commented <span data-processor="relativetime" data-value="2023-09-03T20:08:22+00:00" > 09/03/23, 20:08 </span>

    Have the same issue. Thanks for the report

    This is my TS.

        # keep order
        select.markers.orderings.data = field:field_of_parent_table
        select.selectFields = *, FIND_IN_SET(uid, ###orderings###) AS uid_sort
        select.orderBy = uid_sort

    I wonder how we could fix this to make this possible by default or with a flag and make it cross DBMS conform

  2. Georg Ringer commented and changed status New Closed <span data-processor="relativetime" data-value="2025-02-24T20:53:18+00:00" > 02/24/25, 20:53 </span>

    closed as duplicate of #86151 – still valid

  3. S P commented <span data-processor="relativetime" data-value="2025-02-25T06:17:17+00:00" > 02/25/25, 06:17 </span>

    Georg Ringer wrote in #note-5:
    > closed as duplicate of #86151 – still valid

    Actually I think this is a total different issue. This here is about sorting not being respected in CSV-persistet relations. The other is about find_in_set not behaving as expected.

  4. Gerrit Code Review pushed patch set 1 for main to change 95751 status Accepted Under Review <span data-processor="relativetime" data-value="2026-09-09T20:52:27+00:00" > 09/09/26, 20:52 </span>

  5. Wouter Wolters commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-09-25T20:35:12+00:00" > 09/25/26, 20:35 </span>

    Applied in changeset commit:9f6bd7e9a60de9730ff42e39db9b5ce258ea6c39.