Skip to content

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

@zlotnika

Description

@zlotnika

Description

I want insert({...}).select('id') to require INSERT, but not require SELECT policy. I want to have a user that can INSERT a record and some corresponding stuff with it. I don't want them to be able to, in general, SELECT a record, but I need to get back at least the id of the thing that was INSERTed so that I can add join things.

Suggested solution

If RETURNING is used, it should allow insert({...}).select('id') to work without having SELECT permissions on the INSERTed row.

Alternative

The workaround is to create an id in the client, but I don't like that as much as relying on the DB for such things.

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions