Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter conditions on the same column overwrite each other #53

Open
dmedora opened this issue Jul 6, 2024 · 1 comment
Open

Filter conditions on the same column overwrite each other #53

dmedora opened this issue Jul 6, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@dmedora
Copy link

dmedora commented Jul 6, 2024

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
@dmedora dmedora added the bug Something isn't working label Jul 6, 2024
@dmedora
Copy link
Author

dmedora commented Jul 6, 2024

This was also reported in supabase-go: supabase-community/supabase-go#13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant