Skip to content

Status 400 when attempting to query by array value #47

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

Closed
luisw90 opened this issue May 5, 2023 · 2 comments
Closed

Status 400 when attempting to query by array value #47

luisw90 opened this issue May 5, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@luisw90
Copy link

luisw90 commented May 5, 2023

Bug report

Describe the bug

Status 400 when attempting to query by array value

For example:

  • Making a query for all works.

.from("posts").select(columns: "*").execute().value

  • But making a query by array value gives a unacceptableStatusCode(400)

.from("posts").select(columns: "*").contains(column: "members", value: userid).execute().value

To Reproduce

Crate a table, RLS policy and query by array value

  • Table name: posts
  • Table column name: "members"
  • Column array: [userid1, userid2, userid3]

Expected behavior

Should either return an empty array or results

System information

OS: macOS Ventura 13.3
Version of supabase-ios: 0.2.1

@luisw90 luisw90 added the bug Something isn't working label May 5, 2023
@workbytaylor
Copy link

I saw your post on Stack Overflow, and noticed the same error occurs when using .overlaps() instead of .contains(). Thanks for creating an issue - hopefully it's resolved soon.

For example:

.from("posts")
.select()
.overlaps(column: "column", value: "value")
.execute().value

@grdsdev
Copy link
Contributor

grdsdev commented Jul 22, 2023

Hey @luisw90 I've added this case on the integration tests of postgrest-swift library, and I was able to make it work.

The value parameter has to be an Array as the underlying Postgres type is an array.

Please check this PR #45, if you still have an issue let me know.

@grdsdev grdsdev transferred this issue from supabase/supabase-swift Jul 22, 2023
@grdsdev grdsdev closed this as completed Oct 6, 2023
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

3 participants