POSTGRESQL: DO
top of page
CerebroSQL

PostgreSQL:  

DO

Topic

DO [ LANGUAGE lang_name ] code

Example

DO $$DECLARE r record;
BEGIN
FOR r IN SELECT table_schema, table_name FROM
information_schema.tables
WHERE table_type = 'VIEW' AND table_schema = 'public'
LOOP
EXECUTE 'GRANT ALL ON ' || quote_ident(r.table_schema) ||
'.' || quote_ident(r.table_name) || ' TO webuser';
END LOOP;
END$$;

bottom of page