Skip to content
Discussion options

You must be logged in to vote

The root cause of this failure is that PostgreSQL requires a matching SELECT policy on storage.objects during an INSERT ... RETURNING operation, even when your INSERT policy is completely satisfied.


Why PostgreSQL Rejects the Insert with an RLS Violation

When supabase-js uploads an object via POST /storage/v1/object/..., the Supabase Storage backend (storage-api) writes the binary payload to storage and then persists the metadata record to PostgreSQL by executing:

INSERT INTO storage.objects (bucket_id, name, owner, metadata, version, ...)
VALUES ($1, $2, $3, $4, $5, ...)
RETURNING *;

In PostgreSQL, Row-Level Security evaluation rules dictate that when an INSERT statement includes a RETU…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@kumarbrijesh-900
Comment options

Answer selected by kumarbrijesh-900
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants