Peanut
08/26/2021, 9:28 AMSELECT getIsUserEditorOrAdmin(auth.firebase_uid()) = TRUE
> ?column?
> falsejason-lynx
08/26/2021, 9:28 AMjason-lynx
08/26/2021, 9:29 AMSELECT role = 'admin' OR role = 'editor' FROM userAdminMeta WHERE id = auth.firebase_uid()Peanut
08/26/2021, 9:29 AMSELECT auth.firebase_uid()
> firebase_uid
> nullPeanut
08/26/2021, 9:30 AMPeanut
08/26/2021, 9:30 AMauth.uid()nulljason-lynx
08/26/2021, 9:30 AMPeanut
08/26/2021, 9:32 AMpostgresjason-lynx
08/26/2021, 9:33 AMPeanut
08/26/2021, 9:35 AMjason-lynx
08/26/2021, 9:40 AMPeanut
08/26/2021, 9:46 AMPeanut
08/26/2021, 9:46 AMkennethcassel
08/26/2021, 12:09 PMEmreCan
08/26/2021, 12:46 PMkyrelldixon
08/26/2021, 5:13 PMScott P
08/26/2021, 5:59 PMsql
(SELECT CASE WHEN (
        SELECT COUNT(*) FROM my_table
        WHERE my_table.user_id = auth.uid()
        GROUP BY my_table.user_id
    ) <= 50
) THEN true ELSE false end)my_tableuser_id50Scott P
08/26/2021, 6:00 PMjon.m
08/26/2021, 8:10 PMScott P
08/26/2021, 8:22 PMjon.m
08/26/2021, 8:22 PMPeanut
08/26/2021, 11:38 PMPeanut
08/27/2021, 12:06 AM"message": "invalid input syntax for type uuid: \"jAdocMIsWmRJg5JomxDNdHjNGFJp\""auth.uid()CREATE FUNCTION public.getisusereditororadmin(id TEXT)
RETURNS BOOLEAN
AS $$
    SELECT (SELECT role = 'admin' OR role = 'editor' FROM userAdminMeta WHERE id = $1) IS NOT NULL
$$ LANGUAGE sql;
CREATE POLICY "Users can update their own profile OR staff can update any profile."
    ON public.users
    FOR UPDATE USING (
         auth.uid()::TEXT = users.id OR
        public.getisusereditororadmin(auth.uid()::TEXT)
    );TEXTfunction public.getisusereditororadmin(uuid) does not exist
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.silentworks
08/27/2021, 12:14 AMTEXTauth.uidPeanut
08/27/2021, 12:23 AMPeanut
08/27/2021, 12:26 AMBEGIN;
SET LOCAL request.jwt.claim.sub = 'a user id';
SET LOCAL ROLE authenticated;
UPDATE PUBLIC.users SET username = 'My username' WHERE id = 'my user id';
COMMIT;SET LOCAL ROLE authenticated;Peanut
08/27/2021, 12:43 AMauthenticatedjason-lynx
08/27/2021, 1:08 AMjason-lynx
08/27/2021, 1:08 AMjason-lynx
08/27/2021, 1:09 AM