Hi Laura,
> On 08. Jun, 2020, at 12:17, Laura Smith <n5d9xq3ti233xiyif2vp(at)protonmail(dot)ch> $$ LANGUAGE plpgsql SECURITY DEFINER;
you might want to use security invoker instead of definer.
https://www.postgresql.org/docs/current/sql-createfunction.html#SQL-CREATEFUNCTION-SECURITY
https://www.cybertec-postgresql.com/en/abusing-security-definer-functions/
Cheers,
Paul