I'm having trouble when using the variable arrow in my loop. Postgres ignores the declared variable and reads it as text. How can I solve that?
I have the following error:
ERROR: relation "arrow" does not exist Where: SQL statement "GRANT SELECT ON arrow TO test" PL/pgSQL function inline_code_block line 8 at SQL statement
do $$
declare
arrow record;
BEGIN
FOR arrow IN
SELECT table_name FROM information_schema.tables WHERE table_schema = 'public'
LOOP
GRANT SELECT ON arrow TO test;
END LOOP;
END;
$$ LANGUAGE plpgsql;