sudo killall windows
10/04/2021, 10:56 PMSteve
10/04/2021, 11:03 PMsql
create or replace function
basic_auth.check_role_exists() returns trigger as $$
begin
if not exists (select 1 from pg_roles as r where r.rolname = new.role) then
raise foreign_key_violation using message =
'unknown database role: ' || new.role;
return null;
end if;
return new;
end
$$ language plpgsql;
drop trigger if exists ensure_user_role_exists on basic_auth.users;
create constraint trigger ensure_user_role_exists
after insert or update on basic_auth.users
for each row
execute procedure basic_auth.check_role_exists();
sudo killall windows
10/04/2021, 11:27 PMSteve
10/04/2021, 11:51 PMsudo killall windows
10/04/2021, 11:53 PMSteve
10/04/2021, 11:56 PMnew
keyword on the trigger, for your case I think it'd be like new.raw_user_meta_data->>'provider_id'
sudo killall windows
10/05/2021, 1:02 AMBad Request
begin
if ((SELECT raw_user_meta_data->>'provider_id' from auth.users WHERE auth.users.id = auth.uid())=new."DiscordID") then
raise foreign_key_violation using message =
'unknown discord id: ' || new."DiscordID";
return null;
end if;
return new;
end
This is what I have in the dashboardjason-lynx
10/06/2021, 1:52 AMnew.DiscordID
is indeed the issue by replacing the whole thing with a hardcoded sample discord ID you have in your data? if it really is the cause of the issue, then the error should go away and you'd know the causesudo killall windows
10/06/2021, 12:15 PMSteve
10/06/2021, 7:11 PMsudo killall windows
10/06/2021, 9:12 PM}
code: "42501"
details: null
hint: null
message: "permission denied for table users"
<prototype>: Object { … }
status: 403
statusText: "Forbidden"
stibbs
10/07/2021, 12:59 AMusers
table or the one that supabase automatically creates?private
, which means it is locked down completely other than the authentication APIs. If you need to store other data or interact with a users table, I'd suggest creating your own public
users table and it can reference the private.users
tablesudo killall windows
10/07/2021, 1:37 AMstibbs
10/07/2021, 1:49 AMprivate.users
table?private.users
?sudo killall windows
10/07/2021, 2:37 AM