Skip to content
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

Batch delete is subject to max URL length #292

Open
pryme0 opened this issue Jan 6, 2022 · 6 comments
Open

Batch delete is subject to max URL length #292

pryme0 opened this issue Jan 6, 2022 · 6 comments
Labels
enhancement New feature or request postgrest-patch-needed Requires a change on PostgREST

Comments

@pryme0
Copy link

pryme0 commented Jan 6, 2022

Discussed in supabase/supabase#4831

Originally posted by pryme0 January 6, 2022
Is there a way to do batch delete with supbase?
Like i pass in an array containing id's of records i want to delete and it runs the operation for me

@kiwicopple
Copy link
Member

definitely:

const { data, error } = await supabase
  .from('cities')
  .delete()
  .in('id', ['1', '2'])

@24jr
Copy link

24jr commented Jul 17, 2022

I have a join table using multiple fields as a primary id. For simplicity say user_colors. Perhaps I first add 4 user_colors supabase.from('user_colors').upsert([ {user_id: 'bill', color_id: 'red'}, {user_id: 'bill', color_id: 'green'}, {user_id: 'bill', color_id: 'blue'}]) and I now want to delete the ones with user_id as bill and colors red and green and keep blue

How does this look in that case?

@steve-chavez
Copy link
Member

steve-chavez commented Jul 19, 2022

@24jr Can you ask that one in a new discussion? https://github.com/supabase/supabase/discussions

upsert seems unrelated to this one.

@aiibe
Copy link

aiibe commented Jul 22, 2022

With filter in aren’t we limited to the length of url params ? When we have lots of items to delete with long string ids, for instance.

@steve-chavez steve-chavez transferred this issue from supabase/supabase Jul 22, 2022
@steve-chavez
Copy link
Member

@aiibe Yes, see PostgREST/postgrest#2314. A bulk delete with a request payload is being worked on PostgREST/postgrest#2355.

@steve-chavez steve-chavez reopened this Jul 22, 2022
@soedirgo soedirgo changed the title batch delete Batch delete is subject to max URL length Sep 27, 2022
@soedirgo
Copy link
Member

Repurposing this issue to batch delete w/ request body

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request postgrest-patch-needed Requires a change on PostgREST
Projects
None yet
Development

No branches or pull requests

6 participants