SELECT S.created_on
FROM t_orders AS A
LEFT JOIN t_source_zipped AS S ON S.order_id = A.id
WHERE A.deleted_on IS NULL AND A.id = :P3 /* XXXX */ AND S.created_on IS NOT NULL
ORDER BY A.created_on ASC
With DESC
SELECT S.created_on
FROM t_orders AS A
LEFT JOIN t_source_zipped AS S ON S.order_id = A.id
WHERE A.deleted_on IS NULL AND A.id = :P3 /* XXXX */ AND S.created_on IS NOT NULL
ORDER BY A.created_on DESC
The debug json is returning dir: "asc" for both, and the output is sorted in DESC order in both cases here.
NOTE: When I wrote the original post, the query was always sorting in ASC order.
Turns out, sorting was set on created_on column of main table, instead of the joined table.
So it should have been S.created_on instead of A.created_on.
There is no issue with the sorting of timestamp columns.