RESET SESSION AUTHORIZATION;

DROP OWNED BY nosuper_1, nosuper_2 CASCADE;
DROP ROLE IF EXISTS nosuper_1, nosuper_2;
DROP SCHEMA IF EXISTS nosuper CASCADE;

CREATE USER nosuper_1;
CREATE USER nosuper_2;

GRANT nosuper_2 TO nosuper_1;
GRANT nosuper_1 TO nosuper_3;

CREATE SCHEMA nosuper AUTHORIZATIOn nosuper_1;
SET ROLE nosuper_1;
GRANT ALL ON SCHEMA nosuper TO nosuper_2;

CREATE TABLE nosuper.tbl();
ALTER TABLE nosuper.tbl OWNER TO nosuper_2;


-- Dumping this database results in the following pg_dump:
--
--
-- CREATE SCHEMA nosuper;
-- ALTER SCHEMA nosuper OWNER TO nosuper_1;
-- ..
-- CREATE TABLE nosuper.tbl (
-- );
-- ALTER TABLE nosuper.tbl OWNER TO nosuper_2;
-- ...
-- GRANT ALL ON SCHEMA nosuper TO nosuper_2;
--
--
-- Which is bad because the ALTER TABLE OWNER TO cannot be executed before
-- the GRANT ALL.
