Migrating tables to schemas

From: Chris Jewell <c(dot)jewell(at)lancaster(dot)ac(dot)uk>
To: pgsql-admin(at)postgresql(dot)org
Subject: Migrating tables to schemas
Date: 2005-10-19 22:11:12
Message-ID: 4356C480.7050501@lancaster.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Jim C. Nasby 2005-10-19 22:43:00 Re: Migrating tables to schemas
Previous Message Michael Fuhr 2005-10-19 17:25:07 Re: Reg : Error Handling