Save the (text) file and edit it to remove the first lines (the ones that are comments). After that issue a command like the following (the “insert 1” is to insert the new rules at the top of ufw rules list):

CREATE OR REPLACE FUNCTION change_all()
RETURNS VOID AS
$$
DECLARE rec RECORD;
BEGIN
-- Get all the schemas
FOR rec IN
SELECT DISTINCT schemaname
FROM pg_catalog.pg_tables
-- You can exclude the schema which you don't want to drop by adding another condition here
WHERE schemaname not like 'pg_catalog'
LOOP
EXECUTE 'GRANT ALL ON SCHEMA ' || rec.schemaname || ' TO username';
END LOOP;
RETURN;
END;
$$ LANGUAGE plpgsql;
SELECT change_all();

CREATE OR REPLACE FUNCTION update_observation()
RETURNS trigger AS
$BODY$
DECLARE
vf boolean;
BEGIN
-- Check the description of the observation
IF NEW.description IS NULL THEN
RAISE EXCEPTION 'Description cannot be empty';
END IF;
-- Check the geometry is completely contained within the boundaries of a polygon layer
vf := (SELECT ST_Within(NEW.geom, geom) FROM boundaries WHERE ST_Within(NEW.geom, geom));
IF vf IS NOT TRUE THEN
RAISE EXCEPTION 'The new geometry must be completely within the boundaries of the limits layer';
END IF;
RETURN NEW;
END;
$BODY$
LANGUAGE plpgsql VOLATILE
COST 100;
ALTER FUNCTION update_observation()
OWNER TO username;