Skip to content

Instantly share code, notes, and snippets.

@isccarrasco
Created October 3, 2015 00:17
Show Gist options
  • Save isccarrasco/124ae8b7d6258ba86d3e to your computer and use it in GitHub Desktop.
Save isccarrasco/124ae8b7d6258ba86d3e to your computer and use it in GitHub Desktop.
Change tables owner for a postgresql schema.

for tbl in psql -qAt -c "select tablename from pg_tables where schemaname = 'public';" -h localhost -U postgres -d DATABASE ; do psql -c "alter table "$tbl" owner to ROLE" -h localhost -U postgres -d DATABASE ; done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment