8

I need to automatically add an author of an inserted row in one of its columns. I am using postgREST (using Supabase cloud service) and I don't want users to add whoever they want as the author. Is there a way to automatically add user id of the user posting the data? Thanks!

2 Answers 2

9

You can add it via Table Editor or use auth.uid() in your SQL functions.

Admin Panel

Sign up to request clarification or add additional context in comments.

Comments

6

The column's DEFAULT value should be:

  1. uid() for Supabase.
  2. current_user for Postgres.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.