Timestamp Column Sorting Not Working in Query

Wappler Version : 5.2.2
Operating System : W10
Server Model: NodeJS
Database Type: PostgreSQL

Expected behavior

Sorting using a timestamp column should sort the output data.

Actual behavior

It doesn’t.

How to reproduce

Create a query and set sorting column in sorting tab.

Output:

Bump.

Please check Debug in the query step and tell me the output of the action, it should show the generated query instead of the results.

This is what I see with debug on.

With ASC:

image

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

image

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.

Not sure where the dir property is coming from, the ordering is defined under the orders property and should be an array with column and direction.

I wasn’t able to reproduce the problem, its correctly sorting for me. Does it only happen specific with timestamp columns?

This array is correct as per ASC/DESC selection.

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.