Scott P
08/20/2021, 12:42 AMadmin_id
set to auth.uid()
and then inserts the other values in the same row - sort of like modifying it in-place before committing the transaction to the DB.
Another option is to put the other values from new
into the query: e.g. INSERT INTO public.my_table(admin_id, some_string, some_number) VALUES (auth.uid(), new.some_string, new.some_number)
.
Another option which might work would be to set the column default to auth.uid()
. That way, whenever a new row is inserted, it'll automatically set the value of the admin_id
column to auth.uid()
.dailylurker
08/20/2021, 2:19 AM