You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running a query with multiple filters on the same column, only the last filter on that column is applied. The previously applied filters are silently overwritten.
To Reproduce
The simplest way to reproduce is just to observe the HTTP request emitted by the library:
Observe that the query string in the GET request printed by netcat only includes the greater than condition:
GET /users?age=gt.20&select=name%2Cage HTTP/1.1
You could also test by spinning up a Postgrest instance, adding some rows to a table, and then making a similar query to the one shown above.
Expected behavior
Both the less than and greater than conditions should be applied. I believe the correct way to do that with Postgrest is using the query parameter and=(age.lt.30,age.gt.20).
Screenshots
N/A
System information
OS: Linux
Browser (if applies): N/A
Version of postgrest-go: v0.0.11
Version of Go: go version go1.23.2 linux/amd64
Additional context
A viable workaround is to manually construct the and filter instead:
However, I think that the library should construct the and filter automatically. If not, it should at least return an error to let the user know that their query won't work as intended.
Thanks for this useful client library! I can probably submit a PR fixing this if desired.
The text was updated successfully, but these errors were encountered:
Bug report
Describe the bug
When running a query with multiple filters on the same column, only the last filter on that column is applied. The previously applied filters are silently overwritten.
To Reproduce
The simplest way to reproduce is just to observe the HTTP request emitted by the library:
Start netcat running on port 3000:
In another terminal, run the following go code:
Observe that the query string in the GET request printed by netcat only includes the greater than condition:
You could also test by spinning up a Postgrest instance, adding some rows to a table, and then making a similar query to the one shown above.
Expected behavior
Both the less than and greater than conditions should be applied. I believe the correct way to do that with Postgrest is using the query parameter
and=(age.lt.30,age.gt.20)
.Screenshots
N/A
System information
Additional context
A viable workaround is to manually construct the
and
filter instead:However, I think that the library should construct the
and
filter automatically. If not, it should at least return an error to let the user know that their query won't work as intended.Thanks for this useful client library! I can probably submit a PR fixing this if desired.
The text was updated successfully, but these errors were encountered: