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): replace profile headers when switching schema - #2075
schema() appended the new schema to Accept-Profile and Content-Profile instead of replacing it, so requests went to the old schema and a second switch failed with PGRST106.
PostgrestClient.__init__ now uses override instead of set for both profile headers.
New test switches schema twice and checks every request carries exactly one schema (string builder, RPC, typed table, insert; sync and async).
No actionable comments were generated in the recent review.
Summary
Summary by CodeRabbit
Bug Fixes
Switching schemas now updates the profile headers used by requests, so operations target the selected schema consistently.
PostgrestClient.__init__ now uses Headers.override for Accept-Profile and Content-Profile. New synchronous and asynchronous tests check these profile headers and the apikey header across default and switched schemas, including select, RPC, typed-table select, and insert requests.
Change: Bug fix
Merge Risk: Minimal · up to 5d32c
This fixes schema switching so each request carries a single profile header instead of accumulating old values. It is low-risk and covered by new tests.
- [ ] 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.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 00b7da40-042d-4d07-bcbc-ef27a7491d10
Commits
Reviewing files that changed from the base of the PR and between cea4eab and 5d32c66.
Files selected for processing: 2
src/postgrest/src/postgrest/client.py
src/postgrest/tests/test_schema_switch.py
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 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.
schema()appended the new schema toAccept-ProfileandContent-Profileinstead of replacing it, so requests went to the old schema and a second switch failed withPGRST106.PostgrestClient.__init__now usesoverrideinstead ofsetfor both profile headers.Fixes SDK-2758