Skip to content

Conversation

@MuzzaiyyanHussain
Copy link

Description

Fixes #1832 — Enables .insert(...).select('id') to work without requiring SELECT RLS policy
by using INSERT ... RETURNING instead of an additional SELECT request.

Changes

  • Automatically applies Prefer: return=representation to insert() requests.
  • Ensures backward compatibility for all existing insert flows.

Impact

  • Users with only INSERT permission can now retrieve IDs of inserted rows.
  • Reduces insert+select to a single network call.

Checklist

@MuzzaiyyanHussain MuzzaiyyanHussain requested review from a team as code owners November 12, 2025 07:44
@coveralls
Copy link

coveralls commented Nov 12, 2025

Coverage Status

coverage: 95.367% (+13.8%) from 81.58%
when pulling 1dd6b8e on MuzzaiyyanHussain:feat-insert-returning
into 1371057 on supabase:master.

@steve-chavez
Copy link
Member

Not sure if this feature is right, I've asked for more input on #1832 (comment)

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.

On an INSERT with a SELECT, use RETURNING (Instead of a separate SELECT call)

3 participants