Migrating tables to schemas

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

 



Hi,

With an ever increasing number of tables being added to our research database, we have come to the conclusion that we need to confine individual users to private schemas instead of everybody creating their tables in the default public schema. In order to move the tables, I have used a CREATE TABLE <privateschema>.<tablename> AS SELECT * FROM public.<tablename>; command on each private table. This worked fine. However, when it came to DROPping the old tables from the public schema, I had trouble with user's views that were dependent on these tables. I don't want to use the CASCADE attribute as I don't want to erase all my users' views. Thus, my question is: can I migrate the views such that they point to the new tables in the users' schemata, and/or how do I drop the public schema tables without dropping the users' views?

Thanks,

Chris

--
--
Chris Jewell, BSc(Hons), BVSc, MRCVS
Dept of Maths and Statistics
Fylde College
Lancaster University
Lancaster
Lancs
LA1 4YF

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

[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