Cannot create new users — auth.users.id default missing and cannot be altered
Hi everyone — I’m having an issue where new user signups fail with “Database error creating new user.”
After checking, I found that auth.users.id has no default value.
I tried:
ALTER TABLE auth.users ALTER COLUMN id SET DEFAULT gen_random_uuid();
but got ERROR: must be owner of table users.
pgcrypto is installed and gen_random_uuid() works fine — it’s just that I don’t have ownership of the auth.users table (owned by supabase_auth_admin).
3 Replies
You are not allowed to alter the auth schema columns.
What are you trying to do?
If to create new users without using auth signup methods then auth.admin.createUser() is the best way to go. As it handles filling out the auth.users table exactly right and the identities table as needed.
As @garyaustin mentioned, you can’t change the auth table. You may have set up the trigger with the auth table, so that is failing and it shows as the DB error when creating a new user.
If you explain more about how you set up the auth and other tables and what exactly you are trying to achieve, we may be better able to help.
This helped thanks a lot