FeatureFuel
1

[Supabase-js] Support ordering numeric column ascending but push zeros and/or negatives to the end

Source: supabase/supabase#38661 · opened by @JFGHT
Description
Currently, .order(column, { ascending: true }) in Supabase-JS only allows basic ascending/descending sorting.
There is no way to push specific values such as 0 (or all non-positive values) to the end while keeping natural ordering for the rest.

In SQL this is often achieved with expressions like:



Use cases / motivation

• Treat 0 as a “default / empty” value that should not appear before meaningful positive values.
• Group all non-positive values (<= 0) at the end, keeping positives first.
• Allow custom ordering logic for datasets where certain values should appear later in UI lists or reports.
• Avoid requiring raw SQL or stored procedures for what is a common data presentation requirement.

Proposed API
Extend .order() with new options, for example:



Alternatively, support SQL expressions inside .order():

No pledges yet. Be the first to back this.

Make a pledge

Pledge your monetary support if this feature is added.

$

Comments

No comments yet.

Replying to

Add a comment

What do you think about this feature request?


Similar requests