supabase / supabase-js

An isomorphic Javascript client for Supabase. Query your Supabase database, subscribe to realtime events, upload and download files, browse typescript examples, invoke postgres functions via rpc, invoke supabase edge functions, query pgvector.
https://supabase.com
MIT License
3.26k stars 270 forks source link

Multiple order on table ignores 2nd order #1222

Open wheelie33 opened 5 months ago

wheelie33 commented 5 months ago

I have a simple table that has 2 columns I care about.

created_at: timestamp (always has a value) read_on: timestamps (null if unread, value if read).

I want to show all unread first, then order the rest by created_at with newest first.

let { data: announcements, error: announcementError } = await supabase
      .from('announcements')
      .select('*')
      .eq('user_id', session?.user.id)
      .order('read_on', { nullsFirst: true })
      .order('created_at', { ascending: true });

That call doesn't seem to change the results at all. Running the 2nd order() by itself works as expected.

wheelie33 commented 5 months ago

Anyone able to reproduce this?

wheelie33 commented 4 months ago

hello?

leohanon commented 3 months ago

I can't reproduce, can you share a bit more details so I can set up my db the same way you are? the 2nd order seems to be working as expected for me.