You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(postgrest): omit the columns parameter when a bulk insert has no keys - #2048
insert([]), upsert([]) and bulk payloads whose rows have no keys ([{}]) sent ?columns= with an empty value, because pre_insert and pre_upsert always set the parameter for list bodies.
Both now only add columns when the rows contribute at least one key. Upsert keeps its on_conflict parameter either way.
Tests
Added test_bulk_insert_without_columns and test_bulk_upsert_without_columns to the async and sync request builder tests, parametrized over [] and [{}]. Both fail without the fix.
No actionable comments were generated in the recent review.
Summary
Summary by CodeRabbit
Bug Fixes
Bulk inserts and upserts with empty rows or no columns no longer include an empty columns parameter. Requests retain their POST method, body, and any specified conflict setting.
For list payloads, pre_insert and pre_upsert now add the columns query parameter only when the payload produces a nonempty unique-column string. Sync and async tests cover empty lists and lists containing an empty mapping. The tests also check that upsert requests retain on_conflict="id".
Change: Bug fix
Merge Risk: Minimal · up to 92dc3
Bulk inserts and upserts with no row keys no longer send an empty columns parameter that PostgREST rejects. Payloads with keys behave as before. No merge-blocking risk was identified.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
insert([]),upsert([])and bulk payloads whose rows have no keys ([{}]) sent?columns=with an empty value, becausepre_insertandpre_upsertalways set the parameter for list bodies.Both now only add
columnswhen the rows contribute at least one key. Upsert keeps itson_conflictparameter either way.Tests
Added
test_bulk_insert_without_columnsandtest_bulk_upsert_without_columnsto the async and sync request builder tests, parametrized over[]and[{}]. Both fail without the fix.Closes SDK-2763