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
I stumbled across a weird behavior where I could not use a filter with eq to filter by an IP-Address (e.g. 10.0.0.1).
The generated url for From("Foo").Select("*").Eq("ip", "10.0.0.1").Execute() is /rest/v1/Foo?select=%2A&vpn_ip=eq.%2210.0.0.1%22. As the PostgrestAPI states, when using reserved characters we have to use percent encoded double quotes %22 for correct processing (Source).
This library correctly identifies the reserved characters and does as the documentation states. Unfortunately the result is always empty.
Using the generated URL in a curl request confirms that an empty result is returned.
Interestingly it is possible to perform following curl request and receiving the expected single result:
/rest/v1/Foo?select=%2A&vpn_ip=eq.10.0.0.1
Note the missing " or %22 in the request above.
With some further research I could identify a different behaviour in the official postgrest-js. It appears that not all filters must recognize reserved chars. On first glance it mainly is the in filter.
If you could confirm this @nedpals I could prepare a pull request until next week.
Edit: I would open this issue in the corresponding repository if issues were possible (nedpals/postgrest-go)
The text was updated successfully, but these errors were encountered:
I had a simple filter searching from rows where the email column equals a string and the returns back the column id
b.params.Encode() will return this email=eq.%test%gmail.com%22 on it's own, but after using url.QueryUnescape the new string is email=eq."[email protected]". The quotation marks (") around [email protected] cause the filter to fail. I'm not sure why the quotations are added but when they are removed the filter works as expected.
I stumbled across a weird behavior where I could not use a filter with
eq
to filter by an IP-Address (e.g.10.0.0.1
).The generated url for
From("Foo").Select("*").Eq("ip", "10.0.0.1").Execute()
is/rest/v1/Foo?select=%2A&vpn_ip=eq.%2210.0.0.1%22
. As the PostgrestAPI states, when using reserved characters we have to use percent encoded double quotes%22
for correct processing (Source).This library correctly identifies the reserved characters and does as the documentation states. Unfortunately the result is always empty.
Using the generated URL in a
curl
request confirms that an empty result is returned.Interestingly it is possible to perform following curl request and receiving the expected single result:
Note the missing
"
or%22
in the request above.With some further research I could identify a different behaviour in the official postgrest-js. It appears that not all filters must recognize reserved chars. On first glance it mainly is the
in
filter.If you could confirm this @nedpals I could prepare a pull request until next week.
Edit: I would open this issue in the corresponding repository if issues were possible (nedpals/postgrest-go)
The text was updated successfully, but these errors were encountered: