improvement(supabase): allow non-public schemas
Summary
Support making changes to non public schemas.
Type of Change
- [x] Other: Tool improvement
Testing
Tested with @waleedlatif1
Checklist
- [x] Code follows project style guidelines
- [x] Self-reviewed my changes
- [x] Tests added/updated and passing
- [x] No new warnings introduced
- [x] I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)
The latest updates on your projects. Learn more about Vercel for GitHub.
Greptile Summary
This PR adds support for non-public PostgreSQL schemas in Supabase database operations. The implementation adds a new optional schema parameter across 8 database operation tools (query, insert, get_row, update, delete, upsert, text_search, count) along with UI configuration in the block definition.
Changes made:
- Added
schema?: stringparameter to all 8 Supabase operation type interfaces - Added schema input field to block configuration with appropriate conditional visibility
- Added schema parameter handling in all tool implementations with HTTP header integration
Critical Issue Found:
POST, PATCH, and DELETE operations use an incorrect HTTP header Content-Profile for schema selection, which is not recognized by PostgREST API. The correct header for all HTTP methods is Accept-Profile. This causes the schema parameter to be silently ignored for insert, update, delete, and upsert operations, breaking the intended feature for these operations.
Confidence Score: 1/5
- This PR should not be merged in its current state due to a critical PostgREST API specification violation that breaks schema support for 4 out of 8 database operations.
- The PR introduces a fundamental issue with the PostgREST API integration. While the types, UI, and GET-based operations are correctly implemented using the
Accept-Profileheader, the POST/PATCH/DELETE operations use a non-existentContent-Profileheader. This means users cannot change schemas for insert, update, delete, and upsert operations—core database functionality. The feature would appear to work in testing (especially if users only tested GET operations) but fail silently for write operations. This is a high-confidence, reproducible logic error that directly contradicts the PR's stated goal of supporting non-public schemas. - apps/sim/tools/supabase/insert.ts, apps/sim/tools/supabase/update.ts, apps/sim/tools/supabase/delete.ts, apps/sim/tools/supabase/upsert.ts - All use incorrect
Content-Profileheader instead ofAccept-Profile
Important Files Changed
| Filename | Overview |
|---|---|
| apps/sim/tools/supabase/query.ts | Schema parameter added with Accept-Profile header, but POST/PATCH/DELETE tools incorrectly use Content-Profile header instead of Accept-Profile for schema selection |
| apps/sim/tools/supabase/insert.ts | Schema parameter added but uses incorrect Content-Profile header. PostgREST spec requires Accept-Profile for all HTTP methods |
| apps/sim/tools/supabase/update.ts | Schema parameter added but uses incorrect Content-Profile header. PostgREST spec requires Accept-Profile for all HTTP methods |
| apps/sim/tools/supabase/delete.ts | Schema parameter added but uses incorrect Content-Profile header. PostgREST spec requires Accept-Profile for all HTTP methods |
| apps/sim/tools/supabase/upsert.ts | Schema parameter added but uses incorrect Content-Profile header. PostgREST spec requires Accept-Profile for all HTTP methods |
| apps/sim/tools/supabase/get_row.ts | Schema parameter added correctly with Accept-Profile header for GET requests |
Sequence Diagram
sequenceDiagram
participant User as User/LLM
participant Block as Supabase Block
participant Tools as Supabase Tools
participant API as PostgREST API
User->>Block: Provide schema parameter
Block->>Tools: Pass schema to tool (e.g., insert)
alt GET Operations (query, get_row, count, text_search)
Tools->>API: Headers: {Accept-Profile: schema}
API-->>Tools: ✓ Routes to correct schema
end
alt POST/PATCH/DELETE Operations (insert, update, delete, upsert)
Tools->>API: Headers: {Content-Profile: schema}
Note over API: Content-Profile not recognized
API-->>Tools: ✗ Ignores schema, uses public
Tools-->>User: Operation succeeds but on wrong schema
end