Β© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabaseβ€’4y agoβ€’
3 replies
Amr

How do I check if any element of user input array exists in a column which is an array itself?

A user send an array like this
[1, 2]
[1, 2]

There's an existing row that has
[1, 5]
[1, 5]

I want to check if
1
1
exist in
[1, 5]
[1, 5]


I tried this code:
await supabase.from('reservations')
        .select()
        .eq('departureTripId', departureTripId)
        .containedBy('departureSeats', departureSeats);
await supabase.from('reservations')
        .select()
        .eq('departureTripId', departureTripId)
        .containedBy('departureSeats', departureSeats);


But it doesn't return anything resulting in allowing for duplicate seats!
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Check if a value exists in a string?
SupabaseSSupabase / help-and-questions
4y ago
how to check if user exists only with Google OAuth?
SupabaseSSupabase / help-and-questions
4y ago
How can I check if a user exists before creating an Account using OAuth?
SupabaseSSupabase / help-and-questions
5mo ago
how to query & filter depending on if a key exists in a jsonb column?
SupabaseSSupabase / help-and-questions
3y ago