You might be right about that, but it could be wor...
# sql
s
You might be right about that, but it could be worth a try. It's been a long day and my brain isn't working properly right now, but it's possible that it creates the row with
admin_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()
.
d
the thing is the admin_id should be inserted together with the new row as the id is an auto-generated uuid I tried the auth.uid() on the columns default value definition but it didn't accept it