Re: How to change all owners on all objects in a schema

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 23, 2011 at 2:41 PM, Kevin Grittner <Kevin.Grittner@xxxxxxxxxxxx> wrote:
"Kevin Grittner" <Kevin.Grittner@xxxxxxxxxxxx> 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>



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux