Last Updated: May 15, 2019
·
27.99K
· bartlomiejdanek

Dump PostgreSQL without owner and privileges

$ pg_dump database_name -O -x > output_file

Then you shouldn't see

--
-- Name: public; Type: ACL; Schema: -; Owner: username
--

REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM username; 
GRANT ALL ON SCHEMA public TO username;
GRANT ALL ON SCHEMA public TO PUBLIC;

And

--
-- Name: _RETURN; Type: RULE; Schema: public; Owner: username
--