Skip to content

fix(postgrest): replace profile headers when switching schema - #2075

Merged
spydon merged 3 commits into
mainfrom
lukasklingsbo/sdk-2758-postgrest-schema-appends-profile
Nov 16, 2026
Merged

spydon merged 3 commits into
mainfrom
lukasklingsbo/sdk-2758-postgrest-schema-appends-profile

Conversation

@spydon

@spydon spydon commented Nov 16, 2026

Copy link
Copy Markdown
Contributor

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).

Fixes SDK-2758

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Explain Change →

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.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • 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.

@spydon
spydon merged commit 7572f13 into main Nov 16, 2026
26 checks passed
@spydon
spydon deleted the lukasklingsbo/sdk-2758-postgrest-schema-appends-profile branch November 16, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant