Unable to perform table update using POST to function #2387
-
Environment
Description of issueI have a function in Supabase (which uses postgREST) that is supposed to perform an I have slimmed down the contents of the function to avoid the need for any parameters and additional logic, and using hardcoded values: CREATE OR REPLACE FUNCTION set_value() RETURNS INTEGER AS $$
BEGIN
UPDATE values_table SET score = 123 WHERE device_id = '_deviceId';
RETURN 321;
END
$$ LANGUAGE 'plpgsql' VOLATILE;
NOTIFY pgrst, 'reload schema'; The request used to interact with the above is as follows:
I receive the hardcoded value in the response, but the values in the table do not change. What am I doing wrong? SELECT set_value(); I read through related issues, as well as documentation where it states that GET requests run in a read only transaction. Is there something missing in order for this to perform a table update? Thanks ahead of time |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Maybe there's an RLS policy that's filtering the rows UPDATE can affect. Try disabling RLS or making your function SECURITY DEFINER. |
Beta Was this translation helpful? Give feedback.
Maybe there's an RLS policy that's filtering the rows UPDATE can affect.
Try disabling RLS or making your function SECURITY DEFINER.