Migrating tables to schemas - Mailing list pgsql-admin

From Chris Jewell
Subject Migrating tables to schemas
Date
Msg-id 4356C480.7050501@lancaster.ac.uk
Whole thread Raw
Responses Re: Migrating tables to schemas
List 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


pgsql-admin by date:

Previous
From: Michael Fuhr
Date:
Subject: Re: Reg : Error Handling
Next
From: "Jim C. Nasby"
Date:
Subject: Re: Migrating tables to schemas