Does anyone know how to do a WHERE NOT IN query?
# off-topic
c
Does anyone know how to do a WHERE NOT IN query?
s
How are you currently running
WHERE IN
?
c
I use Flutter, supabase.from(table).select().in('column', arrayValues).execute();
And I don't see a NOT IN from docs
s
if you do
supabase.from(table).select().not().in('column', arrayValues).execute();
Does that work?
c
Let me try!
Looks like it won't
I tried the other day, not('column', 'in', ['value', 'valuedsd']) Does not work, it just throws an unexpected [ ] charcater instead
s
That's very strange. I'm working in JS so this might not be the same, but this example shows that
in
is a valid operator for `.not()`:
Copy code
dart
supabase
  .from("table")
  .select()
  .not("column", "", [])
  .execute()
c
Yeah it's pretty weird. This is the exception I am getting
Copy code
"failed to parse filter (not.in.[])" (line 1, column 8)
Hi @User . It dosen't work in Flutter or my query syntax is wrong?
h
can you create an issue on https://github.com/supabase/postgrest-dart thanks
c
Ok will do
h
i guess we didn't support list value properly for not()
c
I see, thought it wasn't a bug
c
I SEE.
h
i think it's a bug from postgrest-dart
c
Now it makes sense
So basically I have to make it a string (uuid, uuid, uuid)
h
hahah, yeah in the mean time can you try to escape your list properly before passing to not()
String _cleanFilterArray(List filter) { return filter.map((s) => '"$s"').join(','); }
c
Thanks man, regarding the ticket here it is https://github.com/supabase/postgrest-dart/issues/36 If team decides to add a support for List Otherwise I think it would be good to involve into the README as example of using where not in
Perfect, thanks man!