SupabaseS
Supabase2y ago
Jota

postgres function help

Hello! Im trying to do something like this;

DO $$
DECLARE
id INTEGER;
BEGIN
-- Set the role to 'postgres'
SET ROLE postgres;

-- Your SQL statements go here
SELECT tenant_id INTO id FROM users WHERE id = auth.uid();

-- Reset the role to the original user
RESET ROLE;

-- Return the result
RETURN id;
END $$;

but it keep returning syntax error, what should I do?
image.png
Was this page helpful?