pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chris Jewell <c.jewell@lancaster.ac.uk>
To: pgsql-admin@postgresql.org
Subject: Migrating tables to schemas
Date: Wed, 19 Oct 2005 23:11:12 +0100
Message-ID: <4356C480.7050501@lancaster.ac.uk> (raw)

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 




view thread (2+ messages)  latest in thread

Message-ID: <4356C480.7050501@lancaster.ac.uk>
Permalink:  ../4356C480.7050501@lancaster.ac.uk/
Also on:    postgresql.org/message-id/4356C480.7050501@lancaster.ac.uk

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: c.jewell@lancaster.ac.uk
  Subject: Re: Migrating tables to schemas
  In-Reply-To: <4356C480.7050501@lancaster.ac.uk>
  References: <4356C480.7050501@lancaster.ac.uk>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox