Hello everyone! recently started using supabase an...
# help
a
Hello everyone! recently started using supabase and i have a question about RLS Is it possible to use an array of IDs (strings) to authenticate? I tried the example bellow but i have something wrong in the syntax: (collection is my table which has a column of user_ids)
Copy code
exists (
  select 1
  from collection
  where auth.uid() in collection.user_ids
)
n
Hello @aslop2! This thread has been automatically created from your message in #843999948717555735 a few seconds ago. We have already mentioned the @User so that they can see your message and help you as soon as possible! Want to unsubscribe from this thread? Right-click the thread in Discord (or use the ``...`` menu) and select "Leave Thread" to unsubscribe from future updates. Want to change the title? Use the ``/title`` command! We have solved your problem? Click the button below to archive it.
r
auth.uid() in user_ids might be enough as it returns a boolean
n
aslop2 (2022-05-17)
a
Hi, thank you for replying this is what i tried initially But i get an error saying: Error updating policy: syntax error at or near "user_ids" So maybe i am missing something, thank you for your time!
o
Hi Can you try using ``where auth.uid() = ANY(collection.user_ids)`` please? Not sure if it's gonna work, but it's worth to give it a try i think @aslop2
a
@Olyno Oh that worked! Thank you very much!
o
You're welcome :p