Skip to content

Cannot order by multiple columns #775

@justinsunyt

Description

@justinsunyt

Bug report

Describe the bug

When trying to order multiple columns by using multiple .order() modifiers on a select function, the result only orders by the first column specified.

To Reproduce

Here is my code to get some rows from a table, which is then ordered first by last_chatted and then by created_at.

response = (
    supabase.table("clones")
    .select("*")
    .eq("owner", uid)
    .order("last_chatted", desc=True)
    .order("created_at", desc=True)
    .execute()
)

Expected behavior

The response should be ordered by last_chatted, and then created_at. However, this is not the case and the result is only ordered by last_chatted. I have confirmed that when I only order by last_chatted and created_at separately the code works as expected. I have also confirmed using the sort by visualization on my Supabase dashboard that the chained ordering is different from the result I get.

System information

  • OS: macOS
  • supabase: 2.4.2

Additional context

The same issue was reported in Discord in December, but no GitHub issue was created.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions