Skip to content

Filter conditions on the same column overwrite each other #53

Open
@dmedora

Description

@dmedora

Bug report

Describe the bug

If multiple filters are provided for a particular column, only the last filter is applied in the query. All the previous ones are overwritten. This happens here in the FilterBuilder implementation (for all operators).

If we take a look at the other Supabase PostgREST implementations, they append additional filters instead (eg. here in postgrest-dart, here in postgREST-js).

To Reproduce

// Table has a column 'year' with values 2020, 2022, 2024.

client.From("mytable").Select("*", "exact", false).gte("year", 2023).lte("year", 2024).Execute()

// Results include 2020, 2022, 2024. Expected only 2024.

Expected behavior

Multiple filters for a given column should all be applied.

System information

  • Version of postgrest-go: 0.0.11
  • Version of go: 1.22.2

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