Skip to content

Using multiple .Order() methods when querying doesn't work as expected. #85

@hunsra

Description

@hunsra

Bug report

Describe the bug

Using more than one .Order() method in a query doesn't seem to work. Only the first .Order() method is honored.

To Reproduce

Given a model with the following structure (and a corresponding table in a Supabase project):

[Table("Contacts")]
public class Contact : BaseModel
{
	[Column("first_name")]
	public string FirstName { get; set; }

	[Column("middle_name")]
	public string MiddleName { get; set; }

	[Column("last_name")]
	public string LastName { get; set; }
}

Making the following query:

response = await client.From<Contact>()
            .Order("last_name", Ordering.Ascending)
            .Order("first_name", Ordering.Ascending)
            .Order("middle_name", Ordering.Ascending)
            .Get();

Results in a list of Contact models that are only ordered by the "last_name" column.

Expected behavior

The resulting list should be ordered by the "last_name" column, then by the "first_name" column, then by the "middle_name" column.

Screenshots

The Supabase Edge API Network Log seems to indicate the proper ?order= query parameter is being created, but it is not returning records int he correct order, as described above:

"search": "?order=last_name.asc.nullsfirst&order=first_name.asc.nullsfirst&order=middle_name.asc.nullsfirst",

System information

  • OS: iOS 17.0 simulator (also happens on Windows 11)
  • Version of supabase-csharp: 0.14.0

Additional context

This is happening in a .NET MAUI application targeting iOS, Android, Windows, and Mac Catalyst.

Metadata

Metadata

Assignees

No one assigned

    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