On Thu, Jun 23, 2011 at 2:41 PM, Kevin Grittner <[email protected] > wrote:
> "Kevin Grittner" <[email protected]> wrote: > > > || ' set schema newschema;' > > Oops; you wanted to change the owner, but I'll leave that as an > exercise for the reader. :-) > > Beat me to it :) Replace <SCHEMA>, <NEW_OWNER> and <DATABASE> psql -qAt -d <DATABASE> -c "SELECT 'ALTER '||quote_ident(n.nspname)||'.'||case when c.relkind='r' then 'TABLE' else 'SEQUENCE' END||' public.'||quote_ident(relname)||' OWNER TO <NEW_OWNER>;' FROM pg_class c, pg_catalog.pg_namespace n WHERE c.relkind IN ('r','S') AND c.relnamespace=n.oid AND n.nspname='<SCHEMA>';" | psql -qAt -d <DATABASE>
